Move relay commands out of lttcomm_sessiond_command
[lttng-tools.git] / src / common / sessiond-comm / sessiond-comm.h
index f60c5d238a364037fa21a75b42ac128910ce3d61..322400bb2cb7ce91f6a2194250c6e875aca7061d 100644 (file)
@@ -30,6 +30,7 @@
 #include <lttng/lttng.h>
 #include <common/compat/socket.h>
 #include <common/uri.h>
+#include <common/defaults.h>
 
 #include <arpa/inet.h>
 #include <netinet/in.h>
 
 enum lttcomm_sessiond_command {
        /* Tracer command */
-       LTTNG_ADD_CONTEXT,
-       LTTNG_CALIBRATE,
-       LTTNG_DISABLE_CHANNEL,
-       LTTNG_DISABLE_EVENT,
-       LTTNG_DISABLE_ALL_EVENT,
-       LTTNG_ENABLE_CHANNEL,
-       LTTNG_ENABLE_EVENT,
-       LTTNG_ENABLE_ALL_EVENT,
+       LTTNG_ADD_CONTEXT                   = 0,
+       LTTNG_CALIBRATE                     = 1,
+       LTTNG_DISABLE_CHANNEL               = 2,
+       LTTNG_DISABLE_EVENT                 = 3,
+       LTTNG_DISABLE_ALL_EVENT             = 4,
+       LTTNG_ENABLE_CHANNEL                = 5,
+       LTTNG_ENABLE_EVENT                  = 6,
+       LTTNG_ENABLE_ALL_EVENT              = 7,
        /* Session daemon command */
-       LTTNG_CREATE_SESSION,
-       LTTNG_DESTROY_SESSION,
-       LTTNG_LIST_CHANNELS,
-       LTTNG_LIST_DOMAINS,
-       LTTNG_LIST_EVENTS,
-       LTTNG_LIST_SESSIONS,
-       LTTNG_LIST_TRACEPOINTS,
-       LTTNG_REGISTER_CONSUMER,
-       LTTNG_START_TRACE,
-       LTTNG_STOP_TRACE,
-       LTTNG_LIST_TRACEPOINT_FIELDS,
+       LTTNG_CREATE_SESSION                = 8,
+       LTTNG_DESTROY_SESSION               = 9,
+       LTTNG_LIST_CHANNELS                 = 10,
+       LTTNG_LIST_DOMAINS                  = 11,
+       LTTNG_LIST_EVENTS                   = 12,
+       LTTNG_LIST_SESSIONS                 = 13,
+       LTTNG_LIST_TRACEPOINTS              = 14,
+       LTTNG_REGISTER_CONSUMER             = 15,
+       LTTNG_START_TRACE                   = 16,
+       LTTNG_STOP_TRACE                    = 17,
+       LTTNG_LIST_TRACEPOINT_FIELDS        = 18,
 
        /* Consumer */
-       LTTNG_DISABLE_CONSUMER,
-       LTTNG_ENABLE_CONSUMER,
-       LTTNG_SET_CONSUMER_URI,
-       /* Relay daemon */
-       RELAYD_ADD_STREAM,
-       RELAYD_CREATE_SESSION,
-       RELAYD_START_DATA,
-       RELAYD_UPDATE_SYNC_INFO,
-       RELAYD_VERSION,
-       RELAYD_SEND_METADATA,
-       RELAYD_CLOSE_STREAM,
-       LTTNG_SET_FILTER,
-       LTTNG_HEALTH_CHECK,
-       LTTNG_DATA_AVAILABLE,
+       LTTNG_DISABLE_CONSUMER              = 19,
+       LTTNG_ENABLE_CONSUMER               = 20,
+       LTTNG_SET_CONSUMER_URI              = 21,
+       LTTNG_ENABLE_EVENT_WITH_FILTER      = 22,
+       LTTNG_HEALTH_CHECK                  = 23,
+       LTTNG_DATA_PENDING                  = 24,
+};
+
+enum lttcomm_relayd_command {
+       RELAYD_ADD_STREAM                   = 1,
+       RELAYD_CREATE_SESSION               = 2,
+       RELAYD_START_DATA                   = 3,
+       RELAYD_UPDATE_SYNC_INFO             = 4,
+       RELAYD_VERSION                      = 5,
+       RELAYD_SEND_METADATA                = 6,
+       RELAYD_CLOSE_STREAM                 = 7,
+       RELAYD_DATA_PENDING                 = 8,
+       RELAYD_QUIESCENT_CONTROL            = 9,
+       RELAYD_BEGIN_DATA_PENDING           = 10,
+       RELAYD_END_DATA_PENDING             = 11,
 };
 
 /*
@@ -133,14 +140,14 @@ struct lttcomm_sockaddr {
                struct sockaddr_in sin;
                struct sockaddr_in6 sin6;
        } addr;
-};
+} LTTNG_PACKED;
 
 struct lttcomm_sock {
        int fd;
        enum lttcomm_sock_proto proto;
        struct lttcomm_sockaddr sockaddr;
        const struct lttcomm_proto_ops *ops;
-};
+} LTTNG_PACKED;
 
 struct lttcomm_net_family {
        int family;
@@ -170,44 +177,39 @@ struct lttcomm_session_msg {
                struct {
                        char channel_name[LTTNG_SYMBOL_NAME_LEN];
                        char name[NAME_MAX];
-               } disable;
+               } LTTNG_PACKED disable;
                /* Event data */
                struct {
                        char channel_name[LTTNG_SYMBOL_NAME_LEN];
                        struct lttng_event event;
-               } enable;
+                       /* Length of following bytecode for filter. */
+                       uint32_t bytecode_len;
+               } LTTNG_PACKED enable;
                /* Create channel */
                struct {
                        struct lttng_channel chan;
-               } channel;
+               } LTTNG_PACKED channel;
                /* Context */
                struct {
                        char channel_name[LTTNG_SYMBOL_NAME_LEN];
-                       char event_name[LTTNG_SYMBOL_NAME_LEN];
                        struct lttng_event_context ctx;
-               } context;
+               } LTTNG_PACKED context;
                /* Use by register_consumer */
                struct {
                        char path[PATH_MAX];
-               } reg;
+               } LTTNG_PACKED reg;
                /* List */
                struct {
                        char channel_name[LTTNG_SYMBOL_NAME_LEN];
-               } list;
+               } LTTNG_PACKED list;
                struct lttng_calibrate calibrate;
                /* Used by the set_consumer_url and used by create_session also call */
                struct {
                        /* Number of lttng_uri following */
                        uint32_t size;
-               } uri;
-               struct {
-                       char channel_name[LTTNG_SYMBOL_NAME_LEN];
-                       char event_name[LTTNG_SYMBOL_NAME_LEN];
-                       /* Length of following bytecode */
-                       uint32_t bytecode_len;
-               } filter;
+               } LTTNG_PACKED uri;
        } u;
