xref: /freebsd/contrib/ntp/ntpq/libntpq_subs.c (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1 /*****************************************************************************
2  *
3  *  libntpq_subs.c
4  *
5  *  This is the second part of the wrapper library for ntpq, the NTP query utility.
6  *  This library reuses the sourcecode from ntpq and exports a number
7  *  of useful functions in a library that can be linked against applications
8  *  that need to query the status of a running ntpd. The whole
9  *  communcation is based on mode 6 packets.
10  *
11  *  This source file exports the (private) functions from ntpq-subs.c
12  *
13  ****************************************************************************/
14 
15 
16 #include "ntpq-subs.c"
17 #include "libntpq.h"
18 
19 
20 int ntpq_dogetassoc(void)
21 {
22 
23 	if (dogetassoc(NULL))
24 		return numassoc;
25 	else
26 		return 0;
27 }
28 
29 /* the following functions are required internally by a number of libntpq functions
30  * and since they are defined as static in ntpq-subs.c, they need to be exported here
31  */
32 
33 char ntpq_decodeaddrtype(sockaddr_u *sock)
34 {
35 	return decodeaddrtype(sock);
36 }
37 
38 int
39 ntpq_doquerylist(
40 	struct ntpq_varlist *vlist,
41 	int op,
42 	associd_t associd,
43 	int auth,
44 	u_short *rstatus,
45 	size_t *dsize,
46 	const char **datap
47 	)
48 {
49 	return doquerylist((struct varlist *)vlist, op, associd, auth,
50 			   rstatus, dsize, datap);
51 }
52 
53