xref: /freebsd/contrib/ntp/include/ntp_intres.h (revision 907b59d76938e654f0d040a888e8dfca3de1e222)
1 /*
2  * ntp_intres.h - client interface to blocking-worker name resolution.
3  */
4 #ifndef NTP_INTRES_H
5 #define NTP_INTRES_H
6 
7 #include <ntp_worker.h>
8 
9 #ifdef WORKER
10 #define	INITIAL_DNS_RETRY	2	/* seconds between queries */
11 
12 /*
13  * you call getaddrinfo_sometime(name, service, &hints, retry, callback_func, context);
14  * later (*callback_func)(rescode, gai_errno, context, name, service, hints, ai_result) is called.
15  */
16 typedef void	(*gai_sometime_callback)
17 		    (int, int, void *, const char *, const char *,
18 		     const struct addrinfo *, const struct addrinfo *);
19 extern int	getaddrinfo_sometime(const char *, const char *,
20 				     const struct addrinfo *, int,
21 				     gai_sometime_callback, void *);
22 /*
23  * In gai_sometime_callback routines, the resulting addrinfo list is
24  * only available until the callback returns.  To hold on to the list
25  * of addresses after the callback returns, use copy_addrinfo_list():
26  *
27  * struct addrinfo *copy_addrinfo_list(const struct addrinfo *);
28  */
29 
30 
31 /*
32  * you call getnameinfo_sometime(sockaddr, namelen, servlen, flags, callback_func, context);
33  * later (*callback_func)(rescode, gni_errno, sockaddr, flags, name, service, context) is called.
34  */
35 typedef void	(*gni_sometime_callback)
36 		    (int, int, sockaddr_u *, int, const char *,
37 		     const char *, void *);
38 extern int getnameinfo_sometime(sockaddr_u *, size_t, size_t, int,
39 				gni_sometime_callback, void *);
40 #endif	/* WORKER */
41 
42 /* intres_timeout_req() is provided by the client, ntpd or sntp. */
43 extern void intres_timeout_req(u_int);
44 
45 #endif	/* NTP_INTRES_H */
46