1#ifndef _UAPI_XT_HASHLIMIT_H 2#define _UAPI_XT_HASHLIMIT_H 3 4#include <linux/types.h> 5#include <linux/if.h> 6 7/* timings are in milliseconds. */ 8#define XT_HASHLIMIT_SCALE 10000 9/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 10 * seconds, or one packet every 59 hours. 11 */ 12 13/* packet length accounting is done in 16-byte steps */ 14#define XT_HASHLIMIT_BYTE_SHIFT 4 15 16/* details of this structure hidden by the implementation */ 17struct xt_hashlimit_htable; 18 19enum { 20 XT_HASHLIMIT_HASH_DIP = 1 << 0, 21 XT_HASHLIMIT_HASH_DPT = 1 << 1, 22 XT_HASHLIMIT_HASH_SIP = 1 << 2, 23 XT_HASHLIMIT_HASH_SPT = 1 << 3, 24 XT_HASHLIMIT_INVERT = 1 << 4, 25 XT_HASHLIMIT_BYTES = 1 << 5, 26}; 27 28struct hashlimit_cfg { 29 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 30 __u32 avg; /* Average secs between packets * scale */ 31 __u32 burst; /* Period multiplier for upper limit. */ 32 33 /* user specified */ 34 __u32 size; /* how many buckets */ 35 __u32 max; /* max number of entries */ 36 __u32 gc_interval; /* gc interval */ 37 __u32 expire; /* when do entries expire? */ 38}; 39 40struct xt_hashlimit_info { 41 char name [IFNAMSIZ]; /* name */ 42 struct hashlimit_cfg cfg; 43 44 /* Used internally by the kernel */ 45 struct xt_hashlimit_htable *hinfo; 46 union { 47 void *ptr; 48 struct xt_hashlimit_info *master; 49 } u; 50}; 51 52struct hashlimit_cfg1 { 53 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 54 __u32 avg; /* Average secs between packets * scale */ 55 __u32 burst; /* Period multiplier for upper limit. */ 56 57 /* user specified */ 58 __u32 size; /* how many buckets */ 59 __u32 max; /* max number of entries */ 60 __u32 gc_interval; /* gc interval */ 61 __u32 expire; /* when do entries expire? */ 62 63 __u8 srcmask, dstmask; 64}; 65 66struct xt_hashlimit_mtinfo1 { 67 char name[IFNAMSIZ]; 68 struct hashlimit_cfg1 cfg; 69 70 /* Used internally by the kernel */ 71 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); 72}; 73 74#endif /* _UAPI_XT_HASHLIMIT_H */ 75