PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/native_client_sdk/src/libraries/third_party/newlib-extras/arpa/inet.h

https://github.com/j4ckfrost/android_external_chromium_org
C Header | 130 lines | 57 code | 17 blank | 56 comment | 0 complexity | 56e5d4e637a43ba8cece1499c55ff836 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, MPL-2.0-no-copyleft-exception
  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. #ifndef _ARPA_INET_H_
  52. #define _ARPA_INET_H_
  53. /* External definitions for functions in inet(3), addr2ascii(3) */
  54. #include <sys/cdefs.h>
  55. #include <sys/types.h>
  56. #include <machine/ansi.h>
  57. /* Required for byteorder(3) functions. */
  58. #include <machine/endian.h>
  59. #define INET_ADDRSTRLEN 16
  60. #define INET6_ADDRSTRLEN 46
  61. #ifndef _UINT16_T_DECLARED
  62. typedef __uint16_t uint16_t;
  63. #define _UINT16_T_DECLARED
  64. #endif
  65. #ifndef _UINT32_T_DECLARED
  66. typedef __uint32_t uint32_t;
  67. #define _UINT32_T_DECLARED
  68. #endif
  69. #ifndef _IN_ADDR_T_DECLARED
  70. typedef uint32_t in_addr_t;
  71. #define _IN_ADDR_T_DECLARED
  72. #endif
  73. #ifndef _IN_PORT_T_DECLARED
  74. typedef uint16_t in_port_t;
  75. #define _IN_PORT_T_DECLARED
  76. #endif
  77. /*
  78. * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
  79. * POSIX.1-2001.
  80. */
  81. #ifndef __socklen_t_defined
  82. typedef unsigned int socklen_t;
  83. #define __socklen_t_defined 1
  84. #endif
  85. #ifdef _BSD_SOCKLEN_T_
  86. typedef _BSD_SOCKLEN_T_ socklen_t;
  87. #undef _BSD_SOCKLEN_T_
  88. #endif
  89. #ifndef _STRUCT_IN_ADDR_DECLARED
  90. struct in_addr {
  91. in_addr_t s_addr;
  92. };
  93. #define _STRUCT_IN_ADDR_DECLARED
  94. #endif
  95. __BEGIN_DECLS
  96. in_addr_t inet_addr(const char *);
  97. char *inet_ntoa(struct in_addr);
  98. const char *inet_ntop(int, const void *, char *, socklen_t);
  99. int inet_pton(int, const char *, void *);
  100. int ascii2addr(int, const char *, void *);
  101. char *addr2ascii(int, const void *, int, char *);
  102. int inet_aton(const char *, struct in_addr *);
  103. in_addr_t inet_lnaof(struct in_addr);
  104. struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
  105. char * inet_neta(in_addr_t, char *, size_t);
  106. in_addr_t inet_netof(struct in_addr);
  107. in_addr_t inet_network(const char *);
  108. char *inet_net_ntop(int, const void *, int, char *, size_t);
  109. int inet_net_pton(int, const char *, void *, size_t);
  110. unsigned inet_nsap_addr(const char *, unsigned char *, int);
  111. char *inet_nsap_ntoa(int, const unsigned char *, char *);
  112. __END_DECLS
  113. #endif /* !_ARPA_INET_H_ */