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

DHCP message parser. More...

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

Functions

dhcp_message_t dhcp_parse_header (uint8_t *data)
 Parse the header of a DHCP message (not including options). More...
 
dhcp_option_t dhcp_parse_option (uint8_t *data, uint16_t *offset)
 Parse a DHCP option. More...
 
dhcp_options_t dhcp_parse_options (uint8_t *data)
 Parse DHCP options. More...
 
dhcp_message_t dhcp_parse_message (uint8_t *data)
 Parse a DHCP message. More...
 
void dhcp_free_message (dhcp_message_t message)
 Free the memory allocated for a DHCP message. More...
 
void dhcp_print_header (dhcp_message_t message)
 Print the header of a DHCP message. More...
 
void dhcp_print_option (dhcp_option_t option)
 Print a DHCP option. More...
 
void dhcp_print_message (dhcp_message_t message)
 Print a DHCP message. More...
 

Detailed Description

DHCP message parser.

Date
2022-09-12

Function Documentation

◆ dhcp_free_message()

void dhcp_free_message ( dhcp_message_t  message)

Free the memory allocated for a DHCP message.

Parameters
messagethe DHCP message to free

◆ dhcp_parse_header()

dhcp_message_t dhcp_parse_header ( uint8_t *  data)

Parse the header of a DHCP message (not including options).

Parse the header of a DHCP message (not including options)

Parameters
dataa pointer to the start of the DHCP message
Returns
the parsed DHCP message with the header fields filled in

◆ dhcp_parse_message()

dhcp_message_t dhcp_parse_message ( uint8_t *  data)

Parse a DHCP message.

Parameters
dataa pointer to the start of the DHCP message
Returns
the parsed DHCP message

◆ dhcp_parse_option()

dhcp_option_t dhcp_parse_option ( uint8_t *  data,
uint16_t *  offset 
)

Parse a DHCP option.

Parameters
dataa pointer to the start of the DHCP option
offseta pointer to the current offset inside the DHCP message Its value will be updated to point to the next option
Returns
the parsed DHCP option

◆ dhcp_parse_options()

dhcp_options_t dhcp_parse_options ( uint8_t *  data)

Parse DHCP options.

Parameters
dataa pointer to the start of the DHCP options list
Returns
a pointer to the start of the parsed DHCP options

◆ dhcp_print_header()

void dhcp_print_header ( dhcp_message_t  message)

Print the header of a DHCP message.

Parameters
messagethe DHCP message to print the header of

◆ dhcp_print_message()

void dhcp_print_message ( dhcp_message_t  message)

Print a DHCP message.

Parameters
messagethe DHCP message to print

◆ dhcp_print_option()

void dhcp_print_option ( dhcp_option_t  option)

Print a DHCP option.

Parameters
optionthe DHCP option to print