Smart Home firewall
Profile-based Smart Home firewall
Functions
http.c File Reference

HTTP message parser. More...

#include "http.h"
Include dependency graph for http.c:

Functions

bool is_http (uint8_t *data)
 Check if a TCP message is a HTTP message. More...
 
http_message_t http_parse_message (uint8_t *data, uint16_t dst_port)
 Parse the method and URI of HTTP message. More...
 
void http_free_message (http_message_t message)
 Free the memory allocated for a HTTP message. More...
 
char * http_method_to_str (http_method_t method)
 Converts a HTTP method from enum value to character string. More...
 
void http_print_message (http_message_t message)
 Print the method and URI of a HTTP message. More...
 

Detailed Description

HTTP message parser.

Date
2022-09-19

Function Documentation

◆ http_free_message()

void http_free_message ( http_message_t  message)

Free the memory allocated for a HTTP message.

Parameters
messagethe HTTP message to free

◆ http_method_to_str()

char* http_method_to_str ( http_method_t  method)

Converts a HTTP method from enum value to character string.

Parameters
methodthe 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
datapointer to the start of the HTTP message
dst_portTCP destination port
Returns
the parsed HTTP message

◆ http_print_message()

void http_print_message ( http_message_t  message)

Print the method and URI of a HTTP message.

Print an HTTP message.

Parameters
messagethe message to print

◆ is_http()

bool is_http ( uint8_t *  data)

Check if a TCP message is a HTTP message.

Parameters
datapointer to the start of the TCP payload
dst_portTCP destination port
Returns
true if the message is a HTTP message
false if the message is not a HTTP message