xref: /freebsd/contrib/ntp/include/ntp_intres.h (revision d8a0fe102c0cfdfcd5b818f850eff09d8536c9bc)
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 /* flags for extended addrinfo version */
13 #define GAIR_F_IGNDNSERR	0x0001	/* ignore DNS errors */
14 
15 /*
16  * you call getaddrinfo_sometime(name, service, &hints, retry, callback_func, context);
17  * later (*callback_func)(rescode, gai_errno, context, name, service, hints, ai_result) is called.
18  */
19 typedef void	(*gai_sometime_callback)
20 		    (int, int, void *, const char *, const char *,
21 		     const struct addrinfo *, const struct addrinfo *);
22 extern int	getaddrinfo_sometime(const char *, const char *,
23 				     const struct addrinfo *, int,
24 				     gai_sometime_callback, void *);
25 extern int	getaddrinfo_sometime_ex(const char *, const char *,
26 				     const struct addrinfo *, int,
27 				     gai_sometime_callback, void *, u_int);
28 /*
29  * In gai_sometime_callback routines, the resulting addrinfo list is
30  * only available until the callback returns.  To hold on to the list
31  * of addresses after the callback returns, use copy_addrinfo_list():
32  *
33  * struct addrinfo *copy_addrinfo_list(const struct addrinfo *);
34  */
35 
36 
37 /*
38  * you call getnameinfo_sometime(sockaddr, namelen, servlen, flags, callback_func, context);
39  * later (*callback_func)(rescode, gni_errno, sockaddr, flags, name, service, context) is called.
40  */
41 typedef void	(*gni_sometime_callback)
42 		    (int, int, sockaddr_u *, int, const char *,
43 		     const char *, void *);
44 extern int getnameinfo_sometime(sockaddr_u *, size_t, size_t, int,
45 				gni_sometime_callback, void *);
46 #endif	/* WORKER */
47 
48 /* intres_timeout_req() is provided by the client, ntpd or sntp. */
49 extern void intres_timeout_req(u_int);
50 
51 #endif	/* NTP_INTRES_H */
52