| 1 | #ifndef BABELTRACE_CTF_WRITER_RESOLVE_INTERNAL_H |
| 2 | #define BABELTRACE_CTF_WRITER_RESOLVE_INTERNAL_H |
| 3 | |
| 4 | /* |
| 5 | * Babeltrace - CTF writer: Type resolving internal |
| 6 | * |
| 7 | * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 8 | * Copyright 2016 Philippe Proulx <pproulx@efficios.com> |
| 9 | * |
| 10 | * Authors: Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 11 | * Philippe Proulx <pproulx@efficios.com> |
| 12 | * |
| 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 14 | * of this software and associated documentation files (the "Software"), to deal |
| 15 | * in the Software without restriction, including without limitation the rights |
| 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 17 | * copies of the Software, and to permit persons to whom the Software is |
| 18 | * furnished to do so, subject to the following conditions: |
| 19 | * |
| 20 | * The above copyright notice and this permission notice shall be included in |
| 21 | * all copies or substantial portions of the Software. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 29 | * SOFTWARE. |
| 30 | */ |
| 31 | |
| 32 | #include <babeltrace/ctf-writer/field-types.h> |
| 33 | #include <babeltrace/ctf-writer/field-types-internal.h> |
| 34 | #include <babeltrace/values.h> |
| 35 | #include <babeltrace/babeltrace-internal.h> |
| 36 | #include <glib.h> |
| 37 | |
| 38 | enum bt_ctf_resolve_flag { |
| 39 | BT_CTF_RESOLVE_FLAG_PACKET_HEADER = 0x01, |
| 40 | BT_CTF_RESOLVE_FLAG_PACKET_CONTEXT = 0x02, |
| 41 | BT_CTF_RESOLVE_FLAG_EVENT_HEADER = 0x04, |
| 42 | BT_CTF_RESOLVE_FLAG_STREAM_EVENT_CTX = 0x08, |
| 43 | BT_CTF_RESOLVE_FLAG_EVENT_CONTEXT = 0x10, |
| 44 | BT_CTF_RESOLVE_FLAG_EVENT_PAYLOAD = 0x20, |
| 45 | }; |
| 46 | |
| 47 | /* |
| 48 | * Resolves CTF IR field types: recursively locates the tag and length |
| 49 | * field types of resp. variant and sequence field types. |
| 50 | * |
| 51 | * All `*_type` parameters may be resolved, and may as well serve as |
| 52 | * resolving targets. |
| 53 | * |
| 54 | * Resolving is performed based on the flags in `flags`. |
| 55 | * |
| 56 | * It is expected that, amongst all the provided types, no common |
| 57 | * references to sequence variant field types exist. In other words, |
| 58 | * this function does not copy field types. |
| 59 | * |
| 60 | * All parameters are owned by the caller. |
| 61 | */ |
| 62 | BT_HIDDEN |
| 63 | int bt_ctf_resolve_types(struct bt_value *environment, |
| 64 | struct bt_ctf_field_type_common *packet_header_type, |
| 65 | struct bt_ctf_field_type_common *packet_context_type, |
| 66 | struct bt_ctf_field_type_common *event_header_type, |
| 67 | struct bt_ctf_field_type_common *stream_event_ctx_type, |
| 68 | struct bt_ctf_field_type_common *event_context_type, |
| 69 | struct bt_ctf_field_type_common *event_payload_type, |
| 70 | enum bt_ctf_resolve_flag flags); |
| 71 | |
| 72 | #endif /* BABELTRACE_CTF_WRITER_RESOLVE_INTERNAL_H */ |