Home | History | Annotate | Download | only in netfilter
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ***   To edit the content of this header, modify the corresponding
     11  ***   source file (e.g. under external/kernel-headers/original/) then
     12  ***   run bionic/libc/kernel/tools/update_all.py
     13  ***
     14  ***   Any manual change here will be lost the next time this script will
     15  ***   be run. You've been warned!
     16  ***
     17  ****************************************************************************
     18  ****************************************************************************/
     19 #ifndef _UAPI_X_TABLES_H
     20 #define _UAPI_X_TABLES_H
     21 #include <linux/kernel.h>
     22 #include <linux/types.h>
     23 #define XT_FUNCTION_MAXNAMELEN 30
     24 #define XT_EXTENSION_MAXNAMELEN 29
     25 #define XT_TABLE_MAXNAMELEN 32
     26 struct xt_entry_match {
     27   union {
     28     struct {
     29       __u16 match_size;
     30       char name[XT_EXTENSION_MAXNAMELEN];
     31       __u8 revision;
     32     } user;
     33     struct {
     34       __u16 match_size;
     35       struct xt_match * match;
     36     } kernel;
     37     __u16 match_size;
     38   } u;
     39   unsigned char data[0];
     40 };
     41 struct xt_entry_target {
     42   union {
     43     struct {
     44       __u16 target_size;
     45       char name[XT_EXTENSION_MAXNAMELEN];
     46       __u8 revision;
     47     } user;
     48     struct {
     49       __u16 target_size;
     50       struct xt_target * target;
     51     } kernel;
     52     __u16 target_size;
     53   } u;
     54   unsigned char data[0];
     55 };
     56 #define XT_TARGET_INIT(__name,__size) \
     57 {.target.u.user = {.target_size = XT_ALIGN(__size),.name = __name, }, \
     58 }
     59 struct xt_standard_target {
     60   struct xt_entry_target target;
     61   int verdict;
     62 };
     63 struct xt_error_target {
     64   struct xt_entry_target target;
     65   char errorname[XT_FUNCTION_MAXNAMELEN];
     66 };
     67 struct xt_get_revision {
     68   char name[XT_EXTENSION_MAXNAMELEN];
     69   __u8 revision;
     70 };
     71 #define XT_CONTINUE 0xFFFFFFFF
     72 #define XT_RETURN (- NF_REPEAT - 1)
     73 struct _xt_align {
     74   __u8 u8;
     75   __u16 u16;
     76   __u32 u32;
     77   __u64 u64;
     78 };
     79 #define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
     80 #define XT_STANDARD_TARGET ""
     81 #define XT_ERROR_TARGET "ERROR"
     82 #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
     83 #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
     84 struct xt_counters {
     85   __u64 pcnt, bcnt;
     86 };
     87 struct xt_counters_info {
     88   char name[XT_TABLE_MAXNAMELEN];
     89   unsigned int num_counters;
     90   struct xt_counters counters[0];
     91 };
     92 #define XT_INV_PROTO 0x40
     93 #define XT_MATCH_ITERATE(type,e,fn,args...) \
     94 ({ unsigned int __i; int __ret = 0; struct xt_entry_match * __m; for(__i = sizeof(type); __i < (e)->target_offset; __i += __m->u.match_size) { __m = (void *) e + __i; __ret = fn(__m, ##args); if(__ret != 0) break; } __ret; \
     95 })
     96 #define XT_ENTRY_ITERATE_CONTINUE(type,entries,size,n,fn,args...) \
     97 ({ unsigned int __i, __n; int __ret = 0; type * __entry; for(__i = 0, __n = 0; __i < (size); __i += __entry->next_offset, __n ++) { __entry = (void *) (entries) + __i; if(__n < n) continue; __ret = fn(__entry, ##args); if(__ret != 0) break; } __ret; \
     98 })
     99 #define XT_ENTRY_ITERATE(type,entries,size,fn,args...) XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
    100 #define xt_entry_foreach(pos,ehead,esize) for((pos) = (typeof(pos)) (ehead); (pos) < (typeof(pos)) ((char *) (ehead) + (esize)); (pos) = (typeof(pos)) ((char *) (pos) + (pos)->next_offset))
    101 #define xt_ematch_foreach(pos,entry) for((pos) = (struct xt_entry_match *) entry->elems; (pos) < (struct xt_entry_match *) ((char *) (entry) + (entry)->target_offset); (pos) = (struct xt_entry_match *) ((char *) (pos) + (pos)->u.match_size))
    102 #endif
    103