/asylo/platform/posix/include/netdb.h

https://github.com/google/asylo · C Header · 90 lines · 55 code · 12 blank · 23 comment · 0 complexity · 8a15b674401c49da09d38733ec2bc27e MD5 · raw file

  1. /*
  2. *
  3. * Copyright 2017 Asylo authors
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef ASYLO_PLATFORM_POSIX_INCLUDE_NETDB_H_
  19. #define ASYLO_PLATFORM_POSIX_INCLUDE_NETDB_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* No implementation provided. */
  24. const char *gai_strerror(int ecode);
  25. #define _NETDB_H 1
  26. #include <netinet/in.h>
  27. // Values for 'ai_flags' field in 'addrinfo' structure.
  28. #define AI_CANONNAME 0x0002
  29. #define AI_NUMERICHOST 0x0004
  30. #define AI_V4MAPPED 0x0008
  31. #define AI_ADDRCONFIG 0x0010
  32. #define AI_ALL 0x0020
  33. #define AI_PASSIVE 0x0040
  34. #define AI_NUMERICSERV 0x0080
  35. #define AI_IDN 0x0100
  36. #define AI_CANONIDN 0x0200
  37. // Error values for getaddrinfo
  38. #define EAI_BADFLAGS -1 // Invalid value for `ai_flags' field.
  39. #define EAI_NONAME -2 // NAME or SERVICE is unknown.
  40. #define EAI_AGAIN -3 // Temporary failure in name resolution.
  41. #define EAI_FAIL -4 // Non-recoverable failure in name res.
  42. #define EAI_FAMILY -6 // `ai_family' not supported.
  43. #define EAI_SOCKTYPE -7 // `ai_socktype' not supported.
  44. #define EAI_SERVICE -8 // SERVICE not supported for `ai_socktype'.
  45. #define EAI_MEMORY -10 // Memory allocation failure.
  46. #define EAI_SYSTEM -11 // System error returned in `errno'.
  47. #define EAI_OVERFLOW -12 // Argument buffer overflow.
  48. #define EAI_NODATA -5 // No address associated with NAME.
  49. #define EAI_ADDRFAMILY -9 // Address family for NAME not supported.
  50. #define EAI_INPROGRESS -100 // Processing request in progress.
  51. #define EAI_CANCELED -101 // Request canceled.
  52. #define EAI_NOTCANCELED -102 // Request not canceled.
  53. #define EAI_ALLDONE -103 // All requests done.
  54. #define EAI_INTR -104 // Interrupted by a signal.
  55. #define EAI_IDN_ENCODE -105 // IDN encoding failed.
  56. // Description of data base entry for a single host.
  57. struct hostent {
  58. char *h_name; // Official name of host.
  59. char **h_aliases; // Alias list.
  60. int h_addrtype; // Host address type.
  61. int h_length; // Length of address.
  62. char **h_addr_list; // List of addresses from name server.
  63. #define h_addr h_addr_list[0] // Address, for backward compatibility.
  64. };
  65. // Description of data base entry for a single service.
  66. struct servent {
  67. char *s_name; // Official service name.
  68. char **s_aliases; // Alias list.
  69. int s_port; // Port number.
  70. char *s_proto; // Protocol to use.
  71. };
  72. // No implementation provided
  73. extern struct servent *getservbyname(const char *name, const char *proto);
  74. extern struct servent *getservbyport(int port, const char *proto);
  75. #ifdef __cplusplus
  76. } // extern "C"
  77. #endif
  78. #endif // ASYLO_PLATFORM_POSIX_INCLUDE_NETDB_H_