Data Structures | |
struct | ip_sockaddr_s |
struct | in6_bytes_s |
Defines | |
#define | IP_ADDR_SIZE(ip) |
#define | IP_ADDR_IN(ip) (&((((struct sockaddr_in*)(ip))->sin_addr))) |
#define | IP_ADDR_IN6(ip) (&((((struct sockaddr_in6*)(ip))->sin6_addr))) |
#define | IP_ADDR_LLC(ip) (&((ip)->sa_data[(2*sizeof(__ss_aligntype))-sizeof(sa_family_t)])) |
#define | IP_ADDR(ip) |
#define | IP_ADDR_AF(ip, af) |
Typedefs | |
typedef ip_sockaddr_s | ip_addr_t |
typedef in6_bytes_s | in6_bytes_t |
Functions | |
ip_addr_t | ip_addr_v4 (register uint32_t) |
uint32_t | ip_v4_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_in (register struct in_addr *) |
in_addr | ip_in_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_sin (register struct sockaddr_in *) |
sockaddr_in | ip_sin_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_in6 (register struct in6_addr *) |
in6_addr | ip_in6_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_sin6 (register struct sockaddr_in6 *) |
sockaddr_in6 | ip_sin6_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_in6bytes (register in6_bytes_t *) |
in6_bytes_t | ip_in6bytes_addr (register ip_addr_t *) |
ip_addr_t | ip_addr_text (register const char *) |
char * | ip_text_addr (register ip_addr_t *, register char *, register size_t) |
char * | ip_text (ip_addr_t ip, register char *, register size_t) |
ip_addr_t | ip_addr_binary (uint8_t *buf, uint8_t len) |
ip_addr_t | ip_v4_broadcast (ip_addr_t *, uint8_t prefix) |
uint8_t | ip_v4_netmask_to_prefix (ip_addr_t *netmask) |
ip_addr_t | ip_v4_prefix_to_netmask (uint8_t prefix) |
ip_addr_t | ip_mask (ip_addr_t *, uint8_t prefix) |
#define IP_ADDR | ( | ip | ) |
Value:
( ((ip)->sa_family == AF_INET) ? (void*) IP_ADDR_IN(ip) \ :(((ip)->sa_family == AF_INET6) ? (void*) IP_ADDR_IN6(ip) \ :(((ip)->sa_family == AF_LLC) ? (void*) IP_ADDR_LLC(ip) : 0 ) \ ) \ )
#define IP_ADDR_AF | ( | ip, | |||
af | ) |
Value:
( ((af) == AF_INET) ? (void*) IP_ADDR_IN(ip) \ :(((af) == AF_INET6) ? (void*) IP_ADDR_IN6(ip) \ :(((af) == AF_LLC) ? (void*) IP_ADDR_LLC(ip) : 0 ) \ ) \ )
#define IP_ADDR_IN | ( | ip | ) | (&((((struct sockaddr_in*)(ip))->sin_addr))) |
IP_ADDR_IN macro: returns the address of the AF_INET IPv4 address field within the ip_addr_t structure pointed to by 'ip'.
Definition at line 74 of file ip_addr.h.
Referenced by ip_addr_binary(), ip_addr_in(), ip_addr_text(), ip_addr_v4(), ip_in_addr(), ip_mask(), ip_text_addr(), ip_v4_addr(), and ip_v4_broadcast().
#define IP_ADDR_IN6 | ( | ip | ) | (&((((struct sockaddr_in6*)(ip))->sin6_addr))) |
IP_ADDR_IN6 macro: returns the address of the AF_INET6 IPv6 address field within the ip_addr_t structure pointed to by 'ip'.
Definition at line 80 of file ip_addr.h.
Referenced by ip_addr_binary(), ip_addr_in6(), ip_addr_in6bytes(), ip_addr_text(), ip_in6_addr(), ip_in6bytes_addr(), ip_mask(), and ip_text_addr().
#define IP_ADDR_LLC | ( | ip | ) | (&((ip)->sa_data[(2*sizeof(__ss_aligntype))-sizeof(sa_family_t)])) |
IP_ADDR_LLC macro: returns the address of the AF_LLC Link Layer (ethernet) address field within the ip_addr_t structure pointed to by 'ip'.
Definition at line 86 of file ip_addr.h.
Referenced by ip_addr_binary(), and ip_text_addr().
#define IP_ADDR_SIZE | ( | ip | ) |
Value:
( ((ip)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ :(((ip)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ :(((ip)->sa_family == AF_LLC) ? __LLC_SOCK_SIZE__ : 0) \ ) \ )
typedef struct in6_bytes_s in6_bytes_t |
struct in6_bytes_s: representation of an IPv6 address as an array of 16 bytes:
typedef struct ip_sockaddr_s ip_addr_t |
IP addresses structure big enough for an IPv6 address by default (minimum size == sizeof(struct sockaddr_in6)). Compatible with all of struct sockaddr, struct sockaddr_in, and struct sockaddr_in6. If used to represent an IPv4 or IPv6 address, (&(s->sin_addr) == &(s->sin6_addr) == &(s->sa_pad)) . If used to represent an AF_LLC address (ethernet), &(((ip_addr_t*)s)->sa_data) == &(((struct sockaddr*)s)->sa_data).
ip_addr_t ip_addr_binary | ( | uint8_t * | buf, | |
uint8_t | len | |||
) |
ip_addr_binary ( buf, len ): returns the ip_addr_t representation of the len address bytes pointed to by buf; if len is not a recognized address length (the fixed length of an AF_INET, AF_INET6, or AF_LLC ethernet address), returns a null ip address with sa_family==0.
Definition at line 164 of file ip_addr.c.
References AF_LLC, IP_ADDR_IN, IP_ADDR_IN6, IP_ADDR_LLC, and ip_sockaddr_s::sa_family.
ip_addr_t ip_addr_in | ( | register struct in_addr * | ) |
ip_addr_in( in_addr ): returns the ip_addr_t representation of the struct in_addr AF_INET address argument.
Definition at line 42 of file ip_addr.c.
References IP_ADDR_IN, and ip_sockaddr_s::sa_data.
Referenced by dhcp4_nic_option_handler(), and dhcp4_process_lease().
ip_addr_t ip_addr_in6 | ( | register struct in6_addr * | ) |
ip_addr_in6( in6 ): returns the ip_addr_t representation of the struct in6_addr pointed to by in6 .
Definition at line 70 of file ip_addr.c.
References IP_ADDR_IN6, and ip_sockaddr_s::sa_data.
Referenced by dhcp6_process_lease().
ip_addr_t ip_addr_in6bytes | ( | register in6_bytes_t * | ) |
ip_addr_in6bytes( in6bytes ): returns the ip_addr_t representation of the in6_bytes_t pointed to by in6_bytes
Definition at line 99 of file ip_addr.c.
References IP_ADDR_IN6, and ip_sockaddr_s::sa_data.
ip_addr_t ip_addr_sin | ( | register struct sockaddr_in * | ) |
ip_addr_t ip_addr_sin6 | ( | register struct sockaddr_in6 * | ) |
ip_addr_t ip_addr_text | ( | register const char * | ) |
ip_addr_text( str ): converts string str to an IP address represented by the returned ip_addr_t, if possible. If not possible, a null IP address (with sa_family == 0) is returned.
Definition at line 113 of file ip_addr.c.
References IP_ADDR_IN, and IP_ADDR_IN6.
ip_addr_t ip_addr_v4 | ( | register | uint32_t | ) |
ip_addr_v4(uint32_t int_ip): returns the ip_addr_t struct of the 32-bit AF_INET address int_ip, converting int_ip to network byte order.
Definition at line 27 of file ip_addr.c.
References IP_ADDR_IN, and ip_sockaddr_s::sa_data.
struct in6_addr ip_in6_addr | ( | register ip_addr_t * | ) |
ip_in6_addr( ip ): returns the struct in6_addr representation of the ip_addr_t pointed to by ip.
Definition at line 79 of file ip_addr.c.
References IP_ADDR_IN6.
in6_bytes_t ip_in6bytes_addr | ( | register ip_addr_t * | ) |
ip_in6bytes_addr( ip ): returns the in6_bytes_t representation of the ip_addr_t pointed to by ip.
Definition at line 108 of file ip_addr.c.
References IP_ADDR_IN6.
struct in_addr ip_in_addr | ( | register ip_addr_t * | ) |
ip_in_addr(ip): returns the struct in_addr AF_INET address represented by the ip_addr_t pointed to by ip.
Definition at line 50 of file ip_addr.c.
References IP_ADDR_IN.
ip_mask( ip, prefix ): returns the subnet address of the IPv4 or IPv6 address pointed to by ip with the given prefix.
Definition at line 221 of file ip_addr.c.
References IP_ADDR_IN, IP_ADDR_IN6, and ip_sockaddr_s::sa_family.
struct sockaddr_in6 ip_sin6_addr | ( | register ip_addr_t * | ) |
struct sockaddr_in ip_sin_addr | ( | register ip_addr_t * | ) |
char* ip_text | ( | ip_addr_t | ip, | |
register char * | , | |||
register | size_t | |||
) |
ip_text_addr( ip, buf, size ): converts the ip_addr_t ip to a string. If buf is 0 or size is less than the string length required, uses a static buffer; otherwise, buf is used to store the string.
Definition at line 159 of file ip_addr.c.
References ip_text_addr().
char* ip_text_addr | ( | register ip_addr_t * | , | |
register char * | , | |||
register | size_t | |||
) |
ip_text_addr( ip, buf, size ): converts the ip_addr_t pointed to by ip to a string. If buf is 0 or size is less than the string length required, uses a static buffer; otherwise, buf is used to store the string.
Definition at line 134 of file ip_addr.c.
References __LLC_SOCK_SIZE__, AF_LLC, IP_ADDR_IN, IP_ADDR_IN6, and IP_ADDR_LLC.
Referenced by dhcp4_nic_option_handler(), dhcp4_process_lease(), ip_text(), and nic_configure_resolver().
uint32_t ip_v4_addr | ( | register ip_addr_t * | ) |
ip_addr_v4(ip): returns the the 32 bit integer representation of the AF_INET address represented by ip_addr_t IP, in host byte order.
Definition at line 35 of file ip_addr.c.
References IP_ADDR_IN.
Referenced by dhcp4_nic_option_handler().
ip_v4_broadcast( ip, prefix ): returns the IPv4 broadcast address of the AF_INET IPv4 address pointed to by ip with the given prefix .
Definition at line 191 of file ip_addr.c.
References IP_ADDR_IN, and ip_sockaddr_s::sa_data.
Referenced by dhcp4_nic_option_handler().
uint8_t ip_v4_netmask_to_prefix | ( | ip_addr_t * | netmask | ) |
ip_v4_netmask_to_prefix( netmask ): returns the prefix length of all-one bits in the ip_addr_t pointed to by netmask.
Definition at line 203 of file ip_addr.c.
References ip_sockaddr_s::sa_family.
ip_addr_t ip_v4_prefix_to_netmask | ( | uint8_t | prefix | ) |
ip_v4_prefix_to_netmask( prefix ): returns the netmask address of prefix all-one bits .
Definition at line 211 of file ip_addr.c.
References ip_sockaddr_s::sa_family.