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

/ppu/include/net/netdb.h

https://github.com/tmandersson/PSL1GHT
C Header | 90 lines | 68 code | 13 blank | 9 comment | 0 complexity | 33ed3308352ef6bc83cff9d30a337c16 MD5 | raw file
  1. #ifndef __NETDB_H__
  2. #define __NETDB_H__
  3. #include <net/socket.h>
  4. #define NETDB_INTERNAL -1
  5. #define NETDB_SUCCESS 0x00
  6. #define HOST_NOT_FOUND 0x01
  7. #define TRY_AGAIN 0x02
  8. #define NO_RECOVERY 0x03
  9. #define NO_DATA 0x04
  10. #define NO_ADDRESS NO_DATA
  11. #define NI_MAXHOST 1025
  12. #define NI_MAXSERV 32
  13. #define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
  14. #define NI_NUMERICSERV 2 /* Don't convert port number to name. */
  15. #define NI_NOFQDN 4 /* Only return nodename portion. */
  16. #define NI_NAMEREQD 8 /* Don't return numeric addresses. */
  17. #define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
  18. #define NI_IDN 32 /* Convert name from IDN format. */
  19. #define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
  20. code points. */
  21. #define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
  22. STD3 rules. */
  23. /* Possible values for `ai_flags' field in `addrinfo' structure. */
  24. #define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
  25. #define AI_CANONNAME 0x0002 /* Request for canonical name. */
  26. #define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
  27. #define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
  28. #define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
  29. #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
  30. returned address type.. */
  31. #define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
  32. in the current locale's character set)
  33. before looking it up. */
  34. #define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
  35. #define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
  36. code points. */
  37. #define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
  38. STD3 rules. */
  39. extern int h_errno;
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. struct hostent
  44. {
  45. char *h_name;
  46. char **h_aliases;
  47. int h_addrtype;
  48. int h_length;
  49. char **h_addr_list;
  50. #define h_addr h_addr_list[0]
  51. };
  52. struct servent
  53. {
  54. char *s_name; /* Official service name. */
  55. char **s_aliases; /* Alias list. */
  56. int s_port; /* Port number. */
  57. char *s_proto; /* Protocol to use. */
  58. };
  59. /* Structure to contain information about address of a service provider. */
  60. struct addrinfo
  61. {
  62. int ai_flags; /* Input flags. */
  63. int ai_family; /* Protocol family for socket. */
  64. int ai_socktype; /* Socket type. */
  65. int ai_protocol; /* Protocol for socket. */
  66. socklen_t ai_addrlen; /* Length of socket address. */
  67. struct sockaddr *ai_addr; /* Socket address for socket. */
  68. char *ai_canonname; /* Canonical name for service location. */
  69. struct addrinfo *ai_next; /* Pointer to next in list. */
  70. };
  71. struct hostent* gethostbyaddr(const char *addr,socklen_t len,int tpye);
  72. struct hostent* gethostbyname(const char *name);
  73. struct servent *getservbyport(int port, const char *proto);
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif