s/qmail  3.3.23
Next generation secure email transport
Functions
ip.c File Reference

IPv4 functions: ip4_fmt, ip4_scan, ip4_scanbracket IPv6 functions: ip6_fmt, ip6_scan, ip6_scanbracket conversion functions: ip4_bitstring, ip6_bitstring, intfromhex. More...

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

Go to the source code of this file.

Functions

unsigned int ip4_fmt (char *s, struct ip_address *ip)
 ip4_fmt converts IPv4 address to dotted decimal string format More...
 
unsigned int ip4_scan (struct ip_address *ip, char *s)
 ip4_scan parse IPv4 address string and convert to ip_address More...
 
unsigned int ip4_scanbracket (struct ip_address *ip, char *s)
 ip4_scanbracket parse IPv4 address string enclosed in brackets and convert to ip_address struct More...
 
unsigned int ip6_fmt (char *s, struct ip6_address *ip)
 ip6_fmt convert IPv6 address to compactified IPv6 address string More...
 
unsigned int ip6_scan (struct ip6_address *ip, char *s)
 ip6_scan parse compactified IPv6 address string and convert to ip6_address struct More...
 
unsigned int ip6_scanbracket (struct ip6_address *ip6, char *s)
 ip6_scanbracket parse IPv6 string address enclosed in brackets More...
 
unsigned int ip4_bitstring (stralloc *ip4string, struct ip_address *ip4, int prefix)
 ip4_bitstring parse IPv4 address and represent as char string with length prefix More...
 
unsigned int ip6_bitstring (stralloc *ip6string, struct ip6_address *ip6, int prefix)
 ip6_bitstring parse IPv6 address and represent as char string with length prefix More...
 

Detailed Description

IPv4 functions: ip4_fmt, ip4_scan, ip4_scanbracket IPv6 functions: ip6_fmt, ip6_scan, ip6_scanbracket conversion functions: ip4_bitstring, ip6_bitstring, intfromhex.

Definition in file ip.c.

Function Documentation

◆ ip4_bitstring()

unsigned int ip4_bitstring ( stralloc *  ip4string,
struct ip_address ip4,
int  prefix 
)

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

Parameters
inputpointer to struct IPv4 address, prefix length output: pointer to stralloc bitstring
Returns
0, if ok; 1, memory shortage; 2, input error

Definition at line 293 of file ip.c.

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

◆ ip4_fmt()

unsigned int ip4_fmt ( char *  s,
struct ip_address ip 
)

ip4_fmt converts IPv4 address to dotted decimal string format

Parameters
inputpointer to IPv4 ip_address struct output: pointer to IPv4 address string
Returns
int length of address (ok > 0)

Definition at line 23 of file ip.c.

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

◆ ip4_scan()

unsigned int ip4_scan ( struct ip_address ip,
char *  s 
)

ip4_scan parse IPv4 address string and convert to ip_address

Parameters
inputpointer to IPv4 address string output: pointer to IPv4 ip_address struct
Returns
int lenth of ip_address (ok > 0)

Definition at line 47 of file ip.c.

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

◆ ip4_scanbracket()

unsigned int ip4_scanbracket ( struct ip_address ip,
char *  s 
)

ip4_scanbracket parse IPv4 address string enclosed in brackets and convert to ip_address struct

Parameters
inputpointer to IPv4 address string output: pointer to IPv4 ip_address struct
Returns
int lenth of ip_address (ok > 0)

Definition at line 72 of file ip.c.

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

◆ ip6_bitstring()

unsigned int ip6_bitstring ( stralloc *  ip6string,
struct ip6_address ip6,
int  prefix 
)

ip6_bitstring parse IPv6 address and represent as char string with length prefix

Parameters
inputpointer to struct IPv6 address, prefix length output: pointer to stralloc bit string;
Returns
0, if ok; 1, memory shortage

Definition at line 332 of file ip.c.

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

◆ ip6_fmt()

unsigned int ip6_fmt ( char *  s,
struct ip6_address ip 
)

ip6_fmt convert IPv6 address to compactified IPv6 address string

Parameters
inputpointer to IPv6 ip6_address struct output: pointer to IPv6 address string
Returns
int length of address (ok > 0)

Definition at line 91 of file ip.c.

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

◆ ip6_scan()

unsigned int ip6_scan ( struct ip6_address ip,
char *  s 
)

ip6_scan parse compactified IPv6 address string and convert to ip6_address struct

Parameters
inputpointer to IPv6 address string output: pointer to ip6_address struct
Returns
int length of ip6_address/ip

Definition at line 160 of file ip.c.

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

◆ ip6_scanbracket()

unsigned int ip6_scanbracket ( struct ip6_address ip6,
char *  s 
)

ip6_scanbracket parse IPv6 string address enclosed in brackets

Parameters
inputpointer to IPv6 address string output: pointer to IPv6 address struct
Returns
int length of ip_address (ok > 0)

Definition at line 264 of file ip.c.

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