summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-09-14 13:43:09 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-09-15 11:30:40 +0200
commit26d4a6072cbf59708071dac8393c88ddacd69a37 (patch)
tree40d3dd4c9e955528e770325f5e59b84c61316d2c /include
parent07a2d315205fccf42e891e2bb46db44401b29153 (diff)
downloadouroboros-26d4a6072cbf59708071dac8393c88ddacd69a37.tar.gz
ouroboros-26d4a6072cbf59708071dac8393c88ddacd69a37.zip
lib: Add reordering queue to FRCT
This adds a reordering queue to FRCT so that SDUs can be delivered in-order when requested.
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/rq.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/ouroboros/rq.h b/include/ouroboros/rq.h
new file mode 100644
index 00000000..7c024c11
--- /dev/null
+++ b/include/ouroboros/rq.h
@@ -0,0 +1,47 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2017
+ *
+ * Reordering queue
+ *
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#ifndef OUROBOROS_LIB_RQ_H
+#define OUROBOROS_LIB_RQ_H
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+struct rq * rq_create(int size);
+
+void rq_destroy(struct rq * rq);
+
+int rq_push(struct rq * rq,
+ uint64_t seqno,
+ size_t idx);
+
+uint64_t rq_peek(struct rq * rq);
+
+bool rq_is_empty(struct rq * rq);
+
+size_t rq_pop(struct rq * rq);
+
+bool rq_has(struct rq * rq,
+ uint64_t seqno);
+
+#endif /* OUROBOROS_LIB_RQ_H */