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