Detailed Description
Types and methods to parse IP address strings.
Introduction
IP v4 and v6 addresses can be parsed using the fiftyoneDegreesIpParseAddress and fiftyoneDegreesIpParseAddresses methods.
Collaboration diagram for IP:
Structs
struct | fiftyoneDegreesEvidenceIpAddress
IP address structure containing the bytes of a v4 or v6 IP address. More...
|
Macros
#define | FIFTYONE_DEGREES_IPV4_LENGTH 4
The number of bytes in an Ipv4 Address.
|
#define | FIFTYONE_DEGREES_IPV6_LENGTH 16
The number of bytes in an Ipv6 Address.
|
Enumerations
enum | fiftyoneDegreesEvidenceIpType { FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_IPV4 = 0,
FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_IPV6 = 1,
FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_INVALID = 2
}
Enum indicating the type of IP address. More...
|
Functions
void | fiftyoneDegreesIpFreeAddresses (void(*free)(void *), fiftyoneDegreesEvidenceIpAddress *addresses)
Free a linked list of IP addresses. More...
|
fiftyoneDegreesEvidenceIpAddress * | fiftyoneDegreesIpParseAddress (void *(*malloc)(size_t), const char *start, const char *end)
Parse a single IP address string. More...
|
fiftyoneDegreesEvidenceIpAddress * | fiftyoneDegreesIpParseAddresses (void *(*malloc)(size_t), const char *start)
Parse a list of IP addresses and return as a linked list. More...
|
int | fiftyoneDegreesCompareIpAddresses (const unsigned char *ipAddress1, const unsigned char *ipAddress2, fiftyoneDegreesEvidenceIpType type)
Compare two IP addresses in its binary form. More...
|
Enumeration Type Documentation
Function Documentation
◆ fiftyoneDegreesCompareIpAddresses()
int fiftyoneDegreesCompareIpAddresses | ( | const unsigned char * | ipAddress1, |
const unsigned char * | ipAddress2, | ||
fiftyoneDegreesEvidenceIpType | type | ||
) |
Compare two IP addresses in its binary form.
- Parameters
-
- ipAddress1 - the first IP address
- ipAddress2 - the second IP address
- type - the type of IP address. This determine the number of bytes to compare. IPv4 require 4 bytes and IPv6 require 16 bytes
- Returns
- a value indicate the result: 0 for equals
0 for ipAddress1 comes after ipAddress2
◆ fiftyoneDegreesIpFreeAddresses()
void fiftyoneDegreesIpFreeAddresses | ( | void(*)(void *) | free, |
fiftyoneDegreesEvidenceIpAddress * | addresses | ||
) |
Free a linked list of IP addresses.
This can also be a single IP address as this is equivalent to a linked list with a size of 1.
- Parameters
-
- free - method to free the IP addresses
- addresses - head of the linked list
◆ fiftyoneDegreesIpParseAddress()
fiftyoneDegreesEvidenceIpAddress* fiftyoneDegreesIpParseAddress | ( | void *(*)(size_t) | malloc, |
const char * | start, | ||
const char * | end | ||
) |
Parse a single IP address string.
- Parameters
-
- malloc - method to allocate the IP address
- start - of the string containing the IP address to parse
- end - of the string containing the IP address to parse
- Returns
- pointer to the parsed IP address
◆ fiftyoneDegreesIpParseAddresses()
fiftyoneDegreesEvidenceIpAddress* fiftyoneDegreesIpParseAddresses | ( | void *(*)(size_t) | malloc, |
const char * | start | ||
) |
Parse a list of IP addresses and return as a linked list.
- Parameters
-
- malloc - method to allocate IP addresses
- start - of the string containing the IP addresses to parse
- Returns
- pointer to the head of the linked list