12b15cb3dSCy Schubert /* 22b15cb3dSCy Schubert * ntp_intres.h - client interface to blocking-worker name resolution. 32b15cb3dSCy Schubert */ 42b15cb3dSCy Schubert #ifndef NTP_INTRES_H 52b15cb3dSCy Schubert #define NTP_INTRES_H 62b15cb3dSCy Schubert 72b15cb3dSCy Schubert #include <ntp_worker.h> 82b15cb3dSCy Schubert 92b15cb3dSCy Schubert #ifdef WORKER 102b15cb3dSCy Schubert #define INITIAL_DNS_RETRY 2 /* seconds between queries */ 112b15cb3dSCy Schubert 12*f391d6bcSXin LI /* flags for extended addrinfo version */ 13*f391d6bcSXin LI #define GAIR_F_IGNDNSERR 0x0001 /* ignore DNS errors */ 14*f391d6bcSXin LI 152b15cb3dSCy Schubert /* 162b15cb3dSCy Schubert * you call getaddrinfo_sometime(name, service, &hints, retry, callback_func, context); 172b15cb3dSCy Schubert * later (*callback_func)(rescode, gai_errno, context, name, service, hints, ai_result) is called. 182b15cb3dSCy Schubert */ 192b15cb3dSCy Schubert typedef void (*gai_sometime_callback) 202b15cb3dSCy Schubert (int, int, void *, const char *, const char *, 212b15cb3dSCy Schubert const struct addrinfo *, const struct addrinfo *); 222b15cb3dSCy Schubert extern int getaddrinfo_sometime(const char *, const char *, 232b15cb3dSCy Schubert const struct addrinfo *, int, 242b15cb3dSCy Schubert gai_sometime_callback, void *); 25*f391d6bcSXin LI extern int getaddrinfo_sometime_ex(const char *, const char *, 26*f391d6bcSXin LI const struct addrinfo *, int, 27*f391d6bcSXin LI gai_sometime_callback, void *, u_int); 282b15cb3dSCy Schubert /* 292b15cb3dSCy Schubert * In gai_sometime_callback routines, the resulting addrinfo list is 302b15cb3dSCy Schubert * only available until the callback returns. To hold on to the list 312b15cb3dSCy Schubert * of addresses after the callback returns, use copy_addrinfo_list(): 322b15cb3dSCy Schubert * 332b15cb3dSCy Schubert * struct addrinfo *copy_addrinfo_list(const struct addrinfo *); 342b15cb3dSCy Schubert */ 352b15cb3dSCy Schubert 362b15cb3dSCy Schubert 372b15cb3dSCy Schubert /* 382b15cb3dSCy Schubert * you call getnameinfo_sometime(sockaddr, namelen, servlen, flags, callback_func, context); 392b15cb3dSCy Schubert * later (*callback_func)(rescode, gni_errno, sockaddr, flags, name, service, context) is called. 402b15cb3dSCy Schubert */ 412b15cb3dSCy Schubert typedef void (*gni_sometime_callback) 422b15cb3dSCy Schubert (int, int, sockaddr_u *, int, const char *, 432b15cb3dSCy Schubert const char *, void *); 442b15cb3dSCy Schubert extern int getnameinfo_sometime(sockaddr_u *, size_t, size_t, int, 452b15cb3dSCy Schubert gni_sometime_callback, void *); 462b15cb3dSCy Schubert #endif /* WORKER */ 472b15cb3dSCy Schubert 482b15cb3dSCy Schubert /* intres_timeout_req() is provided by the client, ntpd or sntp. */ 492b15cb3dSCy Schubert extern void intres_timeout_req(u_int); 502b15cb3dSCy Schubert 512b15cb3dSCy Schubert #endif /* NTP_INTRES_H */ 52