http_client.h revision 272461
1214501Srpaulo/*
2214501Srpaulo * http_client - HTTP client
3214501Srpaulo * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4214501Srpaulo *
5214501Srpaulo * This software may be distributed under the terms of the BSD license.
6214501Srpaulo * 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,
19252726Srpaulo};
20252726Srpaulo
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,
26						 struct http_client *c,
27						 enum http_client_event event),
28				      void *cb_ctx);
29struct http_client * http_client_url(const char *url,
30				     struct wpabuf *req, size_t max_response,
31				     void (*cb)(void *ctx,
32						struct http_client *c,
33						enum http_client_event event),
34				     void *cb_ctx);
35void http_client_free(struct http_client *c);
36struct wpabuf * http_client_get_body(struct http_client *c);
37char * http_client_get_hdr_line(struct http_client *c, const char *tag);
38char * http_link_update(char *url, const char *base);
39
40#endif /* HTTP_CLIENT_H */
41