actf 0.0.1
An acute CTF reader
Loading...
Searching...
No Matches
/home/adwe/code/actf/fld_cls.h File Reference

Field class related methods. More...

#include "flags.h"
#include "fld_loc.h"
#include "mappings.h"
#include "rng.h"
#include "types.h"

Go to the source code of this file.

Enumerations

enum  actf_role {
  ACTF_ROLE_NIL = 0 , ACTF_ROLE_DSTREAM_CLS_ID = (1 << 0) , ACTF_ROLE_DSTREAM_ID = (1 << 1) , ACTF_ROLE_PKT_MAGIC_NUM = (1 << 2) ,
  ACTF_ROLE_METADATA_STREAM_UUID = (1 << 3) , ACTF_ROLE_DEF_CLK_TSTAMP = (1 << 4) , ACTF_ROLE_DISC_EVENT_CNT_SNAPSHOT = (1 << 5) , ACTF_ROLE_PKT_CONTENT_LEN = (1 << 6) ,
  ACTF_ROLE_PKT_END_DEF_CLK_TSTAMP = (1 << 7) , ACTF_ROLE_PKT_SEQ_NUM = (1 << 8) , ACTF_ROLE_PKT_TOT_LEN = (1 << 9) , ACTF_ROLE_EVENT_CLS_ID = (1 << 10)
}
 The possible roles of a field class. More...
enum  actf_fld_cls_type {
  ACTF_FLD_CLS_NIL , ACTF_FLD_CLS_FXD_LEN_BIT_ARR , ACTF_FLD_CLS_FXD_LEN_BIT_MAP , ACTF_FLD_CLS_FXD_LEN_UINT ,
  ACTF_FLD_CLS_FXD_LEN_SINT , ACTF_FLD_CLS_FXD_LEN_BOOL , ACTF_FLD_CLS_FXD_LEN_FLOAT , ACTF_FLD_CLS_VAR_LEN_UINT ,
  ACTF_FLD_CLS_VAR_LEN_SINT , ACTF_FLD_CLS_NULL_TERM_STR , ACTF_FLD_CLS_STATIC_LEN_STR , ACTF_FLD_CLS_DYN_LEN_STR ,
  ACTF_FLD_CLS_STATIC_LEN_BLOB , ACTF_FLD_CLS_DYN_LEN_BLOB , ACTF_FLD_CLS_STRUCT , ACTF_FLD_CLS_STATIC_LEN_ARR ,
  ACTF_FLD_CLS_DYN_LEN_ARR , ACTF_FLD_CLS_OPTIONAL , ACTF_FLD_CLS_VARIANT , ACTF_N_FLD_CLSES
}
 A field class type.

Functions

enum actf_fld_cls_type actf_fld_cls_type (const actf_fld_cls *fc)
 Get the type of a field class.
size_t actf_fld_cls_len (const actf_fld_cls *fc)
 Get the length property of the field class.
enum actf_byte_order actf_fld_cls_byte_order (const actf_fld_cls *fc)
 Get the byte order property of the field class.
enum actf_bit_order actf_fld_cls_bit_order (const actf_fld_cls *fc)
 Get the bit order property of the field class.
size_t actf_fld_cls_alignment (const actf_fld_cls *fc)
 Get the alignment property of the field class.
const actf_flagsactf_fld_cls_bit_map_flags (const actf_fld_cls *fc)
 Get the flags of the field class.
enum actf_base actf_fld_cls_pref_display_base (const actf_fld_cls *fc)
 Get the preferred display base of the field class.
const actf_mappingsactf_fld_cls_mappings (const actf_fld_cls *fc)
 Get any available mappings of the field class.
enum actf_role actf_fld_cls_roles (const actf_fld_cls *fc)
 Get the roles of the field class.
enum actf_encoding actf_fld_cls_encoding (const actf_fld_cls *fc)
 Get the character encoding of the field class.
const char * actf_fld_cls_media_type (const actf_fld_cls *fc)
 Get the IANA media type of the field class.
const actf_fld_locactf_fld_cls_len_fld_loc (const actf_fld_cls *fc)
 Get the field location denoting length of the field class.
uint64_t actf_fld_cls_min_alignment (const actf_fld_cls *fc)
 Get the minimum alignment property of the field class.
size_t actf_fld_cls_members_len (const actf_fld_cls *fc)
 Get the number of members of the struct field class.
