WL865E4-P  36.07.001
m2mb_httpd.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
29 #ifndef M2MB_HTTPD_API_H
30 #define M2MB_HTTPD_API_H
31 
41 /*-----------------------------------------------------------------------------------------------*/
42 
43 
48 /*-----------------------------------------------------------------------------------------------*/
49 /* Global declarations ==========================================================================*/
50 
51 #define M2MB_HTTPD_PATH_MAX 31
52 #define M2MB_HTTPD_SRVR_NAME_MAX 512
54 /* Global typedefs ==============================================================================*/
55 
61 typedef enum
62 {
63  FP_ERR = 0x110,
64  FP_OK = 0x120,
65  FP_FILE = 0x140,
66  FP_DONE = 0x200,
68 
75 typedef enum
76 {
81 
87 typedef enum
88 {
99 
105 typedef enum M2MB_URI_AUTH_FLAG
106 {
111 
118 {
128 
135 typedef struct M2MB_HTTPD_CONFIG_S
136 {
190 
196 typedef struct M2MB_HTTPD_URI_CTX
197 {
201 
208 typedef struct M2MB_HTTPD_URI_REQ_INFO{
210  VOID *hp;
220 
230 
241 
248 typedef INT32 (*M2MB_HTTPD_URI_HANDLER_T)( VOID* conn_handle, VOID* usr_ctx, INT32 **event );
249 
250 /* External variables ===========================================================================*/
251 
252 /* External functions ===========================================================================*/
253 
254 /* Global functions =============================================================================*/
255 
256 /*-----------------------------------------------------------------------------------------------*/
296 /*-----------------------------------------------------------------------------------------------*/
298 
340 /*-----------------------------------------------------------------------------------------------*/
342 
387 /*-----------------------------------------------------------------------------------------------*/
389 
442 /*-----------------------------------------------------------------------------------------------*/
444 
474 /*-----------------------------------------------------------------------------------------------*/
476 
477 /*-----------------------------------------------------------------------------------------------*/
547 /*-----------------------------------------------------------------------------------------------*/
549  M2MB_HTTPD_URI_HANDLER_T fn_cb, VOID* usr_ctx );
550 
607 /*-----------------------------------------------------------------------------------------------*/
609 
610 /*-----------------------------------------------------------------------------------------------*/
689 /*-----------------------------------------------------------------------------------------------*/
691  const INT8 *content_type,
692  INT32 content_length,
693  INT32 status_code,
694  const INT8 *status_text,
695  const INT8 *user_headers );
696 
697 /*-----------------------------------------------------------------------------------------------*/
768 /*-----------------------------------------------------------------------------------------------*/
769 M2MB_STATUS_T m2mb_httpd_send_data( VOID *conn_handle, const INT8 *data, UINT32 length );
770 
855 /*-----------------------------------------------------------------------------------------------*/
856 M2MB_STATUS_T m2mb_httpd_get_message_body( VOID *conn_handle, INT8 *buf, UINT32 *plen);
857 
942 /*-----------------------------------------------------------------------------------------------*/
943 M2MB_STATUS_T m2mb_httpd_get_message_head( VOID *conn_handle, UINT8 *buf, UINT32 *plen);
944 
945 /*-----------------------------------------------------------------------------------------------*/
1009 /*-----------------------------------------------------------------------------------------------*/
1010 INT32 m2mb_httpd_get_content_len( VOID *conn_handle );
1011 
1012 /*-----------------------------------------------------------------------------------------------*/
1076 /*-----------------------------------------------------------------------------------------------*/
1077 CHAR* m2mb_httpd_get_body_location( VOID *conn_handle );
1078 
1079 /*-----------------------------------------------------------------------------------------------*/
1143 /*-----------------------------------------------------------------------------------------------*/
1144 INT32 m2mb_httpd_get_request_type( VOID *conn_handle);
1145 
1146 /*-----------------------------------------------------------------------------------------------*/
1210 /*-----------------------------------------------------------------------------------------------*/
1212 
1213 /*-----------------------------------------------------------------------------------------------*/
1240 /*-----------------------------------------------------------------------------------------------*/
1242 
1243 /*-----------------------------------------------------------------------------------------------*/
1299 /*-----------------------------------------------------------------------------------------------*/
1300 M2MB_STATUS_T m2mb_httpd_user_add( const char *username, const char *password );
1301 
1302 /*-----------------------------------------------------------------------------------------------*/
1365 /*-----------------------------------------------------------------------------------------------*/
1366 M2MB_STATUS_T m2mb_httpd_user_del( const char *username, const char *password );
1367 
1368 /*-----------------------------------------------------------------------------------------------*/
1431 /*-----------------------------------------------------------------------------------------------*/
1432 M2MB_STATUS_T m2mb_httpd_user_validate( char *username, char *password );
1433 
1434 /*-----------------------------------------------------------------------------------------------*/
1502 /*-----------------------------------------------------------------------------------------------*/
1503 M2MB_STATUS_T m2mb_httpd_user_change_password( char *username, char *cur_password, char *new_password );
1504 
1508 /*-----------------------------------------------------------------------------------------------*/
1509 
1510 
1511 #endif
M2MB_HTTPD_URI_REQ_CGI_KEY_PAIR_T nameval[1]
Definition: m2mb_httpd.h:239
unsigned char UINT8
Definition: m2mb_types.h:83
CHAR cert_File[M2MB_HTTPD_PATH_MAX]
Definition: m2mb_httpd.h:158
M2MB_STATUS_T m2mb_httpd_is_started()
Status of HTTP server.
M2MB_STATUS_T m2mb_httpd_user_change_password(char *username, char *cur_password, char *new_password)
Change password of a USER to HTTPD module.
M2MB_HTTPD_URI_REQ_CGI_FORM_DATA_T * m2mb_httpd_get_cgi_form(VOID *conn_handle)
Get CGI form data.
M2MB_STATUS_T m2mb_httpd_deinit()
HTTP server initialization.
M2MB_STATUS_T m2mb_httpd_send_data(VOID *conn_handle, const INT8 *data, UINT32 length)
Send HTTP data.
#define M2MB_HTTPD_PATH_MAX
Definition: m2mb_httpd.h:51
VOID * m2mb_httpd_FindURICtx_FromIndex(INT32 index)
Get URI context from URI&#39;s index.
INT32 M2MB_STATUS_T
Definition: m2mb_status.h:95
enum M2MB_URI_AUTH_FLAG M2MB_URI_AUTH_FLAG_T
HTTP server URI user authentication enumeration.
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
INT32 m2mb_httpd_get_request_type(VOID *conn_handle)
Get request type.
struct M2MB_HTTPD_URI_CTX M2MB_HTTPD_URICTX_T
HTTP server URI context structure.
struct M2MB_HTTPD_CONFIG_S M2MB_HTTPD_CONFIG_T
HTTP server configuration structure.
M2MB_HTTPD_MODE_E mode
Definition: m2mb_httpd.h:141
HTTP server CGI parameter pair structure.
Definition: m2mb_httpd.h:226
M2MB_STATUS_T m2mb_httpd_get_message_head(VOID *conn_handle, UINT8 *buf, UINT32 *plen)
Get Message header of URI request.
M2MB_HTTPD_METHOD_E
HTTP server request method enumeration.
Definition: m2mb_httpd.h:87
signed char INT8
Definition: m2mb_types.h:78
unsigned short UINT16
Definition: m2mb_types.h:84
M2MB_URI_AUTH_FLAG
HTTP server URI user authentication enumeration.
Definition: m2mb_httpd.h:105
M2MB_STATUS_T m2mb_httpd_stop()
Stop HTTP server.
unsigned long int UINT32
Definition: m2mb_types.h:85
HTTP server configuration structure.
Definition: m2mb_httpd.h:135
char CHAR
Definition: m2mb_types.h:74
M2MB_HTTPD_MODE_E
HTTP server operational mode enumeration.
Definition: m2mb_httpd.h:75
M2MB_HTTPD_URI_USER_EVENT
HTTP server URI user event enumeration.
Definition: m2mb_httpd.h:117
M2MB_STATUS_T m2mb_httpd_send_headers(VOID *conn_handle, const INT8 *content_type, INT32 content_length, INT32 status_code, const INT8 *status_text, const INT8 *user_headers)
Send HTTP headers.
M2MB_OS_RESULT_E m2mb_httpd_uri_cfg(CHAR *uri, UINT8 *methods, M2MB_URI_AUTH_FLAG_T flag, M2MB_HTTPD_URI_HANDLER_T fn_cb, VOID *usr_ctx)
Configure URI to HTTP server.
struct M2MB_HTTPD_URI_REQ_CGI_KEY_PAIR M2MB_HTTPD_URI_REQ_CGI_KEY_PAIR_T
HTTP server CGI parameter pair structure.
M2MB_STATUS_T m2mb_httpd_init(M2MB_HTTPD_CONFIG_T *cfg, M2MB_SSL_CTXT_HANDLE ssl_handle)
HTTP server initialization.
HTTP server URI Request structure.
Definition: m2mb_httpd.h:208
INT32(* M2MB_HTTPD_URI_HANDLER_T)(VOID *conn_handle, VOID *usr_ctx, INT32 **event)
HTTP server URI Request user call back prototype.
Definition: m2mb_httpd.h:248
void VOID
Definition: m2mb_types.h:72
CHAR root_Path[M2MB_HTTPD_PATH_MAX]
Definition: m2mb_httpd.h:154
M2MB_STATUS_T m2mb_httpd_user_add(const char *username, const char *password)
Add a USER to HTTPD module.
enum M2MB_HTTPD_URI_USER_EVENT M2MB_HTTPD_URI_USER_EVENT_E
HTTP server URI user event enumeration.
INT32 m2mb_httpd_get_content_len(VOID *conn_handle)
Get content length.
CHAR * m2mb_httpd_get_body_location(VOID *conn_handle)
Get message body location.
M2MB_STATUS_T m2mb_httpd_start()
Start HTTP server.
enum M2MB_OS_RESULT M2MB_OS_RESULT_E
M2MB_HTTPD_CGI_RETURN_E
Return values enumeration.
Definition: m2mb_httpd.h:61
signed int INT32
Definition: m2mb_types.h:80
HTTP server CGI form data structure.
Definition: m2mb_httpd.h:236
M2MB_STATUS_T m2mb_httpd_get_message_body(VOID *conn_handle, INT8 *buf, UINT32 *plen)
Get Message Body of URI request.
HTTP server URI context structure.
Definition: m2mb_httpd.h:196
struct M2MB_HTTPD_URI_REQ_CGI_FORM_DATA M2MB_HTTPD_URI_REQ_CGI_FORM_DATA_T
HTTP server CGI form data structure.
M2MB_STATUS_T m2mb_httpd_user_del(const char *username, const char *password)
Delete a USER to HTTPD module.
struct M2MB_HTTPD_URI_REQ_INFO M2MB_HTTPD_URI_REQ_INFO_T
HTTP server URI Request structure.
M2MB_OS_RESULT_E m2mb_httpd_uri_decfg(char *uri)
De-Configure URI from HTTP server.
CHAR interface_Name[8]
Definition: m2mb_httpd.h:137
VOID(* webfiles_Setup)(void)
Definition: m2mb_httpd.h:167
CHAR root_Index_Page[M2MB_HTTPD_PATH_MAX]
Definition: m2mb_httpd.h:150
M2MB_STATUS_T m2mb_httpd_user_validate(char *username, char *password)
Validate a USER to HTTPD module.