summaryrefslogtreecommitdiffstats
path: root/include/ntp_data_structures.h
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
committerroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
commitd54cfbdce4a9878ef65216dea36b62cf6646b84b (patch)
treea618007bb41d13153794a598e3d904ace2976324 /include/ntp_data_structures.h
parentfd23eea016bd30c806a3ee90eb6f397470c2fa46 (diff)
downloadFreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.zip
FreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.tar.gz
Virgin import of ntpd 4.2.6p5.
When the series of commits is complete, things like https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks should be fixed. PR: bin/148836 (except that we import a newer version) Asked by: Too many MFC after: 2 weeks
Diffstat (limited to 'include/ntp_data_structures.h')
-rw-r--r--include/ntp_data_structures.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/ntp_data_structures.h b/include/ntp_data_structures.h
new file mode 100644
index 0000000..363e0b4
--- /dev/null
+++ b/include/ntp_data_structures.h
@@ -0,0 +1,53 @@
+/* ntp_data_structures.h
+ *
+ * This file contains the structures and function prototypes for the data
+ * structures used by the ntp configuration code and the discrete event
+ * simulator.
+ *
+ * Written By: Sachin Kamboj
+ * University of Delaware
+ * Newark, DE 19711
+ * Copyright (c) 2006
+ */
+
+#ifndef __NTP_DATA_STRUCTURES_H__
+#define __NTP_DATA_STRUCTURES_H__
+
+
+/* Structures for storing a priority queue
+ * ---------------------------------------
+ */
+
+typedef struct node {
+ union {
+ struct node *next;
+ double d;
+ } nodeu;
+} node;
+#define node_next nodeu.next
+
+typedef struct Queue {
+ int (*get_order)(void *, void *);
+ node *front;
+ int no_of_elements;
+} queue;
+
+
+/* FUNCTION PROTOTYPES
+ * -------------------
+ */
+queue *create_priority_queue(int (*get_order)(void *, void *));
+void destroy_queue(queue *my_queue);
+void *get_node(size_t size);
+void free_node(void *my_node);
+void *next_node(void *my_node);
+int empty(queue *my_queue);
+void *queue_head(queue *my_queue);
+queue *enqueue(queue *my_queue, void *my_node);
+void *dequeue(queue *my_queue);
+int get_no_of_elements(queue *my_queue);
+void append_queue(queue *q1, queue *q2);
+int get_fifo_order(void *el1, void *el2);
+queue *create_queue(void);
+
+#endif
OpenPOWER on IntegriCloud