1331722Seadler/*
2156960Sume * ++Copyright++ 1983, 1993
3156960Sume * -
41539Srgrimes * Copyright (c) 1983, 1993
5156960Sume *    The Regents of the University of California.  All rights reserved.
6156960Sume *
71539Srgrimes * Redistribution and use in source and binary forms, with or without
81539Srgrimes * modification, are permitted provided that the following conditions
91539Srgrimes * are met:
101539Srgrimes * 1. Redistributions of source code must retain the above copyright
111539Srgrimes *    notice, this list of conditions and the following disclaimer.
121539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
131539Srgrimes *    notice, this list of conditions and the following disclaimer in the
141539Srgrimes *    documentation and/or other materials provided with the distribution.
15203965Simp * 3. Neither the name of the University nor the names of its contributors
161539Srgrimes *    may be used to endorse or promote products derived from this software
171539Srgrimes *    without specific prior written permission.
18156960Sume *
191539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
201539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221539Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
231539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
251539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
271539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
281539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
291539Srgrimes * SUCH DAMAGE.
3021056Speter * -
3121056Speter * Portions Copyright (c) 1993 by Digital Equipment Corporation.
32156960Sume *
3321056Speter * Permission to use, copy, modify, and distribute this software for any
3421056Speter * purpose with or without fee is hereby granted, provided that the above
3521056Speter * copyright notice and this permission notice appear in all copies, and that
3621056Speter * the name of Digital Equipment Corporation not be used in advertising or
3721056Speter * publicity pertaining to distribution of the document or software without
3821056Speter * specific, written prior permission.
3921056Speter *
4021056Speter * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
4121056Speter * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
4221056Speter * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
4321056Speter * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
4421056Speter * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
4521056Speter * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
4621056Speter * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4721056Speter * SOFTWARE.
48156960Sume * -
49156960Sume * --Copyright--
50156960Sume */
51156960Sume
52170244Sume/*%
531539Srgrimes *	@(#)inet.h	8.1 (Berkeley) 6/2/93
54269867Sume *	$Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $
5550473Speter * $FreeBSD$
561539Srgrimes */
571539Srgrimes
582163Spaul#ifndef _ARPA_INET_H_
592163Spaul#define	_ARPA_INET_H_
601539Srgrimes
61209715Smaxim/* External definitions for functions in inet(3). */
621539Srgrimes
631539Srgrimes#include <sys/cdefs.h>
64102227Smike#include <sys/_types.h>
651539Srgrimes
6690868Smike/* Required for byteorder(3) functions. */
6790868Smike#include <machine/endian.h>
6890868Smike
6991984Smike#define	INET_ADDRSTRLEN		16
7091984Smike#define	INET6_ADDRSTRLEN	46
7191984Smike
7293514Smike#ifndef _UINT16_T_DECLARED
7393514Smiketypedef	__uint16_t	uint16_t;
7493514Smike#define	_UINT16_T_DECLARED
7587158Smike#endif
7616352Swollman
7793514Smike#ifndef _UINT32_T_DECLARED
7893514Smiketypedef	__uint32_t	uint32_t;
7993514Smike#define	_UINT32_T_DECLARED
8087158Smike#endif
8187158Smike
82101995Smike#ifndef _IN_ADDR_T_DECLARED
8393514Smiketypedef	uint32_t	in_addr_t;
8493514Smike#define	_IN_ADDR_T_DECLARED
8593514Smike#endif
8693514Smike
87101995Smike#ifndef _IN_PORT_T_DECLARED
8893514Smiketypedef	uint16_t	in_port_t;
8993514Smike#define	_IN_PORT_T_DECLARED
9093514Smike#endif
9193514Smike
92101995Smike#if __BSD_VISIBLE
93102227Smike#ifndef _SIZE_T_DECLARED
94102227Smiketypedef	__size_t	size_t;
95102227Smike#define	_SIZE_T_DECLARED
9687158Smike#endif
97101995Smike#endif
9887158Smike
9987158Smike/*
10091984Smike * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
10191984Smike * POSIX.1-2001.
10287158Smike */
103102227Smike#ifndef _SOCKLEN_T_DECLARED
104102227Smiketypedef	__socklen_t	socklen_t;
105102227Smike#define	_SOCKLEN_T_DECLARED
10687158Smike#endif
10787158Smike
10887158Smike#ifndef _STRUCT_IN_ADDR_DECLARED
10987158Smikestruct in_addr {
11087158Smike	in_addr_t s_addr;
11187158Smike};
11287158Smike#define	_STRUCT_IN_ADDR_DECLARED
11387158Smike#endif
11487158Smike
11536888Speter/* XXX all new diversions!! argh!! */
11694353Smike#if __BSD_VISIBLE
117156960Sume#define	inet_addr		__inet_addr
118156960Sume#define	inet_aton		__inet_aton
119156960Sume#define	inet_lnaof		__inet_lnaof
120156960Sume#define	inet_makeaddr		__inet_makeaddr
121156960Sume#define	inet_neta		__inet_neta
122156960Sume#define	inet_netof		__inet_netof
123156960Sume#define	inet_network		__inet_network
124156960Sume#define	inet_net_ntop		__inet_net_ntop
125156960Sume#define	inet_net_pton		__inet_net_pton
126156960Sume#define	inet_cidr_ntop		__inet_cidr_ntop
127156960Sume#define	inet_cidr_pton		__inet_cidr_pton
128156960Sume#define	inet_ntoa		__inet_ntoa
129170548Sdelphij#define	inet_ntoa_r		__inet_ntoa_r
130156960Sume#define	inet_pton		__inet_pton
131156960Sume#define	inet_ntop		__inet_ntop
132156960Sume#define	inet_nsap_addr		__inet_nsap_addr
133156960Sume#define	inet_nsap_ntoa		__inet_nsap_ntoa
13494353Smike#endif /* __BSD_VISIBLE */
13536888Speter
13691959Smike__BEGIN_DECLS
13791959Smike#ifndef _BYTEORDER_PROTOTYPED
13891959Smike#define	_BYTEORDER_PROTOTYPED
13993514Smikeuint32_t	 htonl(uint32_t);
14093514Smikeuint16_t	 htons(uint16_t);
14193514Smikeuint32_t	 ntohl(uint32_t);
14293514Smikeuint16_t	 ntohs(uint16_t);
14390868Smike#endif
14490868Smike
14593032Simpin_addr_t	 inet_addr(const char *);
146156960Sume/*const*/ char	*inet_ntoa(struct in_addr);
147101995Smikeconst char	*inet_ntop(int, const void * __restrict, char * __restrict,
148101995Smike		    socklen_t);
149101995Smikeint		 inet_pton(int, const char * __restrict, void * __restrict);
15087158Smike
15194353Smike#if __BSD_VISIBLE
15293032Simpint		 inet_aton(const char *, struct in_addr *);
15393032Simpin_addr_t	 inet_lnaof(struct in_addr);
15493032Simpstruct in_addr	 inet_makeaddr(in_addr_t, in_addr_t);
15593032Simpchar *		 inet_neta(in_addr_t, char *, size_t);
15693032Simpin_addr_t	 inet_netof(struct in_addr);
15793032Simpin_addr_t	 inet_network(const char *);
15893032Simpchar		*inet_net_ntop(int, const void *, int, char *, size_t);
15993032Simpint		 inet_net_pton(int, const char *, void *, size_t);
160189806Sdaschar		*inet_ntoa_r(struct in_addr, char *buf, socklen_t size);
161156960Sumechar		*inet_cidr_ntop(int, const void *, int, char *, size_t);
162156960Sumeint		 inet_cidr_pton(int, const char *, void *, int *);
16393032Simpunsigned	 inet_nsap_addr(const char *, unsigned char *, int);
16493032Simpchar		*inet_nsap_ntoa(int, const unsigned char *, char *);
16594353Smike#endif /* __BSD_VISIBLE */
1661539Srgrimes__END_DECLS
1671539Srgrimes
16891959Smike#ifndef _BYTEORDER_FUNC_DEFINED
16991959Smike#define	_BYTEORDER_FUNC_DEFINED
17091959Smike#define	htonl(x)	__htonl(x)
17191959Smike#define	htons(x)	__htons(x)
17291959Smike#define	ntohl(x)	__ntohl(x)
17391959Smike#define	ntohs(x)	__ntohs(x)
17491959Smike#endif
17591959Smike
17687158Smike#endif /* !_ARPA_INET_H_ */
177170244Sume
178170244Sume/*! \file */
179