1*53ee8cc1Swenshuai.xi /* Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc. 2*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 3*53ee8cc1Swenshuai.xi 4*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 5*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 6*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 7*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 8*53ee8cc1Swenshuai.xi 9*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 10*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 11*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 13*53ee8cc1Swenshuai.xi 14*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 15*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 16*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 18*53ee8cc1Swenshuai.xi 19*53ee8cc1Swenshuai.xi #ifndef _ARPA_INET_H 20*53ee8cc1Swenshuai.xi #define _ARPA_INET_H 1 21*53ee8cc1Swenshuai.xi 22*53ee8cc1Swenshuai.xi #include <features.h> 23*53ee8cc1Swenshuai.xi #include <netinet/in.h> /* To define `struct in_addr'. */ 24*53ee8cc1Swenshuai.xi 25*53ee8cc1Swenshuai.xi /* Type for length arguments in socket calls. */ 26*53ee8cc1Swenshuai.xi #ifndef __socklen_t_defined 27*53ee8cc1Swenshuai.xi typedef __socklen_t socklen_t; 28*53ee8cc1Swenshuai.xi # define __socklen_t_defined 29*53ee8cc1Swenshuai.xi #endif 30*53ee8cc1Swenshuai.xi 31*53ee8cc1Swenshuai.xi __BEGIN_DECLS 32*53ee8cc1Swenshuai.xi 33*53ee8cc1Swenshuai.xi /* Convert Internet host address from numbers-and-dots notation in CP 34*53ee8cc1Swenshuai.xi into binary data in network byte order. */ 35*53ee8cc1Swenshuai.xi extern in_addr_t inet_addr (__const char *__cp) __THROW; 36*53ee8cc1Swenshuai.xi 37*53ee8cc1Swenshuai.xi /* Return the local host address part of the Internet address in IN. */ 38*53ee8cc1Swenshuai.xi extern in_addr_t inet_lnaof (struct in_addr __in) __THROW; 39*53ee8cc1Swenshuai.xi 40*53ee8cc1Swenshuai.xi /* Make Internet host address in network byte order by combining the 41*53ee8cc1Swenshuai.xi network number NET with the local address HOST. */ 42*53ee8cc1Swenshuai.xi extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host) 43*53ee8cc1Swenshuai.xi __THROW; 44*53ee8cc1Swenshuai.xi 45*53ee8cc1Swenshuai.xi /* Return network number part of the Internet address IN. */ 46*53ee8cc1Swenshuai.xi extern in_addr_t inet_netof (struct in_addr __in) __THROW; 47*53ee8cc1Swenshuai.xi 48*53ee8cc1Swenshuai.xi /* Extract the network number in network byte order from the address 49*53ee8cc1Swenshuai.xi in numbers-and-dots natation starting at CP. */ 50*53ee8cc1Swenshuai.xi extern in_addr_t inet_network (__const char *__cp) __THROW; 51*53ee8cc1Swenshuai.xi 52*53ee8cc1Swenshuai.xi /* Convert Internet number in IN to ASCII representation. The return value 53*53ee8cc1Swenshuai.xi is a pointer to an internal array containing the string. */ 54*53ee8cc1Swenshuai.xi extern char *inet_ntoa (struct in_addr __in) __THROW; 55*53ee8cc1Swenshuai.xi 56*53ee8cc1Swenshuai.xi /* Convert from presentation format of an Internet number in buffer 57*53ee8cc1Swenshuai.xi starting at CP to the binary network format and store result for 58*53ee8cc1Swenshuai.xi interface type AF in buffer starting at BUF. */ 59*53ee8cc1Swenshuai.xi extern int inet_pton (int __af, __const char *__restrict __cp, 60*53ee8cc1Swenshuai.xi void *__restrict __buf) __THROW; 61*53ee8cc1Swenshuai.xi 62*53ee8cc1Swenshuai.xi /* Convert a Internet address in binary network format for interface 63*53ee8cc1Swenshuai.xi type AF in buffer starting at CP to presentation form and place 64*53ee8cc1Swenshuai.xi result in buffer of length LEN astarting at BUF. */ 65*53ee8cc1Swenshuai.xi extern __const char *inet_ntop (int __af, __const void *__restrict __cp, 66*53ee8cc1Swenshuai.xi char *__restrict __buf, socklen_t __len) 67*53ee8cc1Swenshuai.xi __THROW; 68*53ee8cc1Swenshuai.xi 69*53ee8cc1Swenshuai.xi 70*53ee8cc1Swenshuai.xi /* The following functions are not part of XNS 5.2. */ 71*53ee8cc1Swenshuai.xi #ifdef __USE_MISC 72*53ee8cc1Swenshuai.xi /* Convert Internet host address from numbers-and-dots notation in CP 73*53ee8cc1Swenshuai.xi into binary data and store the result in the structure INP. */ 74*53ee8cc1Swenshuai.xi extern int inet_aton (__const char *__cp, struct in_addr *__inp) __THROW; 75*53ee8cc1Swenshuai.xi 76*53ee8cc1Swenshuai.xi /* Format a network number NET into presentation format and place result 77*53ee8cc1Swenshuai.xi in buffer starting at BUF with length of LEN bytes. */ 78*53ee8cc1Swenshuai.xi extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; 79*53ee8cc1Swenshuai.xi 80*53ee8cc1Swenshuai.xi /* Convert network number for interface type AF in buffer starting at 81*53ee8cc1Swenshuai.xi CP to presentation format. The result will specifiy BITS bits of 82*53ee8cc1Swenshuai.xi the number. */ 83*53ee8cc1Swenshuai.xi extern char *inet_net_ntop (int __af, __const void *__cp, int __bits, 84*53ee8cc1Swenshuai.xi char *__buf, size_t __len) __THROW; 85*53ee8cc1Swenshuai.xi 86*53ee8cc1Swenshuai.xi /* Convert network number for interface type AF from presentation in 87*53ee8cc1Swenshuai.xi buffer starting at CP to network format and store result int 88*53ee8cc1Swenshuai.xi buffer starting at BUF of size LEN. */ 89*53ee8cc1Swenshuai.xi extern int inet_net_pton (int __af, __const char *__cp, 90*53ee8cc1Swenshuai.xi void *__buf, size_t __len) __THROW; 91*53ee8cc1Swenshuai.xi 92*53ee8cc1Swenshuai.xi /* Convert ASCII representation in hexadecimal form of the Internet 93*53ee8cc1Swenshuai.xi address to binary form and place result in buffer of length LEN 94*53ee8cc1Swenshuai.xi starting at BUF. */ 95*53ee8cc1Swenshuai.xi extern unsigned int inet_nsap_addr (__const char *__cp, 96*53ee8cc1Swenshuai.xi unsigned char *__buf, int __len) __THROW; 97*53ee8cc1Swenshuai.xi 98*53ee8cc1Swenshuai.xi /* Convert internet address in binary form in LEN bytes starting at CP 99*53ee8cc1Swenshuai.xi a presentation form and place result in BUF. */ 100*53ee8cc1Swenshuai.xi extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp, 101*53ee8cc1Swenshuai.xi char *__buf) __THROW; 102*53ee8cc1Swenshuai.xi #endif 103*53ee8cc1Swenshuai.xi 104*53ee8cc1Swenshuai.xi __END_DECLS 105*53ee8cc1Swenshuai.xi 106*53ee8cc1Swenshuai.xi #endif /* arpa/inet.h */ 107