Home | History | Annotate | Line # | Download | only in include
      1  1.6  christos /*	$NetBSD: ntp_intres.h,v 1.6 2020/05/25 20:47:19 christos Exp $	*/
      2  1.1    kardel 
      3  1.2  christos /*
      4  1.2  christos  * ntp_intres.h - client interface to blocking-worker name resolution.
      5  1.2  christos  */
      6  1.1    kardel #ifndef NTP_INTRES_H
      7  1.1    kardel #define NTP_INTRES_H
      8  1.1    kardel 
      9  1.2  christos #include <ntp_worker.h>
     10  1.2  christos 
     11  1.2  christos #ifdef WORKER
     12  1.2  christos #define	INITIAL_DNS_RETRY	2	/* seconds between queries */
     13  1.2  christos 
     14  1.5  christos /* flags for extended addrinfo version */
     15  1.5  christos #define GAIR_F_IGNDNSERR	0x0001	/* ignore DNS errors */
     16  1.5  christos 
     17  1.2  christos /*
     18  1.2  christos  * you call getaddrinfo_sometime(name, service, &hints, retry, callback_func, context);
     19  1.2  christos  * later (*callback_func)(rescode, gai_errno, context, name, service, hints, ai_result) is called.
     20  1.2  christos  */
     21  1.2  christos typedef void	(*gai_sometime_callback)
     22  1.2  christos 		    (int, int, void *, const char *, const char *,
     23  1.2  christos 		     const struct addrinfo *, const struct addrinfo *);
     24  1.2  christos extern int	getaddrinfo_sometime(const char *, const char *,
     25  1.2  christos 				     const struct addrinfo *, int,
     26  1.2  christos 				     gai_sometime_callback, void *);
     27  1.5  christos extern int	getaddrinfo_sometime_ex(const char *, const char *,
     28  1.5  christos 				     const struct addrinfo *, int,
     29  1.5  christos 				     gai_sometime_callback, void *, u_int);
     30  1.1    kardel /*
     31  1.2  christos  * In gai_sometime_callback routines, the resulting addrinfo list is
     32  1.2  christos  * only available until the callback returns.  To hold on to the list
     33  1.2  christos  * of addresses after the callback returns, use copy_addrinfo_list():
     34  1.2  christos  *
     35  1.2  christos  * struct addrinfo *copy_addrinfo_list(const struct addrinfo *);
     36  1.1    kardel  */
     37  1.1    kardel 
     38  1.2  christos 
     39  1.2  christos /*
     40  1.2  christos  * you call getnameinfo_sometime(sockaddr, namelen, servlen, flags, callback_func, context);
     41  1.2  christos  * later (*callback_func)(rescode, gni_errno, sockaddr, flags, name, service, context) is called.
     42  1.2  christos  */
     43  1.2  christos typedef void	(*gni_sometime_callback)
     44  1.2  christos 		    (int, int, sockaddr_u *, int, const char *,
     45  1.2  christos 		     const char *, void *);
     46  1.2  christos extern int getnameinfo_sometime(sockaddr_u *, size_t, size_t, int,
     47  1.2  christos 				gni_sometime_callback, void *);
     48  1.2  christos #endif	/* WORKER */
     49  1.2  christos 
     50  1.2  christos /* intres_timeout_req() is provided by the client, ntpd or sntp. */
     51  1.2  christos extern void intres_timeout_req(u_int);
     52  1.2  christos 
     53  1.2  christos #endif	/* NTP_INTRES_H */
     54