x_tables.h revision e309c5fa6adf7c48074a08126721838ad4ea2749
1#ifndef _X_TABLES_H 2#define _X_TABLES_H 3 4#define XT_FUNCTION_MAXNAMELEN 30 5#define XT_TABLE_MAXNAMELEN 32 6 7struct xt_entry_match 8{ 9 union { 10 struct { 11 u_int16_t match_size; 12 13 /* Used by userspace */ 14 char name[XT_FUNCTION_MAXNAMELEN-1]; 15 16 u_int8_t revision; 17 } user; 18 struct { 19 u_int16_t match_size; 20 21 /* Used inside the kernel */ 22 struct xt_match *match; 23 } kernel; 24 25 /* Total length */ 26 u_int16_t match_size; 27 } u; 28 29 unsigned char data[0]; 30}; 31 32struct xt_entry_target 33{ 34 union { 35 struct { 36 u_int16_t target_size; 37 38 /* Used by userspace */ 39 char name[XT_FUNCTION_MAXNAMELEN-1]; 40 41 u_int8_t revision; 42 } user; 43 struct { 44 u_int16_t target_size; 45 46 /* Used inside the kernel */ 47 struct xt_target *target; 48 } kernel; 49 50 /* Total length */ 51 u_int16_t target_size; 52 } u; 53 54 unsigned char data[0]; 55}; 56 57struct xt_standard_target 58{ 59 struct xt_entry_target target; 60 int verdict; 61}; 62 63/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 64 * kernel supports, if >= revision. */ 65struct xt_get_revision 66{ 67 char name[XT_FUNCTION_MAXNAMELEN-1]; 68 69 u_int8_t revision; 70}; 71 72/* CONTINUE verdict for targets */ 73#define XT_CONTINUE 0xFFFFFFFF 74 75/* For standard target */ 76#define XT_RETURN (-NF_REPEAT - 1) 77 78/* this is a dummy structure to find out the alignment requirement for a struct 79 * containing all the fundamental data types that are used in ipt_entry, 80 * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my 81 * personal pleasure to remove it -HW 82 */ 83struct _xt_align 84{ 85 u_int8_t u8; 86 u_int16_t u16; 87 u_int32_t u32; 88 u_int64_t u64; 89}; 90 91#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ 92 & ~(__alignof__(struct _xt_align)-1)) 93 94/* Standard return verdict, or do jump. */ 95#define XT_STANDARD_TARGET "" 96/* Error verdict. */ 97#define XT_ERROR_TARGET "ERROR" 98 99#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) 100#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) 101 102struct xt_counters 103{ 104 u_int64_t pcnt, bcnt; /* Packet and byte counters */ 105}; 106 107/* The argument to IPT_SO_ADD_COUNTERS. */ 108struct xt_counters_info 109{ 110 /* Which table. */ 111 char name[XT_TABLE_MAXNAMELEN]; 112 113 unsigned int num_counters; 114 115 /* The counters (actually `number' of these). */ 116 struct xt_counters counters[0]; 117}; 118 119#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 120 121 122#endif /* _X_TABLES_H */ 123