forked from sleinen/samplicator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
samplicator.h
81 lines (65 loc) · 1.55 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
/*
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,
pf_SPOOF_WITH_IP = 0x0004,
};
struct samplicator_context {
struct source_context *sources;
const char *faddr_spec;
struct sockaddr_storage faddr;
const char *fport_spec;
long sockbuflen;
long pdulen;
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;
const char *spoofed_src_addr;
/* 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;
struct sockaddr_storage spoofed_src_addr;
socklen_t spoofed_src_addrlen;
/* 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;
unsigned tx_delay;
int debug;
/* statistics */
uint32_t matched_packets;
uint64_t matched_octets;
};
#endif /* not _SAMPLICATOR_H_ */