gai.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Mar 8, 2000 by Hajimu UMEMOTO <ume@mahoroba.org>
  3. *
  4. * This module is besed on ssh-1.2.27-IPv6-1.5 written by
  5. * KIKUCHI Takahiro <kick@kyoto.wide.ad.jp>
  6. */
  7. /*
  8. * Copyright (c) 1998-2016 Carnegie Mellon University. All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. *
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in
  19. * the documentation and/or other materials provided with the
  20. * distribution.
  21. *
  22. * 3. The name "Carnegie Mellon University" must not be used to
  23. * endorse or promote products derived from this software without
  24. * prior written permission. For permission or any other legal
  25. * details, please contact
  26. * Carnegie Mellon University
  27. * Center for Technology Transfer and Enterprise Creation
  28. * 4615 Forbes Avenue
  29. * Suite 302
  30. * Pittsburgh, PA 15213
  31. * (412) 268-7393, fax: (412) 268-7395
  32. * innovation@andrew.cmu.edu
  33. *
  34. * 4. Redistributions of any form whatsoever must retain the following
  35. * acknowledgment:
  36. * "This product includes software developed by Computing Services
  37. * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  38. *
  39. * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
  40. * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  41. * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
  42. * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  43. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  44. * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  45. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  46. */
  47. /*
  48. * fake library for ssh
  49. *
  50. * This file is included in getaddrinfo.c and getnameinfo.c.
  51. * See getaddrinfo.c and getnameinfo.c.
  52. */
  53. #ifndef _GAI_H_
  54. #define _GAI_H_
  55. #ifndef NI_MAXHOST
  56. #define NI_MAXHOST 1025
  57. #endif
  58. #ifndef NI_MAXSERV
  59. #define NI_MAXSERV 32
  60. #endif
  61. /* for old netdb.h */
  62. #ifndef EAI_NODATA
  63. #define EAI_NODATA 1
  64. #define EAI_MEMORY 2
  65. #define EAI_FAMILY 5 /* ai_family not supported */
  66. #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
  67. #endif
  68. /* dummy value for old netdb.h */
  69. #ifndef AI_PASSIVE
  70. #define AI_PASSIVE 1
  71. #define AI_CANONNAME 2
  72. struct addrinfo {
  73. int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
  74. int ai_family; /* PF_xxx */
  75. int ai_socktype; /* SOCK_xxx */
  76. int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
  77. size_t ai_addrlen; /* length of ai_addr */
  78. char *ai_canonname; /* canonical name for hostname */
  79. struct sockaddr *ai_addr; /* binary address */
  80. struct addrinfo *ai_next; /* next structure in linked list */
  81. };
  82. #endif
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86. #ifndef HAVE_GETNAMEINFO
  87. int getnameinfo(const struct sockaddr *, socklen_t, char *,
  88. size_t, char *, size_t, int);
  89. #endif
  90. #ifndef HAVE_GETADDRINFO
  91. int getaddrinfo(const char *, const char *,
  92. const struct addrinfo *, struct addrinfo **);
  93. void freeaddrinfo(struct addrinfo *);
  94. char *gai_strerror(int);
  95. #endif
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif