Fix: liblttng-ctl comm: lttng_event_field is not packed
[lttng-tools.git] / include / lttng / event-internal.h
index e3aceaa703ac62a9f70e7df72bbcb96dd1e1b7fd..898609879d5107bd4af71ef61a28a66008db23ba 100644 (file)
@@ -77,6 +77,64 @@ struct lttng_event_function_attr_comm {
        char payload[];
 } LTTNG_PACKED;
 
+struct lttng_event_context_comm {
+       uint32_t type;
+       /*
+        * Depending on the type.
+        * For:
+        *  - LTTNG_EVENT_CONTEXT_APP_CONTEXT.
+        *
+        *  -> struct lttng_event_context_app_comm
+        *
+        * For
+        *  - LTTNG_EVENT_CONTEXT_PERF_COUNTER,
+        *  - LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER,
+        *  - LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER.
+        *
+        *  -> struct lttng_event_context_perf_counter_comm
+        *
+        *  Other type -> no payload.
+        */
+       char payload[];
+} LTTNG_PACKED;
+
+struct lttng_event_context_perf_counter_comm {
+       uint32_t type;
+       uint64_t config;
+       /* Includes terminator `\0`. */
+       uint32_t name_len;
+       /*
+        * char name [name_len]
+        */
+       char payload[];
+} LTTNG_PACKED;
+
+struct lttng_event_context_app_comm {
+       /* Includes terminator `\0`. */
+       uint32_t provider_name_len;
+       /* Includes terminator `\0`. */
+       uint32_t ctx_name_len;
+       /*
+        * provider name [provider_name_len]
+        * ctx name [ctx_name_len]
+        */
+       char payload[];
+} LTTNG_PACKED;
+
+struct lttng_event_field_comm {
+       uint8_t type;
+       uint8_t nowrite;
+       /* Includes terminator `\0`. */
+       uint32_t name_len;
+       uint32_t event_len;
+
+       /*
+        * - name [name_len]
+        * - lttng_event object
+        */
+       char payload[];
+} LTTNG_PACKED;
+
 struct lttng_event_extended {
        /*
         * exclusions and filter_expression are only set when the lttng_event
@@ -114,10 +172,37 @@ int lttng_event_serialize(const struct lttng_event *event,
                struct lttng_dynamic_buffer *buf,
                int *fd_to_send);
 
+LTTNG_HIDDEN
+ssize_t lttng_event_context_create_from_buffer(
+               const struct lttng_buffer_view *view,
+               struct lttng_event_context **event_ctx);
+
+LTTNG_HIDDEN
+int lttng_event_context_serialize(struct lttng_event_context *context,
+               struct lttng_dynamic_buffer *buf);
+
+LTTNG_HIDDEN
+void lttng_event_context_destroy(struct lttng_event_context *context);
+
+LTTNG_HIDDEN
+ssize_t lttng_event_field_create_from_buffer(
+               const struct lttng_buffer_view *view,
+               struct lttng_event_field **field);
+
+LTTNG_HIDDEN
+int lttng_event_field_serialize(const struct lttng_event_field *field,
+               struct lttng_dynamic_buffer *buffer);
+
 LTTNG_HIDDEN
 enum lttng_error_code lttng_events_create_and_flatten_from_buffer(
                const struct lttng_buffer_view *view,
                unsigned int count,
                struct lttng_event **events);
 
+LTTNG_HIDDEN
+enum lttng_error_code lttng_event_fields_create_and_flatten_from_buffer(
+               const struct lttng_buffer_view *view,
+               unsigned int count,
+               struct lttng_event_field **fields);
+
 #endif /* LTTNG_EVENT_INTERNAL_H */
This page took 0.023764 seconds and 4 git commands to generate.