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