diff options
author | Dimitri Staessens <[email protected]> | 2017-11-08 19:25:48 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-11-08 21:40:28 +0100 |
commit | 35c43358a110758090b48dd18628bb285ffddfc6 (patch) | |
tree | 9746475ac579e516e86f720a3bcb107bf6e36784 /src/lib/frct_pci.h | |
parent | c59053040ce927f2926e5a569b19bdd129c354a7 (diff) | |
download | ouroboros-35c43358a110758090b48dd18628bb285ffddfc6.tar.gz ouroboros-35c43358a110758090b48dd18628bb285ffddfc6.zip |
lib: Use packed struct for FRCT header access
This replaces the variable FRCT header with a packed struct, which
significantly simplifies the implementation. The shm_du_buff calls to
release the head/tail are updated to return a pointer to the original
head or the new tail (in symmetry to the alloc calls, which return a
pointer to the new head and old tail), so that it immediately points
to the structure that is needed.
The frct_pci sources are removed and frct is now fully in the frct.c
source file.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib/frct_pci.h')
-rw-r--r-- | src/lib/frct_pci.h | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/lib/frct_pci.h b/src/lib/frct_pci.h deleted file mode 100644 index fbbfd354..00000000 --- a/src/lib/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 cflags; - - /* 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_RENDEZ_VOUS = 0x08, - PDU_TYPE_CONFIG = 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 */ |