OLD | NEW |
1 #ifndef LOOKUP_H | 1 #ifndef LOOKUP_H |
2 #define LOOKUP_H | 2 #define LOOKUP_H |
3 | 3 |
4 #include <stdint.h> | 4 #include <stdint.h> |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 struct address { | 7 struct address { |
8 » int family; | 8 int family; |
9 » unsigned scopeid; | 9 unsigned scopeid; |
10 » uint8_t addr[16]; | 10 uint8_t addr[16]; |
11 » int sortkey; | 11 int sortkey; |
12 }; | 12 }; |
13 | 13 |
14 struct service { | 14 struct service { |
15 » uint16_t port; | 15 uint16_t port; |
16 » unsigned char proto, socktype; | 16 unsigned char proto, socktype; |
17 }; | 17 }; |
18 | 18 |
19 #define MAXNS 3 | 19 #define MAXNS 3 |
20 | 20 |
21 struct resolvconf { | 21 struct resolvconf { |
22 » struct address ns[MAXNS]; | 22 struct address ns[MAXNS]; |
23 » unsigned nns, attempts, ndots; | 23 unsigned nns, attempts, ndots; |
24 » unsigned timeout; | 24 unsigned timeout; |
25 }; | 25 }; |
26 | 26 |
27 /* The limit of 48 results is a non-sharp bound on the number of addresses | 27 /* The limit of 48 results is a non-sharp bound on the number of addresses |
28 * that can fit in one 512-byte DNS packet full of v4 results and a second | 28 * that can fit in one 512-byte DNS packet full of v4 results and a second |
29 * packet full of v6 results. Due to headers, the actual limit is lower. */ | 29 * packet full of v6 results. Due to headers, the actual limit is lower. */ |
30 #define MAXADDRS 48 | 30 #define MAXADDRS 48 |
31 #define MAXSERVS 2 | 31 #define MAXSERVS 2 |
32 | 32 |
33 int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int pro
to, int socktype, int flags); | 33 int __lookup_serv(struct service buf[static MAXSERVS], |
34 int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], c
onst char *name, int family, int flags); | 34 const char* name, |
35 int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
y); | 35 int proto, |
| 36 int socktype, |
| 37 int flags); |
| 38 int __lookup_name(struct address buf[static MAXADDRS], |
| 39 char canon[static 256], |
| 40 const char* name, |
| 41 int family, |
| 42 int flags); |
| 43 int __lookup_ipliteral(struct address buf[static 1], |
| 44 const char* name, |
| 45 int family); |
36 | 46 |
37 int __get_resolv_conf(struct resolvconf *, char *, size_t); | 47 int __get_resolv_conf(struct resolvconf*, char*, size_t); |
38 | 48 |
39 #endif | 49 #endif |
OLD | NEW |