lib: remove unused _NO_SINK graph status
[babeltrace.git] / include / babeltrace / ctf-writer / validation-internal.h
1 #ifndef BABELTRACE_CTF_WRITER_VALIDATION_INTERNAL_H
2 #define BABELTRACE_CTF_WRITER_VALIDATION_INTERNAL_H
3
4 /*
5 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26 #include <babeltrace/babeltrace-internal.h>
27 #include <babeltrace/ctf-writer/values-internal.h>
28
29 struct bt_ctf_trace_common;
30 struct bt_ctf_stream_class_common;
31 struct bt_ctf_event_class_common;
32 struct bt_ctf_field_type_common;
33
34 typedef struct bt_ctf_field_type_common *(*bt_ctf_validation_flag_copy_field_type_func)(
35 struct bt_ctf_field_type_common *);
36
37 enum bt_ctf_validation_flag {
38 BT_CTF_VALIDATION_FLAG_TRACE = 1,
39 BT_CTF_VALIDATION_FLAG_STREAM = 2,
40 BT_CTF_VALIDATION_FLAG_EVENT = 4,
41 };
42
43 /*
44 * Validation output structure.
45 *
46 * This is where the results of the validation function go. The field
47 * types are the validated ones which should replace the original field
48 * types of a trace, a stream class, and an event class.
49 *
50 * `valid_flags` contains the results of the validation.
51 */
52 struct bt_ctf_validation_output {
53 struct bt_ctf_field_type_common *packet_header_type;
54 struct bt_ctf_field_type_common *packet_context_type;
55 struct bt_ctf_field_type_common *event_header_type;
56 struct bt_ctf_field_type_common *stream_event_ctx_type;
57 struct bt_ctf_field_type_common *event_context_type;
58 struct bt_ctf_field_type_common *event_payload_type;
59 enum bt_ctf_validation_flag valid_flags;
60 };
61
62 /*
63 * This function resolves and validates the field types of an event
64 * class, a stream class, and a trace. Copies are created if needed
65 * and the resulting field types to use are placed in the `output`
66 * validation structure, which also contains the results of the
67 * validation. Copies can replace the original field types of a trace,
68 * a stream class, and an event class using
69 * bt_ctf_validation_replace_types().
70 *
71 * The current known validity of the field types of the trace,
72 * stream class, and event class must be indicated with the
73 * `trace_valid`, `stream_class_valid`, and `event_class_valid`
74 * parameters. If a class is valid, its field types are not copied,
75 * validated, or resolved during this call.
76 *
77 * The validation flags `validate_flags` indicate which classes should
78 * have their field types validated.
79 *
80 * All parameters are owned by the caller.
81 */
82 BT_HIDDEN
83 int bt_ctf_validate_class_types(struct bt_ctf_private_value *environment,
84 struct bt_ctf_field_type_common *packet_header_type,
85 struct bt_ctf_field_type_common *packet_context_type,
86 struct bt_ctf_field_type_common *event_header_type,
87 struct bt_ctf_field_type_common *stream_event_ctx_type,
88 struct bt_ctf_field_type_common *event_context_type,
89 struct bt_ctf_field_type_common *event_payload_type,
90 int trace_valid, int stream_class_valid, int event_class_valid,
91 struct bt_ctf_validation_output *output,
92 enum bt_ctf_validation_flag validate_flags,
93 bt_ctf_validation_flag_copy_field_type_func copy_field_type_func);
94
95 /*
96 * This function replaces the actual field types of a trace, a stream
97 * class, and an event class with the appropriate field types contained
98 * in a validation output structure.
99 *
100 * The replace flags `replace_flags` indicate which classes should have
101 * their field types replaced.
102 *
103 * Note that the field types that are not used in the validation output
104 * structure are still owned by it at the end of this call.
105 * bt_ctf_validation_output_put_types() should be called to clean the
106 * structure.
107 *
108 * All parameters are owned by the caller.
109 */
110 BT_HIDDEN
111 void bt_ctf_validation_replace_types(struct bt_ctf_trace_common *trace,
112 struct bt_ctf_stream_class_common *stream_class,
113 struct bt_ctf_event_class_common *event_class,
114 struct bt_ctf_validation_output *output,
115 enum bt_ctf_validation_flag replace_flags);
116
117 /*
118 * This function puts all the field types contained in a given
119 * validation output structure.
120 *
121 * `output` is owned by the caller and is not freed here.
122 */
123 BT_HIDDEN
124 void bt_ctf_validation_output_put_types(
125 struct bt_ctf_validation_output *output);
126
127 #endif /* BABELTRACE_CTF_WRITER_VALIDATION_INTERNAL_H */
This page took 0.033162 seconds and 4 git commands to generate.