Elliott Hughes | d0bbfa8 | 2021-04-08 11:58:51 -0700 | [diff] [blame^] | 1 | #pragma once |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 2 | |
| 3 | #include <netdb.h> |
Elliott Hughes | d0bbfa8 | 2021-04-08 11:58:51 -0700 | [diff] [blame^] | 4 | #include <sys/cdefs.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 | |
Elliott Hughes | d0bbfa8 | 2021-04-08 11:58:51 -0700 | [diff] [blame^] | 18 | __BEGIN_DECLS |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 19 | |
Elliott Hughes | d0bbfa8 | 2021-04-08 11:58:51 -0700 | [diff] [blame^] | 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 | }; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 31 | |
Elliott Hughes | d0bbfa8 | 2021-04-08 11:58:51 -0700 | [diff] [blame^] | 32 | struct res_static* __res_get_static(void); |
| 33 | |
| 34 | __END_DECLS |