const char * actf_fld_cls_members_name_idx (const actf_fld_cls *fc, size_t i)
 Get the name of the member with the specified index of the struct field class.
const actf_fld_clsactf_fld_cls_members_fld_cls_idx (const actf_fld_cls *fc, size_t i)
 Get the field class of the member with the specified index of the struct field class.
const actf_fldactf_fld_cls_members_attributes_idx (const actf_fld_cls *fc, size_t i)
 Get the attributes of the member with the specified index of the struct field class.
const actf_fldactf_fld_cls_members_extensions_idx (const actf_fld_cls *fc, size_t i)
 Get the extensions of the member with the specified index of the struct field class.
const actf_fld_clsactf_fld_cls_element_fld_cls (const actf_fld_cls *fc)
 Get the element field class of the field class.
const actf_fld_locactf_fld_cls_selector_fld_loc (const actf_fld_cls *fc)
 Get the field location denoting selector field of the field class.
const actf_rng_setactf_fld_cls_selector_rng_set (const actf_fld_cls *fc)
 Get the selector ranges which determine if an optional field is enabled or not when the selector field is an integer.
const actf_fld_clsactf_fld_cls_optional_fld_cls (const actf_fld_cls *fc)
 Get a the conditional field class of an optional field class.
size_t actf_fld_cls_options_len (const actf_fld_cls *fc)
 Get the number of options of the variant field class.
const char * actf_fld_cls_options_name_idx (const actf_fld_cls *fc, size_t i)
 Get the name of the option with the specified index of the variant field class.
const actf_fld_clsactf_fld_cls_options_fld_cls_idx (const actf_fld_cls *fc, size_t i)
 Get the field class of the option with the specified index of the variant field class.
const actf_rng_setactf_fld_cls_options_selector_rng_set_idx (const actf_fld_cls *fc, size_t i)
 Get the selector range set of the option with the specified index of the variant field class.
const actf_fldactf_fld_cls_options_attributes_idx (const actf_fld_cls *fc, size_t i)
 Get the attributes of the option with the specified index of the variant field class.
const actf_fldactf_fld_cls_options_extensions_idx (const actf_fld_cls *fc, size_t i)
 Get the extensions of the option with the specified index of the variant field class.
const char * actf_fld_cls_aliased_name (const actf_fld_cls *fc)
 Get the alias of the field class.
const actf_fldactf_fld_cls_attributes (const actf_fld_cls *fc)
 Get the attributes of the field class.
const actf_fldactf_fld_cls_extensions (const actf_fld_cls *fc)
 Get the extensions of the field class.

Detailed Description

Field class related methods.

Enumeration Type Documentation

◆ actf_role

enum actf_role

The possible roles of a field class.

A field class can have multiple roles ORed together.

Function Documentation

◆ actf_fld_cls_type()

Get the type of a field class.

Parameters
fcthe field class
Returns
the type

◆ actf_fld_cls_len()

size_t actf_fld_cls_len ( const actf_fld_cls * fc)

Get the length property of the field class.

The following field classes return length in bits:

  • ACTF_FLD_CLS_FXD_LEN_BIT_ARR
  • ACTF_FLD_CLS_FXD_LEN_BIT_MAP
  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_FXD_LEN_BOOL
  • ACTF_FLD_CLS_FXD_LEN_FLOAT

The following field classes return length in bytes:

  • ACTF_FLD_CLS_STATIC_LEN_BLOB
  • ACTF_FLD_CLS_STATIC_LEN_STR

The following field class returns the number of element fields:

  • ACTF_FLD_CLS_STATIC_LEN_ARR

Any other field class returns 0.

Parameters
fcthe field class
Returns
the length

◆ actf_fld_cls_byte_order()

enum actf_byte_order actf_fld_cls_byte_order ( const actf_fld_cls * fc)

Get the byte order property of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_BIT_ARR
  • ACTF_FLD_CLS_FXD_LEN_BIT_MAP
  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_FXD_LEN_BOOL
  • ACTF_FLD_CLS_FXD_LEN_FLOAT

Any other field class returns ACTF_LIL_ENDIAN.

Parameters
fcthe field class
Returns
the byte order

◆ actf_fld_cls_bit_order()

enum actf_bit_order actf_fld_cls_bit_order ( const actf_fld_cls * fc)

