summaryrefslogtreecommitdiff
path: root/ntpq/libntpq_subs.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-12-02 09:01:21 +0000
committer <>2014-12-04 16:11:25 +0000
commitbdab5265fcbf3f472545073a23f8999749a9f2b9 (patch)
treec6018dd03dea906f8f1fb5f105f05b71a7dc250a /ntpq/libntpq_subs.c
downloadntp-bdab5265fcbf3f472545073a23f8999749a9f2b9.tar.gz
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
Diffstat (limited to 'ntpq/libntpq_subs.c')
-rw-r--r--ntpq/libntpq_subs.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/ntpq/libntpq_subs.c b/ntpq/libntpq_subs.c
new file mode 100644
index 0000000..e53b419
--- /dev/null
+++ b/ntpq/libntpq_subs.c
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ *
+ * libntpq_subs.c
+ *
+ * This is the second part of the wrapper library for ntpq, the NTP query utility.
+ * This library reuses the sourcecode from ntpq and exports a number
+ * of useful functions in a library that can be linked against applications
+ * that need to query the status of a running ntpd. The whole
+ * communcation is based on mode 6 packets.
+ *
+ * This source file exports the (private) functions from ntpq-subs.c
+ *
+ ****************************************************************************/
+
+
+#include "ntpq-subs.c"
+#include "libntpq.h"
+
+
+int ntpq_dogetassoc(void)
+{
+
+ if (dogetassoc(NULL))
+ return numassoc;
+ else
+ return 0;
+}
+
+/* the following functions are required internally by a number of libntpq functions
+ * and since they are defined as static in ntpq-subs.c, they need to be exported here
+ */
+
+char ntpq_decodeaddrtype(sockaddr_u *sock)
+{
+ return decodeaddrtype(sock);
+}
+
+int
+ntpq_doquerylist(
+ struct ntpq_varlist *vlist,
+ int op,
+ associd_t associd,
+ int auth,
+ u_short *rstatus,
+ int *dsize,
+ const char **datap
+ )
+{
+ return doquerylist((struct varlist *)vlist, op, associd, auth,
+ rstatus, dsize, datap);
+}
+