diff options
author | Dimitri Staessens <[email protected]> | 2017-11-06 21:38:55 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-11-07 11:22:45 +0100 |
commit | eef84a2afd2aa0d21072f6e7ef038fe10dcc245d (patch) | |
tree | 201297fccdaaf865283039b3bf39b13e5e50bfda /include | |
parent | f5c60ee47c097d7408470e4be6182bf9ee684e84 (diff) | |
download | ouroboros-eef84a2afd2aa0d21072f6e7ef038fe10dcc245d.tar.gz ouroboros-eef84a2afd2aa0d21072f6e7ef038fe10dcc245d.zip |
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 <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/frct_pci.h | 67 | ||||
-rw-r--r-- | include/ouroboros/rq.h | 47 |
2 files changed, 0 insertions, 114 deletions
diff --git a/include/ouroboros/frct_pci.h b/include/ouroboros/frct_pci.h deleted file mode 100644 index a919bc60..00000000 --- a/include/ouroboros/frct_pci.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Protocol Control Information of FRCT - * - * Dimitri Staessens <[email protected]> - * Sander Vrijders <[email protected]> - * - * 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_FRCT_PCI_H -#define OUROBOROS_LIB_FRCT_PCI_H - -#include <ouroboros/shm_du_buff.h> - -#include <stdint.h> -#include <stdbool.h> - -struct frct_pci { - /* Present in every PDU. */ - uint8_t type; - uint8_t flags; - uint64_t seqno; - - /* Present in config PDU. */ - uint16_t conf_flags; - - /* Present in flow control PDU. */ - uint64_t lwe; - uint64_t rwe; -}; - -enum pdu_types { - PDU_TYPE_DATA = 0x01, - PDU_TYPE_ACK = 0x02, - PDU_TYPE_FC = 0x04, - PDU_TYPE_ACK_AND_FC = (PDU_TYPE_ACK | PDU_TYPE_FC), - PDU_TYPE_CONFIG = 0x08, - PDU_TYPE_RENDEZ_VOUS = 0x10 -}; - -enum data_flags { - FLAG_DATA_RUN = 0x01, - FLAG_MORE_FRAGMENTS = 0x02 -}; - -int frct_pci_ser(struct shm_du_buff * sdb, - struct frct_pci * pci, - bool error_check); - -int frct_pci_des(struct shm_du_buff * sdb, - struct frct_pci * pci, - bool error_check); - -#endif /* OUROBOROS_LIB_FRCT_PCI_H */ diff --git a/include/ouroboros/rq.h b/include/ouroboros/rq.h deleted file mode 100644 index 7c024c11..00000000 --- a/include/ouroboros/rq.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Reordering queue - * - * Dimitri Staessens <[email protected]> - * Sander Vrijders <[email protected]> - * - * 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 */ |