Get the bit order property of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_BIT_ARR
  • ACTF_FLD_CLS_FXD_LEN_BIT_MAP
  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_FXD_LEN_BOOL
  • ACTF_FLD_CLS_FXD_LEN_FLOAT

Any other field class returns ACTF_FIRST_TO_LAST.

Parameters
fcthe field class
Returns
the bit order

◆ actf_fld_cls_alignment()

size_t actf_fld_cls_alignment ( const actf_fld_cls * fc)

Get the alignment property of the field class.

This is not the same as the effective alignment requirement of a field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_BIT_ARR
  • ACTF_FLD_CLS_FXD_LEN_BIT_MAP
  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_FXD_LEN_BOOL
  • ACTF_FLD_CLS_FXD_LEN_FLOAT

Any other field class returns 0.

Parameters
fcthe field class
Returns
the alignment

◆ actf_fld_cls_bit_map_flags()

const actf_flags * actf_fld_cls_bit_map_flags ( const actf_fld_cls * fc)

Get the flags of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_BIT_MAP

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the flags

◆ actf_fld_cls_pref_display_base()

enum actf_base actf_fld_cls_pref_display_base ( const actf_fld_cls * fc)

Get the preferred display base of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_VAR_LEN_UINT
  • ACTF_FLD_CLS_VAR_LEN_SINT

Any other field class returns ACTF_BASE_DECIMAL.

Parameters
fcthe field class
Returns
the preferred display base

◆ actf_fld_cls_mappings()

const actf_mappings * actf_fld_cls_mappings ( const actf_fld_cls * fc)

Get any available mappings of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_SINT
  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_VAR_LEN_SINT
  • ACTF_FLD_CLS_VAR_LEN_UINT

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the mappings

◆ actf_fld_cls_roles()

enum actf_role actf_fld_cls_roles ( const actf_fld_cls * fc)

Get the roles of the field class.

Applicable to:

  • ACTF_FLD_CLS_FXD_LEN_UINT
  • ACTF_FLD_CLS_STATIC_LEN_BLOB
  • ACTF_FLD_CLS_VAR_LEN_UINT

Any other field class returns ACTF_ROLE_NIL.

Parameters
fcthe field class
Returns
the roles

◆ actf_fld_cls_encoding()

enum actf_encoding actf_fld_cls_encoding ( const actf_fld_cls * fc)

Get the character encoding of the field class.

Applicable to:

  • ACTF_FLD_CLS_NULL_TERM_STR
  • ACTF_FLD_CLS_STATIC_LEN_STR
  • ACTF_FLD_CLS_DYN_LEN_STR

Any other field class returns ACTF_ENCODING_UTF8.

Parameters
fcthe field class
Returns
the character encoding

◆ actf_fld_cls_media_type()

const char * actf_fld_cls_media_type ( const actf_fld_cls * fc)

Get the IANA media type of the field class.

Applicable to:

  • ACTF_FLD_CLS_STATIC_LEN_BLOB
  • ACTF_FLD_CLS_DYN_LEN_BLOB

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the media type

◆ actf_fld_cls_len_fld_loc()

const actf_fld_loc * actf_fld_cls_len_fld_loc ( const actf_fld_cls * fc)

Get the field location denoting length of the field class.

Applicable to:

  • ACTF_FLD_CLS_DYN_LEN_STR
  • ACTF_FLD_CLS_DYN_LEN_BLOB
  • ACTF_FLD_CLS_DYN_LEN_ARR

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the length field location

◆ actf_fld_cls_min_alignment()

uint64_t actf_fld_cls_min_alignment ( const actf_fld_cls * fc)

Get the minimum alignment property of the field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT
  • ACTF_FLD_CLS_STATIC_LEN_ARR
  • ACTF_FLD_CLS_DYN_LEN_ARR

Any other field class returns 0.

Parameters
fcthe field class
Returns
the minimum alignment

◆ actf_fld_cls_members_len()

size_t actf_fld_cls_members_len ( const actf_fld_cls * fc)

Get the number of members of the struct field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT

Any other field class returns 0.

Parameters
fcthe field class
Returns
the number of members

◆ actf_fld_cls_members_name_idx()

const char * actf_fld_cls_members_name_idx ( const actf_fld_cls * fc,
size_t i )

Get the name of the member with the specified index of the struct field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the member name

◆ actf_fld_cls_members_fld_cls_idx()

const actf_fld_cls * actf_fld_cls_members_fld_cls_idx ( const actf_fld_cls * fc,
size_t i )

