diff options
Diffstat (limited to 'src/network/lookup.h')
-rw-r--r-- | src/network/lookup.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/network/lookup.h b/src/network/lookup.h new file mode 100644 index 00000000..82c969ec --- /dev/null +++ b/src/network/lookup.h @@ -0,0 +1,26 @@ +#ifndef LOOKUP_H +#define LOOKUP_H + +#include <stdint.h> + +struct address { + int family; + unsigned scopeid; + uint8_t addr[16]; +}; + +struct service { + uint16_t port; + char proto; +}; + +/* The limit of 48 results is a non-sharp bound on the number of addresses + * that can fit in one 512-byte DNS packet full of v4 results and a second + * packet full of v6 results. Due to headers, the actual limit is lower. */ +#define MAXADDRS 48 +#define MAXSERVS 2 + +int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int flags); +int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, int flags); + +#endif |