WL865E4-P  36.07.001
m2mb_httpc.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
24 #ifndef GEPS_INC_HTTP_CLIENT_M2MB_HTTPC_H_
25 #define GEPS_INC_HTTP_CLIENT_M2MB_HTTPC_H_
26 
27 
28 #include "nwk/m2mb_ssl.h"
29 #include "m2mb_uart.h"
30 #include "m2mb_dbg.h"
31 
41 /*-----------------------------------------------------------------------------------------------*/
42 
43 
49 #define M2MB_HTTPC_DEBUG_PRINT_ENABLE
50 #ifdef M2MB_HTTPC_DEBUG_PRINT_ENABLE
51 /* Initialize debug module in application to use debug print */
52 #define M2MB_HTTPC_DBG_PRINTF m2mb_dbg_consol_print
53 #else
54 #define M2MB_HTTPC_DBG_PRINTF(...)
55 #endif
56 
57 
58 typedef enum M2MB_HTTPC_RESULT
59 {
75 
79 typedef enum M2MB_HTTPC_METHODS {
81 
82  /*supported http client methods */
92 
93 
97 typedef enum M2MB_HTTPC_STATES
98 {
120 
121 
125 typedef struct M2MB_HTTPC_RESPONSE{
133 
134 #define HTTPCLIENT_MAX_URL_LENGTH 128
135 
147 typedef VOID (*M2MB_HTTPC_CB_T)(VOID* arg, signed int state, VOID* value);
148 
152 typedef struct M2MB_HTTPC_CTX{
164 
191 
220 
266  UINT32 timeout,
267  M2MB_HTTPC_CB_T cb,
268  VOID* cb_arg,
269  UINT16 httpc_max_body_len,
270  UINT16 httpc_max_Header_len,
271  UINT16 httpc_Rx_Buffer_Size,
272  VOID * m2mbSslCtx);
273 
274 
321 
382 
429 
478 
535 
550 M2MB_HTTPC_RESULT_E m2mb_httpc_set_request_body(VOID *handle, UINT8 *body, UINT32 body_length, UINT32 total_length);
551 
577 
621 M2MB_HTTPC_RESULT_E m2mb_httpc_set_header(VOID *handle,UINT8 *hdr_name, UINT8 *hdr_value);
622 
672 
727 
790 M2MB_HTTPC_RESULT_E m2mb_httpc_send(VOID *handle, UINT8 isFirstPacket,
791  UINT8 *body, UINT32 body_length, UINT32 total_length);
792 
847 
851 /*-----------------------------------------------------------------------------------------------*/
852 
853 
854 #endif /* GEPS_INC_HTTP_CLIENT_M2MB_HTTPC_H_ */
M2MB_HTTPC_RESULT_E m2mb_httpc_set_request(VOID *handle, M2MB_HTTPC_METHODS_E method, UINT8 *url)
Set the http request.
unsigned char UINT8
Definition: m2mb_types.h:83
M2MB_HTTPC_RESULT_E m2mb_httpc_session_abort(VOID *handle)
Aborts an HTTP client session.
M2MB_HTTPC_STATES
HTTP client callback state.
Definition: m2mb_httpc.h:97
M2MB_SSL_CTXT_HANDLE ssl_handle
Definition: m2mb_httpc.h:153
struct M2MB_HTTPC_RESPONSE M2MB_HTTPC_RESPONSE_T
HTTP client response.
enum M2MB_HTTPC_METHODS M2MB_HTTPC_METHODS_E
For use with m2mb_httpc_request.
UART support.
M2MB_HTTPC_RESULT_E m2mb_httpc_clear_all_headers(VOID *handle)
Clears the header field for an HTTP client session.
struct M2MB_HTTPC_CTX M2MB_HTTPC_CTX_T
HANDLE M2MB_SSL_CTXT_HANDLE
SSL context handle. This is obtained from m2mb_ssl_create_ctxt API and then used in subsequent SSL ...
Definition: m2mb_ssl.h:107
HTTP client response.
Definition: m2mb_httpc.h:125
M2MB_HTTPC_RESULT_E m2mb_httpc_connect(VOID *handle, UINT8 *url, UINT16 port)
Connects to an HTTP server in Blocking mode.
SSL TLS support.
#define HTTPCLIENT_MAX_URL_LENGTH
Definition: m2mb_httpc.h:134
M2MB_HTTPC_RESULT_E m2mb_httpc_session_getInfo(VOID *handle, M2MB_IP46_ADDR_T *ipv6, INT32 *socket)
Sets HTTP socket information from the http client session.
UINT8 url[HTTPCLIENT_MAX_URL_LENGTH+1]
Definition: m2mb_httpc.h:159
M2MB_HTTPC_RESULT_E m2mb_httpc_send(VOID *handle, UINT8 isFirstPacket, UINT8 *body, UINT32 body_length, UINT32 total_length)
Send HTTP information from the http client session.
M2MB_HTTPC_RESULT_E m2mb_httpc_start()
(Re)starts the HTTP client module.
M2MB_HTTPC_RESULT_E m2mb_httpc_enable_http_response_header(VOID *handle, UINT16 enable)
Enables/disables the addition of an HTTP header in a session callback.
unsigned short UINT16
Definition: m2mb_types.h:84
M2MB_HTTPC_RESULT_E m2mb_httpc_disconnect(VOID *handle)
Disconnects from an HTTP server .
unsigned long int UINT32
Definition: m2mb_types.h:85
M2MB_HTTPC_RESULT_E m2mb_httpc_set_header(VOID *handle, UINT8 *hdr_name, UINT8 *hdr_value)
Sets the header field for an HTTP client session.
enum M2MB_HTTPC_RESULT M2MB_HTTPC_RESULT_E
M2MB_HTTPC_RESULT_E m2mb_httpc_set_request_body(VOID *handle, UINT8 *body, UINT32 body_length, UINT32 total_length)
Sets the body on an HTTP client session.
M2MB_HTTPC_RESULT_E m2mb_httpc_request(VOID *handle, M2MB_HTTPC_METHODS_E method, UINT8 *url)
Send an HTTP request to an HTTP server or proxy.
UINT8 chunksendInprogress
Definition: m2mb_httpc.h:162
M2MB_HTTPC_METHODS_E method
Definition: m2mb_httpc.h:158
void VOID
Definition: m2mb_types.h:72
Socket IPv4/IPv6 Internet address union.
Definition: m2mb_socket.h:347
UINT32 max_body_len
Definition: m2mb_httpc.h:160
signed int INT32
Definition: m2mb_types.h:80
VOID * httpc_handle
Definition: m2mb_httpc.h:154
M2MB_HTTPC_RESULT_E m2mb_httpc_set_cgi_params(VOID *handle, UINT8 *arg, UINT8 *value)
Forms a URL-encoded string on an HTTP client session.
M2MB_HTTPC_RESULT
Definition: m2mb_httpc.h:58
M2MB_HTTPC_CB_T cb
Definition: m2mb_httpc.h:155
M2MB_HTTPC_METHODS
For use with m2mb_httpc_request.
Definition: m2mb_httpc.h:79
This file contains the public APIs and structures of the debug module.
VOID * m2mb_httpc_session_create(UINT32 timeout, M2MB_HTTPC_CB_T cb, VOID *cb_arg, UINT16 httpc_max_body_len, UINT16 httpc_max_Header_len, UINT16 httpc_Rx_Buffer_Size, VOID *m2mbSslCtx)
create http client session.
UINT32 timeout
Definition: m2mb_httpc.h:157
VOID(* M2MB_HTTPC_CB_T)(VOID *arg, signed int state, VOID *value)
User registered callback for returning response message.
Definition: m2mb_httpc.h:147
enum M2MB_HTTPC_STATES M2MB_HTTPC_STATES_E
HTTP client callback state.
M2MB_HTTPC_RESULT_E m2mb_httpc_stop()
Stops the HTTP client module.