| 1 | /* |
| 2 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> |
| 3 | * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0-only |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #ifndef AGENT_COMM |
| 10 | #define AGENT_COMM |
| 11 | |
| 12 | #include <stdint.h> |
| 13 | |
| 14 | #include <common/macros.h> |
| 15 | #include <lttng/lttng.h> |
| 16 | |
| 17 | /* |
| 18 | * Command value passed in the header. |
| 19 | */ |
| 20 | enum lttcomm_agent_command { |
| 21 | AGENT_CMD_LIST = 1, |
| 22 | AGENT_CMD_ENABLE = 2, |
| 23 | AGENT_CMD_DISABLE = 3, |
| 24 | AGENT_CMD_REG_DONE = 4, /* End registration process. */ |
| 25 | AGENT_CMD_APP_CTX_ENABLE = 5, |
| 26 | AGENT_CMD_APP_CTX_DISABLE = 6, |
| 27 | }; |
| 28 | |
| 29 | /* |
| 30 | * Return codes from the agent. |
| 31 | */ |
| 32 | enum lttcomm_agent_ret_code { |
| 33 | /* Success, assumed to be the first entry */ |
| 34 | AGENT_RET_CODE_SUCCESS = 1, |
| 35 | /* Invalid command */ |
| 36 | AGENT_RET_CODE_INVALID = 2, |
| 37 | /* Unknown logger name */ |
| 38 | AGENT_RET_CODE_UNKNOWN_NAME = 3, |
| 39 | AGENT_RET_CODE_NR, |
| 40 | }; |
| 41 | |
| 42 | /* |
| 43 | * Agent application communication header. |
| 44 | */ |
| 45 | struct lttcomm_agent_hdr { |
| 46 | uint64_t data_size; /* data size following this header */ |
| 47 | uint32_t cmd; /* Enum of agent command. */ |
| 48 | uint32_t cmd_version; /* command version */ |
| 49 | } LTTNG_PACKED; |
| 50 | |
| 51 | /* |
| 52 | * Enable event command payload. Will be immediately followed by the |
| 53 | * variable-length string representing the filter expression. |
| 54 | */ |
| 55 | struct lttcomm_agent_enable_event { |
| 56 | uint32_t loglevel_value; |
| 57 | uint32_t loglevel_type; |
| 58 | char name[LTTNG_SYMBOL_NAME_LEN]; |
| 59 | uint32_t filter_expression_length; |
| 60 | } LTTNG_PACKED; |
| 61 | |
| 62 | /* |
| 63 | * Disable event command payload. |
| 64 | */ |
| 65 | struct lttcomm_agent_disable_event { |
| 66 | char name[LTTNG_SYMBOL_NAME_LEN]; |
| 67 | } LTTNG_PACKED; |
| 68 | |
| 69 | /* |
| 70 | * Generic reply coming from the agent. |
| 71 | */ |
| 72 | struct lttcomm_agent_generic_reply { |
| 73 | uint32_t ret_code; |
| 74 | } LTTNG_PACKED; |
| 75 | |
| 76 | /* |
| 77 | * List command reply header. |
| 78 | */ |
| 79 | struct lttcomm_agent_list_reply_hdr { |
| 80 | uint32_t ret_code; |
| 81 | uint32_t data_size; |
| 82 | } LTTNG_PACKED; |
| 83 | |
| 84 | /* |
| 85 | * List command reply payload coming from the agent. |
| 86 | */ |
| 87 | struct lttcomm_agent_list_reply { |
| 88 | uint32_t nb_event; |
| 89 | /* List of event name each of them ending by a NULL byte. */ |
| 90 | char payload[]; |
| 91 | } LTTNG_PACKED; |
| 92 | |
| 93 | #endif /* AGENT_COMM */ |