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