tests: compile all unit tests as C++
[lttng-tools.git] / include / lttng / kernel-probe-internal.h
1 /*
2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_KERNEL_PROBE_INTERNAL_H
9 #define LTTNG_KERNEL_PROBE_INTERNAL_H
10
11 #include <common/fd-handle.h>
12 #include <common/macros.h>
13 #include <lttng/lttng-error.h>
14 #include <lttng/kernel-probe.h>
15 #include <lttng/lttng-error.h>
16 #include <stdbool.h>
17 #include <stdint.h>
18 #include <sys/types.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 struct lttng_payload;
25 struct lttng_payload_view;
26 struct lttng_dynamic_buffer;
27 struct mi_writer;
28
29 typedef bool (*kernel_probe_location_equal_cb)(
30 const struct lttng_kernel_probe_location *a,
31 const struct lttng_kernel_probe_location *b);
32 typedef int (*kernel_probe_location_serialize_cb)(
33 const struct lttng_kernel_probe_location *kernel_probe_location,
34 struct lttng_payload *payload);
35 typedef bool (*kernel_probe_location_equal_cb)(
36 const struct lttng_kernel_probe_location *a,
37 const struct lttng_kernel_probe_location *b);
38 typedef ssize_t (*kernel_probe_location_create_from_payload_cb)(
39 struct lttng_payload_view *view,
40 struct lttng_kernel_probe_location **kernel_probe_location);
41 typedef unsigned long (*kernel_probe_location_hash_cb)(
42 const struct lttng_kernel_probe_location *location);
43 typedef enum lttng_error_code (*kernel_probe_location_mi_serialize_cb)(
44 const struct lttng_kernel_probe_location *location,
45 struct mi_writer *writer);
46
47 struct lttng_kernel_probe_location_comm {
48 /* enum lttng_kernel_probe_location_type */
49 int8_t type;
50 /*
51 * Payload is composed of, in that order,
52 * - type-specific payload
53 */
54 char payload[];
55 } LTTNG_PACKED;
56
57 struct lttng_kernel_probe_location_symbol_comm {
58 /* Includes the trailing \0. */
59 uint32_t symbol_len;
60 /* The offset from the symbol. */
61 uint64_t offset;
62 /*
63 * Payload is composed of, in that order,
64 * - symbol name (with trailing \0).
65 */
66 char payload[];
67 } LTTNG_PACKED;
68
69 struct lttng_kernel_probe_location_address_comm {
70 uint64_t address;
71 } LTTNG_PACKED;
72
73 /* Common ancestor of all kernel probe locations. */
74 struct lttng_kernel_probe_location {
75 enum lttng_kernel_probe_location_type type;
76 kernel_probe_location_equal_cb equal;
77 kernel_probe_location_serialize_cb serialize;
78 kernel_probe_location_hash_cb hash;
79 kernel_probe_location_mi_serialize_cb mi_serialize;
80 };
81
82 struct lttng_kernel_probe_location_symbol {
83 struct lttng_kernel_probe_location parent;
84 char *symbol_name;
85 uint64_t offset;
86 };
87
88 struct lttng_kernel_probe_location_address {
89 struct lttng_kernel_probe_location parent;
90 uint64_t address;
91 };
92
93 int lttng_kernel_probe_location_serialize(
94 const struct lttng_kernel_probe_location *location,
95 struct lttng_payload *payload);
96
97 ssize_t lttng_kernel_probe_location_create_from_payload(
98 struct lttng_payload_view *view,
99 struct lttng_kernel_probe_location **probe_location);
100
101 bool lttng_kernel_probe_location_is_equal(
102 const struct lttng_kernel_probe_location *a,
103 const struct lttng_kernel_probe_location *b);
104
105 struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
106 const struct lttng_kernel_probe_location *location);
107
108 unsigned long lttng_kernel_probe_location_hash(
109 const struct lttng_kernel_probe_location *location);
110
111 enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
112 const struct lttng_kernel_probe_location *location,
113 struct mi_writer *writer);
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */
This page took 0.030648 seconds and 4 git commands to generate.