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