forked from sleinen/samplicator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsamplicator.h
93 lines (78 loc) · 1.5 KB
/
samplicator.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
samplicator.h
Date Created: Tue Feb 23 19:00:32 2010
Author: Simon Leinen <[email protected]>
*/
#ifndef _SAMPLICATOR_H_
#define _SAMPLICATOR_H_
enum receiver_flags
{
pf_SPOOF = 0x0001,
pf_CHECKSUM = 0x0002,
};
enum _CATEGORIES
{
CAT_BLACKLIST,
CAT_STANDARD,
CAT_UNMATCHED,
CAT_UNKNOWN
};
#define NUM_CATEGORIES CAT_UNKNOWN
static char *STR_CATEGORY[] =
{
"Blacklist",
"Standard",
"Unmatched",
"Unknown"
};
struct samplicator_context
{
struct source_context *sources[NUM_CATEGORIES];
const char *faddr_spec;
struct sockaddr_storage faddr;
const char *fport_spec;
long sockbuflen;
long pdulen;
unsigned tx_delay;
int debug;
int timeout;
int fork;
int ipv4_only;
int ipv6_only;
const char *pid_file;
enum receiver_flags default_receiver_flags;
int fsockfd;
socklen_t fsockaddrlen;
const char *config_file_name;
int config_file_lineno;
/* statistics */
uint32_t unmatched_packets;
};
struct receiver
{
int fd;
struct sockaddr_storage addr;
socklen_t addrlen;
int port;
int freq;
int freqcount;
int ttl;
enum receiver_flags flags;
/* statistics */
uint32_t out_packets;
uint32_t out_errors;
uint64_t out_octets;
};
struct source_context
{
struct source_context *next;
struct sockaddr_storage source;
struct sockaddr_storage mask;
socklen_t addrlen;
struct receiver *receivers;
unsigned nreceivers;
/* statistics */
uint32_t matched_packets;
uint64_t matched_octets;
};
#endif /* not _SAMPLICATOR_H_ */