fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
Functions
ip4.c File Reference

handling of IPv4 addresses More...

#include "fmt.h"
#include "scan.h"
#include "str.h"
#include "ip.h"
Include dependency graph for ip4.c:

Go to the source code of this file.

Functions

unsigned int ip4_fmt (char *s, char ip[4])
 ip4_fmt converts IPv4 address to dotted decimal string format
 
unsigned int ia4_fmt (char *s, char ip[4])
 ia4_fmt converts IPv4 address into DNS inverse nibble format
 
unsigned int ip4_scan (const char *s, char ip[4])
 ip4_scan parse IPv4 address string and convert to IP address array
 
unsigned int ip4_scanbracket (const char *s, char ip[4])
 ip4_scanbracket parse IPv4 address string enclosed in brackets and convert to IP address array
 
unsigned int ip4_cidr (char *s, char ip[4], unsigned long *plen)
 ip4_cidr parse IPv4 address string concatinated with the prefix length: 192.168.1/24
 
unsigned int ip4_bytestring (stralloc *ipstring, char ip[4], int prefix)
 ip4_bytestring parse IPv4 address and represent as char string with length prefix
 

Detailed Description

handling of IPv4 addresses

Authors
djb, fefe, feh, kp ucspi-tcp, ucspi-tcp6

Definition in file ip4.c.

Function Documentation

◆ ia4_fmt()

unsigned int ia4_fmt ( char *  s,
char  ip[4] 
)

ia4_fmt converts IPv4 address into DNS inverse nibble format

Parameters
inputIPv4 char array output: IPv4 address string
Returns
int length of address (ok > 0)

Definition at line 43 of file ip4.c.

Here is the call graph for this function:

◆ ip4_bytestring()

unsigned int ip4_bytestring ( stralloc ipstring,
char  ip[4],
int  prefix 
)

ip4_bytestring parse IPv4 address and represent as char string with length prefix

Parameters
inputIPv4 char array, prefix length output: pointer to stralloc bytestring
Returns
n: number of bytes, if ok; -1: memory shortage; -2: input error

Definition at line 131 of file ip4.c.

Here is the call graph for this function:

◆ ip4_cidr()

unsigned int ip4_cidr ( char *  s,
char  ip[4],
unsigned long *  plen 
)

ip4_cidr parse IPv4 address string concatinated with the prefix length: 192.168.1/24

Parameters
inputIPv6 char array output: IPv6 char array, long plen
Returns
int length of ip6_address/ip

Definition at line 111 of file ip4.c.

Here is the call graph for this function:

◆ ip4_fmt()

unsigned int ip4_fmt ( char *  s,
char  ip[4] 
)

ip4_fmt converts IPv4 address to dotted decimal string format

Parameters
inputIPv4 char array output: IPv4 address string
Returns
int length of address (ok > 0)

Definition at line 20 of file ip4.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip4_scan()

unsigned int ip4_scan ( const char *  s,
char  ip[4] 
)

ip4_scan parse IPv4 address string and convert to IP address array

Parameters
inputIPv4 address string output: IPv4 char array
Returns
int length of ip_address (ok > 0)

Definition at line 67 of file ip4.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip4_scanbracket()

unsigned int ip4_scanbracket ( const char *  s,
char  ip[4] 
)

ip4_scanbracket parse IPv4 address string enclosed in brackets and convert to IP address array

Parameters
inputIPv4 char array output: IPv4 char array
Returns
int length of ip_address (ok > 0)

Definition at line 92 of file ip4.c.

Here is the call graph for this function:
Here is the caller graph for this function: