Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. #ifndef _NETDB_H
  2. #define _NETDB_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <sys/types.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. /* Absolute file name for network data base files.  */
  10. #define _PATH_HEQUIV            "/etc/hosts.equiv"
  11. #define _PATH_HOSTS             "/etc/hosts"
  12. #define _PATH_NETWORKS          "/etc/networks"
  13. #define _PATH_NSSWITCH_CONF     "/etc/nsswitch.conf"
  14. #define _PATH_PROTOCOLS         "/etc/protocols"
  15. #define _PATH_SERVICES          "/etc/services"
  16.  
  17. /* Description of data base entry for a single service.  */
  18. struct servent {
  19.   char *s_name;                 /* Official service name.  */
  20.   char **s_aliases;             /* Alias list.  */
  21.   int s_port;                   /* Port number.  */
  22.   char *s_proto;                /* Protocol to use.  */
  23. };
  24.  
  25. extern void endservent (void) ;
  26. extern void setservent(int stayopen) ;
  27.  
  28. extern int getservent_r(struct servent *res, char *buf, size_t buflen,
  29.                          struct servent **res_sig) ;
  30. extern int getservbyname_r(const char* name,const char* proto,
  31.                            struct servent *res, char *buf, size_t buflen,
  32.                            struct servent **res_sig) ;
  33. extern int getservbyport_r(int port,const char* proto,
  34.                            struct servent *res, char *buf, size_t buflen,
  35.                            struct servent **res_sig) ;
  36.  
  37. extern struct servent *getservent(void) ;
  38. extern struct servent *getservbyname (const char *__name,
  39.                                       const char *__proto) ;
  40. extern struct servent *getservbyport (int __port, const char *__proto)
  41.      ;
  42.  
  43. struct hostent {
  44.   char *h_name;                 /* Official name of host.  */
  45.   char **h_aliases;             /* Alias list.  */
  46.   int h_addrtype;               /* Host address type.  */
  47.   socklen_t h_length;           /* Length of address.  */
  48.   char **h_addr_list;           /* List of addresses from name server.  */
  49. #define h_addr  h_addr_list[0]  /* Address, for backward compatibility.  */
  50. };
  51.  
  52. extern void endhostent (void) ;
  53. extern struct hostent *gethostent (void) ;
  54. extern struct hostent *gethostent_r (char* buf,int len) ;
  55. extern struct hostent *gethostbyaddr (const void *__addr, socklen_t __len,
  56.                                       int __type) ;
  57. extern struct hostent *gethostbyname (const char *__name) ;
  58. extern struct hostent *gethostbyname2 (const char *__name, int __af) ;
  59.  
  60. /* this glibc "invention" is so ugly, I'm going to throw up any minute
  61.  * now */
  62. extern int gethostbyname_r(const char* NAME, struct hostent* RESULT_BUF,char* BUF,
  63.                            size_t BUFLEN, struct hostent** RESULT,
  64.                            int* H_ERRNOP) ;
  65.  
  66. #define HOST_NOT_FOUND 1
  67. #define TRY_AGAIN 2
  68. #define NO_RECOVERY 3
  69. #define NO_ADDRESS 4
  70. #define NO_DATA 5
  71.  
  72. extern int gethostbyaddr_r(const char* addr, size_t length, int format,
  73.                     struct hostent* result, char *buf, size_t buflen,
  74.                     struct hostent **RESULT, int *h_errnop) ;
  75.  
  76. int gethostbyname2_r(const char* name, int AF, struct hostent* result,
  77.                     char *buf, size_t buflen,
  78.                     struct hostent **RESULT, int *h_errnop) ;
  79.  
  80. struct protoent {
  81.   char    *p_name;        /* official protocol name */
  82.   char    **p_aliases;    /* alias list */
  83.   int     p_proto;        /* protocol number */
  84. };
  85.  
  86. struct protoent *getprotoent(void) ;
  87. struct protoent *getprotobyname(const char *name) ;
  88. struct protoent *getprotobynumber(int proto) ;
  89. void setprotoent(int stayopen) ;
  90. void endprotoent(void) ;
  91.  
  92. int getprotoent_r(struct protoent *res, char *buf, size_t buflen,
  93.                   struct protoent **res_sig) ;
  94. int getprotobyname_r(const char* name,
  95.                      struct protoent *res, char *buf, size_t buflen,
  96.                      struct protoent **res_sig) ;
  97. int getprotobynumber_r(int proto,
  98.                       struct protoent *res, char *buf, size_t buflen,
  99.                       struct protoent **res_sig) ;
  100.  
  101.  
  102. void sethostent(int stayopen) ;
  103.  
  104. /* dummy */
  105. extern int h_errno;
  106.  
  107. struct netent {
  108.   char    *n_name;          /* official network name */
  109.   char    **n_aliases;      /* alias list */
  110.   int     n_addrtype;       /* net address type */
  111.   unsigned long int n_net;  /* network number */
  112. };
  113.  
  114. struct netent *getnetbyaddr(unsigned long net, int type) ;
  115. void endnetent(void) ;
  116. void setnetent(int stayopen) ;
  117. struct netent *getnetbyname(const char *name) ;
  118. struct netent *getnetent(void) ;
  119.  
  120. extern const char *hstrerror (int err_num) ;
  121. void herror(const char *s) ;
  122.  
  123. #define NI_MAXHOST 1025
  124. #define NI_MAXSERV 32
  125.  
  126. __END_DECLS
  127.  
  128. #endif
  129.