This module provides implementation of HTTP client 1.1 for WINC1500 board.
Detailed description of HTTP, please refer to the following documents.
http://tools.ietf.org/html/rfc2616
Revision history 2014/10/07 : Initial draft. (v1.0)
Data Structures | |
struct | http_client_config |
HTTP client configuration structure. More... | |
union | http_client_data |
Structure of the HTTP client callback. More... | |
struct | http_client_data_disconnected |
Structure of the HTTP_CLIENT_CALLBACK_DISCONNECTED callback. More... | |
struct | http_client_data_recv_chunked_data |
Structure of the HTTP_CLIENT_CALLBACK_RECV_CHUNKED_DATA callback. More... | |
struct | http_client_data_recv_response |
Structure of the HTTP_CLIENT_CALLBACK_RECV_RESPONSE callback. More... | |
struct | http_client_data_requested |
Structure of the HTTP_CLIENT_CALLBACK_REQUESTED callback. More... | |
struct | http_client_data_sock_connected |
Structure of the HTTP_CLIENT_CALLBACK_SOCK_CONNECTED callback. More... | |
struct | http_client_module |
Structure of HTTP client connection instance. More... | |
struct | http_client_req |
HTTP client request instance. More... | |
struct | http_client_resp |
HTTP client response instance. More... | |
struct | http_entity |
A structure that the implementation of HTTP entity. More... | |
Macros | |
#define | HTTP_HEADER_ACCEPT ("Accept: ") |
#define | HTTP_HEADER_ACCEPT_CHARSET ("Accept-Charset: ") |
#define | HTTP_HEADER_ACCEPT_ENCODING ("Accept-Encoding: ") |
#define | HTTP_HEADER_ACCEPT_LANGUAGE ("Accept-Language: ") |
#define | HTTP_HEADER_ACCEPT_RANGES ("Accept-Ranges: ") |
#define | HTTP_HEADER_AGE ("Age: ") |
#define | HTTP_HEADER_ALLOW ("Allow: ") |
#define | HTTP_HEADER_AUTHORIZATION ("Authorization: ") |
#define | HTTP_HEADER_CACHE_CONTROL ("Cache-Control: ") |
#define | HTTP_HEADER_CONNECTION ("Connection: ") |
#define | HTTP_HEADER_CONTENT_ENCODING ("Content-Encoding: ") |
#define | HTTP_HEADER_CONTENT_LANGUAGE ("Content-Language: ") |
#define | HTTP_HEADER_CONTENT_LENGTH ("Content-Length: ") |
#define | HTTP_HEADER_CONTENT_LOCATION ("Content-Location: ") |
#define | HTTP_HEADER_CONTENT_MD5 ("Content-MD5: ") |
#define | HTTP_HEADER_CONTENT_RANGE ("Content-Range: ") |
#define | HTTP_HEADER_CONTENT_TYPE ("Content-Type: ") |
#define | HTTP_HEADER_DATE ("Date: ") |
#define | HTTP_HEADER_ETAG ("ETag: ") |
#define | HTTP_HEADER_EXPECT ("Expect: ") |
#define | HTTP_HEADER_EXPIRES ("Expires: ") |
#define | HTTP_HEADER_FROM ("From: ") |
#define | HTTP_HEADER_HOST ("Host: ") |
#define | HTTP_HEADER_IF_MATCH ("If-Match: ") |
#define | HTTP_HEADER_IF_MODIFIED_SINCE ("If-Modified-Since: ") |
#define | HTTP_HEADER_IF_NONE_MATCH ("If-None-Match: ") |
#define | HTTP_HEADER_IF_RANGE ("If-Range: ") |
#define | HTTP_HEADER_IF_UNMODIFIED_SINCE ("If-Unmodified-Since: ") |
#define | HTTP_HEADER_LAST_MODIFIED ("Last-Modified: ") |
#define | HTTP_HEADER_LOCATION ("Location: ") |
#define | HTTP_HEADER_MAX_FORWARDS ("Max-Forwards: ") |
#define | HTTP_HEADER_PRAGMA ("Pragma: ") |
#define | HTTP_HEADER_PROXY_AUTHENTICATE ("Proxy-Authenticate: ") |
#define | HTTP_HEADER_PROXY_AUTHORIZATION ("Proxy-Authorization: ") |
#define | HTTP_HEADER_RANGE ("Range: ") |
#define | HTTP_HEADER_REFERER ("Referer: ") |
#define | HTTP_HEADER_RETRY_AFTER ("Retry-After: ") |
#define | HTTP_HEADER_SERVER ("Server: ") |
#define | HTTP_HEADER_TE ("TE: ") |
#define | HTTP_HEADER_TRAILER ("Trailer: ") |
#define | HTTP_HEADER_TRANSFER_ENCODING ("Transfer-Encoding: ") |
#define | HTTP_HEADER_UPGRADE ("Upgrade: ") |
#define | HTTP_HEADER_USER_AGENT ("User-Agent: ") |
#define | HTTP_HEADER_VARY ("Vary: ") |
#define | HTTP_HEADER_VIA ("Via: ") |
#define | HTTP_HEADER_WARNING ("Warning: ") |
#define | HTTP_HEADER_WWW_AUTHENTICATE ("WWW-Authenticate: ") |
#define | HTTP_MAX_URI_LENGTH 64 |
Max size of URI. More... | |
#define | HTTP_PROTO_NAME "HTTP/1.1" |
Protocol version string of HTTP client. More... | |
Typedefs | |
typedef void(* | http_client_callback_t )(struct http_client_module *module_inst, int type, union http_client_data *data) |
Callback interface of HTTP client service. More... | |
Enumerations | |
enum | http_client_callback_type { HTTP_CLIENT_CALLBACK_SOCK_CONNECTED, HTTP_CLIENT_CALLBACK_REQUESTED, HTTP_CLIENT_CALLBACK_RECV_RESPONSE, HTTP_CLIENT_CALLBACK_RECV_CHUNKED_DATA, HTTP_CLIENT_CALLBACK_DISCONNECTED } |
A type of HTTP client callback. More... | |
enum | http_method { HTTP_METHOD_GET = 1, HTTP_METHOD_POST, HTTP_METHOD_DELETE, HTTP_METHOD_PUT, HTTP_METHOD_OPTIONS, HTTP_METHOD_HEAD } |
A type of HTTP method. More... | |
Functions | |
int | http_client_deinit (struct http_client_module *const module) |
Terminate HTTP client service. More... | |
void | http_client_get_config_defaults (struct http_client_config *const config) |
Get default configuration of HTTP client module. More... | |
int | http_client_init (struct http_client_module *const module, struct http_client_config *config) |
Initialize HTTP client service. More... | |
int | http_client_register_callback (struct http_client_module *const module, http_client_callback_t callback) |
Register and enable the callback. More... | |
int | http_client_send_request (struct http_client_module *const module, const char *url, enum http_method method, struct http_entity *const entity) |
Event handler of gethostbyname. More... | |
void | http_client_socket_event_handler (SOCKET sock, uint8_t msg_type, void *msg_data) |
Event handler of socket event. More... | |
void | http_client_socket_resolve_handler (uint8_t *doamin_name, uint32_t server_ip) |
Event handler of gethostbyname. More... | |
int | http_client_unregister_callback (struct http_client_module *const module) |
Unregister callback. More... | |
#define HTTP_HEADER_ACCEPT ("Accept: ") |
#define HTTP_HEADER_ACCEPT_CHARSET ("Accept-Charset: ") |
#define HTTP_HEADER_ACCEPT_ENCODING ("Accept-Encoding: ") |
#define HTTP_HEADER_ACCEPT_LANGUAGE ("Accept-Language: ") |
#define HTTP_HEADER_ACCEPT_RANGES ("Accept-Ranges: ") |
#define HTTP_HEADER_AGE ("Age: ") |
#define HTTP_HEADER_ALLOW ("Allow: ") |
#define HTTP_HEADER_AUTHORIZATION ("Authorization: ") |
#define HTTP_HEADER_CACHE_CONTROL ("Cache-Control: ") |
#define HTTP_HEADER_CONNECTION ("Connection: ") |
#define HTTP_HEADER_CONTENT_ENCODING ("Content-Encoding: ") |
#define HTTP_HEADER_CONTENT_LANGUAGE ("Content-Language: ") |
#define HTTP_HEADER_CONTENT_LENGTH ("Content-Length: ") |
#define HTTP_HEADER_CONTENT_LOCATION ("Content-Location: ") |
#define HTTP_HEADER_CONTENT_MD5 ("Content-MD5: ") |
#define HTTP_HEADER_CONTENT_RANGE ("Content-Range: ") |
#define HTTP_HEADER_CONTENT_TYPE ("Content-Type: ") |
#define HTTP_HEADER_DATE ("Date: ") |
#define HTTP_HEADER_ETAG ("ETag: ") |
#define HTTP_HEADER_EXPECT ("Expect: ") |
#define HTTP_HEADER_EXPIRES ("Expires: ") |
#define HTTP_HEADER_FROM ("From: ") |
#define HTTP_HEADER_HOST ("Host: ") |
#define HTTP_HEADER_IF_MATCH ("If-Match: ") |
#define HTTP_HEADER_IF_MODIFIED_SINCE ("If-Modified-Since: ") |
#define HTTP_HEADER_IF_NONE_MATCH ("If-None-Match: ") |
#define HTTP_HEADER_IF_RANGE ("If-Range: ") |
#define HTTP_HEADER_IF_UNMODIFIED_SINCE ("If-Unmodified-Since: ") |
#define HTTP_HEADER_LAST_MODIFIED ("Last-Modified: ") |
#define HTTP_HEADER_LOCATION ("Location: ") |
#define HTTP_HEADER_MAX_FORWARDS ("Max-Forwards: ") |
#define HTTP_HEADER_PRAGMA ("Pragma: ") |
#define HTTP_HEADER_PROXY_AUTHENTICATE ("Proxy-Authenticate: ") |
#define HTTP_HEADER_PROXY_AUTHORIZATION ("Proxy-Authorization: ") |
#define HTTP_HEADER_RANGE ("Range: ") |
#define HTTP_HEADER_REFERER ("Referer: ") |
#define HTTP_HEADER_RETRY_AFTER ("Retry-After: ") |
#define HTTP_HEADER_SERVER ("Server: ") |
#define HTTP_HEADER_TE ("TE: ") |
#define HTTP_HEADER_TRAILER ("Trailer: ") |
#define HTTP_HEADER_TRANSFER_ENCODING ("Transfer-Encoding: ") |
#define HTTP_HEADER_UPGRADE ("Upgrade: ") |
#define HTTP_HEADER_USER_AGENT ("User-Agent: ") |
#define HTTP_HEADER_VARY ("Vary: ") |
#define HTTP_HEADER_VIA ("Via: ") |
#define HTTP_HEADER_WARNING ("Warning: ") |
#define HTTP_HEADER_WWW_AUTHENTICATE ("WWW-Authenticate: ") |
#define HTTP_MAX_URI_LENGTH 64 |
Max size of URI.
#define HTTP_PROTO_NAME "HTTP/1.1" |
Protocol version string of HTTP client.
typedef void(* http_client_callback_t)(struct http_client_module *module_inst, int type, union http_client_data *data) |
Callback interface of HTTP client service.
[in] | module_inst | Module instance of HTTP client module. |
[in] | type | Type of event. |
[in] | data | Data structure of the event. http_client_data |
A type of HTTP client callback.
enum http_method |
int http_client_deinit | ( | struct http_client_module *const | module | ) |
Terminate HTTP client service.
[in] | module | Module instance of HTTP client. |
void http_client_get_config_defaults | ( | struct http_client_config *const | config | ) |
Get default configuration of HTTP client module.
[in] | config | Pointer of configuration structure which will be used in the module. |
Referenced by configure_http_client().
int http_client_init | ( | struct http_client_module *const | module, |
struct http_client_config * | config | ||
) |
Initialize HTTP client service.
[in] | module | Module instance of HTTP client module. |
[in] | config | Pointer of configuration structure which will be used in the module. |
Referenced by configure_http_client().
int http_client_register_callback | ( | struct http_client_module *const | module, |
http_client_callback_t | callback | ||
) |
Register and enable the callback.
[in] | module_inst | Instance of HTTP client module. |
[in] | callback | Callback entry for the HTTP client module. |
Referenced by configure_http_client().
int http_client_send_request | ( | struct http_client_module *const | module, |
const char * | url, | ||
enum http_method | method, | ||
struct http_entity *const | entity | ||
) |
Event handler of gethostbyname.
[in] | module_inst | Instance of HTTP client module. |
[in] | url | URL of request. |
[in] | method | Method of request. |
[in] | entity | Entity of request. Entity is consist of Entity header and Entity body Please refer to http_entity. |
Referenced by http_client_callback(), and wifi_callback().
void http_client_socket_event_handler | ( | SOCKET | sock, |
uint8_t | msg_type, | ||
void * | msg_data | ||
) |
Event handler of socket event.
[in] | sock | Socket descriptor. |
[in] | msg_type | Event type. |
[in] | msg_data | Structure of socket event. |
Referenced by socket_event_handler().
void http_client_socket_resolve_handler | ( | uint8_t * | doamin_name, |
uint32_t | server_ip | ||
) |
Event handler of gethostbyname.
[in] | doamin_name | Domain name. |
[in] | server_ip | Server IP. |
Referenced by socket_resolve_handler().
int http_client_unregister_callback | ( | struct http_client_module *const | module | ) |
Unregister callback.
[in] | module_inst | Instance of HTTP client module. |