From eef84a2afd2aa0d21072f6e7ef038fe10dcc245d Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 6 Nov 2017 21:38:55 +0100 Subject: lib: Refactor FRCT implementation The frct_pci and rq headers are moved from include/ouroboros to src/lib since they are only needed in the library. FRCT is moved to its own source file. FRCT takes the application PDUs, encapsulates and processes them and hands them back. This makes it easier to disable FRCT should the application want to write to a "raw" flow. An FRCT instance is now allocated upon alloc and released upon dealloc. The FRCT data structure is split into a sender and receiver connection record. Setting a new configuration will now be done upon sending the next data PDU, which will flag the DRF for a new run and use that configuration. This avoids some issues should packets arrive out-of-order, and simplifies setting a configuration. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/rq.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/lib/rq.h (limited to 'src/lib/rq.h') diff --git a/src/lib/rq.h b/src/lib/rq.h new file mode 100644 index 00000000..7c024c11 --- /dev/null +++ b/src/lib/rq.h @@ -0,0 +1,47 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Reordering queue + * + * Dimitri Staessens + * Sander Vrijders + * + * 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 +#include +#include + +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 */ -- cgit v1.2.3