1#ifndef LOOKUP_H 2#define LOOKUP_H 3 4#include <stdint.h> 5#include <stddef.h> 6 7struct address { 8 int family; 9 unsigned scopeid; 10 uint8_t addr[16]; 11 int sortkey; 12}; 13 14struct service { 15 uint16_t port; 16 unsigned char proto, socktype; 17}; 18 19#define MAXNS 3 20 21struct resolvconf { 22 struct address ns[MAXNS]; 23 unsigned nns, attempts, ndots; 24 unsigned timeout; 25}; 26 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 29 * packet full of v6 results. Due to headers, the actual limit is lower. */ 30#define MAXADDRS 48 31#define MAXSERVS 2 32 33int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int socktype, int flags); 34int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, int flags); 35int __lookup_ipliteral(struct address buf[static 1], const char *name, int family); 36 37int __get_resolv_conf(struct resolvconf *, char *, size_t); 38 39#endif 40