51Degrees Device Detection C/C++  4.1

A device detection library that is used natively or by 51Degrees products

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...

Enumerations

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...

Enumeration Type Documentation

◆ fiftyoneDegreesEvidenceIpType

Enum indicating the type of IP address.

Enumerator

FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_IPV4 

An IPv4 address.

FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_IPV6 

An IPv6 address.

FIFTYONE_DEGREES_EVIDENCE_IP_TYPE_INVALID 

Invalid IP address.

Function Documentation

◆ 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