diff options
Diffstat (limited to 'include/ip.h')
-rw-r--r-- | include/ip.h | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/include/ip.h b/include/ip.h index 3f0c299..6088813 100644 --- a/include/ip.h +++ b/include/ip.h @@ -30,35 +30,39 @@ #define V4MAPPREFIX "::ffff:" #define HOSTNAMELEN 1025 -#define IP4MLMTU 512 -#define IP6MLMTU 1280 /* RFC 8200 */ -#define MTUSIZE IP6MLMTU +#define IP4MLMTU 512 +#define IP6MLMTU 1280 /* RFC 8200 */ +#define MTUSIZE IP6MLMTU -#define IP4_FMT 20 /* backwards compatibility */ -#define IP6_FMT 40 /* " */ -#define IPFMT 72 /* used in qmail-remote only (temp?) */ +#define IP4_FMT 20 /* backwards compatibility */ +#define IP6_FMT 40 /* " */ +#define IPFMT 72 /* used in qmail-remote only (temp?) */ /* may be better: */ //#define IP4_FMT IPFMT /* backwards compatibility */ //#define IP6_FMT IPFMT /* " */ /* deprecated: */ -#define FMT_IP4 IP4_FMT /* more backwards compatibility */ -#define FMT_IP6 IP6_FMT /* " */ +#define FMT_IP4 IP4_FMT /* more backwards compatibility */ +#define FMT_IP6 IP6_FMT /* " */ /* these structs are going deprecated (should replaced by socket lib) */ -struct ip4_address { unsigned char d[4]; }; /* 4 decimal pieces */ -struct ip6_address { unsigned char d[16]; }; /* 16 hex pieces */ -#define ip_address ip4_address /* backward compatibility */ +struct ip4_address { + unsigned char d[4]; +}; /* 4 decimal pieces */ +struct ip6_address { + unsigned char d[16]; +}; /* 16 hex pieces */ +#define ip_address ip4_address /* backward compatibility */ -unsigned int ip4_bytestring(stralloc *,char [4],int); -unsigned int ip4_cidr(char *,char [4],unsigned long *); -unsigned int ip4_fmt(char *,char [4]); -unsigned int ip4_scan(const char *,char [4]); -unsigned int ip4_scanbracket(const char *,char [4]); -unsigned int ia4_fmt(char *,char [4]); +unsigned int ip4_bytestring(stralloc *, char[4], int); +unsigned int ip4_cidr(char *, char[4], unsigned long *); +unsigned int ip4_fmt(char *, char[4]); +unsigned int ip4_scan(const char *, char[4]); +unsigned int ip4_scanbracket(const char *, char[4]); +unsigned int ia4_fmt(char *, char[4]); -const static char V4loopback[4] = {127,0,0,1}; -const static char V4localnet[4] = {0,0,0,0}; -const static char V4broadcast[4] = {-1,-1,-1,-1}; // all bits 1 +const static char V4loopback[4] = {127, 0, 0, 1}; +const static char V4localnet[4] = {0, 0, 0, 0}; +const static char V4broadcast[4] = {-1, -1, -1, -1}; // all bits 1 /*** * Compactified IPv6 addresses are really ugly to parse. @@ -82,26 +86,26 @@ const static char V4broadcast[4] = {-1,-1,-1,-1}; // all bits 1 * */ -unsigned int ip6_bytestring(stralloc *,char *,int); -unsigned int ip6_cidr(char *,char [16],unsigned long *); -unsigned int ip6_fmt(char *,char [16]); -unsigned int ip6_fmt_flat(char *,char [16]); -unsigned int ip6_ifscan(char *,char [16],stralloc *); -unsigned int ip6_scan(const char *,char [16]); -unsigned int ip6_scanbracket(const char *,char [16]); -unsigned int ip6_scan_flat(const char *,char [16]); -unsigned int ia6_fmt(char *,char [16]); +unsigned int ip6_bytestring(stralloc *, char *, int); +unsigned int ip6_cidr(char *, char[16], unsigned long *); +unsigned int ip6_fmt(char *, char[16]); +unsigned int ip6_fmt_flat(char *, char[16]); +unsigned int ip6_ifscan(char *, char[16], stralloc *); +unsigned int ip6_scan(const char *, char[16]); +unsigned int ip6_scanbracket(const char *, char[16]); +unsigned int ip6_scan_flat(const char *, char[16]); +unsigned int ia6_fmt(char *, char[16]); -static const unsigned char V4mappedprefix[12] = {0,0,0,0, 0,0,0,0, 0,0,0xff,0xff}; -static const unsigned char V46loopback[16] = {0,0,0,0, 0,0,0,0, 0,0,0xff,0xff, 127,0,0,1}; -static const unsigned char V6loopback[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1}; -static const unsigned char V6localnet[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}; -static const unsigned char V6linklocal[2] = {0xfe,0x80}; +static const unsigned char V4mappedprefix[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff}; +static const unsigned char V46loopback[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 127, 0, 0, 1}; +static const unsigned char V6loopback[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; +static const unsigned char V6localnet[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned char V6linklocal[2] = {0xfe, 0x80}; int fromhex(unsigned char); char tohex(char); -#define V6any V6localnet /* backward compatibility */ -#define ip6_isv4mapped(ip) (byte_equal(ip,12,V4mappedprefix)) +#define V6any V6localnet /* backward compatibility */ +#define ip6_isv4mapped(ip) (byte_equal(ip, 12, V4mappedprefix)) #endif |