-};
+} LTTNG_PACKED;
 
 #define LTTNG_FILTER_MAX_LEN   65536
 
@@ -216,11 +218,14 @@ struct lttcomm_session_msg {
  * bytecode. It is made of tuples: (uint16_t, var. len. string). It
  * starts at reloc_table_offset.
  */
+#define LTTNG_FILTER_PADDING   32
 struct lttng_filter_bytecode {
        uint32_t len;   /* len of data */
        uint32_t reloc_table_offset;
+       uint64_t seqnum;
+       char padding[LTTNG_FILTER_PADDING];
        char data[0];
-};
+} LTTNG_PACKED;
 
 /*
  * Data structure for the response from sessiond to the lttng client.
@@ -232,16 +237,16 @@ struct lttcomm_lttng_msg {
        uint32_t data_size;
        /* Contains: trace_name + data */
        char payload[];
-};
+} LTTNG_PACKED;
 
 struct lttcomm_health_msg {
        uint32_t component;
        uint32_t cmd;
-};
+} LTTNG_PACKED;
 
 struct lttcomm_health_data {
        uint32_t ret_code;
-};
+} LTTNG_PACKED;
 
 /*
  * lttcomm_consumer_msg is the message sent from sessiond to consumerd
@@ -259,7 +264,7 @@ struct lttcomm_consumer_msg {
                        /* nb_init_streams is the number of streams open initially. */
                        unsigned int nb_init_streams;
                        char name[LTTNG_SYMBOL_NAME_LEN];
-               } channel;
+               } LTTNG_PACKED channel;
                struct {
                        int channel_key;
                        int stream_key;
@@ -272,23 +277,32 @@ struct lttcomm_consumer_msg {
                        char path_name[PATH_MAX];
                        int net_index;
                        unsigned int metadata_flag;
-                       char name[LTTNG_SYMBOL_NAME_LEN];  /* Name string of the stream */
+                       char name[DEFAULT_STREAM_NAME_LEN];  /* Name string of the stream */
                        uint64_t session_id;   /* Tracing session id of the stream */
-               } stream;
+               } LTTNG_PACKED stream;
                struct {
                        int net_index;
                        enum lttng_stream_type type;
                        /* Open socket to the relayd */
                        struct lttcomm_sock sock;
-               } relayd_sock;
+                       /* Tracing session id associated to the relayd. */
+                       uint64_t session_id;
+               } LTTNG_PACKED relayd_sock;
                struct {
                        uint64_t net_seq_idx;
-               } destroy_relayd;
+               } LTTNG_PACKED destroy_relayd;
                struct {
                        uint64_t session_id;
-               } data_available;
+               } LTTNG_PACKED data_pending;
        } u;
-};
+} LTTNG_PACKED;
+
+/*
+ * Status message returned to the sessiond after a received command.
+ */
+struct lttcomm_consumer_status_msg {
+       enum lttng_error_code ret_code;
+} LTTNG_PACKED;
 
 #ifdef HAVE_LIBLTTNG_UST_CTL
 
@@ -307,7 +321,7 @@ struct lttcomm_ust_msg {
                struct lttng_ust_context context;
                struct lttng_ust_tracer_version version;
        } u;
-};
+} LTTNG_PACKED;
 
 /*
  * Data structure for the response from UST to the session daemon.
@@ -321,13 +335,13 @@ struct lttcomm_ust_reply {
        union {
                struct {
                        uint64_t memory_map_size;
-               } channel;
+               } LTTNG_PACKED channel;
                struct {
                        uint64_t memory_map_size;
-               } stream;
+               } LTTNG_PACKED stream;
                struct lttng_ust_tracer_version version;
        } u;
-};
+} LTTNG_PACKED;
 
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
This page took 0.027344 seconds and 4 git commands to generate.