2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: net.h,v 1.3.12.3 2004/03/08 09:05:12 marka Exp $ */
28 * Basic Networking Types
30 * This module is responsible for defining the following basic networking
39 * It ensures that the AF_ and PF_ macros are defined.
41 * It declares ntoh[sl]() and hton[sl]().
43 * It declares lwres_net_aton(), lwres_net_ntop(), and lwres_net_pton().
45 * It ensures that INADDR_LOOPBACK, INADDR_ANY and IN6ADDR_ANY_INIT
53 #include <lwres/platform.h> /* Required for LWRES_PLATFORM_*. */
56 #include <sys/types.h>
57 #include <sys/socket.h> /* Contractual promise. */
58 #include <sys/ioctl.h>
62 #include <netinet/in.h> /* Contractual promise. */
63 #include <arpa/inet.h> /* Contractual promise. */
64 #ifdef LWRES_PLATFORM_NEEDNETINETIN6H
65 #include <netinet/in6.h> /* Required on UnixWare. */
67 #ifdef LWRES_PLATFORM_NEEDNETINET6IN6H
68 #include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */
72 #include <lwres/lang.h>
74 #ifndef LWRES_PLATFORM_HAVEIPV6
75 #include <lwres/ipv6.h> /* Contractual promise. */
78 #ifdef LWRES_PLATFORM_HAVEINADDR6
79 #define in6_addr in_addr6 /* Required for pre RFC2133 implementations. */
83 * Required for some pre RFC2133 implementations.
84 * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in
85 * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt.
86 * If 's6_addr' is defined then assume that there is a union and three
87 * levels otherwise assume two levels required.
89 #ifndef IN6ADDR_ANY_INIT
91 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
93 #define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }
97 #ifndef IN6ADDR_LOOPBACK_INIT
99 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
101 #define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } }
110 #define PF_INET6 AF_INET6
113 #ifndef INADDR_LOOPBACK
114 #define INADDR_LOOPBACK 0x7f000001UL
117 LWRES_LANG_BEGINDECLS
120 lwres_net_ntop(int af, const void *src, char *dst, size_t size);
123 lwres_net_pton(int af, const char *src, void *dst);
126 lwres_net_aton(const char *cp, struct in_addr *addr);
130 #endif /* LWRES_NET_H */