1214501Srpaulo/*
2214501Srpaulo * http_client - HTTP client
3214501Srpaulo * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4214501Srpaulo *
5252726Srpaulo * This software may be distributed under the terms of the BSD license.
6252726Srpaulo * See README for more details.
7214501Srpaulo */
8214501Srpaulo
9214501Srpaulo#ifndef HTTP_CLIENT_H
10214501Srpaulo#define HTTP_CLIENT_H
11214501Srpaulo
12214501Srpaulostruct http_client;
13214501Srpaulo
14214501Srpauloenum http_client_event {
15214501Srpaulo	HTTP_CLIENT_FAILED,
16214501Srpaulo	HTTP_CLIENT_TIMEOUT,
17214501Srpaulo	HTTP_CLIENT_OK,
18214501Srpaulo	HTTP_CLIENT_INVALID_REPLY,
19214501Srpaulo};
20214501Srpaulo
21214501Srpaulochar * http_client_url_parse(const char *url, struct sockaddr_in *dst,
22214501Srpaulo			     char **path);
23214501Srpaulostruct http_client * http_client_addr(struct sockaddr_in *dst,
24214501Srpaulo				      struct wpabuf *req, size_t max_response,
25214501Srpaulo				      void (*cb)(void *ctx,
26214501Srpaulo						 struct http_client *c,
27214501Srpaulo						 enum http_client_event event),
28214501Srpaulo				      void *cb_ctx);
29214501Srpaulostruct http_client * http_client_url(const char *url,
30214501Srpaulo				     struct wpabuf *req, size_t max_response,
31214501Srpaulo				     void (*cb)(void *ctx,
32214501Srpaulo						struct http_client *c,
33214501Srpaulo						enum http_client_event event),
34214501Srpaulo				     void *cb_ctx);
35214501Srpaulovoid http_client_free(struct http_client *c);
36214501Srpaulostruct wpabuf * http_client_get_body(struct http_client *c);
37214501Srpaulochar * http_client_get_hdr_line(struct http_client *c, const char *tag);
38214501Srpaulochar * http_link_update(char *url, const char *base);
39214501Srpaulo
40214501Srpaulo#endif /* HTTP_CLIENT_H */
41