Data Structures | |
| struct | ltrx_http_dynamic_callback |
| HTTP server dynamic callback. More... | |
| struct | ltrx_http_query_data |
| HTTP server query data. More... | |
Enumerations | |
| enum | ltrx_http_header_content_type { LTRX_HTTP_HEADER_CONTENT_TYPE__TEXT_PLAIN , LTRX_HTTP_HEADER_CONTENT_TYPE__MULTIPART_FORM_DATA , LTRX_HTTP_HEADER_CONTENT_TYPE__APPLICATION_X_WWW_FORM_URLENCODED , LTRX_HTTP_HEADER_CONTENT_TYPE__OTHERS } |
| HTTP server header content types. More... | |
| enum | ltrx_http_header_method { LTRX_HTTP_HEADER_METHOD__GET , LTRX_HTTP_HEADER_METHOD__POST , LTRX_HTTP_HEADER_METHOD__PUT , LTRX_HTTP_HEADER_METHOD__DELETE , LTRX_HTTP_HEADER_METHOD__MKCOL , LTRX_HTTP_HEADER_METHOD__OPTIONS , LTRX_HTTP_HEADER_METHOD__OTHERS } |
| HTTP server header methods. More... | |
Functions | |
| void | ltrx_http_dynamic_callback_register (const struct ltrx_http_dynamic_callback *hdc) |
| Register a dynamic callback. | |
| void | ltrx_http_error (struct ltrx_http_client *client) |
| Declares an error on the HTTP client. | |
| enum ltrx_http_header_content_type | ltrx_http_get_content_type (struct ltrx_http_client *client) |
| Get content type. | |
| enum ltrx_http_header_method | ltrx_http_get_header_method (const struct ltrx_http_client *client) |
| Get header method. | |
| const char * | ltrx_http_get_request_path (const struct ltrx_http_client *client) |
| Retrieves the HTTP request path for the current HTTP client. | |
| const char * | ltrx_http_get_request_query_data (const struct ltrx_http_client *client) |
| Retrieves the complete HTTP GET request query string. | |
| bool | ltrx_http_multipart_process (struct ltrx_http_client *client, struct ltrx_http_query_data *query_data[], bool(*unknownKeyHandler)(struct ltrx_http_client *client, struct ltrx_http_multipart_parse_data *pMultipart_Data, const char *key, const char *attribute_key, void *arg), void *arg, struct ltrx_write_user_message_info *lwumi) |
| Process key/value parameters in HTTP POST request multipart/form-data body. | |
| int | ltrx_http_multipart_read_char (struct ltrx_http_client *client, struct ltrx_http_multipart_parse_data *pData) |
| Reads a single character from a multipart stream. | |
| int | ltrx_http_read_char_from_body_stream (struct ltrx_http_client *client) |
| Reads a single character from the body stream. | |
| void | ltrx_http_send_data_encoded (struct ltrx_http_client *client, const char *data) |
| Encodes and sends data to the HTTP client. | |
| void | ltrx_http_send_data_flush (struct ltrx_http_client *client) |
| Pushes out any pending data to the HTTP client. | |
HTTP Server.
HTTP server header content types.
HTTP server header methods.
| void ltrx_http_dynamic_callback_register | ( | const struct ltrx_http_dynamic_callback * | hdc | ) |
Register a dynamic callback.
The input struct contains the callback reference and the URI name under which to register.
| [in] | hdc | The definition of the dynamic callback. |
| void ltrx_http_error | ( | struct ltrx_http_client * | client | ) |
Declares an error on the HTTP client.
| client | Current HTTP client context. |
| enum ltrx_http_header_content_type ltrx_http_get_content_type | ( | struct ltrx_http_client * | client | ) |
Get content type.
| client | Current HTTP client context. |
| enum ltrx_http_header_method ltrx_http_get_header_method | ( | const struct ltrx_http_client * | client | ) |
Get header method.
| client | Current HTTP client context. |
| const char * ltrx_http_get_request_path | ( | const struct ltrx_http_client * | client | ) |
Retrieves the HTTP request path for the current HTTP client.
| client | Current HTTP client context. |
| requestPath | Return HTTP client request path if succeeded. |
| NULL | Error occurred. |
| const char * ltrx_http_get_request_query_data | ( | const struct ltrx_http_client * | client | ) |
Retrieves the complete HTTP GET request query string.
| client | Current HTTP client context. |
| requestQuery | Return the complete HTTP client GET request query string if succeeded. |
| NULL | Error occurred. |
| bool ltrx_http_multipart_process | ( | struct ltrx_http_client * | client, |
| struct ltrx_http_query_data * | query_data[], | ||
| bool(* | unknownKeyHandler )(struct ltrx_http_client *client, struct ltrx_http_multipart_parse_data *pMultipart_Data, const char *key, const char *attribute_key, void *arg), | ||
| void * | arg, | ||
| struct ltrx_write_user_message_info * | lwumi ) |
Process key/value parameters in HTTP POST request multipart/form-data body.
| client | Current HTTP client context. |
| query_data | An array of structure defining the keys and value buffers to be filled in by this function. |
| unknownKeyHandler | Callback function to handle key not found in query_data[] array. key is the current unknown key to be handled by unknownKeyHandler. If an attribute presents, unknownKeyHandler will be called with the current attribute key attribute_key to indicate its ready to process the attribute value. When all attributes are processed, unknownKeyHandler will be called with attribute_key == NULL to indicate its ready to process the value. unknownKeyHandler should return true to indicate the current key is processed or false otherwise. |
| arg | Argument to be passed to unknownKeyHandler. |
| lwumi | Message reporting structure used internally. |
| true | Process succeeded |
| false | Error (including native HTTP error) occurred |
| int ltrx_http_multipart_read_char | ( | struct ltrx_http_client * | client, |
| struct ltrx_http_multipart_parse_data * | pData ) |
Reads a single character from a multipart stream.
| client | Current HTTP client context. |
| pData | Multipart parse data context. |
| character | Returns a single character if not negative. |
| -1 | Error occurred. |
| int ltrx_http_read_char_from_body_stream | ( | struct ltrx_http_client * | client | ) |
Reads a single character from the body stream.
| client | Current HTTP client context. |
| character | Returns a single character if not negative. |
| -1 | Means "content_length" has been reached. |
| -2 | Means timeout, client close, or data exceeds buffer length. |
| -3 | Means NULL client pointer. |
| void ltrx_http_send_data_encoded | ( | struct ltrx_http_client * | client, |
| const char * | data ) |
Encodes and sends data to the HTTP client.
| client | Current HTTP client context. |
| data | Zero-terminated character data. |
| void ltrx_http_send_data_flush | ( | struct ltrx_http_client * | client | ) |
Pushes out any pending data to the HTTP client.
| client | Current HTTP client context. |