2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_PAYLOAD_H
9 #define LTTNG_PAYLOAD_H
11 #include <common/dynamic-buffer.h>
12 #include <common/dynamic-array.h>
15 * An lttng_payload encompasses the 'data' (bytes) and any passed file
16 * descriptors as part of a message between liblttng-ctl and the session
19 struct lttng_payload
{
20 struct lttng_dynamic_buffer buffer
;
22 struct lttng_dynamic_array _fds
;
26 * Initialize a payload. This performs no allocation and is meant
27 * to be used instead of zero-ing the payload structure.
30 void lttng_payload_init(struct lttng_payload
*payload
);
34 int lttng_payload_copy(const struct lttng_payload
*src_payload
,
35 struct lttng_payload
*dst_payload
);
37 /* Release any memory used by the payload. */
39 void lttng_payload_reset(struct lttng_payload
*payload
);
42 * Add an fd to the payload.
43 * No ownership of the file descriptor is assumed by the payload.
45 * @payload Payload instance
46 * @fd File descriptor to add to the payload
48 * Returns 0 on success, -1 on allocation error.
51 int lttng_payload_push_fd(struct lttng_payload
*payload
, int fd
);
53 #endif /* LTTNG_PAYLOAD_H */