Type object

Philippe Proulx edited this page Mar 23, 2016 · 2 revisions

Type objects represent CTF types.

Type objects are used at various places in the YAML configuration file:

  • As the properties of the type-aliases property of the metadata object
  • As the packet-header-type property of the trace object
  • As the packet-context-type, event-header-type, and event-context-type properties of a stream object
  • As the context-type and payload-type properties of an event object

Common properties

Property Type Description Required? Default value
class String Type class Required if $inherit property is absent N/A
$inherit String Name of type alias from which to inherit properties Required if class property is absent N/A

The accepted values for the class property are:

class property value CTF type Type object
int
integer
Integer type Integer type object
flt
float
floating-point
Floating point number type Floating point number type object
enum
enumeration
Enumeration type Enumeration type object
str
string
String type String type object
struct
structure
Structure type Structure type object
array Array or sequence type Array type object
var
variant
Variant type Variant type object

Type inheritance

The $inherit property accepts the name of any previously defined type alias. Any properyy in a type object that inherits from another type object overrides the base properties as follows:

  • Booleans, numbers, and strings:
    • Property exists in base object: base property is replaced by child property
    • Property does not exist in base object: child property is appended to base object
  • Arrays:
    • Property exists in base object: child array elements are appended to base array
    • Property does not exist in base object: child property is appended to base object
  • Associative arrays:
    • Property exists in base object: child associative array properties that exist in base assocative array replace them, and new child associative array properties are appended to base associative array
    • Property does not exist in base object: child property is appended to base object