blob: 51b18d83b4778ebc1d69eb71513e5be1faee9809 [file] [log] [blame]
Patrick McHardy39b46fc2006-11-29 02:35:36 +01001#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H
3
4/* timings are in milliseconds. */
5#define XT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
7 seconds, or one every 59 hours. */
8
9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable;
11
Jan Engelhardt09e410d2008-01-31 04:48:13 -080012enum {
13 XT_HASHLIMIT_HASH_DIP = 1 << 0,
14 XT_HASHLIMIT_HASH_DPT = 1 << 1,
15 XT_HASHLIMIT_HASH_SIP = 1 << 2,
16 XT_HASHLIMIT_HASH_SPT = 1 << 3,
17 XT_HASHLIMIT_INVERT = 1 << 4,
18};
Patrick McHardy39b46fc2006-11-29 02:35:36 +010019
20struct hashlimit_cfg {
Jan Engelhardt09e410d2008-01-31 04:48:13 -080021 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
Patrick McHardy39b46fc2006-11-29 02:35:36 +010022 u_int32_t avg; /* Average secs between packets * scale */
23 u_int32_t burst; /* Period multiplier for upper limit. */
24
25 /* user specified */
26 u_int32_t size; /* how many buckets */
27 u_int32_t max; /* max number of entries */
28 u_int32_t gc_interval; /* gc interval */
29 u_int32_t expire; /* when do entries expire? */
30};
31
32struct xt_hashlimit_info {
33 char name [IFNAMSIZ]; /* name */
34 struct hashlimit_cfg cfg;
Patrick McHardy39b46fc2006-11-29 02:35:36 +010035
36 /* Used internally by the kernel */
Jan Engelhardt8b6f3f62008-01-14 23:33:14 -080037 struct xt_hashlimit_htable *hinfo;
Patrick McHardy39b46fc2006-11-29 02:35:36 +010038 union {
39 void *ptr;
40 struct xt_hashlimit_info *master;
41 } u;
42};
Jan Engelhardt09e410d2008-01-31 04:48:13 -080043
44struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */
48
49 /* user specified */
50 u_int32_t size; /* how many buckets */
51 u_int32_t max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */
54
55 u_int8_t srcmask, dstmask;
56};
57
58struct xt_hashlimit_mtinfo1 {
59 char name[IFNAMSIZ];
60 struct hashlimit_cfg1 cfg;
61
62 /* Used internally by the kernel */
63 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
Jan Engelhardt09e410d2008-01-31 04:48:13 -080064};
65
Patrick McHardy39b46fc2006-11-29 02:35:36 +010066#endif /*_XT_HASHLIMIT_H*/