File: struct-ft-obj.adoc

package info (click to toggle)
barectf 3.1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,840 kB
  • sloc: python: 3,781; ansic: 1,585; makefile: 45; sh: 11
file content (130 lines) | stat: -rw-r--r-- 2,933 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
= YAML structure field type objects

A _**structure field type object**_ is the type of structure data
fields, found in xref:how-barectf-works:ctf-primer.adoc#ds[data
streams].

A structure data field is a sequence of named data fields, or
_members_. In CTF, the names of those members are found in the
xref:how-barectf-works:ctf-primer.adoc#trace[metadata stream].

[[props]]
== Properties

[%autowidth.stretch, cols="d,a,a,d,a"]
|===
|Name |Type |Description |{req-abbr} |Default

|[[class-prop]]`class`
|String
|This property's value must be one of:

* `structure`
* `struct`
|Yes if the <<inherit-prop,`$inherit`>> property is not set.
|

include::partial$ft-obj-inherit-prop.adoc[]
|

|[[min-align-prop]]`minimum-alignment`
|Power-of-two integer
|_Minimum_ alignment of the first bit of this field type's instances
within a xref:how-barectf-works:ctf-primer.adoc#pkt[CTF{nbsp}packet]
(bits).
|No
|1

|[[members-prop]]`members`
|Sequence of mappings, where each mapping has a single entry:

Key::
    Member's name.

Value::
    <<struct-ft-member-obj,Structure field type member object>>
    or string.

This sequence is considered to be an _ordered mapping_, similar to
YAML's https://yaml.org/type/omap.html[`+!!omap+`] type. Therefore,
each mapping key must be unique.
|Members of this structure field type.

If a mapping's value is a string, it must be the name of an existing
xref:trace-type-obj.adoc#ft-aliases-prop[field type alias]. This
field type must _not_ be a structure field type.
|No
|No members
|===

[[struct-ft-member-obj]]
== Structure field type member object

A member within a structure field type object.

=== Properties

[%autowidth.stretch, cols="d,d,a,d"]
|===
|Name |Type |Description |{req-abbr}

|[[member-ft-prop]]`field-type`
|xref:ft-obj.adoc[Field type object] (except a structure field type
object) or string
|Member's field type.

If this property's value is a string, it must be the name of an existing
xref:trace-type-obj.adoc#ft-aliases-prop[field type alias]. This
field type must _not_ be a structure field type.
|Yes
|===

== Examples

.Basic structure field type object with no <<members-prop,members>>.
====
[source,yaml]
----
class: structure
----
====

.Structure field type object with three <<members-prop,members>> using xref:trace-type-obj.adoc#ft-aliases-prop[field type aliases].
====
[source,yaml]
----
class: structure
members:
  - msg: string
  - msg_id: uint32
  - src_ip_addr: ipv4
----
====

.Structure field type object with one <<struct-ft-member-obj,member object>>.
====
[source,yaml]
----
class: structure
members:
  - msg: string
  - msg_id:
      field-type:
        class: unsigned-integer
        size: 32
  - src_ip_addr: ipv4
----
====

.Structure field type object with an explicit <<min-align-prop,minimum alignment>>.
====
[source,yaml]
----
class: structure
minimum-alignment: 64
members:
  - msg: string
  - msg_id: uint32
  - src_ip_addr: ipv4
----
====