refactor getaddrinfo and add support for most remaining features
[musl] / src / network / lookup.h
1 #ifndef LOOKUP_H
2 #define LOOKUP_H
3
4 #include <stdint.h>
5
6 struct address {
7         int family;
8         unsigned scopeid;
9         uint8_t addr[16];
10 };
11
12 struct service {
13         uint16_t port;
14         char proto;
15 };
16
17 /* The limit of 48 results is a non-sharp bound on the number of addresses
18  * that can fit in one 512-byte DNS packet full of v4 results and a second
19  * packet full of v6 results. Due to headers, the actual limit is lower. */
20 #define MAXADDRS 48
21 #define MAXSERVS 2
22
23 int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int flags);
24 int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, int flags);
25
26 #endif