netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
datatype.h File Reference
This graph shows which files directly or indirectly include this file:

Data Structures

struct  datatype
 
struct  symbolic_constant
 struct symbolic_constant - symbol <-> constant mapping More...
 
struct  symbol_table
 struct symbol_table - type construction from symbolic values More...
 

Macros

#define TYPE_MAX   (__TYPE_MAX - 1)
 
#define TYPE_BITS   6
 
#define TYPE_MASK   ((1 << TYPE_BITS) - 1)
 

Enumerations

enum  datatypes {
  TYPE_INVALID,
  TYPE_VERDICT,
  TYPE_NFPROTO,
  TYPE_BITMASK,
  TYPE_INTEGER,
  TYPE_STRING,
  TYPE_LLADDR,
  TYPE_IPADDR,
  TYPE_IP6ADDR,
  TYPE_ETHERADDR,
  TYPE_ETHERTYPE,
  TYPE_ARPOP,
  TYPE_INET_PROTOCOL,
  TYPE_INET_SERVICE,
  TYPE_ICMP_TYPE,
  TYPE_TCP_FLAG,
  TYPE_DCCP_PKTTYPE,
  TYPE_MH_TYPE,
  TYPE_TIME,
  TYPE_MARK,
  TYPE_IFINDEX,
  TYPE_ARPHRD,
  TYPE_REALM,
  TYPE_TC_HANDLE,
  TYPE_UID,
  TYPE_GID,
  TYPE_CT_STATE,
  TYPE_CT_DIR,
  TYPE_CT_STATUS,
  TYPE_ICMP6_TYPE,
  TYPE_CT_LABEL,
  TYPE_PKTTYPE,
  TYPE_ICMP_CODE,
  TYPE_ICMPV6_CODE,
  TYPE_ICMPX_CODE,
  TYPE_DEVGROUP,
  __TYPE_MAX
}
 enum datatypes More...
 
enum  byteorder {
  BYTEORDER_INVALID,
  BYTEORDER_HOST_ENDIAN,
  BYTEORDER_BIG_ENDIAN
}
 enum byteorder More...
 
enum  datatype_flags {
  DTYPE_F_ALLOC = (1 << 0),
  DTYPE_F_PREFIX = (1 << 1)
}
 enum datatype_flags More...
 

: type name

struct datatype

: numeric identifier : byteorder of type (non-basetypes only) : flags : type size (fixed sized non-basetypes only) : number of subtypes (concat type)

: type description : basetype for subtypes, determines type compatibilty : format string for basetype : function to print a constant of this type : function to parse a symbol and return an expression : symbol table for this type

#define SYMBOL(id, v)   { .identifier = (id), .value = (v) }
 
#define SYMBOL_LIST_END   (struct symbolic_constant) { }
 
const struct datatype invalid_type
 
const struct datatype verdict_type
 
const struct datatype nfproto_type
 
const struct datatype bitmask_type
 
const struct datatype integer_type
 
const struct datatype string_type
 
const struct datatype lladdr_type
 
const struct datatype ipaddr_type
 
const struct datatype ip6addr_type
 
const struct datatype etheraddr_type
 
const struct datatype ethertype_type
 
const struct datatype arphrd_type
 
const struct datatype inet_protocol_type
 
const struct datatype inet_service_type
 
const struct datatype mark_type
 
const struct datatype icmp_code_type
 
const struct datatype icmpv6_code_type
 
const struct datatype icmpx_code_type
 
const struct datatype time_type
 
void datatype_register (const struct datatype *dtype)
 
const struct datatypedatatype_lookup (enum datatypes type)
 
const struct datatypedatatype_lookup_byname (const char *name)
 
struct error_recordsymbol_parse (const struct expr *sym, struct expr **res)
 
void datatype_print (const struct expr *expr)
 
struct error_recordsymbolic_constant_parse (const struct expr *sym, const struct symbol_table *tbl, struct expr **res)
 
void symbolic_constant_print (const struct symbol_table *tbl, const struct expr *expr)
 
void symbol_table_print (const struct symbol_table *tbl, const struct datatype *dtype)
 
struct symbol_tablert_symbol_table_init (const char *filename)
 
void rt_symbol_table_free (struct symbol_table *tbl)
 
const struct datatypeconcat_type_alloc (uint32_t type)
 
void concat_type_destroy (const struct datatype *dtype)
 

Macro Definition Documentation

#define SYMBOL (   id,
 
)    { .identifier = (id), .value = (v) }
#define SYMBOL_LIST_END   (struct symbolic_constant) { }

Referenced by rt_symbol_table_init().

#define TYPE_BITS   6

Referenced by concat_type_alloc().

#define TYPE_MASK   ((1 << TYPE_BITS) - 1)

Referenced by datatype_register().

#define TYPE_MAX   (__TYPE_MAX - 1)

Enumeration Type Documentation

enum byteorder

enum byteorder

: uninitialized/unknown : host endian : big endian

