Fix: tests: `-Wstringop-overflow` warning
[lttng-tools.git] / src / common / sessiond-comm / agent.h
1 /*
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
3 * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef AGENT_COMM
20 #define AGENT_COMM
21
22 #include <stdint.h>
23
24 #include <common/macros.h>
25 #include <lttng/lttng.h>
26
27 /*
28 * Command value passed in the header.
29 */
30 enum lttcomm_agent_command {
31 AGENT_CMD_LIST = 1,
32 AGENT_CMD_ENABLE = 2,
33 AGENT_CMD_DISABLE = 3,
34 AGENT_CMD_REG_DONE = 4, /* End registration process. */
35 AGENT_CMD_APP_CTX_ENABLE = 5,
36 AGENT_CMD_APP_CTX_DISABLE = 6,
37 };
38
39 /*
40 * Return codes from the agent.
41 */
42 enum lttcomm_agent_ret_code {
43 /* Success, assumed to be the first entry */
44 AGENT_RET_CODE_SUCCESS = 1,
45 /* Invalid command */
46 AGENT_RET_CODE_INVALID = 2,
47 /* Unknown logger name */
48 AGENT_RET_CODE_UNKNOWN_NAME = 3,
49 AGENT_RET_CODE_NR,
50 };
51
52 /*
53 * Agent application communication header.
54 */
55 struct lttcomm_agent_hdr {
56 uint64_t data_size; /* data size following this header */
57 uint32_t cmd; /* Enum of agent command. */
58 uint32_t cmd_version; /* command version */
59 } LTTNG_PACKED;
60
61 /*
62 * Enable event command payload. Will be immediately followed by the
63 * variable-length string representing the filter expression.
64 */
65 struct lttcomm_agent_enable_event {
66 uint32_t loglevel_value;
67 uint32_t loglevel_type;
68 char name[LTTNG_SYMBOL_NAME_LEN];
69 uint32_t filter_expression_length;
70 } LTTNG_PACKED;
71
72 /*
73 * Disable event command payload.
74 */
75 struct lttcomm_agent_disable_event {
76 char name[LTTNG_SYMBOL_NAME_LEN];
77 } LTTNG_PACKED;
78
79 /*
80 * Generic reply coming from the agent.
81 */
82 struct lttcomm_agent_generic_reply {
83 uint32_t ret_code;
84 } LTTNG_PACKED;
85
86 /*
87 * List command reply header.
88 */
89 struct lttcomm_agent_list_reply_hdr {
90 uint32_t ret_code;
91 uint32_t data_size;
92 } LTTNG_PACKED;
93
94 /*
95 * List command reply payload coming from the agent.
96 */
97 struct lttcomm_agent_list_reply {
98 uint32_t nb_event;
99 /* List of event name each of them ending by a NULL byte. */
100 char payload[];
101 } LTTNG_PACKED;
102
103 #endif /* AGENT_COMM */
This page took 0.030503 seconds and 4 git commands to generate.