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 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 }; 19 20 struct hashlimit_cfg { 21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 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; 35 36 /* Used internally by the kernel */ 37 struct xt_hashlimit_htable *hinfo; 38 union { 39 void *ptr; 40 struct xt_hashlimit_info *master; 41 } u; 42 }; 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))); 64 }; 65 66 #endif /*_XT_HASHLIMIT_H*/ 67