1121468Ssimokawa/* 2121468Ssimokawa * ++Copyright++ 1983, 1993 3121468Ssimokawa * - 4121468Ssimokawa * Copyright (c) 1983, 1993 5121468Ssimokawa * The Regents of the University of California. All rights reserved. 6121468Ssimokawa * 7121468Ssimokawa * Redistribution and use in source and binary forms, with or without 8121468Ssimokawa * modification, are permitted provided that the following conditions 9121468Ssimokawa * are met: 10121468Ssimokawa * 1. Redistributions of source code must retain the above copyright 11121468Ssimokawa * notice, this list of conditions and the following disclaimer. 12121468Ssimokawa * 2. Redistributions in binary form must reproduce the above copyright 13121468Ssimokawa * notice, this list of conditions and the following disclaimer in the 14121468Ssimokawa * documentation and/or other materials provided with the distribution. 15121468Ssimokawa * 3. Neither the name of the University nor the names of its contributors 16121468Ssimokawa * may be used to endorse or promote products derived from this software 17121468Ssimokawa * without specific prior written permission. 18121468Ssimokawa * 19121468Ssimokawa * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20121468Ssimokawa * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21121468Ssimokawa * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22121468Ssimokawa * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23121468Ssimokawa * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24121468Ssimokawa * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25121468Ssimokawa * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26121468Ssimokawa * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27121468Ssimokawa * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28121468Ssimokawa * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29121468Ssimokawa * SUCH DAMAGE. 30121468Ssimokawa * - 31121468Ssimokawa * Portions Copyright (c) 1993 by Digital Equipment Corporation. 32121468Ssimokawa * 33130420Sru * Permission to use, copy, modify, and distribute this software for any 34130420Sru * purpose with or without fee is hereby granted, provided that the above 35121468Ssimokawa * copyright notice and this permission notice appear in all copies, and that 36121468Ssimokawa * the name of Digital Equipment Corporation not be used in advertising or 37121468Ssimokawa * publicity pertaining to distribution of the document or software without 38170775Ssimokawa * specific, written prior permission. 39121468Ssimokawa * 40121468Ssimokawa * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 41121468Ssimokawa * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 42121468Ssimokawa * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 43121468Ssimokawa * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 44121468Ssimokawa * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 45121468Ssimokawa * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 46121468Ssimokawa * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 47121468Ssimokawa * SOFTWARE. 48121468Ssimokawa * - 49121468Ssimokawa * --Copyright-- 50121468Ssimokawa */ 51121468Ssimokawa 52121468Ssimokawa/*% 53121468Ssimokawa * @(#)inet.h 8.1 (Berkeley) 6/2/93 54121468Ssimokawa * $Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $ 55121468Ssimokawa * $FreeBSD$ 56121468Ssimokawa */ 57121468Ssimokawa 58121468Ssimokawa#ifndef _ARPA_INET_H_ 59121468Ssimokawa#define _ARPA_INET_H_ 60130420Sru 61121468Ssimokawa/* External definitions for functions in inet(3). */ 62121468Ssimokawa 63121468Ssimokawa#include <sys/cdefs.h> 64121468Ssimokawa#include <sys/_types.h> 65130420Sru 66130420Sru/* Required for byteorder(3) functions. */ 67121468Ssimokawa#include <machine/endian.h> 68121468Ssimokawa 69121468Ssimokawa#define INET_ADDRSTRLEN 16 70121468Ssimokawa#define INET6_ADDRSTRLEN 46 71130420Sru 72121468Ssimokawa#ifndef _UINT16_T_DECLARED 73170422Ssimokawatypedef __uint16_t uint16_t; 74170422Ssimokawa#define _UINT16_T_DECLARED 75121468Ssimokawa#endif 76121468Ssimokawa 77121468Ssimokawa#ifndef _UINT32_T_DECLARED 78130420Srutypedef __uint32_t uint32_t; 79121468Ssimokawa#define _UINT32_T_DECLARED 80130420Sru#endif 81130420Sru 82130420Sru#ifndef _IN_ADDR_T_DECLARED 83130420Srutypedef uint32_t in_addr_t; 84121468Ssimokawa#define _IN_ADDR_T_DECLARED 85121468Ssimokawa#endif 86130420Sru 87130420Sru#ifndef _IN_PORT_T_DECLARED 88130420Srutypedef uint16_t in_port_t; 89130420Sru#define _IN_PORT_T_DECLARED 90130420Sru#endif 91130420Sru 92130420Sru#if __BSD_VISIBLE 93121468Ssimokawa#ifndef _SIZE_T_DECLARED 94121468Ssimokawatypedef __size_t size_t; 95121468Ssimokawa#define _SIZE_T_DECLARED 96130420Sru#endif 97130420Sru#endif 98130420Sru 99121468Ssimokawa/* 100121468Ssimokawa * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by 101121468Ssimokawa * POSIX.1-2001. 102130420Sru */ 103121468Ssimokawa#ifndef _SOCKLEN_T_DECLARED 104121468Ssimokawatypedef __socklen_t socklen_t; 105121468Ssimokawa#define _SOCKLEN_T_DECLARED 106121468Ssimokawa#endif 107121468Ssimokawa 108170422Ssimokawa#ifndef _STRUCT_IN_ADDR_DECLARED 109170422Ssimokawastruct in_addr { 110170422Ssimokawa in_addr_t s_addr; 111170775Ssimokawa}; 112170775Ssimokawa#define _STRUCT_IN_ADDR_DECLARED 113170775Ssimokawa#endif 114170422Ssimokawa 115170422Ssimokawa/* XXX all new diversions!! argh!! */ 116170422Ssimokawa#if __BSD_VISIBLE 117170422Ssimokawa#define inet_addr __inet_addr 118170775Ssimokawa#define inet_aton __inet_aton 119170775Ssimokawa#define inet_lnaof __inet_lnaof 120170422Ssimokawa#define inet_makeaddr __inet_makeaddr 121170422Ssimokawa#define inet_neta __inet_neta 122170422Ssimokawa#define inet_netof __inet_netof 123170422Ssimokawa#define inet_network __inet_network 124170422Ssimokawa#define inet_net_ntop __inet_net_ntop 125170422Ssimokawa#define inet_net_pton __inet_net_pton 126170422Ssimokawa#define inet_cidr_ntop __inet_cidr_ntop 127130420Sru#define inet_cidr_pton __inet_cidr_pton 128121468Ssimokawa#define inet_ntoa __inet_ntoa 129130420Sru#define inet_ntoa_r __inet_ntoa_r 130130420Sru#define inet_pton __inet_pton 131130420Sru#define inet_ntop __inet_ntop 132130420Sru#define inet_nsap_addr __inet_nsap_addr 133130420Sru#define inet_nsap_ntoa __inet_nsap_ntoa 134121468Ssimokawa#endif /* __BSD_VISIBLE */ 135121468Ssimokawa 136121468Ssimokawa__BEGIN_DECLS 137130420Sru#ifndef _BYTEORDER_PROTOTYPED 138130420Sru#define _BYTEORDER_PROTOTYPED 139130420Sruuint32_t htonl(uint32_t); 140130420Sruuint16_t htons(uint16_t); 141121468Ssimokawauint32_t ntohl(uint32_t); 142130420Sruuint16_t ntohs(uint16_t); 143121468Ssimokawa#endif 144130420Sru 145130420Sruin_addr_t inet_addr(const char *); 146130420Sru/*const*/ char *inet_ntoa(struct in_addr); 147130420Sruconst char *inet_ntop(int, const void * __restrict, char * __restrict, 148121468Ssimokawa socklen_t); 149130420Sruint inet_pton(int, const char * __restrict, void * __restrict); 150121468Ssimokawa 151130420Sru#if __BSD_VISIBLE 152130420Sruint inet_aton(const char *, struct in_addr *); 153130420Sruin_addr_t inet_lnaof(struct in_addr); 154130420Srustruct in_addr inet_makeaddr(in_addr_t, in_addr_t); 155121468Ssimokawachar * inet_neta(in_addr_t, char *, size_t); 156130420Sruin_addr_t inet_netof(struct in_addr); 157130420Sruin_addr_t inet_network(const char *); 158130420Sruchar *inet_net_ntop(int, const void *, int, char *, size_t); 159121468Ssimokawaint inet_net_pton(int, const char *, void *, size_t); 160121468Ssimokawachar *inet_ntoa_r(struct in_addr, char *buf, socklen_t size); 161170775Ssimokawachar *inet_cidr_ntop(int, const void *, int, char *, size_t); 162170775Ssimokawaint inet_cidr_pton(int, const char *, void *, int *); 163170775Ssimokawaunsigned inet_nsap_addr(const char *, unsigned char *, int); 164121468Ssimokawachar *inet_nsap_ntoa(int, const unsigned char *, char *); 165130420Sru#endif /* __BSD_VISIBLE */ 166130420Sru__END_DECLS 167121468Ssimokawa 168130420Sru#ifndef _BYTEORDER_FUNC_DEFINED 169130420Sru#define _BYTEORDER_FUNC_DEFINED 170121468Ssimokawa#define htonl(x) __htonl(x) 171130420Sru#define htons(x) __htons(x) 172130420Sru#define ntohl(x) __ntohl(x) 173130420Sru#define ntohs(x) __ntohs(x) 174130420Sru#endif 175121468Ssimokawa 176121468Ssimokawa#endif /* !_ARPA_INET_H_ */ 177121468Ssimokawa 178130420Sru/*! \file */ 179130420Sru