X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmsg-iter%2Fmsg-iter.h;h=edba6847793ee2158b1d87bdecc897e67cfbdb9c;hb=516bf0a77e025cfccce2fa400b757e94dc0bf1d8;hp=dd3b01d3d5597aabcbeb599fd05efcee47f8865c;hpb=30174f59ca102e1a3cff21521c901523597483ad;p=babeltrace.git diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.h b/src/plugins/ctf/common/msg-iter/msg-iter.h index dd3b01d3..edba6847 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.h +++ b/src/plugins/ctf/common/msg-iter/msg-iter.h @@ -1,31 +1,15 @@ -#ifndef CTF_MSG_ITER_H -#define CTF_MSG_ITER_H - /* - * Babeltrace - CTF message iterator + * SPDX-License-Identifier: MIT * * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation * Copyright (c) 2015-2016 Philippe Proulx * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Babeltrace - CTF message iterator */ +#ifndef CTF_MSG_ITER_H +#define CTF_MSG_ITER_H + #include #include #include @@ -45,7 +29,8 @@ */ /** - * Medium operations status codes. + * Medium operations status codes. These use the same values as + * libbabeltrace2. */ enum ctf_msg_iter_medium_status { /** @@ -61,12 +46,12 @@ enum ctf_msg_iter_medium_status { */ CTF_MSG_ITER_MEDIUM_STATUS_AGAIN = 11, - /** Unsupported operation. */ - CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3, - /** General error. */ CTF_MSG_ITER_MEDIUM_STATUS_ERROR = -1, + /** Memory error. */ + CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR = -12, + /** Everything okay. */ CTF_MSG_ITER_MEDIUM_STATUS_OK = 0, }; @@ -94,12 +79,12 @@ enum ctf_msg_iter_status { */ CTF_MSG_ITER_STATUS_AGAIN = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN, - /** Unsupported operation. */ - CTF_MSG_ITER_STATUS_UNSUPPORTED = CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED, - /** General error. */ CTF_MSG_ITER_STATUS_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_ERROR, + /** Memory error. */ + CTF_MSG_ITER_STATUS_MEMORY_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR, + /** Everything okay. */ CTF_MSG_ITER_STATUS_OK = CTF_MSG_ITER_MEDIUM_STATUS_OK, }; @@ -163,7 +148,7 @@ struct ctf_msg_iter_medium_ops { * #CTF_MSG_ITER_MEDIUM_STATUS_EOF on the \em following * call. * - #CTF_MSG_ITER_MEDIUM_STATUS_ERROR: A fatal - * error occured during this operation. In this case, the + * error occurred during this operation. In this case, the * message iterator function called by the user returns * #CTF_MSG_ITER_STATUS_ERROR. * @@ -192,6 +177,15 @@ struct ctf_msg_iter_medium_ops { */ enum ctf_msg_iter_medium_status (* seek)(off_t offset, void *data); + /** + * Called when the message iterator wishes to inform the medium that it + * is about to start a new packet. + * + * After the iterator has called switch_packet, the following call to + * request_bytes must return the content at the start of the next + * packet. */ + enum ctf_msg_iter_medium_status (* switch_packet)(void *data); + /** * Returns a stream instance (weak reference) for the given * stream class. @@ -299,10 +293,6 @@ BT_HIDDEN enum ctf_msg_iter_status ctf_msg_iter_curr_packet_last_event_clock_snapshot( struct ctf_msg_iter *msg_it, uint64_t *last_event_cs); -BT_HIDDEN -void ctf_msg_iter_set_medops_data(struct ctf_msg_iter *msg_it, - void *medops_data); - BT_HIDDEN enum ctf_msg_iter_status ctf_msg_iter_seek( struct ctf_msg_iter *msg_it, off_t offset); @@ -323,14 +313,6 @@ void ctf_msg_iter_reset(struct ctf_msg_iter *msg_it); BT_HIDDEN void ctf_msg_iter_reset_for_next_stream_file(struct ctf_msg_iter *msg_it); -BT_HIDDEN -void ctf_msg_iter_set_emit_stream_beginning_message(struct ctf_msg_iter *msg_it, - bool val); - -BT_HIDDEN -void ctf_msg_iter_set_emit_stream_end_message(struct ctf_msg_iter *msg_it, - bool val); - BT_HIDDEN void ctf_msg_iter_set_dry_run(struct ctf_msg_iter *msg_it, bool val); @@ -346,11 +328,13 @@ const char *ctf_msg_iter_medium_status_string( return "AGAIN"; case CTF_MSG_ITER_MEDIUM_STATUS_ERROR: return "ERROR"; + case CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR: + return "MEMORY_ERROR"; case CTF_MSG_ITER_MEDIUM_STATUS_OK: return "OK"; - default: - return "(unknown)"; } + + bt_common_abort(); } static inline @@ -364,11 +348,13 @@ const char *ctf_msg_iter_status_string( return "AGAIN"; case CTF_MSG_ITER_STATUS_ERROR: return "ERROR"; + case CTF_MSG_ITER_STATUS_MEMORY_ERROR: + return "MEMORY_ERROR"; case CTF_MSG_ITER_STATUS_OK: return "OK"; - default: - return "(unknown)"; } + + bt_common_abort(); } #endif /* CTF_MSG_ITER_H */