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