s/qmail  3.3.23
Next generation secure email transport
ip.h
Go to the documentation of this file.
1 #ifndef IP_H
2 #define IP_H
3 
4 #include "uint32.h"
5 #include "stralloc.h"
6 
7 #define IPFMT 40
8 #define V4MAPPREFIX "::ffff:"
9 #define HOSTNAMELEN 1025
10 
11 struct ip_address { unsigned char d[4]; }; /* 4 decimal pieces */
12 struct ip6_address { unsigned char d[16]; }; /* 16 hex pieces */
13 
14 unsigned int ip4_fmt(char *,struct ip_address *);
15 unsigned int ip4_scan(struct ip_address *,char *);
16 unsigned int ip4_scanbracket(struct ip_address *,char *);
17 unsigned int ip4_bitstring(stralloc *,struct ip_address *,int);
18 
19 const static char ip4loopback[4] = {127,0,0,1};
20 
43 unsigned int ip6_fmt(char *,struct ip6_address *);
44 unsigned int ip6_scan(struct ip6_address *,char *);
45 unsigned int ip6_scanbracket(struct ip6_address *,char *);
46 unsigned int ip6_bitstring(stralloc *,struct ip6_address *,int);
47 
48 const static unsigned char V4mappedprefix[12]={0,0,0,0,0,0,0,0,0,0,0xff,0xff};
49 const static unsigned char V6loopback[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
50 const static unsigned char V6any[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
51 
52 #endif
Definition: ip.h:12
unsigned int ip4_scan(struct ip_address *, char *)
ip4_scan parse IPv4 address string and convert to ip_address
Definition: ip.c:47
unsigned char d[4]
Definition: ip.h:11
unsigned int ip6_fmt(char *, struct ip6_address *)
ip6_fmt convert IPv6 address to compactified IPv6 address string
Definition: ip.c:91
unsigned int ip4_fmt(char *, struct ip_address *)
ip4_fmt converts IPv4 address to dotted decimal string format
Definition: ip.c:23
unsigned int ip6_scan(struct ip6_address *, char *)
ip6_scan parse compactified IPv6 address string and convert to ip6_address struct ...
Definition: ip.c:160
Definition: ip.h:11
unsigned int ip6_scanbracket(struct ip6_address *, char *)
ip6_scanbracket parse IPv6 string address enclosed in brackets
Definition: ip.c:264
unsigned int ip6_bitstring(stralloc *, struct ip6_address *, int)
ip6_bitstring parse IPv6 address and represent as char string with length prefix
Definition: ip.c:332
unsigned int ip4_bitstring(stralloc *, struct ip_address *, int)
ip4_bitstring parse IPv4 address and represent as char string with length prefix
Definition: ip.c:293
unsigned int ip4_scanbracket(struct ip_address *, char *)
ip4_scanbracket parse IPv4 address string enclosed in brackets and convert to ip_address struct ...
Definition: ip.c:72