xref: /netbsd-src/external/bsd/libbind/dist/include/arpa/inet.h (revision 5bbd2a12505d72a8177929a37b5cee489d0a1cfd)
1*5bbd2a12Schristos /*	$NetBSD: inet.h,v 1.1.1.2 2012/09/09 16:07:50 christos Exp $	*/
2b5677b36Schristos 
3b5677b36Schristos /*
4b5677b36Schristos  * ++Copyright++ 1983, 1993
5b5677b36Schristos  * -
6b5677b36Schristos  * Copyright (c) 1983, 1993
7b5677b36Schristos  *    The Regents of the University of California.  All rights reserved.
8b5677b36Schristos  *
9b5677b36Schristos  * Redistribution and use in source and binary forms, with or without
10b5677b36Schristos  * modification, are permitted provided that the following conditions
11b5677b36Schristos  * are met:
12b5677b36Schristos  * 1. Redistributions of source code must retain the above copyright
13b5677b36Schristos  *    notice, this list of conditions and the following disclaimer.
14b5677b36Schristos  * 2. Redistributions in binary form must reproduce the above copyright
15b5677b36Schristos  *    notice, this list of conditions and the following disclaimer in the
16b5677b36Schristos  *    documentation and/or other materials provided with the distribution.
17b5677b36Schristos  * 3. All advertising materials mentioning features or use of this software
18b5677b36Schristos  *    must display the following acknowledgement:
19b5677b36Schristos  * 	This product includes software developed by the University of
20b5677b36Schristos  * 	California, Berkeley and its contributors.
21b5677b36Schristos  * 4. Neither the name of the University nor the names of its contributors
22b5677b36Schristos  *    may be used to endorse or promote products derived from this software
23b5677b36Schristos  *    without specific prior written permission.
24b5677b36Schristos  *
25b5677b36Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26b5677b36Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27b5677b36Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28b5677b36Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29b5677b36Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30b5677b36Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31b5677b36Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32b5677b36Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33b5677b36Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34b5677b36Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35b5677b36Schristos  * SUCH DAMAGE.
36b5677b36Schristos  * -
37b5677b36Schristos  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
38b5677b36Schristos  *
39b5677b36Schristos  * Permission to use, copy, modify, and distribute this software for any
40b5677b36Schristos  * purpose with or without fee is hereby granted, provided that the above
41b5677b36Schristos  * copyright notice and this permission notice appear in all copies, and that
42b5677b36Schristos  * the name of Digital Equipment Corporation not be used in advertising or
43b5677b36Schristos  * publicity pertaining to distribution of the document or software without
44b5677b36Schristos  * specific, written prior permission.
45b5677b36Schristos  *
46b5677b36Schristos  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
47b5677b36Schristos  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
48b5677b36Schristos  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
49b5677b36Schristos  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
50b5677b36Schristos  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
51b5677b36Schristos  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
52b5677b36Schristos  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53b5677b36Schristos  * SOFTWARE.
54b5677b36Schristos  * -
55b5677b36Schristos  * --Copyright--
56b5677b36Schristos  */
57b5677b36Schristos 
58b5677b36Schristos /*%
59b5677b36Schristos  *	@(#)inet.h	8.1 (Berkeley) 6/2/93
60b5677b36Schristos  *	Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
61b5677b36Schristos  */
62b5677b36Schristos 
63b5677b36Schristos #ifndef _INET_H_
64b5677b36Schristos #define	_INET_H_
65b5677b36Schristos 
66b5677b36Schristos /* External definitions for functions in inet(3) */
67b5677b36Schristos 
68b5677b36Schristos #include <sys/param.h>
69b5677b36Schristos #if (!defined(BSD)) || (BSD < 199306)
70b5677b36Schristos # include <sys/bitypes.h>
71b5677b36Schristos #else
72b5677b36Schristos # include <sys/types.h>
73b5677b36Schristos #endif
74b5677b36Schristos #include <sys/cdefs.h>
75b5677b36Schristos 
76b5677b36Schristos #define	inet_addr		__inet_addr
77b5677b36Schristos #define	inet_aton		__inet_aton
78b5677b36Schristos #define	inet_lnaof		__inet_lnaof
79b5677b36Schristos #define	inet_makeaddr		__inet_makeaddr
80b5677b36Schristos #define	inet_neta		__inet_neta
81b5677b36Schristos #define	inet_netof		__inet_netof
82b5677b36Schristos #define	inet_network		__inet_network
83b5677b36Schristos #define	inet_net_ntop		__inet_net_ntop
84b5677b36Schristos #define	inet_net_pton		__inet_net_pton
85b5677b36Schristos #define	inet_cidr_ntop		__inet_cidr_ntop
86b5677b36Schristos #define	inet_cidr_pton		__inet_cidr_pton
87b5677b36Schristos #define	inet_ntoa		__inet_ntoa
88b5677b36Schristos #define	inet_pton		__inet_pton
89b5677b36Schristos #define	inet_ntop		__inet_ntop
90b5677b36Schristos #define	inet_nsap_addr		__inet_nsap_addr
91b5677b36Schristos #define	inet_nsap_ntoa		__inet_nsap_ntoa
92b5677b36Schristos 
93b5677b36Schristos __BEGIN_DECLS
94b5677b36Schristos unsigned long	 inet_addr __P((const char *));
95b5677b36Schristos int		 inet_aton __P((const char *, struct in_addr *));
96b5677b36Schristos unsigned long	 inet_lnaof __P((struct in_addr));
97b5677b36Schristos struct in_addr	 inet_makeaddr __P((u_long , u_long));
98b5677b36Schristos char *		 inet_neta __P((u_long, char *, size_t));
99b5677b36Schristos unsigned long	 inet_netof __P((struct in_addr));
100b5677b36Schristos unsigned long	 inet_network __P((const char *));
101b5677b36Schristos char		*inet_net_ntop __P((int, const void *, int, char *, size_t));
102b5677b36Schristos int		 inet_net_pton __P((int, const char *, void *, size_t));
103b5677b36Schristos char		*inet_cidr_ntop __P((int, const void *, int, char *, size_t));
104b5677b36Schristos int		 inet_cidr_pton __P((int, const char *, void *, int *));
105b5677b36Schristos /*const*/ char	*inet_ntoa __P((struct in_addr));
106b5677b36Schristos int		 inet_pton __P((int, const char *, void *));
107b5677b36Schristos const char	*inet_ntop __P((int, const void *, char *, size_t));
108b5677b36Schristos u_int		 inet_nsap_addr __P((const char *, u_char *, int));
109b5677b36Schristos char		*inet_nsap_ntoa __P((int, const u_char *, char *));
110b5677b36Schristos __END_DECLS
111b5677b36Schristos 
112b5677b36Schristos #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
113b5677b36Schristos /*
114b5677b36Schristos  * Macros for number representation conversion.
115b5677b36Schristos  *
116b5677b36Schristos  *    netinet/in.h is another location for these macros
117b5677b36Schristos  */
118b5677b36Schristos #ifndef ntohl
119b5677b36Schristos #define ntohl(x)	(x)
120b5677b36Schristos #define ntohs(x)	(x)
121b5677b36Schristos #define htonl(x)	(x)
122b5677b36Schristos #define htons(x)	(x)
123b5677b36Schristos #endif
124b5677b36Schristos #endif
125b5677b36Schristos 
126b5677b36Schristos #endif /* !_INET_H_ */
127b5677b36Schristos 
128b5677b36Schristos /*! \file */
129