Get the field class of the member with the specified index of the struct field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the member field class

◆ actf_fld_cls_members_attributes_idx()

const actf_fld * actf_fld_cls_members_attributes_idx ( const actf_fld_cls * fc,
size_t i )

Get the attributes of the member with the specified index of the struct field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the member attributes

◆ actf_fld_cls_members_extensions_idx()

const actf_fld * actf_fld_cls_members_extensions_idx ( const actf_fld_cls * fc,
size_t i )

Get the extensions of the member with the specified index of the struct field class.

Applicable to:

  • ACTF_FLD_CLS_STRUCT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the member extensions

◆ actf_fld_cls_element_fld_cls()

const actf_fld_cls * actf_fld_cls_element_fld_cls ( const actf_fld_cls * fc)

Get the element field class of the field class.

Applicable to:

  • ACTF_FLD_CLS_STATIC_LEN_ARR
  • ACTF_FLD_CLS_DYN_LEN_ARR

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the element field class

◆ actf_fld_cls_selector_fld_loc()

const actf_fld_loc * actf_fld_cls_selector_fld_loc ( const actf_fld_cls * fc)

Get the field location denoting selector field of the field class.

Applicable to:

  • ACTF_FLD_CLS_OPTIONAL
  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the selector field location

◆ actf_fld_cls_selector_rng_set()

const actf_rng_set * actf_fld_cls_selector_rng_set ( const actf_fld_cls * fc)

Get the selector ranges which determine if an optional field is enabled or not when the selector field is an integer.

The range set will be empty if the selector field is a boolean.

Applicable to:

  • ACTF_FLD_CLS_OPTIONAL

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the selector range set

◆ actf_fld_cls_optional_fld_cls()

const actf_fld_cls * actf_fld_cls_optional_fld_cls ( const actf_fld_cls * fc)

Get a the conditional field class of an optional field class.

Applicable to:

  • ACTF_FLD_CLS_OPTIONAL

Any other field class returns NULL.

Parameters
fcthe field class
Returns
the optional field class

◆ actf_fld_cls_options_len()

size_t actf_fld_cls_options_len ( const actf_fld_cls * fc)

Get the number of options of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns 0.

Parameters
fcthe field class
Returns
the number of options

◆ actf_fld_cls_options_name_idx()

const char * actf_fld_cls_options_name_idx ( const actf_fld_cls * fc,
size_t i )

Get the name of the option with the specified index of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the option's name

◆ actf_fld_cls_options_fld_cls_idx()

const actf_fld_cls * actf_fld_cls_options_fld_cls_idx ( const actf_fld_cls * fc,
size_t i )

Get the field class of the option with the specified index of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the option's field class

◆ actf_fld_cls_options_selector_rng_set_idx()

const actf_rng_set * actf_fld_cls_options_selector_rng_set_idx ( const actf_fld_cls * fc,
size_t i )

Get the selector range set of the option with the specified index of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the option's selector range set

◆ actf_fld_cls_options_attributes_idx()

const actf_fld * actf_fld_cls_options_attributes_idx ( const actf_fld_cls * fc,
size_t i )

Get the attributes of the option with the specified index of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the option's attributes or NULL

◆ actf_fld_cls_options_extensions_idx()

const actf_fld * actf_fld_cls_options_extensions_idx ( const actf_fld_cls * fc,
size_t i )

Get the extensions of the option with the specified index of the variant field class.

Applicable to:

  • ACTF_FLD_CLS_VARIANT

Any other field class returns NULL.

Parameters
fcthe field class
ithe index
Returns
the option's extensions or NULL

◆ actf_fld_cls_aliased_name()

const char * actf_fld_cls_aliased_name ( const actf_fld_cls * fc)

Get the alias of the field class.

Applicable to ALL field classes.

Parameters
fcthe field class
Returns
the alias or NULL

◆ actf_fld_cls_attributes()

const actf_fld * actf_fld_cls_attributes ( const actf_fld_cls * fc)

Get the attributes of the field class.

Applicable to ALL field classes.

Parameters
fcthe field class
Returns
the attributes or NULL

◆ actf_fld_cls_extensions()

const actf_fld * actf_fld_cls_extensions ( const actf_fld_cls * fc)

Get the extensions of the field class.

Applicable to ALL field classes.

Parameters
fcthe field class
Returns
the extensions or NULL