1+ #ifndef IPXP_INPUT_CTT_HPP
2+ #define IPXP_INPUT_CTT_HPP
3+
4+ #include < bits/types/struct_timeval.h>
5+ #include < cstdint>
6+
7+ namespace ipxp {
8+
9+ enum CsumStatus : uint8_t {
10+ CSUM_UNKNOWN = 0x0 , // /< No information about the checksum
11+ CSUM_BAD = 0x1 , // /< The checksum in the packet is wrong
12+ CSUM_GOOD = 0x2 , // /< The checksum in the packet is valid
13+ CSUM_NONE = 0x3 // /< Checksum not correct but header integrity verified
14+ };
15+
16+ enum ParserStatus : uint8_t {
17+ PA_OK = 0x0 , // /< Parsing completed successfully
18+ PA_UNKNOWN = 0x1 , // /< Parser stopped at an unknown protocol
19+ PA_LIMIT = 0x2 , // /< Parser stopped at its own limit (e.g., VLAN=4)
20+ PA_ERROR = 0x3 // /< Error in protocol header or parsing overflow
21+ };
22+
23+ enum L2PType : uint8_t {
24+ L2_UNKNOWN = 0x0 , // /< Unknown L2 protocol
25+ L2_ETHER_IP = 0x1 , // /< Ethernet with IP payload
26+ L2_ETHER_TIMESYNC = 0x2 , // /< Ethernet with TimeSync protocol
27+ L2_ETHER_ARP = 0x3 , // /< Ethernet with ARP protocol
28+ L2_ETHER_LLDP = 0x4 , // /< Ethernet with LLDP protocol
29+ L2_ETHER_NSH = 0x5 , // /< Ethernet with NSH protocol
30+ L2_ETHER_VLAN = 0x6 , // /< Ethernet with VLAN tagging
31+ L2_ETHER_QINQ = 0x7 , // /< Ethernet with QinQ tagging
32+ L2_ETHER_PPPOE = 0x8 , // /< Ethernet with PPPoE encapsulation
33+ L2_ETHER_FCOE = 0x9 , // /< Ethernet with FCoE protocol
34+ L2_ETHER_MPLS = 0xA // /< Ethernet with MPLS
35+ };
36+
37+ enum L3PType : uint8_t {
38+ L3_UNKNOWN = 0x0 , // /< Unknown L3 protocol
39+ L3_IPV4 = 0x1 , // /< IPv4 protocol
40+ L3_IPV4_EXT = 0x3 , // /< IPv4 with extensions
41+ L3_IPV6 = 0x4 , // /< IPv6 protocol
42+ L3_IPV6_EXT = 0xC // /< IPv6 with extensions
43+ };
44+
45+ enum L4PType : uint8_t {
46+ L4_UNKNOWN = 0x0 , // /< Unknown L4 protocol
47+ L4_TCP = 0x1 , // /< TCP protocol
48+ L4_UDP = 0x2 , // /< UDP protocol
49+ L4_FRAG = 0x3 , // /< Fragmented packet
50+ L4_SCTP = 0x4 , // /< SCTP protocol
51+ L4_ICMP = 0x5 , // /< ICMP protocol
52+ L4_NONFRAG = 0x6 , // /< Non-fragmented packet
53+ L4_IGMP = 0x7 // /< IGMP protocol
54+ };
55+
56+ struct Metadata_CTT {
57+ timeval ts; // /< Timestamp; invalid if all bits are 1
58+ uint16_t vlan_tci; // /< VLAN Tag Control Information from outer VLAN
59+ bool vlan_vld : 1 ; // /< VLAN valid flag; indicates if VLAN TCI is valid
60+ bool vlan_stripped : 1 ; // /< VLAN stripped flag; outer VLAN only
61+ CsumStatus ip_csum_status : 2 ; // /< IP checksum status
62+ CsumStatus l4_csum_status : 2 ; // /< Layer 4 checksum status
63+ ParserStatus parser_status : 2 ;// /< Final state of FPGA parser
64+ uint8_t ifc; // /< Interface (IFC) number
65+ uint16_t filter_bitmap; // /< Filter bitmap; each filter rule can have several mark bits
66+ bool ctt_export_trig : 1 ; // /< CTT flag; packet triggered export in CTT
67+ bool ctt_rec_matched : 1 ; // /< CTT flag; packet matched record in CTT
68+ bool ctt_rec_created : 1 ; // /< CTT flag; packet created record in CTT
69+ bool ctt_rec_deleted : 1 ; // /< CTT flag; packet deleted record in CTT
70+ uint64_t flow_hash; // /< Flow hash; not the same as RSS hash
71+ uint8_t l2_len : 7 ; // /< Length of the L2 layer, if known
72+ uint16_t l3_len : 9 ; // /< Length of the L3 layer, if known
73+ uint8_t l4_len : 8 ; // /< Length of the L4 layer, if known
74+ L2PType l2_ptype : 4 ; // /< Type of the L2 layer
75+ L3PType l3_ptype : 4 ; // /< Type of the L3 layer
76+ L4PType l4_ptype : 4 ; // /< Type of the L4 layer
77+ };
78+
79+ }
80+
81+ #endif // IPXP_INPUT_CTT_HPP
0 commit comments