inet.h 4.0 KB

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