Enumerator
BYTEORDER_INVALID 
BYTEORDER_HOST_ENDIAN 
BYTEORDER_BIG_ENDIAN 

enum datatype_flags

: datatype is dynamically allocated : preferred representation for ranges is a prefix

Enumerator
DTYPE_F_ALLOC 
DTYPE_F_PREFIX 
enum datatypes

enum datatypes

: uninitialized : nftables verdict : netfilter protocol (integer subtype) : bitmask : integer : string : link layer address (integer subtype) : IPv4 address (integer subtype) : IPv6 address (integer subtype) : Ethernet address (lladdr subtype) : EtherType (integer subtype) : ARP operation (integer subtype) : internet protocol (integer subtype) : internet service (integer subtype) : ICMP type codes (integer subtype) : TCP flag (bitmask subtype) : DCCP packet type (integer subtype) : Mobility Header type (integer subtype) : relative time : packet mark (integer subtype) : interface index (integer subtype) : interface type (integer subtype) : routing realm (integer subtype) : TC handle (integer subtype) : user ID (integer subtype) : group ID (integer subtype) : conntrack state (bitmask subtype) : conntrack direction : conntrack status (bitmask subtype) : ICMPv6 type codes (integer subtype) : Conntrack Label (bitmask subtype) : packet type (integer subtype) : icmp code (integer subtype) : icmpv6 code (integer subtype) : icmpx code (integer subtype) : devgroup code (integer subtype)

Enumerator
TYPE_INVALID 
TYPE_VERDICT 
TYPE_NFPROTO 
TYPE_BITMASK 
TYPE_INTEGER 
TYPE_STRING 
TYPE_LLADDR 
TYPE_IPADDR 
TYPE_IP6ADDR 
TYPE_ETHERADDR 
TYPE_ETHERTYPE 
TYPE_ARPOP 
TYPE_INET_PROTOCOL 
TYPE_INET_SERVICE 
TYPE_ICMP_TYPE 
TYPE_TCP_FLAG 
TYPE_DCCP_PKTTYPE 
TYPE_MH_TYPE 
TYPE_TIME 
TYPE_MARK 
TYPE_IFINDEX 
TYPE_ARPHRD 
TYPE_REALM 
TYPE_TC_HANDLE 
TYPE_UID 
TYPE_GID 
TYPE_CT_STATE 
TYPE_CT_DIR 
TYPE_CT_STATUS 
TYPE_ICMP6_TYPE 
TYPE_CT_LABEL 
TYPE_PKTTYPE 
TYPE_ICMP_CODE 
TYPE_ICMPV6_CODE 
TYPE_ICMPX_CODE 
TYPE_DEVGROUP 
__TYPE_MAX 

Function Documentation

const struct datatype* concat_type_alloc ( uint32_t  type)
void concat_type_destroy ( const struct datatype dtype)
const struct datatype* datatype_lookup ( enum datatypes  type)

References NULL, type, and TYPE_MAX.

const struct datatype* datatype_lookup_byname ( const char *  name)
void datatype_print ( const struct expr expr)

References datatype::basetype, BUG, expr::dtype, datatype::name, NULL, datatype::print, datatype::sym_tbl, and symbolic_constant_print().

Here is the call graph for this function:

void datatype_register ( const struct datatype dtype)
void rt_symbol_table_free ( struct symbol_table tbl)
struct symbol_table* rt_symbol_table_init ( const char *  filename)
struct error_record* symbol_parse ( const struct expr sym,
struct expr **  res 
)
void symbol_table_print ( const struct symbol_table tbl,
const struct datatype dtype 
)

References BITS_PER_BYTE, symbolic_constant::identifier, NULL, s, datatype::size, size, symbol_table::symbols, and symbolic_constant::value.

Referenced by expr_describe().

Here is the caller graph for this function:

struct error_record* symbolic_constant_parse ( const struct expr sym,
const struct symbol_table tbl,
struct expr **  res 
)
void symbolic_constant_print ( const struct symbol_table tbl,
const struct expr expr 
)

References BITS_PER_BYTE, expr::byteorder, expr_basetype(), symbolic_constant::identifier, expr::len, mpz_export_data(), NULL, datatype::print, s, symbol_table::symbols, symbolic_constant::value, and expr::value.

Referenced by datatype_print().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const struct datatype arphrd_type

Referenced by payload_gen_dependency().

const struct datatype bitmask_type
const struct datatype etheraddr_type
const struct datatype ethertype_type
const struct datatype icmp_code_type
const struct datatype icmpv6_code_type
const struct datatype icmpx_code_type
const struct datatype inet_protocol_type
const struct datatype inet_service_type

Referenced by ct_expr_update_type().

const struct datatype integer_type
const struct datatype ip6addr_type

Referenced by ct_expr_update_type().

const struct datatype lladdr_type
const struct datatype mark_type
const struct datatype nfproto_type
const struct datatype string_type
const struct datatype time_type
const struct datatype verdict_type