blob: b1925b5925e959af7482f124e360ce79dfcf51bd [file] [log] [blame]
Patrick McHardy39b46fc2006-11-29 02:35:36 +01001#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H
3
Arnd Bergmann60c195c2009-02-26 00:51:43 +01004#include <linux/types.h>
5
Patrick McHardy39b46fc2006-11-29 02:35:36 +01006/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 seconds, or one every 59 hours. */
10
11/* details of this structure hidden by the implementation */
12struct xt_hashlimit_htable;
13
Jan Engelhardt09e410d2008-01-31 04:48:13 -080014enum {
15 XT_HASHLIMIT_HASH_DIP = 1 << 0,
16 XT_HASHLIMIT_HASH_DPT = 1 << 1,
17 XT_HASHLIMIT_HASH_SIP = 1 << 2,
18 XT_HASHLIMIT_HASH_SPT = 1 << 3,
19 XT_HASHLIMIT_INVERT = 1 << 4,
20};
Patrick McHardy39b46fc2006-11-29 02:35:36 +010021
22struct hashlimit_cfg {
Arnd Bergmann60c195c2009-02-26 00:51:43 +010023 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
24 __u32 avg; /* Average secs between packets * scale */
25 __u32 burst; /* Period multiplier for upper limit. */
Patrick McHardy39b46fc2006-11-29 02:35:36 +010026
27 /* user specified */
Arnd Bergmann60c195c2009-02-26 00:51:43 +010028 __u32 size; /* how many buckets */
29 __u32 max; /* max number of entries */
30 __u32 gc_interval; /* gc interval */
31 __u32 expire; /* when do entries expire? */
Patrick McHardy39b46fc2006-11-29 02:35:36 +010032};
33
34struct xt_hashlimit_info {
35 char name [IFNAMSIZ]; /* name */
36 struct hashlimit_cfg cfg;
Patrick McHardy39b46fc2006-11-29 02:35:36 +010037
38 /* Used internally by the kernel */
Jan Engelhardt8b6f3f62008-01-14 23:33:14 -080039 struct xt_hashlimit_htable *hinfo;
Patrick McHardy39b46fc2006-11-29 02:35:36 +010040 union {
41 void *ptr;
42 struct xt_hashlimit_info *master;
43 } u;
44};
Jan Engelhardt09e410d2008-01-31 04:48:13 -080045
46struct hashlimit_cfg1 {
Arnd Bergmann60c195c2009-02-26 00:51:43 +010047 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
48 __u32 avg; /* Average secs between packets * scale */
49 __u32 burst; /* Period multiplier for upper limit. */
Jan Engelhardt09e410d2008-01-31 04:48:13 -080050
51 /* user specified */
Arnd Bergmann60c195c2009-02-26 00:51:43 +010052 __u32 size; /* how many buckets */
53 __u32 max; /* max number of entries */
54 __u32 gc_interval; /* gc interval */
55 __u32 expire; /* when do entries expire? */
Jan Engelhardt09e410d2008-01-31 04:48:13 -080056
Arnd Bergmann60c195c2009-02-26 00:51:43 +010057 __u8 srcmask, dstmask;
Jan Engelhardt09e410d2008-01-31 04:48:13 -080058};
59
60struct xt_hashlimit_mtinfo1 {
61 char name[IFNAMSIZ];
62 struct hashlimit_cfg1 cfg;
63
64 /* Used internally by the kernel */
65 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
Jan Engelhardt09e410d2008-01-31 04:48:13 -080066};
67
Patrick McHardy39b46fc2006-11-29 02:35:36 +010068#endif /*_XT_HASHLIMIT_H*/