DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
Helper functions for various calculations. More...
Files | |
file | iputil.c |
IPv4 And IPv6 Utiliies. | |
Functions | |
void | eui48to64 (unsigned char *mac48, unsigned char *eui64) |
Generate IPv6 address from mac address. More... | |
int | get_ip6_addrprefix (const char *iface, unsigned char *prefix) |
Generate Unique Local IPv6 Unicast Addresses RFC 4193. More... | |
int | score_ipv6 (struct sockaddr_in6 *sa6, char *ipaddr, int iplen) |
Return a score for a IPv6 addrress. More... | |
int | checkipv6mask (const char *ipaddr, const char *network, uint8_t bits) |
Check if ipaddr is in a network. More... | |
int | packetchecksumv6 (uint8_t *pkt) |
Prototype to check checksup on packet. More... | |
char * | ipv6to4prefix (const char *ipaddr) |
Return IPv6 to IPv4 Prefix fot the address. More... | |
Helper functions for various calculations.
int checkipv6mask | ( | const char * | ipaddr, |
const char * | network, | ||
uint8_t | bits | ||
) |
void eui48to64 | ( | unsigned char * | mac48, |
unsigned char * | eui64 | ||
) |
Generate IPv6 address from mac address.
this method is sourced from the following IEEE publication Guidelines for 64-bit Global Identifier (EUI-64TM) Registration Authority mac48 is char[ETH_ALEN] eui64 is char[8]
mac48 | Buffer containing MAC address 6 bytes. |
eui64 | Buffer that will be written with address 8bytes. |
Definition at line 668 of file interface.c.
Referenced by get_ip6_addrprefix().
int get_ip6_addrprefix | ( | const char * | iface, |
unsigned char * | prefix | ||
) |
Generate Unique Local IPv6 Unicast Addresses RFC 4193.
iface | External system interface name. |
prefix | A buffer char[6] that will contain the prefix. |
Definition at line 687 of file interface.c.
References eui48to64(), ifhwaddr(), sha1sum2(), and tvtontp64().
char* ipv6to4prefix | ( | const char * | ipaddr | ) |
int packetchecksumv6 | ( | uint8_t * | pkt | ) |
Prototype to check checksup on packet.
pkt | Packet buffer to check. |
int score_ipv6 | ( | struct sockaddr_in6 * | sa6, |
char * | ipaddr, | ||
int | iplen | ||
) |
Return a score for a IPv6 addrress.
sa6 | Socket addr to check. |
ipaddr | Buffer to place IP address. |
iplen | Length of IP buffer. |
Definition at line 746 of file interface.c.
References inet_ntop(), IPV6_SCORE_RESERVED, IPV6_SCORE_ROUTABLE, and IPV6_SCORE_SIXIN4.
Referenced by get_ifinfo(), and get_ifipaddr().