summaryrefslogtreecommitdiff
path: root/src/lib/frct_pci.h
blob: fbbfd3547a8d4a4b4aa2839fe94ac4e18907fb02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Ouroboros - Copyright (C) 2016 - 2017
 *
 * Protocol Control Information of FRCT
 *
 *    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_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 */