summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2023-05-31 15:14:29 +1000
committerKinseyMoore <48726349+KinseyMoore@users.noreply.github.com>2023-05-31 09:12:07 -0500
commitec6cd17c04f6f081b3a73735f2938a6d3a1c330f (patch)
treea49574ff3247597e50f002a1719eca9e472d5ac3
parentwaf: Detect libdebugger (diff)
downloadrtems-net-services-ec6cd17c04f6f081b3a73735f2938a6d3a1c330f.tar.bz2
bsd/ntp: Clean up ntpq header for use in applications
- Add the ntpq query prototype - Remove references to ntp headers
-rw-r--r--bsd/rtemsbsd/include/rtems/ntpq.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/bsd/rtemsbsd/include/rtems/ntpq.h b/bsd/rtemsbsd/include/rtems/ntpq.h
index 28009bb..50d797d 100644
--- a/bsd/rtemsbsd/include/rtems/ntpq.h
+++ b/bsd/rtemsbsd/include/rtems/ntpq.h
@@ -36,8 +36,7 @@
#ifndef _RTEMS_NTPQ_H
#define _RTEMS_NTPQ_H
-#include <ntp_types.h>
-#include <ntpq-opts.h>
+#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
@@ -54,9 +53,42 @@ extern "C" {
*/
int rtems_shell_ntpq_command(int argc, char **argv);
+/**
+ * @brief Create the NTP query environment
+ *
+ * Call this function before making a query. It only needs to be
+ * called once for the program.
+ *
+ * @param output_buf_size Size of the output buffer to hold the query
+ *
+ * @return This function returns the result.
+ */
int rtems_ntpq_create(size_t output_buf_size);
+
+/**
+ * @brief Destroy the NTP query environment
+ *
+ * This releases any held resources.
+ *
+ * @return This function returns the result.
+ */
void rtems_ntpq_destroy(void);
+/**
+ * @brief Query the NTP service
+ *
+ * Refer to the commands the ntpq command accepts. The output if held
+ * in the output buffer. This command is not designed to run in
+ * separate threads. The single output buffer will corrupt.
+ *
+ * @param argc Argument count
+ *
+ * @param argv Argument string pointers
+ *
+ * @return This function returns the result.
+ */
+int rtems_ntpq_query(const int argc, const char** argv);
+
int rtems_ntpq_error_code(void);
const char* rtems_ntpq_error_text(void);
int rtems_ntpq_create_check(void);