xref: /freebsd-src/contrib/wpa/src/wps/http_client.h (revision 0bfd163f522701b486e066fa2e56624c02f5081a)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * http_client - HTTP client
3e28a4053SRui Paulo  * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5*f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6*f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef HTTP_CLIENT_H
10e28a4053SRui Paulo #define HTTP_CLIENT_H
11e28a4053SRui Paulo 
12e28a4053SRui Paulo struct http_client;
13e28a4053SRui Paulo 
14e28a4053SRui Paulo enum http_client_event {
15e28a4053SRui Paulo 	HTTP_CLIENT_FAILED,
16e28a4053SRui Paulo 	HTTP_CLIENT_TIMEOUT,
17e28a4053SRui Paulo 	HTTP_CLIENT_OK,
18e28a4053SRui Paulo 	HTTP_CLIENT_INVALID_REPLY,
19e28a4053SRui Paulo };
20e28a4053SRui Paulo 
21e28a4053SRui Paulo char * http_client_url_parse(const char *url, struct sockaddr_in *dst,
22e28a4053SRui Paulo 			     char **path);
23e28a4053SRui Paulo struct http_client * http_client_addr(struct sockaddr_in *dst,
24e28a4053SRui Paulo 				      struct wpabuf *req, size_t max_response,
25e28a4053SRui Paulo 				      void (*cb)(void *ctx,
26e28a4053SRui Paulo 						 struct http_client *c,
27e28a4053SRui Paulo 						 enum http_client_event event),
28e28a4053SRui Paulo 				      void *cb_ctx);
29e28a4053SRui Paulo struct http_client * http_client_url(const char *url,
30e28a4053SRui Paulo 				     struct wpabuf *req, size_t max_response,
31e28a4053SRui Paulo 				     void (*cb)(void *ctx,
32e28a4053SRui Paulo 						struct http_client *c,
33e28a4053SRui Paulo 						enum http_client_event event),
34e28a4053SRui Paulo 				     void *cb_ctx);
35e28a4053SRui Paulo void http_client_free(struct http_client *c);
36e28a4053SRui Paulo struct wpabuf * http_client_get_body(struct http_client *c);
37e28a4053SRui Paulo char * http_client_get_hdr_line(struct http_client *c, const char *tag);
38e28a4053SRui Paulo char * http_link_update(char *url, const char *base);
39e28a4053SRui Paulo 
40e28a4053SRui Paulo #endif /* HTTP_CLIENT_H */
41