xref: /netbsd-src/include/arpa/inet.h (revision a0abbe8fe8348ae032da2577ed804f895413eeeb)
1*a0abbe8fSchristos /*	$NetBSD: inet.h,v 1.24 2008/06/21 20:12:49 christos Exp $	*/
2dad5e0c3Sbjh21 
361f28255Scgd /*
43f63ba4dSmrg  * ++Copyright++ 1983, 1993
53f63ba4dSmrg  * -
63f63ba4dSmrg  * Copyright (c) 1983, 1993
73f63ba4dSmrg  *    The Regents of the University of California.  All rights reserved.
861f28255Scgd  *
961f28255Scgd  * Redistribution and use in source and binary forms, with or without
1061f28255Scgd  * modification, are permitted provided that the following conditions
1161f28255Scgd  * are met:
1261f28255Scgd  * 1. Redistributions of source code must retain the above copyright
1361f28255Scgd  *    notice, this list of conditions and the following disclaimer.
1461f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
1561f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
1661f28255Scgd  *    documentation and/or other materials provided with the distribution.
17039cc956Sagc  * 3. Neither the name of the University nor the names of its contributors
1861f28255Scgd  *    may be used to endorse or promote products derived from this software
1961f28255Scgd  *    without specific prior written permission.
2061f28255Scgd  *
2161f28255Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2261f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2361f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2461f28255Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2561f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2661f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2761f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2861f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2961f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3061f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3161f28255Scgd  * SUCH DAMAGE.
323f63ba4dSmrg  * -
333f63ba4dSmrg  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
3461f28255Scgd  *
353f63ba4dSmrg  * Permission to use, copy, modify, and distribute this software for any
363f63ba4dSmrg  * purpose with or without fee is hereby granted, provided that the above
373f63ba4dSmrg  * copyright notice and this permission notice appear in all copies, and that
383f63ba4dSmrg  * the name of Digital Equipment Corporation not be used in advertising or
393f63ba4dSmrg  * publicity pertaining to distribution of the document or software without
403f63ba4dSmrg  * specific, written prior permission.
413f63ba4dSmrg  *
423f63ba4dSmrg  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
433f63ba4dSmrg  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
443f63ba4dSmrg  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
453f63ba4dSmrg  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
463f63ba4dSmrg  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
473f63ba4dSmrg  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
483f63ba4dSmrg  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
493f63ba4dSmrg  * SOFTWARE.
503f63ba4dSmrg  * -
513f63ba4dSmrg  * --Copyright--
5288ae7d9dSchristos  */
5388ae7d9dSchristos 
540d808c59Schristos /*%
553f63ba4dSmrg  *	@(#)inet.h	8.1 (Berkeley) 6/2/93
56*a0abbe8fSchristos  *	Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
5761f28255Scgd  */
5861f28255Scgd 
59d39928a2Sperry #ifndef _ARPA_INET_H_
60d39928a2Sperry #define	_ARPA_INET_H_
6161f28255Scgd 
6261f28255Scgd /* External definitions for functions in inet(3) */
6361f28255Scgd 
64fac4f2f5Sbjh21 #include <sys/ansi.h>
6561f28255Scgd #include <sys/cdefs.h>
66fac4f2f5Sbjh21 #include <sys/featuretest.h>
67fac4f2f5Sbjh21 #include <sys/types.h>
68fac4f2f5Sbjh21 
692277ee22Sbjh21 #include <netinet/in.h>
7061f28255Scgd 
71fac4f2f5Sbjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
72fac4f2f5Sbjh21     defined(_NETBSD_SOURCE)
73ba77dc64Skleink #ifndef socklen_t
74ba77dc64Skleink typedef __socklen_t	socklen_t;
75ba77dc64Skleink #define socklen_t	__socklen_t
76ba77dc64Skleink #endif
77fac4f2f5Sbjh21 #endif /* _POSIX_C_SOURCE >= 200112 || XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
78ba77dc64Skleink 
7961f28255Scgd __BEGIN_DECLS
8019b7469aSperry in_addr_t	 inet_addr(const char *);
8119b7469aSperry in_addr_t	 inet_lnaof(struct in_addr);
8219b7469aSperry struct in_addr	 inet_makeaddr(in_addr_t, in_addr_t);
8319b7469aSperry in_addr_t	 inet_netof(struct in_addr);
8419b7469aSperry in_addr_t	 inet_network(const char *);
8519b7469aSperry char		*inet_ntoa(struct in_addr);
86fac4f2f5Sbjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
87fac4f2f5Sbjh21     defined(_NETBSD_SOURCE)
8819b7469aSperry const char	*inet_ntop(int, const void * __restrict,
8919b7469aSperry 		                char * __restrict, socklen_t);
9019b7469aSperry int		 inet_pton(int, const char * __restrict,
9119b7469aSperry 		                void * __restrict);
92363db7b0Skleink #endif
934be7a2dcSbjh21 #if defined(_NETBSD_SOURCE)
9419b7469aSperry int		 inet_aton(const char *, struct in_addr *);
9519b7469aSperry char *		 inet_neta(u_long, char *, size_t);
9619b7469aSperry char		*inet_net_ntop(int, const void *, int, char *, size_t);
9719b7469aSperry int		 inet_net_pton(int, const char *, void *, size_t);
9819b7469aSperry char		*inet_cidr_ntop(int, const void *, int, char *, size_t);
9919b7469aSperry int		 inet_cidr_pton(int, const char *, void *, int *);
10019b7469aSperry u_int		 inet_nsap_addr(const char *, u_char *, int);
10119b7469aSperry char		*inet_nsap_ntoa(int, const u_char *, char *);
102363db7b0Skleink #endif
10361f28255Scgd __END_DECLS
10461f28255Scgd 
105d39928a2Sperry #endif /* _ARPA_INET_H_ */
106