Back to index

glibc  2.9
inet.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _ARPA_INET_H
00020 #define       _ARPA_INET_H  1
00021 
00022 #include <features.h>
00023 #include <netinet/in.h>            /* To define `struct in_addr'.  */
00024 
00025 /* Type for length arguments in socket calls.  */
00026 #ifndef __socklen_t_defined
00027 typedef __socklen_t socklen_t;
00028 # define __socklen_t_defined
00029 #endif
00030 
00031 __BEGIN_DECLS
00032 
00033 /* Convert Internet host address from numbers-and-dots notation in CP
00034    into binary data in network byte order.  */
00035 extern in_addr_t inet_addr (__const char *__cp) __THROW;
00036 
00037 /* Return the local host address part of the Internet address in IN.  */
00038 extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
00039 
00040 /* Make Internet host address in network byte order by combining the
00041    network number NET with the local address HOST.  */
00042 extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
00043      __THROW;
00044 
00045 /* Return network number part of the Internet address IN.  */
00046 extern in_addr_t inet_netof (struct in_addr __in) __THROW;
00047 
00048 /* Extract the network number in network byte order from the address
00049    in numbers-and-dots natation starting at CP.  */
00050 extern in_addr_t inet_network (__const char *__cp) __THROW;
00051 
00052 /* Convert Internet number in IN to ASCII representation.  The return value
00053    is a pointer to an internal array containing the string.  */
00054 extern char *inet_ntoa (struct in_addr __in) __THROW;
00055 
00056 /* Convert from presentation format of an Internet number in buffer
00057    starting at CP to the binary network format and store result for
00058    interface type AF in buffer starting at BUF.  */
00059 extern int inet_pton (int __af, __const char *__restrict __cp,
00060                     void *__restrict __buf) __THROW;
00061 
00062 /* Convert a Internet address in binary network format for interface
00063    type AF in buffer starting at CP to presentation form and place
00064    result in buffer of length LEN astarting at BUF.  */
00065 extern __const char *inet_ntop (int __af, __const void *__restrict __cp,
00066                             char *__restrict __buf, socklen_t __len)
00067      __THROW;
00068 
00069 
00070 /* The following functions are not part of XNS 5.2.  */
00071 #ifdef __USE_MISC
00072 /* Convert Internet host address from numbers-and-dots notation in CP
00073    into binary data and store the result in the structure INP.  */
00074 extern int inet_aton (__const char *__cp, struct in_addr *__inp) __THROW;
00075 
00076 /* Format a network number NET into presentation format and place result
00077    in buffer starting at BUF with length of LEN bytes.  */
00078 extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
00079 
00080 /* Convert network number for interface type AF in buffer starting at
00081    CP to presentation format.  The result will specifiy BITS bits of
00082    the number.  */
00083 extern char *inet_net_ntop (int __af, __const void *__cp, int __bits,
00084                          char *__buf, size_t __len) __THROW;
00085 
00086 /* Convert network number for interface type AF from presentation in
00087    buffer starting at CP to network format and store result int
00088    buffer starting at BUF of size LEN.  */
00089 extern int inet_net_pton (int __af, __const char *__cp,
00090                        void *__buf, size_t __len) __THROW;
00091 
00092 /* Convert ASCII representation in hexadecimal form of the Internet
00093    address to binary form and place result in buffer of length LEN
00094    starting at BUF.  */
00095 extern unsigned int inet_nsap_addr (__const char *__cp,
00096                                 unsigned char *__buf, int __len) __THROW;
00097 
00098 /* Convert internet address in binary form in LEN bytes starting at CP
00099    a presentation form and place result in BUF.  */
00100 extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp,
00101                           char *__buf) __THROW;
00102 #endif
00103 
00104 __END_DECLS
00105 
00106 #endif /* arpa/inet.h */