15 #include <netinet/in.h>
17 #include <net/ethernet.h>
25 #define OS_INET_ADDRSTRLEN 22
26 #define OS_INET6_ADDRSTRLEN 63
29 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
30 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
36 #define COMPACT_MACSTR "%02x%02x%02x%02x%02x%02x"
37 #define COMPACT_MACSTR_LEN 13
41 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
42 #define IPSTR "%d.%d.%d.%d"
47 (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5], (a)[6], (a)[7], (a)[8], \
48 (a)[9], (a)[10], (a)[11], (a)[12], (a)[13], (a)[14], (a)[15]
50 "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"
69 int ip_2_nbo(
const char *ip,
const char *subnetMask, in_addr_t *addr);
131 int get_ip_host(
const char *ip,
const char *subnet_mask, uint32_t *host);
157 #define hwaddr_aton2(txt, addr) edge_hwaddr_aton2((txt), (addr))
File containing the definition of the allocs functionalities.
#define OS_INET_ADDRSTRLEN
Definition: net.h:25
const char * inaddr4_2_ip(const struct in_addr *addr, char ip[static OS_INET_ADDRSTRLEN])
Convert the in_addr encoded IP4 address to an IP string.
Definition: net.c:129
#define OS_INET6_ADDRSTRLEN
Definition: net.h:26
int ip4_2_buf(const char *ip, uint8_t buf[static IP_ALEN])
IP string to buffer.
Definition: net.c:90
int get_ip_host(const char *ip, const char *subnet_mask, uint32_t *host)
Get the host identifier from an IP address string.
Definition: net.c:160
const char * inaddr6_2_ip(const struct in6_addr *addr, char ip[static OS_INET6_ADDRSTRLEN])
Convert the in6_addr encoded IP6 address to an IP string.
Definition: net.c:134
bool validate_ipv4_string(const char *ip)
Checks whether a string denotes a IPv4 address.
Definition: net.c:27
uint8_t get_short_subnet(const char *subnet_mask)
Convert from a string subnet mask to a short integer version.
Definition: net.c:139
int ip_2_nbo(const char *ip, const char *subnetMask, in_addr_t *addr)
IP string to struct in_addr_t converter.
Definition: net.c:67
int edge_hwaddr_aton2(const char *txt, uint8_t *addr)
Convert ASCII string to MAC address (in any known format)
Definition: net.c:202
#define IP_ALEN
Definition: net.h:24
int disable_pmtu_discovery(int sock)
Disable the PMTU discovery for sockets.
Definition: net.c:181
const char * bit32_2_ip(uint32_t addr, char ip[static OS_INET_ADDRSTRLEN])
Convert a 32 bit number IP to an IP string.
Definition: net.c:122
File containing the definition of the os functionalities.