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