• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  #pragma once
2  
3  #include <netdb.h>
4  #include <sys/cdefs.h>
5  
6  /* this structure contains all the variables that were declared
7   * 'static' in the original NetBSD resolver code.
8   *
9   * this caused vast amounts of crashes and memory corruptions
10   * when the resolver was being used by multiple threads.
11   *
12   * (note: the OpenBSD/FreeBSD resolver has similar 'issues')
13   */
14  
15  #define	MAXALIASES	35
16  #define	MAXADDRS	35
17  
18  __BEGIN_DECLS
19  
20  struct res_static {
21    char* h_addr_ptrs[MAXADDRS + 1];
22    char* host_aliases[MAXALIASES];
23    char hostbuf[8 * 1024];
24    u_int32_t host_addr[16 / sizeof(u_int32_t)]; /* IPv4 or IPv6 */
25    FILE* hostf;
26    int stayopen;
27    const char* servent_ptr;
28    struct servent servent;
29    struct hostent host;
30  };
31  
32  struct res_static* __res_get_static(void);
33  
34  __END_DECLS
35