1df6ad731Slogwang /* 2df6ad731Slogwang * ++Copyright++ 1983, 1993 3df6ad731Slogwang * - 4df6ad731Slogwang * Copyright (c) 1983, 1993 5df6ad731Slogwang * The Regents of the University of California. All rights reserved. 6df6ad731Slogwang * 7df6ad731Slogwang * Redistribution and use in source and binary forms, with or without 8df6ad731Slogwang * modification, are permitted provided that the following conditions 9df6ad731Slogwang * are met: 10df6ad731Slogwang * 1. Redistributions of source code must retain the above copyright 11df6ad731Slogwang * notice, this list of conditions and the following disclaimer. 12df6ad731Slogwang * 2. Redistributions in binary form must reproduce the above copyright 13df6ad731Slogwang * notice, this list of conditions and the following disclaimer in the 14df6ad731Slogwang * documentation and/or other materials provided with the distribution. 15df6ad731Slogwang * 3. Neither the name of the University nor the names of its contributors 16df6ad731Slogwang * may be used to endorse or promote products derived from this software 17df6ad731Slogwang * without specific prior written permission. 18df6ad731Slogwang * 19df6ad731Slogwang * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20df6ad731Slogwang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21df6ad731Slogwang * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22df6ad731Slogwang * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23df6ad731Slogwang * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24df6ad731Slogwang * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25df6ad731Slogwang * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26df6ad731Slogwang * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27df6ad731Slogwang * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28df6ad731Slogwang * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29df6ad731Slogwang * SUCH DAMAGE. 30df6ad731Slogwang * - 31df6ad731Slogwang * Portions Copyright (c) 1993 by Digital Equipment Corporation. 32df6ad731Slogwang * 33df6ad731Slogwang * Permission to use, copy, modify, and distribute this software for any 34df6ad731Slogwang * purpose with or without fee is hereby granted, provided that the above 35df6ad731Slogwang * copyright notice and this permission notice appear in all copies, and that 36df6ad731Slogwang * the name of Digital Equipment Corporation not be used in advertising or 37df6ad731Slogwang * publicity pertaining to distribution of the document or software without 38df6ad731Slogwang * specific, written prior permission. 39df6ad731Slogwang * 40df6ad731Slogwang * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 41df6ad731Slogwang * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 42df6ad731Slogwang * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 43df6ad731Slogwang * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 44df6ad731Slogwang * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 45df6ad731Slogwang * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 46df6ad731Slogwang * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 47df6ad731Slogwang * SOFTWARE. 48df6ad731Slogwang * - 49df6ad731Slogwang * --Copyright-- 50df6ad731Slogwang */ 51df6ad731Slogwang 52df6ad731Slogwang /*% 53df6ad731Slogwang * @(#)inet.h 8.1 (Berkeley) 6/2/93 54df6ad731Slogwang * $Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $ 55df6ad731Slogwang * $FreeBSD$ 56df6ad731Slogwang */ 57df6ad731Slogwang 58df6ad731Slogwang #ifndef _COMPAT_ARPA_INET_H_ 59df6ad731Slogwang #define _COMPAT_ARPA_INET_H_ 60df6ad731Slogwang 61df6ad731Slogwang /* External definitions for functions in inet(3). */ 62df6ad731Slogwang 63df6ad731Slogwang #include <sys/cdefs.h> 64df6ad731Slogwang #include <sys/_types.h> 65df6ad731Slogwang 66df6ad731Slogwang #define INET_ADDRSTRLEN 16 67df6ad731Slogwang #define INET6_ADDRSTRLEN 46 68df6ad731Slogwang 69df6ad731Slogwang #ifndef _UINT16_T_DECLARED 70df6ad731Slogwang typedef __uint16_t uint16_t; 71df6ad731Slogwang #define _UINT16_T_DECLARED 72df6ad731Slogwang #endif 73df6ad731Slogwang 74df6ad731Slogwang #ifndef _UINT32_T_DECLARED 75df6ad731Slogwang typedef __uint32_t uint32_t; 76df6ad731Slogwang #define _UINT32_T_DECLARED 77df6ad731Slogwang #endif 78df6ad731Slogwang 79df6ad731Slogwang #ifndef _IN_ADDR_T_DECLARED 80df6ad731Slogwang typedef uint32_t in_addr_t; 81df6ad731Slogwang #define _IN_ADDR_T_DECLARED 82df6ad731Slogwang #endif 83df6ad731Slogwang 84df6ad731Slogwang #ifndef _IN_PORT_T_DECLARED 85df6ad731Slogwang typedef uint16_t in_port_t; 86df6ad731Slogwang #define _IN_PORT_T_DECLARED 87df6ad731Slogwang #endif 88df6ad731Slogwang 89df6ad731Slogwang #if __BSD_VISIBLE 90df6ad731Slogwang #ifndef _SIZE_T_DECLARED 91df6ad731Slogwang typedef __size_t size_t; 92df6ad731Slogwang #define _SIZE_T_DECLARED 93df6ad731Slogwang #endif 94df6ad731Slogwang #endif 95df6ad731Slogwang 96df6ad731Slogwang /* 97df6ad731Slogwang * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by 98df6ad731Slogwang * POSIX.1-2001. 99df6ad731Slogwang */ 100df6ad731Slogwang #ifndef _SOCKLEN_T_DECLARED 101df6ad731Slogwang typedef __socklen_t socklen_t; 102df6ad731Slogwang #define _SOCKLEN_T_DECLARED 103df6ad731Slogwang #endif 104df6ad731Slogwang 105df6ad731Slogwang #ifndef _STRUCT_IN_ADDR_DECLARED 106df6ad731Slogwang struct in_addr { 107df6ad731Slogwang in_addr_t s_addr; 108df6ad731Slogwang }; 109df6ad731Slogwang #define _STRUCT_IN_ADDR_DECLARED 110df6ad731Slogwang #endif 111df6ad731Slogwang 112df6ad731Slogwang #ifndef _BYTEORDER_PROTOTYPED 113df6ad731Slogwang #define _BYTEORDER_PROTOTYPED 114df6ad731Slogwang extern uint32_t htonl(uint32_t); 115df6ad731Slogwang extern uint16_t htons(uint16_t); 116df6ad731Slogwang extern uint32_t ntohl(uint32_t); 117df6ad731Slogwang extern uint16_t ntohs(uint16_t); 118df6ad731Slogwang #endif 119df6ad731Slogwang 120df6ad731Slogwang in_addr_t inet_addr(const char *); 121df6ad731Slogwang /*const*/ char *inet_ntoa(struct in_addr); 122df6ad731Slogwang const char *inet_ntop(int, const void * __restrict, char * __restrict, 123df6ad731Slogwang socklen_t); 124df6ad731Slogwang int inet_pton(int, const char * __restrict, void * __restrict); 125df6ad731Slogwang 126df6ad731Slogwang int inet_aton(const char *, struct in_addr *); 127df6ad731Slogwang 128*144c6bcdSlogwang in_addr_t inet_lnaof(struct in_addr); 129*144c6bcdSlogwang struct in_addr inet_makeaddr(in_addr_t, in_addr_t); 130*144c6bcdSlogwang char * inet_neta(in_addr_t, char *, size_t); 131*144c6bcdSlogwang in_addr_t inet_netof(struct in_addr); 132*144c6bcdSlogwang in_addr_t inet_network(const char *); 133*144c6bcdSlogwang 134df6ad731Slogwang #endif /* !_ARPA_INET_H_ */ 135df6ad731Slogwang 136df6ad731Slogwang /*! \file */ 137