inet.h revision 87158
11539Srgrimes/* 21539Srgrimes * Copyright (c) 1983, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * Redistribution and use in source and binary forms, with or without 61539Srgrimes * modification, are permitted provided that the following conditions 71539Srgrimes * are met: 81539Srgrimes * 1. Redistributions of source code must retain the above copyright 91539Srgrimes * notice, this list of conditions and the following disclaimer. 101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111539Srgrimes * notice, this list of conditions and the following disclaimer in the 121539Srgrimes * documentation and/or other materials provided with the distribution. 131539Srgrimes * 3. All advertising materials mentioning features or use of this software 141539Srgrimes * must display the following acknowledgement: 151539Srgrimes * This product includes software developed by the University of 161539Srgrimes * California, Berkeley and its contributors. 171539Srgrimes * 4. Neither the name of the University nor the names of its contributors 181539Srgrimes * may be used to endorse or promote products derived from this software 191539Srgrimes * without specific prior written permission. 201539Srgrimes * 211539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311539Srgrimes * SUCH DAMAGE. 3221056Speter * - 3321056Speter * Portions Copyright (c) 1993 by Digital Equipment Corporation. 341539Srgrimes * 3521056Speter * Permission to use, copy, modify, and distribute this software for any 3621056Speter * purpose with or without fee is hereby granted, provided that the above 3721056Speter * copyright notice and this permission notice appear in all copies, and that 3821056Speter * the name of Digital Equipment Corporation not be used in advertising or 3921056Speter * publicity pertaining to distribution of the document or software without 4021056Speter * specific, written prior permission. 4121056Speter * 4221056Speter * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 4321056Speter * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 4421056Speter * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 4521056Speter * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 4621056Speter * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 4721056Speter * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 4821056Speter * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 4921056Speter * SOFTWARE. 5036888Speter */ 5136888Speter 5236888Speter/* 531539Srgrimes * @(#)inet.h 8.1 (Berkeley) 6/2/93 5436888Speter * From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $ 5550473Speter * $FreeBSD: head/include/arpa/inet.h 87158 2001-12-01 03:43:01Z mike $ 561539Srgrimes */ 571539Srgrimes 582163Spaul#ifndef _ARPA_INET_H_ 592163Spaul#define _ARPA_INET_H_ 601539Srgrimes 6116352Swollman/* External definitions for functions in inet(3), addr2ascii(3) */ 621539Srgrimes 631539Srgrimes#include <sys/cdefs.h> 6487158Smike#include <machine/ansi.h> 651539Srgrimes 6687158Smike#ifndef _IN_ADDR_T_DECLARED_ 6787158Smiketypedef __uint32_t in_addr_t; 6887158Smike#define _IN_ADDR_T_DECLARED_ 6987158Smike#endif 7016352Swollman 7187158Smike#ifndef _IN_PORT_T_DECLARED_ 7287158Smiketypedef _uint16_t in_port_t; 7387158Smike#define _IN_PORT_T_DECLARED_ 7487158Smike#endif 7587158Smike 7687158Smike#ifndef _POSIX_SOURCE 7787158Smike#ifdef _BSD_SIZE_T_ 7887158Smiketypedef _BSD_SIZE_T_ size_t; 7987158Smike#undef _BSD_SIZE_T_ 8087158Smike#endif 8187158Smike#endif /* !_POSIX_SOURCE */ 8287158Smike 8387158Smike/* 8487158Smike * XXX socklen_t is used by a POSIX.1-200x interface, but not required by 8587158Smike * POSIX.1-200x. 8687158Smike */ 8787158Smike#ifdef _BSD_SOCKLEN_T_ 8887158Smiketypedef _BSD_SOCKLEN_T_ socklen_t; 8987158Smike#undef _BSD_SOCKLEN_T_ 9087158Smike#endif 9187158Smike 9287158Smike#ifndef _STRUCT_IN_ADDR_DECLARED 9387158Smikestruct in_addr { 9487158Smike in_addr_t s_addr; 9587158Smike}; 9687158Smike#define _STRUCT_IN_ADDR_DECLARED 9787158Smike#endif 9887158Smike 9936888Speter/* XXX all new diversions!! argh!! */ 10087158Smike#ifndef _POSIX_SOURCE 10136888Speter#define inet_addr __inet_addr 10236888Speter#define inet_aton __inet_aton 10336888Speter#define inet_lnaof __inet_lnaof 10436888Speter#define inet_makeaddr __inet_makeaddr 10536888Speter#define inet_neta __inet_neta 10636888Speter#define inet_netof __inet_netof 10736888Speter#define inet_network __inet_network 10836888Speter#define inet_net_ntop __inet_net_ntop 10936888Speter#define inet_net_pton __inet_net_pton 11036888Speter#define inet_ntoa __inet_ntoa 11136888Speter#define inet_pton __inet_pton 11236888Speter#define inet_ntop __inet_ntop 11336888Speter#define inet_nsap_addr __inet_nsap_addr 11436888Speter#define inet_nsap_ntoa __inet_nsap_ntoa 11587158Smike#endif /* !_POSIX_SOURCE */ 11636888Speter 1171539Srgrimes__BEGIN_DECLS 11887158Smikein_addr_t inet_addr __P((const char *)); 11987158Smikechar *inet_ntoa __P((struct in_addr)); 12087158Smikeconst char *inet_ntop __P((int, const void *, char *, socklen_t)); 12187158Smikeint inet_pton __P((int, const char *, void *)); 12287158Smike/* 12387158Smike * XXX missing: ntohl() family. 12487158Smike */ 12587158Smike 12687158Smike/* Nonstandard functions. */ 12787158Smike#ifndef _POSIX_SOURCE 12816352Swollmanint ascii2addr __P((int, const char *, void *)); 12916352Swollmanchar *addr2ascii __P((int, const void *, int, char *)); 1301539Srgrimesint inet_aton __P((const char *, struct in_addr *)); 13174700Sumein_addr_t inet_lnaof __P((struct in_addr)); 13274700Sumestruct in_addr inet_makeaddr __P((in_addr_t, in_addr_t)); 13374700Sumechar * inet_neta __P((in_addr_t, char *, size_t)); 13474700Sumein_addr_t inet_netof __P((struct in_addr)); 13574700Sumein_addr_t inet_network __P((const char *)); 13621056Speterchar *inet_net_ntop __P((int, const void *, int, char *, size_t)); 13721056Speterint inet_net_pton __P((int, const char *, void *, size_t)); 13887158Smikeunsigned inet_nsap_addr __P((const char *, unsigned char *, int)); 13987158Smikechar *inet_nsap_ntoa __P((int, const unsigned char *, char *)); 14087158Smike#endif /* !_POSIX_SOURCE */ 1411539Srgrimes__END_DECLS 1421539Srgrimes 14387158Smike#endif /* !_ARPA_INET_H_ */ 144