-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflow.h
46 lines (35 loc) · 886 Bytes
/
flow.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
/*
* flow.h
*
* Created on: 23.07.2016
* Author: marc
*/
#ifndef FLOW_H_
#define FLOW_H_
#include <linux/if_ether.h>
#include <netinet/ip6.h>
#include <stdint.h>
#define MAX_DIR_STR_LEN 4
#define MAX_PROTO_STR_LEN 20
typedef enum { IN, OUT } traf_dir;
struct pkt_meta {
uint8_t mac[ETH_ALEN];
uint8_t proto;
traf_dir dir;
struct in6_addr ip_addr;
};
struct flow {
struct pkt_meta meta;
/* actual data */
uint32_t size;
uint32_t packets;
struct flow *next_flow;
};
extern struct flow *insert_ptr;
extern struct flow *collect_ptr;
void add_dataset_to_flow(struct flow **ptr, traf_dir dir, uint8_t mac[6], struct in6_addr *ip_addr, uint8_t proto,
uint32_t size);
void print_flow(struct flow *f_ptr);
void flow_to_post(struct flow *f_ptr, char *buf);
void free_flows(struct flow *ptr);
#endif /* FLOW_H_ */