Smart Home firewall
Profile-based Smart Home firewall
|
Utilitaries for payload manipulation and display. More...
#include "packet_utils.h"
Functions | |
void | print_payload (int length, uint8_t *data) |
size_t | hexstr_to_payload (char *hexstring, uint8_t **payload) |
char * | mac_hex_to_str (uint8_t mac_hex[]) |
uint8_t * | mac_str_to_hex (char *mac_str) |
char * | ipv4_net_to_str (uint32_t ipv4_net) |
uint32_t | ipv4_str_to_net (char *ipv4_str) |
char * | ipv4_hex_to_str (char *ipv4_hex) |
char * | ipv4_str_to_hex (char *ipv4_str) |
char * | ipv6_net_to_str (uint8_t ipv6[]) |
Converts an IPv6 to its string representation. More... | |
uint8_t * | ipv6_str_to_net (char *ipv6_str) |
char * | ip_net_to_str (ip_addr_t ip_addr) |
Converts an IP (v4 or v6) address to its string representation. More... | |
ip_addr_t | ip_str_to_net (char *ip_str, uint8_t version) |
bool | compare_ipv6 (uint8_t *ipv6_1, uint8_t *ipv6_2) |
Compare two IPv6 addresses. More... | |
bool | compare_ip (ip_addr_t ip_1, ip_addr_t ip_2) |
Compare two IP (v4 or v6) addresses. More... | |
uint8_t * | compute_hash (uint8_t *payload, int payload_len) |
Compute SHA256 hash of a given payload. More... | |
void | print_hash (uint8_t *hash) |
Print a SHA256 hash. More... | |
Utilitaries for payload manipulation and display.
Compare two IP (v4 or v6) addresses.
ip_1 | first IP address |
ip_2 | second IP address |
bool compare_ipv6 | ( | uint8_t * | ipv6_1, |
uint8_t * | ipv6_2 | ||
) |
Compare two IPv6 addresses.
ipv6_1 | first IPv6 address |
ipv6_2 | second IPv6 address |
uint8_t* compute_hash | ( | uint8_t * | payload, |
int | payload_len | ||
) |
Compute SHA256 hash of a given payload.
payload | Payload to hash |
payload_len | Payload length, including padding (in bytes) |
size_t hexstr_to_payload | ( | char * | hexstring, |
uint8_t ** | payload | ||
) |
Converts a hexstring payload to a data buffer.
hexstring | the hexstring to convert |
payload | a double pointer to the payload, which will be set to the start of the payload |
char* ip_net_to_str | ( | ip_addr_t | ip_addr | ) |
Converts an IP (v4 or v6) address to its string representation.
Converts an IP (v4 or v6) address to its string representation. If it is an IPv6 address, it must be freed after use.
ip_addr | the IP address, as an ip_addr_t struct |
ip_addr_t ip_str_to_net | ( | char * | ip_str, |
uint8_t | version | ||
) |
char* ipv4_hex_to_str | ( | char * | ipv4_hex | ) |
Converts an IPv4 addres from its hexadecimal representation to its string representation.
ipv4_hex | IPv4 address in hexadecimal representation |
char* ipv4_net_to_str | ( | uint32_t | ipv4_net | ) |
Converts an IPv4 address from its network order numerical representation to its string representation. (Wrapper arount inet_ntoa)
ipv4_net | IPv4 address in hexadecimal representation |
char* ipv4_str_to_hex | ( | char * | ipv4_str | ) |
Converts an IPv4 address from its string representation to its hexadecimal representation.
ipv4_str | IPv4 address in string representation |
uint32_t ipv4_str_to_net | ( | char * | ipv4_str | ) |
Converts an IPv4 address from its string representation to its network order numerical representation. (Wrapper arount inet_aton)
ipv4_str | IPv4 address in string representation |
char* ipv6_net_to_str | ( | uint8_t | ipv6[] | ) |
Converts an IPv6 to its string representation.
Converts an IPv6 address to its string representation.
ipv6 | the IPv6 address |
uint8_t* ipv6_str_to_net | ( | char * | ipv6_str | ) |
Converts an IPv6 address from its string representation to its network representation (a 16-byte array).
ipv6_str | IPv6 address in string representation |
char* mac_hex_to_str | ( | uint8_t | mac_hex[] | ) |
Converts a MAC address from its hexadecimal representation to its string representation.
mac_hex | MAC address in hexadecimal representation |
uint8_t* mac_str_to_hex | ( | char * | mac_str | ) |
Converts a MAC address from its string representation to its hexadecimal representation.
mac_str | MAC address in string representation |
void print_hash | ( | uint8_t * | hash | ) |
Print a SHA256 hash.
hash | SHA256 hash to print |
void print_payload | ( | int | length, |
uint8_t * | data | ||
) |
Print a packet payload.
length | length of the payload in bytes |
data | pointer to the start of the payload |