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