-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtuple.h
50 lines (40 loc) · 1.04 KB
/
tuple.h
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
#ifndef __TUPLE_H__
#define __TUPLE_H__
#include <stdint.h>
typedef struct __attribute__ ((__packed__)) FlowKey {
// 8 (4*2) bytes
uint32_t src_ip; // source IP address
uint32_t dst_ip;
// 4 (2*2) bytes
uint16_t src_port;
uint16_t dst_port;
// 1 bytes
uint8_t proto;
} flow_key_t;
#define TUPLE_NORMAL 0
#define TUPLE_PUNC 1
#define TUPLE_TERM 2
#define TUPLE_START 3
typedef struct __attribute__((__packed__)) Tuple {
/**************************************
* keys
*************************************/
flow_key_t key;
/**************************************
* values
*************************************/
// 8 bytes
int32_t size; // inner IP datagram length (header + data)
// 1 bytes
// only used in multi-thread environment
uint8_t flag;
// 8 bytes
double pkt_ts; // timestamp of the packet
} tuple_t;
typedef struct __attribute__((__packed__)) RichTuple {
flow_key_t key;
int32_t size;
int64_t index;
double conf[104];
} rich_tuple_t;
#endif