Loading...
Searching...
No Matches
addr.h File Reference

IPv4 address type and helper functions definitions. More...

Detailed Description

IPv4 address type and helper functions definitions.

Author
Martine Lenders mlend.nosp@m.ers@.nosp@m.inf.f.nosp@m.u-be.nosp@m.rlin..nosp@m.de

Definition in file addr.h.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "byteorder.h"
+ Include dependency graph for addr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  ipv4_addr_t
 Data type to represent an IPv4 address. More...
 

Macros

#define IPV4_ADDR_MAX_STR_LEN   (sizeof("255.255.255.255"))
 Maximum length of an IPv4 address as string.
 
#define IPV4_ADDR_INIT(a, b, c, d)   { .u8 = {a, b, c, d} }
 Static initializer for an IPv4 address.
 

Functions

static bool ipv4_addr_equal (const ipv4_addr_t *a, const ipv4_addr_t *b)
 Checks if two IPv4 addresses are equal.
 
static bool ipv4_addr_is_multicast (const ipv4_addr_t *addr)
 Check if addr is a multicast address.
 
char * ipv4_addr_to_str (char *result, const ipv4_addr_t *addr, uint8_t result_len)
 Converts an IPv4 address to its string representation.
 
ipv4_addr_tipv4_addr_from_str (ipv4_addr_t *result, const char *addr)
 Converts an IPv4 address string representation to a byte-represented IPv4 address.
 
ipv4_addr_tipv4_addr_from_buf (ipv4_addr_t *result, const char *addr, size_t addr_len)
 Converts an IPv4 address from a buffer of characters to a byte-represented IPv4 address.
 
void ipv4_addr_print (const ipv4_addr_t *addr)
 Print IPv4 address to stdout.