Debian Codegraph @

docs/modules/yaml/pages/enum-ft-obj.adoc

raw
1 = YAML enumeration field type objects
2
3 _**Enumeration field type objects**_ are the types of enumeration data
4 fields, found in xref:how-barectf-works:ctf-primer.adoc#ds[data
5 streams].
6
7 An enumeration data field is an integer data field.
8
9 An enumeration field type is an integer field type with
10 <<mappings-prop,_mappings_>>. An enumeration field type mapping is a
11 labeled set of integer ranges. An enumeration data field can have zero
12 or more labels depending on its value.
13
14 [[props]]
15 == Properties
16
17 [%autowidth.stretch, cols="d,d,a,d,a", role="can-break"]
18 |===
19 |Name |Type |Description |{req-abbr} |Default
20
21 |[[class-prop]]`class`
22 |String
23 |This property's value must be one of:
24
25 `unsigned-enumeration`::
26 `unsigned-enum`::
27 `uenum`::
28 Unsigned enumeration field type
29
30 `signed-enumeration`::
31 `signed-enum`::
32 `senum`::
33 Signed enumeration field type
34 |Yes if the <<inherit-prop,`$inherit`>> property is not set.
35 |
36
37 include::partial$int-ft-obj-base-props.adoc[]
38
39 |[[mappings-prop]]`mappings`
40 |Mapping of string keys to
41 <<enum-ft-mapping-seq,enumeration field type mapping sequences>>
42 |Mappings of this enumeration field type.
43
44 Each mapping assigns a label to a set of integer ranges.
45
46 This mapping must contain at least one entry.
47 |Yes
48 |
49 |===
50
51 [[enum-ft-mapping-seq]]
52 == Enumeration field type mapping sequence
53
54 A YAML sequence of integer ranges, which can be:
55
56 A sequence of two integers::
57 The first integer is the range's lower value (included).
58 +
59 The second integer is the range's upper value (included).
60
61 An integer::
62 This is equivalent to a sequence of two identical integers.
63 +
64 In other words, `17` is equivalent to `+[17, 17]+`.
65
66 This sequence must contain at least one item.
67
68 == Generated C{nbsp}types
69
70 include::partial$int-ft-obj-c-types-table.adoc[]
71
72 == Examples
73
74 .Basic <<size-prop,8-bit>> unsigned enumeration field type object with a single <<mappings-prop,mapping>>
75 ====
76 [source,yaml]
77 ----
78 class: unsigned-enumeration
79 size: 8
80 mappings:
81 A: [0]
82 ----
83 ====
84
85 .<<size-prop,23-bit>> signed enumeration field type object with simple <<mappings-prop,mappings>>.
86 ====
87 [source,yaml]
88 ----
89 class: signed-enumeration
90 size: 23
91 mappings:
92 A: [2]
93 B: [5]
94 C: [9]
95 ----
96 ====
97
98 .32-bit-<<align-prop,aligned>> <<size-prop,16-bit>> signed enumeration field type object with <<mappings-prop,mappings>>.
99 ====
100 [source,yaml]
101 ----
102 class: signed-enumeration
103 size: 16
104 alignment: 32
105 mappings:
106 RUNNING:
107 - 17
108 - [19, 24]
109 - -144
110 WAITING:
111 - 18
112 - [-32, -25]
113 STOPPED: [202]
114 ----
115 ====
116
117 .<<size-prop,32-bit>> unsigned enumeration field type object with a hexadecimal <<pref-disp-base-prop,preferred display base>> and <<mappings-prop,mappings>>.
118 ====
119 [source,yaml]
120 ----
121 class: unsigned-enumeration
122 size: 32
123 preferred-display-base: hexadecimal
124 mappings:
125 steam-machine: [18]
126 on/off:
127 - 15
128 - [200, 1000]
129 the-prime-time-of-your-life: [2]
130 ----
131 ====