Fix: liblttng-ctl comm: lttng_channel is not packed
[lttng-tools.git] / src / common / sessiond-comm / sessiond-comm.h
index fd1ceae117c279210071326ab3544ebe58ad2253..0d3e374b3d30ac30fea6394eb8b272158abec3c9 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
- * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
  * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * SPDX-License-Identifier: GPL-2.0-only
@@ -31,6 +30,7 @@
 
 #include <arpa/inet.h>
 #include <netinet/in.h>
+#include <stdint.h>
 #include <sys/un.h>
 
 #include "inet.h"
@@ -179,6 +179,7 @@ enum lttcomm_return_code {
        LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE,/* Trace chunk exists on relay daemon. */
        LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK,      /* Unknown trace chunk. */
        LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED,  /* Relayd does not accept clear command. */
+       LTTCOMM_CONSUMERD_UNKNOWN_ERROR,            /* Unknown error. */
 
        /* MUST be last element */
        LTTCOMM_NR,                                             /* Last element */
@@ -223,14 +224,14 @@ struct lttcomm_sockaddr {
                struct sockaddr_in sin;
                struct sockaddr_in6 sin6;
        } addr;
-} LTTNG_PACKED;
+};
 
 struct lttcomm_sock {
        int32_t fd;
        enum lttcomm_sock_proto proto;
        struct lttcomm_sockaddr sockaddr;
        const struct lttcomm_proto_ops *ops;
-} LTTNG_PACKED;
+};
 
 /*
  * Relayd sock. Adds the protocol version to use for the communications with
@@ -240,7 +241,7 @@ struct lttcomm_relayd_sock {
        struct lttcomm_sock sock;
        uint32_t major;
        uint32_t minor;
-} LTTNG_PACKED;
+};
 
 struct lttcomm_net_family {
        int family;
@@ -310,9 +311,7 @@ struct lttcomm_session_msg {
                } LTTNG_PACKED disable;
                /* Create channel */
                struct {
-                       struct lttng_channel chan LTTNG_PACKED;
-                       /* struct lttng_channel_extended is already packed. */
-                       struct lttng_channel_extended extended;
+                       uint32_t length;
                } LTTNG_PACKED channel;
                /* Context */
                struct {
@@ -336,18 +335,18 @@ struct lttcomm_session_msg {
                        uint32_t size;
                } LTTNG_PACKED uri;
                struct {
-                       struct lttng_snapshot_output output LTTNG_PACKED;
+                       struct lttng_snapshot_output output;
                } LTTNG_PACKED snapshot_output;
                struct {
                        uint32_t wait;
-                       struct lttng_snapshot_output output LTTNG_PACKED;
+                       struct lttng_snapshot_output output;
                } LTTNG_PACKED snapshot_record;
                struct {
                        uint32_t nb_uri;
                        unsigned int timer_interval;    /* usec */
                } LTTNG_PACKED session_live;
                struct {
-                       struct lttng_save_session_attr attr; /* struct already packed */
+                       struct lttng_save_session_attr attr;
                } LTTNG_PACKED save_session;
                struct {
                        char shm_path[PATH_MAX];
@@ -452,6 +451,14 @@ struct lttcomm_event_command_header {
        uint32_t nb_events;
 } LTTNG_PACKED;
 
+/*
+ * Listing command header.
+ */
+struct lttcomm_list_command_header {
+       /* Number of elements */
+       uint32_t count;
+} LTTNG_PACKED;
+
 /*
  * Event extended info header. This is the structure preceding each
  * extended info data.
@@ -534,6 +541,8 @@ struct lttcomm_consumer_msg {
                        uint32_t monitor;
                        /* timer to check the streams usage in live mode (usec). */
                        unsigned int live_timer_interval;
+                       /* is part of a live session */
+                       uint8_t is_live;
                        /* timer to sample a channel's positions (usec). */
                        unsigned int monitor_timer_interval;
                } LTTNG_PACKED channel; /* Only used by Kernel. */
@@ -547,8 +556,9 @@ struct lttcomm_consumer_msg {
                struct {
                        uint64_t net_index;
                        enum lttng_stream_type type;
-                       /* Open socket to the relayd */
-                       struct lttcomm_relayd_sock sock;
+                       uint32_t major;
+                       uint32_t minor;
+                       uint8_t relayd_socket_protocol;
                        /* Tracing session id associated to the relayd. */
                        uint64_t session_id;
                        /* Relayd session id, only used with control socket. */
@@ -567,6 +577,7 @@ struct lttcomm_consumer_msg {
                        uint32_t switch_timer_interval;         /* usec */
                        uint32_t read_timer_interval;           /* usec */
                        unsigned int live_timer_interval;       /* usec */
+                       uint8_t is_live;                        /* is part of a live session */
                        uint32_t monitor_timer_interval;        /* usec */
                        int32_t output;                         /* splice, mmap */
                        int32_t type;                           /* metadata or per_cpu */
@@ -702,6 +713,9 @@ struct lttcomm_consumer_msg {
                struct {
                        uint64_t key;
                } LTTNG_PACKED clear_channel;
+               struct {
+                       uint64_t key;
+               } LTTNG_PACKED open_channel_packets;
        } u;
 } LTTNG_PACKED;
 
@@ -790,6 +804,10 @@ LTTNG_HIDDEN int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *sockaddr,
                const char *ip, unsigned int port);
 
 LTTNG_HIDDEN struct lttcomm_sock *lttcomm_alloc_sock(enum lttcomm_sock_proto proto);
+LTTNG_HIDDEN int lttcomm_populate_sock_from_open_socket(
+               struct lttcomm_sock *sock,
+               int fd,
+               enum lttcomm_sock_proto protocol);
 LTTNG_HIDDEN int lttcomm_create_sock(struct lttcomm_sock *sock);
 LTTNG_HIDDEN struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri);
 LTTNG_HIDDEN void lttcomm_destroy_sock(struct lttcomm_sock *sock);
This page took 0.025646 seconds and 4 git commands to generate.