1/*	$NetBSD: libntpq_subs.c,v 1.5 2020/05/25 20:47:26 christos 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
22int ntpq_dogetassoc(void)
23{
24
25	if (dogetassoc(NULL))
26		return numassoc;
27	else
28		return 0;
29}
30
31/* the following functions are required internally by a number of libntpq functions
32 * and since they are defined as static in ntpq-subs.c, they need to be exported here
33 */
34
35char ntpq_decodeaddrtype(sockaddr_u *sock)
36{
37	return decodeaddrtype(sock);
38}
39
40int
41ntpq_doquerylist(
42	struct ntpq_varlist *vlist,
43	int op,
44	associd_t associd,
45	int auth,
46	u_short *rstatus,
47	size_t *dsize,
48	const char **datap
49	)
50{
51	return doquerylist((struct varlist *)vlist, op, associd, auth,
52			   rstatus, dsize, datap);
53}
54
55