+struct perf_event;
+struct perf_event_attr;
+
+/* Type description */
+
+/* Update the astract_types name table in lttng-types.c along with this enum */
+enum abstract_types {
+ atype_integer,
+ atype_enum,
+ atype_array,
+ atype_sequence,
+ atype_string,
+ NR_ABSTRACT_TYPES,
+};
+
+/* Update the string_encodings name table in lttng-types.c along with this enum */
+enum lttng_string_encodings {
+ lttng_encode_none = 0,
+ lttng_encode_UTF8 = 1,
+ lttng_encode_ASCII = 2,
+ NR_STRING_ENCODINGS,
+};
+
+struct lttng_enum_entry {
+ unsigned long long start, end; /* start and end are inclusive */
+ const char *string;
+};
+
+#define __type_integer(_type, _byte_order, _base, _encoding) \
+ { \
+ .atype = atype_integer, \
+ .u.basic.integer = \
+ { \
+ .size = sizeof(_type) * CHAR_BIT, \
+ .alignment = ltt_alignof(_type) * CHAR_BIT, \
+ .signedness = is_signed_type(_type), \
+ .reverse_byte_order = _byte_order != __BYTE_ORDER, \
+ .base = _base, \
+ .encoding = lttng_encode_##_encoding, \
+ }, \
+ } \
+
+struct lttng_integer_type {
+ unsigned int size; /* in bits */
+ unsigned short alignment; /* in bits */
+ unsigned int signedness:1;
+ unsigned int reverse_byte_order:1;
+ unsigned int base; /* 2, 8, 10, 16, for pretty print */
+ enum lttng_string_encodings encoding;
+};
+
+union _lttng_basic_type {
+ struct lttng_integer_type integer;
+ struct {
+ const char *name;
+ } enumeration;
+ struct {
+ enum lttng_string_encodings encoding;
+ } string;
+};
+
+struct lttng_basic_type {
+ enum abstract_types atype;
+ union {
+ union _lttng_basic_type basic;
+ } u;
+};
+
+struct lttng_type {
+ enum abstract_types atype;
+ union {
+ union _lttng_basic_type basic;
+ struct {
+ struct lttng_basic_type elem_type;
+ unsigned int length; /* num. elems. */
+ } array;
+ struct {
+ struct lttng_basic_type length_type;
+ struct lttng_basic_type elem_type;
+ } sequence;
+ } u;
+};
+
+struct lttng_enum {
+ const char *name;
+ struct lttng_type container_type;
+ const struct lttng_enum_entry *entries;
+ unsigned int len;
+};
+
+/* Event field description */
+
+struct lttng_event_field {
+ const char *name;
+ struct lttng_type type;
+};
+
+struct lttng_ctx_field {
+ struct lttng_event_field event_field;
+ size_t (*get_size)(size_t offset);
+ void (*record)(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan);
+ union {
+ struct {
+ struct perf_event **e; /* per-cpu array */
+ struct list_head head;
+ struct perf_event_attr *attr;
+ } perf_counter;
+ } u;
+ void (*destroy)(struct lttng_ctx_field *field);
+};
+
+struct lttng_ctx {
+ struct lttng_ctx_field *fields;
+ unsigned int nr_fields;
+ unsigned int allocated_fields;
+};
+
+struct lttng_event_desc {
+ const char *name;
+ void *probe_callback;
+ const struct lttng_event_ctx *ctx; /* context */
+ const struct lttng_event_field *fields; /* event payload */
+ unsigned int nr_fields;
+ struct module *owner;
+};
+
+struct lttng_probe_desc {
+ const struct lttng_event_desc *event_desc;
+ unsigned int nr_events;
+ struct list_head head; /* chain registered probes */
+};