1 // SPDX-License-Identifier: MIT
3 * Copyright 2022-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 #ifndef SIDE_ABI_ATTRIBUTE_H
7 #define SIDE_ABI_ATTRIBUTE_H
10 #include <side/macros.h>
11 #include <side/endian.h>
13 #include <side/abi/type-value.h>
16 * SIDE ABI for description of event and type attributes.
17 * Event and type attributes are an optional array of { key, value }
18 * pairs which can be associated with either an event or a type.
20 * The extensibility scheme for the SIDE ABI for description of event
21 * and type attributes is as follows:
23 * * Existing attribute types are never changed nor extended. Attribute
24 * types can be added to the ABI by reserving a label within
25 * enum side_attr_type.
26 * * Each union part of the ABI has an explicit size defined by a
27 * side_padding() member. Each structure and union have a static
28 * assert validating its size.
29 * * Changing the semantic of the existing attribute type fields is a
30 * breaking ABI change.
32 * Handling of unknown attribute types by the tracers:
34 * * A tracer may choose to support only a subset of the types supported
35 * by libside. When encountering an unknown or unsupported attribute
36 * type, the tracer has the option to either disallow the entire
37 * event, skip over the field containing the unknown attribute, or
38 * skip over the unknown attribute, both at event registration and
39 * when receiving the side_call arguments.
53 SIDE_ATTR_TYPE_FLOAT_BINARY16
,
54 SIDE_ATTR_TYPE_FLOAT_BINARY32
,
55 SIDE_ATTR_TYPE_FLOAT_BINARY64
,
56 SIDE_ATTR_TYPE_FLOAT_BINARY128
,
57 SIDE_ATTR_TYPE_STRING
,
59 _NR_SIDE_ATTR_TYPE
, /* Last entry. */
62 struct side_attr_value
{
63 side_enum_t(enum side_attr_type
, uint32_t) type
;
66 struct side_type_raw_string string_value
;
67 union side_integer_value integer_value
;
68 union side_float_value float_value
;
72 side_check_size(struct side_attr_value
, 36);
75 const struct side_type_raw_string key
;
76 const struct side_attr_value value
;
78 side_check_size(struct side_attr
, 54);
80 #endif /* SIDE_ABI_ATTRIBUTE_H */