Skip to content

Structure type object

Philippe Proulx edited this page Sep 10, 2020 · 3 revisions

A CTF structure type, i.e. a list of fields, each field having a name and a CTF type.

See also: Type object.

Properties

Property Type Description Required? Default value
class String Set to struct or structure Required N/A
min-align Integer (positive) Minimum alignment (bits) (power of two) Optional 1
fields Associative array of field names (string) to Type objects or strings (alias names) Structure type's fields Optional {}

All the properties which have a default value can also be set to null to force this default value. This is especially useful when also using type inheritance or when including external YAML files.

The order of the entries in the fields property is important; it is in this order that the fields are serialized in binary streams.

A given structure field type's field's type can only refer to the following type objects:

Example

class: struct
min-align: 32
fields:
  msg_id: uint8
  src:
    class: string
  dst:
    class: string
  dst_ip_addr:
    class: array
    length: 4
    element-type: uint8
  dst_mac_addr:
    class: array
    length: 6
    element-type: uint8