Line data Source code
1 : #ifndef HEADER_fd_src_waltz_resolv_fd_lookup_h 2 : #define HEADER_fd_src_waltz_resolv_fd_lookup_h 3 : 4 : #include <stdint.h> 5 : #include <stddef.h> 6 : #include <features.h> 7 : #include <netinet/in.h> 8 : #include "fd_netdb.h" 9 : 10 : struct aibuf { 11 : fd_addrinfo_t ai; 12 : union sa { 13 : struct sockaddr_in sin; 14 : struct sockaddr_in6 sin6; 15 : } sa; 16 : short slot, ref; 17 : }; 18 : 19 : struct address { 20 : int family; 21 : uint scopeid; 22 : uchar addr[16]; 23 : int sortkey; 24 : }; 25 : 26 0 : #define MAXNS 3 27 : 28 : struct fd_resolvconf { 29 : struct address ns[MAXNS]; 30 : uint nns, attempts, ndots; 31 : uint timeout; 32 : }; 33 : 34 : typedef struct fd_resolvconf fd_resolvconf_t; 35 : 36 : /* The limit of 48 results is a non-sharp bound on the number of addresses 37 : * that can fit in one 512-byte DNS packet full of v4 results and a second 38 : * packet full of v6 results. Due to headers, the actual limit is lower. */ 39 0 : #define MAXADDRS 48 40 : #define MAXSERVS 2 41 : 42 : __attribute__((__visibility__("hidden"))) int 43 : fd_lookup_name( struct address buf[ static MAXADDRS ], 44 : char canon[ static 256 ], 45 : const char * name, 46 : int family, 47 : int flags ); 48 : 49 : __attribute__((__visibility__("hidden"))) int 50 : fd_lookup_ipliteral( struct address buf[ static 1 ], 51 : const char * name, 52 : int family ); 53 : 54 : __attribute__((__visibility__("hidden"))) int 55 : fd_get_resolv_conf( fd_resolvconf_t * ); 56 : 57 : __attribute__((__visibility__("hidden"))) int 58 : fd_res_msend_rc( int, 59 : uchar const * const *, 60 : int const *, 61 : uchar * const *, 62 : int *, 63 : int, 64 : fd_resolvconf_t const * ); 65 : 66 : __attribute__((__visibility__("hidden"))) int 67 : fd_dns_parse( uchar const *, 68 : int, 69 : int (*)( void *, 70 : int, 71 : void const *, 72 : int, 73 : void const *, 74 : int ), 75 : void * ); 76 : 77 : /* Firedancer extension: pre-opened file descriptors */ 78 : 79 : extern FD_TL int fd_etc_hosts_fd; 80 : extern FD_TL int fd_etc_resolv_conf_fd; 81 : 82 : #endif /* HEADER_fd_src_waltz_resolv_fd_lookup_h */