PcapPlusPlus  19.12
IpUtils.h File Reference
#include <stdint.h>
#include <in.h>
#include <arpa/inet.h>
#include <winsock2.h>
#include <ws2tcpip.h>

Go to the source code of this file.

Classes

struct  pcpp::ScalarBuffer< T >
 

Namespaces

 pcpp
 The main namespace for the PcapPlusPlus lib.
 

Functions

const char * inet_ntop (int af, const void *src, char *dst, size_t size)
 
int inet_pton (int af, const char *src, void *dst)
 
in_addr * pcpp::sockaddr2in_addr (struct sockaddr *sa)
 
in6_addr * pcpp::sockaddr2in6_addr (struct sockaddr *sa)
 
void pcpp::sockaddr2string (struct sockaddr *sa, char *resultString)
 
uint32_t pcpp::in_addr2int (in_addr inAddr)
 
uint16_t pcpp::compute_checksum (ScalarBuffer< uint16_t > vec[], size_t vecSize)
 
uint32_t pcpp::fnv_hash (ScalarBuffer< uint8_t > vec[], size_t vecSize)
 
uint32_t pcpp::fnv_hash (uint8_t *buffer, size_t bufSize)
 

Function Documentation

◆ inet_ntop()

const char* inet_ntop ( int  af,
const void *  src,
char *  dst,
size_t  size 
)

Convert a network format address to presentation format.

Parameters
[in]afAddress family, can be either AF_INET (IPv4) or AF_INET6 (IPv6)
[in]srcNetwork address structure, can be either in_addr (IPv4) or in6_addr (IPv6)
[out]dstNetwork address string representation
[in]size'dst' Maximum size
Returns
pointer to presentation format address ('dst'), or NULL (see errno).

◆ inet_pton()

int inet_pton ( int  af,
const char *  src,
void *  dst 
)

Convert from presentation format (which usually means ASCII printable) to network format (which is usually some kind of binary format).

Parameters
[in]afAddress family, can be either AF_INET (IPv4) or AF_INET6 (IPv6)
[in]srcNetwork address string representation
[out]dstNetwork address structure result, can be either in_addr (IPv4) or in6_addr (IPv6)
Returns
1 if the address was valid for the specified address family; 0 if the address wasn't valid ('dst' is untouched in this case); -1 if some other error occurred ('dst' is untouched in this case, too)