HTTP message parser.
More...
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
#define | HTTP_MESSAGE_MIN_LEN 16 |
|
#define | HTTP_METHOD_MAX_LEN 7 |
|
#define | HTTP_URI_DEFAULT_LEN 100 |
|
|
enum | http_method_t {
HTTP_GET
, HTTP_HEAD
, HTTP_POST
, HTTP_PUT
,
HTTP_DELETE
, HTTP_CONNECT
, HTTP_OPTIONS
, HTTP_TRACE
,
HTTP_UNKNOWN
} |
|
HTTP message parser.
- Date
- 2022-09-09
- Copyright
- Copyright (c) 2022
◆ http_message_t
Abstraction of a HTTP message
◆ http_method_t
◆ http_free_message()
Free the memory allocated for a HTTP message.
- Parameters
-
message | the HTTP message to free |
◆ http_method_to_str()
Converts a HTTP method from enum value to character string.
- Parameters
-
method | the HTTP method in enum value |
- Returns
- the same HTTP method as a character string
◆ http_parse_message()
http_message_t http_parse_message |
( |
uint8_t * |
data, |
|
|
uint16_t |
dst_port |
|
) |
| |
Parse the method and URI of HTTP message.
- Parameters
-
data | pointer to the start of the HTTP message |
src_port | TCP destination port |
- Returns
- the parsed HTTP message
- Parameters
-
data | pointer to the start of the HTTP message |
dst_port | TCP destination port |
- Returns
- the parsed HTTP message
◆ http_print_message()
Print an HTTP message.
- Parameters
-
message | the HTTP message to print |
Print an HTTP message.
- Parameters
-
message | the message to print |
◆ is_http()
bool is_http |
( |
uint8_t * |
data | ) |
|
Check if a TCP message is a HTTP message.
- Parameters
-
data | pointer to the start of the TCP payload |
dst_port | TCP destination port |
- Returns
- true if the message is a HTTP message
-
false if the message is not a HTTP message