Patrick McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 1 | #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 */ |
| 10 | struct xt_hashlimit_htable; |
| 11 | |
Jan Engelhardt | 09e410d | 2008-01-31 04:48:13 -0800 | [diff] [blame] | 12 | enum { |
| 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 McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 19 | |
| 20 | struct hashlimit_cfg { |
Jan Engelhardt | 09e410d | 2008-01-31 04:48:13 -0800 | [diff] [blame] | 21 | u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ |
Patrick McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 22 | 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 | |
| 32 | struct xt_hashlimit_info { |
| 33 | char name [IFNAMSIZ]; /* name */ |
| 34 | struct hashlimit_cfg cfg; |
Patrick McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 35 | |
| 36 | /* Used internally by the kernel */ |
Jan Engelhardt | 8b6f3f6 | 2008-01-14 23:33:14 -0800 | [diff] [blame] | 37 | struct xt_hashlimit_htable *hinfo; |
Patrick McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 38 | union { |
| 39 | void *ptr; |
| 40 | struct xt_hashlimit_info *master; |
| 41 | } u; |
| 42 | }; |
Jan Engelhardt | 09e410d | 2008-01-31 04:48:13 -0800 | [diff] [blame] | 43 | |
| 44 | struct 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 | |
| 58 | struct 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 Engelhardt | 09e410d | 2008-01-31 04:48:13 -0800 | [diff] [blame] | 64 | }; |
| 65 | |
Patrick McHardy | 39b46fc | 2006-11-29 02:35:36 +0100 | [diff] [blame] | 66 | #endif /*_XT_HASHLIMIT_H*/ |