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