blob: 83a435a7c932f8c9bb14f06872843c013ed68baf [file] [log] [blame]
Elliott Hughesd0bbfa82021-04-08 11:58:51 -07001#pragma once
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002
3#include <netdb.h>
Elliott Hughesd0bbfa82021-04-08 11:58:51 -07004#include <sys/cdefs.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08005
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
Elliott Hughesd0bbfa82021-04-08 11:58:51 -070018__BEGIN_DECLS
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080019
Elliott Hughesd0bbfa82021-04-08 11:58:51 -070020struct 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};
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031
Elliott Hughesd0bbfa82021-04-08 11:58:51 -070032struct res_static* __res_get_static(void);
33
34__END_DECLS