| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
| 5 | */ |
| 6 | |
| 7 | #ifndef BABELTRACE2_GRAPH_MESSAGE_H |
| 8 | #define BABELTRACE2_GRAPH_MESSAGE_H |
| 9 | |
| 10 | #ifndef __BT_IN_BABELTRACE_H |
| 11 | # error "Please include <babeltrace2/babeltrace.h> instead." |
| 12 | #endif |
| 13 | |
| 14 | #include <babeltrace2/types.h> |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | /*! |
| 21 | @defgroup api-msg Messages |
| 22 | @ingroup api-comp-cls-dev |
| 23 | |
| 24 | @brief |
| 25 | Elements exchanged between \bt_p_comp. |
| 26 | |
| 27 | <strong><em>Messages</em></strong> are the objects which are exchanged |
| 28 | between \bt_p_comp in a trace processing \bt_graph to accomplish a |
| 29 | trace processing job. |
| 30 | |
| 31 | \bt_cp_msg_iter create messages while message iterators \em and |
| 32 | \bt_p_sink_comp consume messages. |
| 33 | |
| 34 | There are eight types of messages: |
| 35 | |
| 36 | - \bt_c_sb_msg |
| 37 | - \bt_c_se_msg |
| 38 | - \bt_c_ev_msg |
| 39 | - \bt_c_pb_msg |
| 40 | - \bt_c_pe_msg |
| 41 | - \bt_c_disc_ev_msg |
| 42 | - \bt_c_disc_pkt_msg |
| 43 | - \bt_c_inac_msg |
| 44 | |
| 45 | The type of a message is #bt_message. |
| 46 | |
| 47 | Get the type enumerator of a message with bt_message_get_type(). |
| 48 | |
| 49 | A message is a \ref api-fund-shared-object "shared object": get a |
| 50 | new reference with bt_message_get_ref() and put an existing |
| 51 | reference with bt_message_put_ref(). |
| 52 | |
| 53 | Some library functions \ref api-fund-freezing "freeze" messages on |
| 54 | success. The documentation of those functions indicate this |
| 55 | postcondition. |
| 56 | |
| 57 | Messages transport objects of the \ref api-tir API, which is an |
| 58 | intermediate representation of the tracing domain concepts. |
| 59 | |
| 60 | All types of messages, except the \bt_inac_msg type, are related to a |
| 61 | specific <em>\bt_stream</em>, which represents a conceptual |
| 62 | \ref api-msg-seq "sequence of messages". |
| 63 | |
| 64 | Some types of messages can have a default \bt_cs, depending on whether |
| 65 | or not their stream has a conceptual default clock, that is, whether or |
| 66 | not the stream's \ref api-tir-stream-cls "class" has a |
| 67 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 68 | The creation functions for those types of messages contain |
| 69 | <code>_with_default_clock_snapshot</code> (for example, |
| 70 | bt_message_event_create_with_default_clock_snapshot()). |
| 71 | |
| 72 | For the \bt_sb_msg and \bt_se_msg, the default clock snapshot property |
| 73 | is optional, therefore they have dedicated |
| 74 | bt_message_stream_beginning_set_default_clock_snapshot() and |
| 75 | bt_message_stream_end_set_default_clock_snapshot() functions. |
| 76 | |
| 77 | All the message creation functions take a \bt_self_msg_iter as their |
| 78 | first parameter. This is because a message iterator method is the only |
| 79 | valid context to create a message. |
| 80 | |
| 81 | <h1>Message types</h1> |
| 82 | |
| 83 | This section details each type of message. |
| 84 | |
| 85 | The following table shows the creation functions and types for each type |
| 86 | of message: |
| 87 | |
| 88 | <table> |
| 89 | <tr> |
| 90 | <th>Name |
| 91 | <th>Type enumerator |
| 92 | <th>Creation functions |
| 93 | <tr> |
| 94 | <td>\ref api-msg-sb "Stream beginning" |
| 95 | <td>#BT_MESSAGE_TYPE_STREAM_BEGINNING |
| 96 | <td>bt_message_stream_beginning_create() |
| 97 | <tr> |
| 98 | <td>\ref api-msg-se "Stream end" |
| 99 | <td>#BT_MESSAGE_TYPE_STREAM_END |
| 100 | <td>bt_message_stream_end_create() |
| 101 | <tr> |
| 102 | <td>\ref api-msg-ev "Event" |
| 103 | <td>#BT_MESSAGE_TYPE_EVENT |
| 104 | <td> |
| 105 | bt_message_event_create()<br> |
| 106 | bt_message_event_create_with_default_clock_snapshot()<br> |
| 107 | bt_message_event_create_with_packet()<br> |
| 108 | bt_message_event_create_with_packet_and_default_clock_snapshot() |
| 109 | <tr> |
| 110 | <td>\ref api-msg-pb "Packet beginning" |
| 111 | <td>#BT_MESSAGE_TYPE_PACKET_BEGINNING |
| 112 | <td> |
| 113 | bt_message_packet_beginning_create()<br> |
| 114 | bt_message_packet_beginning_create_with_default_clock_snapshot() |
| 115 | <tr> |
| 116 | <td>\ref api-msg-pe "Packet end" |
| 117 | <td>#BT_MESSAGE_TYPE_PACKET_END |
| 118 | <td> |
| 119 | bt_message_packet_end_create()<br> |
| 120 | bt_message_packet_end_create_with_default_clock_snapshot() |
| 121 | <tr> |
| 122 | <td>\ref api-msg-disc-ev "Discarded events" |
| 123 | <td>#BT_MESSAGE_TYPE_DISCARDED_EVENTS |
| 124 | <td> |
| 125 | bt_message_discarded_events_create()<br> |
| 126 | bt_message_discarded_events_create_with_default_clock_snapshots() |
| 127 | <tr> |
| 128 | <td>\ref api-msg-disc-pkt "Discarded packets" |
| 129 | <td>#BT_MESSAGE_TYPE_DISCARDED_PACKETS |
| 130 | <td> |
| 131 | bt_message_discarded_packets_create()<br> |
| 132 | bt_message_discarded_packets_create_with_default_clock_snapshots() |
| 133 | <tr> |
| 134 | <td>\ref api-msg-inac "Message iterator inactivity" |
| 135 | <td>#BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY |
| 136 | <td>bt_message_message_iterator_inactivity_create() |
| 137 | </table> |
| 138 | |
| 139 | <h2>\anchor api-msg-sb Stream beginning message</h2> |
| 140 | |
| 141 | A <strong><em>stream beginning message</em></strong> indicates the |
| 142 | beginning of a \bt_stream. |
| 143 | |
| 144 | For a given stream: |
| 145 | |
| 146 | - A stream beginning message is always the first one in the |
| 147 | \ref api-msg-seq "message sequence". |
| 148 | |
| 149 | - There can be only one stream beginning message. |
| 150 | |
| 151 | Create a stream beginning message with |
| 152 | bt_message_stream_beginning_create(). |
| 153 | |
| 154 | A stream beginning message has the following properties: |
| 155 | |
| 156 | <dl> |
| 157 | <dt>\anchor api-msg-sb-prop-stream Stream</dt> |
| 158 | <dd> |
| 159 | \bt_c_stream of which the message indicates the beginning. |
| 160 | |
| 161 | You cannot change the stream once the message is created. |
| 162 | |
| 163 | Borrow a stream beginning message's stream with |
| 164 | bt_message_stream_beginning_borrow_stream() and |
| 165 | bt_message_stream_beginning_borrow_stream_const(). |
| 166 | </dd> |
| 167 | |
| 168 | <dt> |
| 169 | \anchor api-msg-sb-prop-cs |
| 170 | \bt_dt_opt Default \bt_cs |
| 171 | </dt> |
| 172 | <dd> |
| 173 | Snapshot of the message's \bt_stream's default clock when the |
| 174 | stream begins. |
| 175 | |
| 176 | A stream beginning message can only have a default clock snapshot |
| 177 | if its stream's \ref api-tir-stream-cls "class" has a |
| 178 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 179 | |
| 180 | When a stream beginning message has no default clock snapshot, |
| 181 | then its time is <em>unknown</em>. |
| 182 | |
| 183 | Set a stream beginning message's default clock snapshot with |
| 184 | bt_message_stream_beginning_set_default_clock_snapshot(). |
| 185 | |
| 186 | Borrow a stream beginning message's default clock snapshot with |
| 187 | bt_message_stream_beginning_borrow_default_clock_snapshot_const(). |
| 188 | </dd> |
| 189 | </dl> |
| 190 | |
| 191 | <h2>\anchor api-msg-se Stream end message</h2> |
| 192 | |
| 193 | A <strong><em>stream end message</em></strong> indicates the |
| 194 | end of a \bt_stream. |
| 195 | |
| 196 | For a given stream: |
| 197 | |
| 198 | - A stream end message is always the last one in the |
| 199 | \ref api-msg-seq "message sequence". |
| 200 | |
| 201 | - There can be only one stream end message. |
| 202 | |
| 203 | Create a stream end message with bt_message_stream_end_create(). |
| 204 | |
| 205 | A stream end message has the following properties: |
| 206 | |
| 207 | <dl> |
| 208 | <dt>\anchor api-msg-se-prop-stream Stream</dt> |
| 209 | <dd> |
| 210 | \bt_c_stream of which the message indicates the end. |
| 211 | |
| 212 | You cannot change the stream once the message is created. |
| 213 | |
| 214 | Borrow a stream end message's stream with |
| 215 | bt_message_stream_end_borrow_stream() and |
| 216 | bt_message_stream_end_borrow_stream_const(). |
| 217 | </dd> |
| 218 | |
| 219 | <dt> |
| 220 | \anchor api-msg-se-prop-cs |
| 221 | \bt_dt_opt Default \bt_cs |
| 222 | </dt> |
| 223 | <dd> |
| 224 | Snapshot of the message's \bt_stream's default clock when the |
| 225 | stream ends. |
| 226 | |
| 227 | A stream end message can only have a default clock snapshot |
| 228 | if its stream's \ref api-tir-stream-cls "class" has a |
| 229 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 230 | |
| 231 | When a stream end message has no default clock snapshot, then its |
| 232 | time is <em>unknown</em>. |
| 233 | |
| 234 | Set a stream end message's default clock snapshot with |
| 235 | bt_message_stream_end_set_default_clock_snapshot(). |
| 236 | |
| 237 | Borrow a stream end message's default clock snapshot with |
| 238 | bt_message_stream_end_borrow_default_clock_snapshot_const(). |
| 239 | </dd> |
| 240 | </dl> |
| 241 | |
| 242 | <h2>\anchor api-msg-ev Event message</h2> |
| 243 | |
| 244 | An <strong><em>event message</em></strong> transports an \bt_ev and has, |
| 245 | possibly, a default \bt_cs. |
| 246 | |
| 247 | Within its \bt_stream's \ref api-msg-seq "message sequence", an event |
| 248 | message can only occur: |
| 249 | |
| 250 | <dl> |
| 251 | <dt> |
| 252 | If the stream's \ref api-tir-stream-cls "class" |
| 253 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets" |
| 254 | </dt> |
| 255 | <dd>After a \bt_pb_msg and before a \bt_pe_msg.</dd> |
| 256 | |
| 257 | <dt> |
| 258 | If the stream's class does not support packets |
| 259 | </dt> |
| 260 | <dd>After the \bt_sb_msg and before the \bt_se_msg.</dd> |
| 261 | </dl> |
| 262 | |
| 263 | To create an event message for a given stream, use: |
| 264 | |
| 265 | <dl> |
| 266 | <dt> |
| 267 | If the stream's \ref api-tir-stream-cls "class" |
| 268 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets" |
| 269 | </dt> |
| 270 | <dd> |
| 271 | <dl> |
| 272 | <dt> |
| 273 | If the stream's class has a |
| 274 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 275 | </dt> |
| 276 | <dd>bt_message_event_create_with_packet_and_default_clock_snapshot()</dd> |
| 277 | |
| 278 | <dt> |
| 279 | If the stream's class does not have a |
| 280 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 281 | </dt> |
| 282 | <dd>bt_message_event_create_with_packet()</dd> |
| 283 | </dl> |
| 284 | |
| 285 | Those two creation functions accept a \bt_pkt parameter which is |
| 286 | the packet logically containing the message's event. A packet is |
| 287 | part of a stream. |
| 288 | </dd> |
| 289 | |
| 290 | <dt> |
| 291 | If the stream's class does not supports packets |
| 292 | </dt> |
| 293 | <dd> |
| 294 | <dl> |
| 295 | <dt> |
| 296 | If the stream's class has a default clock class |
| 297 | </dt> |
| 298 | <dd>bt_message_event_create_with_default_clock_snapshot()</dd> |
| 299 | |
| 300 | <dt> |
| 301 | If the stream's class does not have a |
| 302 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 303 | </dt> |
| 304 | <dd>bt_message_event_create()</dd> |
| 305 | </dl> |
| 306 | </dd> |
| 307 | </dl> |
| 308 | |
| 309 | The four creation functions above accept an \bt_ev_cls parameter. When |
| 310 | you create the message, the library instantiates this event class as an |
| 311 | \bt_ev. Borrow the resulting event with bt_message_event_borrow_event(). |
| 312 | This event class must be part of the class of the event message's |
| 313 | stream. |
| 314 | |
| 315 | An event message's event is initially <em>not set</em>: before you emit |
| 316 | the event message from a \bt_msg_iter's |
| 317 | \link api-msg-iter-cls-meth-next "next" method\endlink, you need to |
| 318 | borrow each of its \bt_p_field (with bt_event_borrow_payload_field(), |
| 319 | bt_event_borrow_specific_context_field(), and |
| 320 | bt_event_borrow_common_context_field()) and, recursively, set the values |
| 321 | of the all their inner fields. |
| 322 | |
| 323 | An event message has the following properties: |
| 324 | |
| 325 | <dl> |
| 326 | <dt>\anchor api-msg-ev-prop-ev Event</dt> |
| 327 | <dd> |
| 328 | \bt_c_ev which the message transports. |
| 329 | |
| 330 | This is an instance of the \bt_ev_cls which was passed to the |
| 331 | message's creation function. |
| 332 | |
| 333 | With this event, you can access its \bt_pkt (if any) with |
| 334 | bt_event_borrow_packet_const() and its |
| 335 | \bt_stream with bt_event_borrow_stream_const(). |
| 336 | |
| 337 | Borrow an event message's event with bt_message_event_borrow_event() |
| 338 | and bt_message_event_borrow_event_const(). |
| 339 | </dd> |
| 340 | |
| 341 | <dt> |
| 342 | \anchor api-msg-ev-prop-cs |
| 343 | \bt_dt_opt Default \bt_cs |
| 344 | </dt> |
| 345 | <dd> |
| 346 | Snapshot of the message's \bt_stream's default clock when the |
| 347 | event occurs. |
| 348 | |
| 349 | An event message has a default clock snapshot |
| 350 | if its stream's \ref api-tir-stream-cls "class" has a |
| 351 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class", |
| 352 | and has none otherwise. |
| 353 | |
| 354 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 355 | the default clock snapshot of an event message must be greater than |
| 356 | or equal to any default clock snapshot of any previous message. |
| 357 | |
| 358 | Borrow an event message's default clock snapshot with |
| 359 | bt_message_event_borrow_default_clock_snapshot_const(). |
| 360 | </dd> |
| 361 | </dl> |
| 362 | |
| 363 | <h2>\anchor api-msg-pb Packet beginning message</h2> |
| 364 | |
| 365 | A <strong><em>packet beginning message</em></strong> indicates the |
| 366 | beginning of a \bt_pkt. |
| 367 | |
| 368 | A packet beginning message can only exist if its \bt_stream's |
| 369 | \ref api-tir-stream-cls "class" |
| 370 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets". |
| 371 | |
| 372 | For a given packet, there can be only one packet beginning message. |
| 373 | |
| 374 | Within its \bt_stream's \ref api-msg-seq "message sequence", a packet |
| 375 | beginning message can only occur after the \bt_sb_msg and before the |
| 376 | \bt_se_msg. |
| 377 | |
| 378 | To create a packet beginning message for a given stream, use: |
| 379 | |
| 380 | <dl> |
| 381 | <dt> |
| 382 | If, for this stream's class, |
| 383 | \ref api-tir-stream-cls-prop-pkt-beg-cs "packets have a beginning default clock snapshot" |
| 384 | </dt> |
| 385 | <dd>bt_message_packet_beginning_create_with_default_clock_snapshot()</dd> |
| 386 | |
| 387 | <dt> |
| 388 | If, for this stream's class, packets do not have a beginning default |
| 389 | clock snapshot |
| 390 | </dt> |
| 391 | <dd>bt_message_packet_beginning_create()</dd> |
| 392 | </dl> |
| 393 | |
| 394 | A packet beginning message has the following properties: |
| 395 | |
| 396 | <dl> |
| 397 | <dt>\anchor api-msg-pb-prop-pkt Packet</dt> |
| 398 | <dd> |
| 399 | \bt_c_pkt of which the message indicates the beginning. |
| 400 | |
| 401 | You cannot change the packet once the message is created. |
| 402 | |
| 403 | Borrow a packet beginning message's packet with |
| 404 | bt_message_packet_beginning_borrow_packet() and |
| 405 | bt_message_packet_beginning_borrow_packet_const(). |
| 406 | </dd> |
| 407 | |
| 408 | <dt> |
| 409 | \anchor api-msg-pb-prop-cs |
| 410 | \bt_dt_opt Default \bt_cs |
| 411 | </dt> |
| 412 | <dd> |
| 413 | Snapshot of the message's \bt_stream's default clock when the |
| 414 | packet begins. |
| 415 | |
| 416 | A packet beginning message has a default clock snapshot if: |
| 417 | |
| 418 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 419 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 420 | |
| 421 | - For its stream's class, |
| 422 | \ref api-tir-stream-cls-prop-pkt-beg-cs "packets have a beginning default clock snapshot". |
| 423 | |
| 424 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 425 | the default clock snapshot of a packet beginning message must be |
| 426 | greater than or equal to any clock snapshot of any previous message. |
| 427 | |
| 428 | Borrow a packet beginning message's default clock snapshot with |
| 429 | bt_message_packet_beginning_borrow_default_clock_snapshot_const(). |
| 430 | </dd> |
| 431 | </dl> |
| 432 | |
| 433 | <h2>\anchor api-msg-pe Packet end message</h2> |
| 434 | |
| 435 | A <strong><em>packet end message</em></strong> indicates the |
| 436 | end of a \bt_pkt. |
| 437 | |
| 438 | A packet end message can only exist if its \bt_stream's |
| 439 | \ref api-tir-stream-cls "class" |
| 440 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets". |
| 441 | |
| 442 | For a given packet, there can be only one packet end message. |
| 443 | |
| 444 | Within its \bt_stream's \ref api-msg-seq "message sequence", a packet |
| 445 | end message can only occur: |
| 446 | |
| 447 | - After the \bt_sb_msg and before the \bt_se_msg. |
| 448 | - After a \bt_pb_msg for the same packet. |
| 449 | |
| 450 | To create a packet end message for a given stream, use: |
| 451 | |
| 452 | <dl> |
| 453 | <dt> |
| 454 | If, for this stream's class, |
| 455 | \ref api-tir-stream-cls-prop-pkt-end-cs "packets have an end default clock snapshot" |
| 456 | </dt> |
| 457 | <dd>bt_message_packet_end_create_with_default_clock_snapshot()</dd> |
| 458 | |
| 459 | <dt> |
| 460 | If, for this stream's class, packets do not have an end default |
| 461 | clock snapshot |
| 462 | </dt> |
| 463 | <dd>bt_message_packet_end_create()</dd> |
| 464 | </dl> |
| 465 | |
| 466 | A packet end message has the following properties: |
| 467 | |
| 468 | <dl> |
| 469 | <dt>\anchor api-msg-pe-prop-pkt Packet</dt> |
| 470 | <dd> |
| 471 | \bt_c_pkt of which the message indicates the end. |
| 472 | |
| 473 | You cannot change the packet once the message is created. |
| 474 | |
| 475 | Borrow a packet end message's packet with |
| 476 | bt_message_packet_end_borrow_packet() and |
| 477 | bt_message_packet_end_borrow_packet_const(). |
| 478 | </dd> |
| 479 | |
| 480 | <dt> |
| 481 | \anchor api-msg-pe-prop-cs |
| 482 | \bt_dt_opt Default \bt_cs |
| 483 | </dt> |
| 484 | <dd> |
| 485 | Snapshot of the message's \bt_stream's default clock when the |
| 486 | packet ends. |
| 487 | |
| 488 | A packet end message has a default clock snapshot if: |
| 489 | |
| 490 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 491 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 492 | |
| 493 | - For its stream's class, |
| 494 | \ref api-tir-stream-cls-prop-pkt-end-cs "packets have an end default clock snapshot". |
| 495 | |
| 496 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 497 | the default clock snapshot of a packet end message must be greater |
| 498 | than or equal to any clock snapshot of any previous message. |
| 499 | |
| 500 | Borrow a packet end message's default clock snapshot with |
| 501 | bt_message_packet_end_borrow_default_clock_snapshot_const(). |
| 502 | </dd> |
| 503 | </dl> |
| 504 | |
| 505 | <h2>\anchor api-msg-disc-ev Discarded events message</h2> |
| 506 | |
| 507 | A <strong><em>discarded events message</em></strong> indicates that |
| 508 | events were discarded at <em>tracing time</em>. It does \em not indicate |
| 509 | that \bt_p_ev_msg were dropped during a trace processing \bt_graph run. |
| 510 | |
| 511 | A discarded events message can only exist if its \bt_stream's |
| 512 | \ref api-tir-stream-cls "class" |
| 513 | \ref api-tir-stream-cls-prop-supports-disc-ev "supports discarded events". |
| 514 | |
| 515 | Within its \bt_stream's \ref api-msg-seq "message sequence", a discarded |
| 516 | events message can only occur after the \bt_sb_msg and before the |
| 517 | \bt_se_msg. |
| 518 | |
| 519 | To create a discarded events message for a given stream, use: |
| 520 | |
| 521 | <dl> |
| 522 | <dt> |
| 523 | If, for this stream's class, |
| 524 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots" |
| 525 | </dt> |
| 526 | <dd>bt_message_discarded_events_create_with_default_clock_snapshots()</dd> |
| 527 | |
| 528 | <dt> |
| 529 | If, for this stream's class, discarded events do not have default |
| 530 | clock snapshots |
| 531 | </dt> |
| 532 | <dd>bt_message_discarded_events_create()</dd> |
| 533 | </dl> |
| 534 | |
| 535 | A discarded events message has the following properties: |
| 536 | |
| 537 | <dl> |
| 538 | <dt>\anchor api-msg-disc-ev-prop-stream Stream</dt> |
| 539 | <dd> |
| 540 | \bt_c_stream into which events were discarded. |
| 541 | |
| 542 | You cannot change the stream once the message is created. |
| 543 | |
| 544 | Borrow a discarded events message's stream with |
| 545 | bt_message_discarded_events_borrow_stream() and |
| 546 | bt_message_discarded_events_borrow_stream_const(). |
| 547 | </dd> |
| 548 | |
| 549 | <dt> |
| 550 | \anchor api-msg-disc-ev-prop-cs-beg |
| 551 | \bt_dt_opt Beginning default \bt_cs |
| 552 | </dt> |
| 553 | <dd> |
| 554 | Snapshot of the message's \bt_stream's default clock which indicates |
| 555 | the beginning of the discarded events time range. |
| 556 | |
| 557 | A discarded events message has a beginning default clock snapshot |
| 558 | if: |
| 559 | |
| 560 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 561 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 562 | |
| 563 | - For its stream's class, |
| 564 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots". |
| 565 | |
| 566 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 567 | the beginning default clock snapshot of a discarded events message |
| 568 | must be greater than or equal to any clock snapshot of any previous |
| 569 | message. |
| 570 | |
| 571 | Borrow a discarded events message's beginning default clock snapshot |
| 572 | with |
| 573 | bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(). |
| 574 | </dd> |
| 575 | |
| 576 | <dt> |
| 577 | \anchor api-msg-disc-ev-prop-cs-end |
| 578 | \bt_dt_opt End default \bt_cs |
| 579 | </dt> |
| 580 | <dd> |
| 581 | Snapshot of the message's \bt_stream's default clock which indicates |
| 582 | the end of the discarded events time range. |
| 583 | |
| 584 | A discarded events message has an end default clock snapshot if: |
| 585 | |
| 586 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 587 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 588 | |
| 589 | - For its stream's class, |
| 590 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots". |
| 591 | |
| 592 | If a discarded events message has both a |
| 593 | \ref api-msg-disc-ev-prop-cs-beg "beginning" and an end default |
| 594 | clock snapshots, the end default clock snapshot must be greater than |
| 595 | or equal to the beginning default clock snapshot. |
| 596 | |
| 597 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 598 | the end default clock snapshot of a discarded events message must be |
| 599 | greater than or equal to any clock snapshot of any previous message. |
| 600 | |
| 601 | Borrow a discarded events message's end default clock snapshot with |
| 602 | bt_message_discarded_events_borrow_end_default_clock_snapshot_const(). |
| 603 | </dd> |
| 604 | |
| 605 | <dt> |
| 606 | \anchor api-msg-disc-ev-prop-count |
| 607 | \bt_dt_opt Discarded event count |
| 608 | </dt> |
| 609 | <dd> |
| 610 | Exact number of discarded events. |
| 611 | |
| 612 | If this property is missing, then the number of discarded events |
| 613 | is at least one. |
| 614 | |
| 615 | Use bt_message_discarded_events_set_count() and |
| 616 | bt_message_discarded_events_get_count(). |
| 617 | </dd> |
| 618 | </dl> |
| 619 | |
| 620 | <h2>\anchor api-msg-disc-pkt Discarded packets message</h2> |
| 621 | |
| 622 | A <strong><em>discarded packets message</em></strong> indicates that |
| 623 | packets were discarded at <em>tracing time</em>. It does \em not |
| 624 | indicate that whole packets were dropped during a trace processing |
| 625 | \bt_graph run. |
| 626 | |
| 627 | A discarded packets message can only exist if its \bt_stream's |
| 628 | \ref api-tir-stream-cls "class" |
| 629 | \ref api-tir-stream-cls-prop-supports-disc-pkt "supports discarded packets". |
| 630 | |
| 631 | Within its \bt_stream's \ref api-msg-seq "message sequence", a discarded |
| 632 | packets message can only occur: |
| 633 | |
| 634 | - After the \bt_sb_msg. |
| 635 | - Before the \bt_se_msg. |
| 636 | - One of: |
| 637 | - Before any \bt_pb_msg. |
| 638 | - After any \bt_pe_msg. |
| 639 | - Between a packet end and a packet beginning message. |
| 640 | |
| 641 | To create a discarded packets message for a given stream, use: |
| 642 | |
| 643 | <dl> |
| 644 | <dt> |
| 645 | If, for this stream's class, |
| 646 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots" |
| 647 | </dt> |
| 648 | <dd>bt_message_discarded_packets_create_with_default_clock_snapshots()</dd> |
| 649 | |
| 650 | <dt> |
| 651 | If, for this stream's class, discarded packets do not have default |
| 652 | clock snapshots |
| 653 | </dt> |
| 654 | <dd>bt_message_discarded_packets_create()</dd> |
| 655 | </dl> |
| 656 | |
| 657 | A discarded packets message has the following properties: |
| 658 | |
| 659 | <dl> |
| 660 | <dt>\anchor api-msg-disc-pkt-prop-stream Stream</dt> |
| 661 | <dd> |
| 662 | \bt_c_stream into which packets were discarded. |
| 663 | |
| 664 | You cannot change the stream once the message is created. |
| 665 | |
| 666 | Borrow a discarded packets message's stream with |
| 667 | bt_message_discarded_packets_borrow_stream() and |
| 668 | bt_message_discarded_packets_borrow_stream_const(). |
| 669 | </dd> |
| 670 | |
| 671 | <dt> |
| 672 | \anchor api-msg-disc-pkt-prop-cs-beg |
| 673 | \bt_dt_opt Beginning default \bt_cs |
| 674 | </dt> |
| 675 | <dd> |
| 676 | Snapshot of the message's \bt_stream's default clock which indicates |
| 677 | the beginning of the discarded packets time range. |
| 678 | |
| 679 | A discarded packets message has a beginning default clock snapshot |
| 680 | if: |
| 681 | |
| 682 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 683 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 684 | |
| 685 | - For its stream's class, |
| 686 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots". |
| 687 | |
| 688 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 689 | the beginning default clock snapshot of a discarded packets message |
| 690 | must be greater than or equal to any clock snapshot of any previous |
| 691 | message. |
| 692 | |
| 693 | Borrow a discarded packets message's beginning default clock snapshot |
| 694 | with |
| 695 | bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(). |
| 696 | </dd> |
| 697 | |
| 698 | <dt> |
| 699 | \anchor api-msg-disc-pkt-prop-cs-end |
| 700 | \bt_dt_opt End default \bt_cs |
| 701 | </dt> |
| 702 | <dd> |
| 703 | Snapshot of the message's \bt_stream's default clock which indicates |
| 704 | the end of the discarded packets time range. |
| 705 | |
| 706 | A discarded packets message has an end default clock snapshot if: |
| 707 | |
| 708 | - Its stream's \ref api-tir-stream-cls "class" has a |
| 709 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 710 | |
| 711 | - For its stream's class, |
| 712 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots". |
| 713 | |
| 714 | If a discarded packets message has both a |
| 715 | \ref api-msg-disc-pkt-prop-cs-beg "beginning" and an end default |
| 716 | clock snapshots, the end default clock snapshot must be greater than |
| 717 | or equal to the beginning default clock snapshot. |
| 718 | |
| 719 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", |
| 720 | the end default clock snapshot of a discarded packets message must |
| 721 | be greater than or equal to any clock snapshot of any previous |
| 722 | message. |
| 723 | |
| 724 | Borrow a discarded packets message's end default clock snapshot with |
| 725 | bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(). |
| 726 | </dd> |
| 727 | |
| 728 | <dt> |
| 729 | \anchor api-msg-disc-pkt-prop-count |
| 730 | \bt_dt_opt Discarded packet count |
| 731 | </dt> |
| 732 | <dd> |
| 733 | Exact number of discarded packets. |
| 734 | |
| 735 | If this property is missing, then the number of discarded packets |
| 736 | is at least one. |
| 737 | |
| 738 | Use bt_message_discarded_packets_set_count() and |
| 739 | bt_message_discarded_packets_get_count(). |
| 740 | </dd> |
| 741 | </dl> |
| 742 | |
| 743 | <h2>\anchor api-msg-inac Message iterator inactivity</h2> |
| 744 | |
| 745 | A <strong><em>message iterator inactivity message</em></strong> |
| 746 | indicates that, within the \ref api-msg-seq "message sequence" of a |
| 747 | given \bt_msg_iter, there's no messages since the last message (if any) |
| 748 | until a given point in time. |
| 749 | |
| 750 | A message iterator inactivity message is the only type of message that's |
| 751 | not related to a \bt_stream: it targets the whole message sequence of a |
| 752 | message iterator, and can occur at any position within the sequence. |
| 753 | |
| 754 | This message is mostly significant for real-time message iterators: if a |
| 755 | message iterator A indicates that there's no messages until a given |
| 756 | point in time T, then a downstream filter message iterator B which |
| 757 | relies on multiple upstream message iterators does not have to wait for |
| 758 | new messages from A until T. |
| 759 | |
| 760 | In other words, a message iterator inactivity message can help |
| 761 | downstream message iterators or \bt_p_sink_comp <em>progress</em>. |
| 762 | |
| 763 | Create a message iterator inactivity message with |
| 764 | bt_message_message_iterator_inactivity_create(). You must pass a |
| 765 | \bt_clock_cls and the value of a fictitious (clock) instance to this |
| 766 | function so that it creates a \bt_cs. |
| 767 | |
| 768 | A message iterator inactivity message has the following property: |
| 769 | |
| 770 | <dl> |
| 771 | <dt> |
| 772 | \anchor api-msg-inac-prop-cs |
| 773 | \bt_dt_opt \bt_c_cs |
| 774 | </dt> |
| 775 | <dd> |
| 776 | Snapshot of a fictitious instance of the message's \bt_clock_cls |
| 777 | which indicates the point in time until when there's no messages |
| 778 | in the message iterator's \ref api-msg-seq "message sequence". |
| 779 | |
| 780 | Within its \bt_msg_iter's message sequence, the clock snapshot of a |
| 781 | message iterator inactivity message must be greater than or equal to |
| 782 | any clock snapshot of any previous message. |
| 783 | |
| 784 | Borrow a message iterator inactivity message's clock snapshot |
| 785 | with |
| 786 | bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(). |
| 787 | </dd> |
| 788 | </dl> |
| 789 | |
| 790 | <h1>\anchor api-msg-mip Message Interchange Protocol</h1> |
| 791 | |
| 792 | The <em>Message Interchange Protocol</em> (MIP) is the system of rules |
| 793 | used by \bt_p_comp and \bt_p_msg_iter to exchance messages within a |
| 794 | trace processing graph. |
| 795 | |
| 796 | The MIP covers everything related to messages and what they contain, as |
| 797 | well as how they are ordered within the \ref api-msg-seq "sequence" that |
| 798 | a message iterator produces. |
| 799 | |
| 800 | For example: |
| 801 | |
| 802 | - A valid message sequence for a given \bt_stream starts with a |
| 803 | \bt_sb_msg and ends with a \bt_se_msg. |
| 804 | |
| 805 | - The maximum |
| 806 | \ref api-tir-fc-int-prop-size "field value range" for an \bt_uint_fc |
| 807 | is [0, 2<sup>64</sup> - 1]. |
| 808 | |
| 809 | - The available message types are stream beginning and end, event, |
| 810 | packet beginning and end, discarded events and packets, and message |
| 811 | iterator inactivity. |
| 812 | |
| 813 | The MIP has a version which is a single major number, independent from |
| 814 | the \bt_name project's version. As of \bt_name_version_min_maj, the only |
| 815 | available MIP version is 0. |
| 816 | |
| 817 | If what the MIP covers changes in a breaking or semantical way in the |
| 818 | future, the MIP and \bt_name's minor versions will be bumped. |
| 819 | |
| 820 | When you create a trace processing \bt_graph with bt_graph_create(), you |
| 821 | must pass the effective MIP version to use. Then, the components you |
| 822 | \ref api-graph-lc-add "add" to this graph can access this configured MIP |
| 823 | version with bt_self_component_get_graph_mip_version() and behave |
| 824 | accordingly. In other words, if the configured MIP version is 0, then a |
| 825 | component cannot use features introduced by MIP version 1. For |
| 826 | example, should the project introduce a new type of \bt_fc, the MIP |
| 827 | version would be bumped. |
| 828 | |
| 829 | A component which cannot honor a given MIP can fail at |
| 830 | initialization time, making the corresponding |
| 831 | <code>bt_graph_add_*_component*()</code> call fail too. To avoid any |
| 832 | surprise, you can create a \bt_comp_descr_set with descriptors of the |
| 833 | components you intend to add to a trace processing graph and call |
| 834 | bt_get_greatest_operative_mip_version() to get the greatest (most |
| 835 | recent) MIP version you can use. |
| 836 | |
| 837 | To get the library's latest MIP version, use |
| 838 | bt_get_maximal_mip_version(). |
| 839 | |
| 840 | The ultimate goal of the MIP version feature is for the \bt_name project |
| 841 | to be able to introduce new features or even major breaking changes |
| 842 | without breaking existing \bt_p_comp_cls. This is especially important |
| 843 | considering that \bt_name supports \bt_p_plugin written by different |
| 844 | authors. Of course one of the project's objectives is to bump the MIP |
| 845 | version as rarely as possible. When it is required, though, it's a |
| 846 | welcome tool to make the project evolve gracefully. |
| 847 | |
| 848 | The Message Interchange Protocol has no dedicated documentation as this |
| 849 | very message module (and its submodules, like \ref api-tir) |
| 850 | documentation is enough. You can consider that all the |
| 851 | functions of the message and trace IR objects have an implicit MIP |
| 852 | version \ref api-fund-pre-post "precondition". When a given |
| 853 | function documentation does not explicitly document a MIP version |
| 854 | precondition, it means that the effective MIP version has no effect on |
| 855 | said function's behaviour. |
| 856 | |
| 857 | <h2>\anchor api-msg-seq Message sequence rules</h2> |
| 858 | |
| 859 | The purpose of a \bt_msg_iter is to iterate a sequence of messages. |
| 860 | |
| 861 | Those messages can be related to different \bt_p_stream: |
| 862 | |
| 863 | @image html trace-structure-msg-seq.png "Messages of multiple streams as a single message sequence for a given message iterator." |
| 864 | |
| 865 | However, for such a message sequence, the current \bt_mip |
| 866 | (version \bt_max_mip_version) dictates that: |
| 867 | |
| 868 | <ul> |
| 869 | <li> |
| 870 | For a given \bt_stream: |
| 871 | |
| 872 | - The sequence must begin with a \bt_sb_msg. |
| 873 | - The sequence must end with a \bt_se_msg. |
| 874 | - <strong>If the stream's \ref api-tir-stream-cls "class" |
| 875 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets"</strong>: |
| 876 | - Any \bt_pb_msg must be followed with a \bt_pe_msg. |
| 877 | - All \bt_p_ev_msg must be between a packet beginning and a |
| 878 | packet end message. |
| 879 | - A \bt_disc_pkt_msg must be (one of): |
| 880 | - Before the first packet beginning message. |
| 881 | - Between a packet end message and a packet beginning message. |
| 882 | - After the last packet end message. |
| 883 | |
| 884 | The rules above can be summarized by the following regular |
| 885 | expressions: |
| 886 | |
| 887 | <dl> |
| 888 | <dt>Without packets</dt> |
| 889 | <dd> |
| 890 | @code{.unparsed} |
| 891 | SB (E | DE)* SE |
| 892 | @endcode |
| 893 | </dd> |
| 894 | |
| 895 | <dt>With packets</dt> |
| 896 | <dd> |
| 897 | @code{.unparsed} |
| 898 | SB ((PB (E | DE)* PE) | DE | DP)* SE |
| 899 | @endcode |
| 900 | </dd> |
| 901 | </dl> |
| 902 | |
| 903 | With this alphabet: |
| 904 | |
| 905 | <dl> |
| 906 | <dt>SB</dt> |
| 907 | <dd>\bt_c_sb_msg</dd> |
| 908 | |
| 909 | <dt>SE</dt> |
| 910 | <dd>\bt_c_se_msg</dd> |
| 911 | |
| 912 | <dt>E</dt> |
| 913 | <dd>\bt_c_ev_msg</dd> |
| 914 | |
| 915 | <dt>PB</dt> |
| 916 | <dd>\bt_c_pb_msg</dd> |
| 917 | |
| 918 | <dt>PE</dt> |
| 919 | <dd>\bt_c_pe_msg</dd> |
| 920 | |
| 921 | <dt>DE</dt> |
| 922 | <dd>\bt_c_disc_ev_msg</dd> |
| 923 | |
| 924 | <dt>DP</dt> |
| 925 | <dd>\bt_c_disc_pkt_msg</dd> |
| 926 | </dl> |
| 927 | <li> |
| 928 | For a given message iterator, for any message with a \bt_cs, its |
| 929 | clock snapshot must be greater than or equal to any clock snapshot |
| 930 | of any previous message. |
| 931 | |
| 932 | For the scope of this rule, the clock snapshot of a \bt_disc_ev_msg |
| 933 | or of a \bt_disc_pkt_msg is its beginning default clock snapshot. |
| 934 | <li> |
| 935 | For a given message iterator, the \bt_p_cs of all the messages of |
| 936 | the sequence with a clock snapshot must be correlatable |
| 937 | (see \ref api-tir-clock-cls-origin "Clock value vs. clock class origin"). |
| 938 | </ul> |
| 939 | */ |
| 940 | |
| 941 | /*! @{ */ |
| 942 | |
| 943 | /*! |
| 944 | @name Type |
| 945 | @{ |
| 946 | |
| 947 | @typedef struct bt_message bt_message; |
| 948 | |
| 949 | @brief |
| 950 | Message. |
| 951 | |
| 952 | @} |
| 953 | */ |
| 954 | |
| 955 | /*! |
| 956 | @name Type query |
| 957 | @{ |
| 958 | */ |
| 959 | |
| 960 | /*! |
| 961 | @brief |
| 962 | Message type enumerators. |
| 963 | */ |
| 964 | typedef enum bt_message_type { |
| 965 | /*! |
| 966 | @brief |
| 967 | \bt_c_sb_msg. |
| 968 | */ |
| 969 | BT_MESSAGE_TYPE_STREAM_BEGINNING = 1 << 0, |
| 970 | |
| 971 | /*! |
| 972 | @brief |
| 973 | \bt_c_se_msg. |
| 974 | */ |
| 975 | BT_MESSAGE_TYPE_STREAM_END = 1 << 1, |
| 976 | |
| 977 | /*! |
| 978 | @brief |
| 979 | \bt_c_ev_msg. |
| 980 | */ |
| 981 | BT_MESSAGE_TYPE_EVENT = 1 << 2, |
| 982 | |
| 983 | /*! |
| 984 | @brief |
| 985 | \bt_c_pb_msg. |
| 986 | */ |
| 987 | BT_MESSAGE_TYPE_PACKET_BEGINNING = 1 << 3, |
| 988 | |
| 989 | /*! |
| 990 | @brief |
| 991 | \bt_c_pe_msg. |
| 992 | */ |
| 993 | BT_MESSAGE_TYPE_PACKET_END = 1 << 4, |
| 994 | |
| 995 | /*! |
| 996 | @brief |
| 997 | \bt_c_disc_ev_msg. |
| 998 | */ |
| 999 | BT_MESSAGE_TYPE_DISCARDED_EVENTS = 1 << 5, |
| 1000 | |
| 1001 | /*! |
| 1002 | @brief |
| 1003 | \bt_c_disc_pkt_msg. |
| 1004 | */ |
| 1005 | BT_MESSAGE_TYPE_DISCARDED_PACKETS = 1 << 6, |
| 1006 | |
| 1007 | /*! |
| 1008 | @brief |
| 1009 | \bt_c_inac_msg. |
| 1010 | */ |
| 1011 | BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY = 1 << 7, |
| 1012 | } bt_message_type; |
| 1013 | |
| 1014 | /*! |
| 1015 | @brief |
| 1016 | Returns the type enumerator of the message \bt_p{message}. |
| 1017 | |
| 1018 | @param[in] message |
| 1019 | Message of which to get the type enumerator |
| 1020 | |
| 1021 | @returns |
| 1022 | Type enumerator of \bt_p{message}. |
| 1023 | |
| 1024 | @bt_pre_not_null{message} |
| 1025 | */ |
| 1026 | extern bt_message_type bt_message_get_type(const bt_message *message); |
| 1027 | |
| 1028 | /*! @} */ |
| 1029 | |
| 1030 | /*! |
| 1031 | @name Common stream message |
| 1032 | @{ |
| 1033 | */ |
| 1034 | |
| 1035 | /*! |
| 1036 | @brief |
| 1037 | Return type of |
| 1038 | bt_message_stream_beginning_borrow_default_clock_snapshot_const() |
| 1039 | and |
| 1040 | bt_message_stream_end_borrow_default_clock_snapshot_const(). |
| 1041 | */ |
| 1042 | typedef enum bt_message_stream_clock_snapshot_state { |
| 1043 | /*! |
| 1044 | @brief |
| 1045 | Known \bt_cs. |
| 1046 | */ |
| 1047 | BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN = 1, |
| 1048 | |
| 1049 | /*! |
| 1050 | @brief |
| 1051 | Unknown (no) \bt_cs. |
| 1052 | */ |
| 1053 | BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN = 0, |
| 1054 | } bt_message_stream_clock_snapshot_state; |
| 1055 | |
| 1056 | /*! @} */ |
| 1057 | |
| 1058 | /*! |
| 1059 | @name Stream beginning message |
| 1060 | @{ |
| 1061 | */ |
| 1062 | |
| 1063 | /*! |
| 1064 | @brief |
| 1065 | Creates a \bt_sb_msg for the \bt_stream \bt_p{stream} from the |
| 1066 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1067 | |
| 1068 | On success, the returned stream beginning message has the following |
| 1069 | property values: |
| 1070 | |
| 1071 | <table> |
| 1072 | <tr> |
| 1073 | <th>Property |
| 1074 | <th>Value |
| 1075 | <tr> |
| 1076 | <td>\ref api-msg-sb-prop-stream "Stream" |
| 1077 | <td>\bt_p{stream} |
| 1078 | <tr> |
| 1079 | <td>\ref api-msg-sb-prop-cs "Default clock snapshot" |
| 1080 | <td>\em None |
| 1081 | </table> |
| 1082 | |
| 1083 | @param[in] self_message_iterator |
| 1084 | Self message iterator from which to create the stream beginning |
| 1085 | message. |
| 1086 | @param[in] stream |
| 1087 | Stream of which the message to create indicates the beginning. |
| 1088 | |
| 1089 | @returns |
| 1090 | New stream beginning message reference, or \c NULL on memory error. |
| 1091 | |
| 1092 | @bt_pre_not_null{self_message_iterator} |
| 1093 | @bt_pre_not_null{stream} |
| 1094 | |
| 1095 | @bt_post_success_frozen{stream} |
| 1096 | */ |
| 1097 | extern |
| 1098 | bt_message *bt_message_stream_beginning_create( |
| 1099 | bt_self_message_iterator *self_message_iterator, |
| 1100 | const bt_stream *stream); |
| 1101 | |
| 1102 | /*! |
| 1103 | @brief |
| 1104 | Borrows the \bt_stream of the \bt_sb_msg \bt_p{message}. |
| 1105 | |
| 1106 | See the \ref api-msg-sb-prop-stream "stream" property. |
| 1107 | |
| 1108 | @param[in] message |
| 1109 | Stream beginning message from which to borrow the stream. |
| 1110 | |
| 1111 | @returns |
| 1112 | @parblock |
| 1113 | \em Borrowed reference of the stream of \bt_p{message}. |
| 1114 | |
| 1115 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 1116 | @endparblock |
| 1117 | |
| 1118 | @bt_pre_not_null{message} |
| 1119 | @bt_pre_is_sb_msg{message} |
| 1120 | |
| 1121 | @sa bt_message_stream_beginning_borrow_stream_const() — |
| 1122 | \c const version of this function. |
| 1123 | */ |
| 1124 | extern bt_stream *bt_message_stream_beginning_borrow_stream( |
| 1125 | bt_message *message); |
| 1126 | |
| 1127 | /*! |
| 1128 | @brief |
| 1129 | Borrows the \bt_stream of the \bt_sb_msg \bt_p{message} |
| 1130 | (\c const version). |
| 1131 | |
| 1132 | See bt_message_stream_beginning_borrow_stream(). |
| 1133 | */ |
| 1134 | extern const bt_stream *bt_message_stream_beginning_borrow_stream_const( |
| 1135 | const bt_message *message); |
| 1136 | |
| 1137 | /*! |
| 1138 | @brief |
| 1139 | Sets the value, in clock cycles, of the default \bt_cs of the |
| 1140 | \bt_sb_msg \bt_p{message} to \bt_p{value}. |
| 1141 | |
| 1142 | See the \ref api-msg-sb-prop-cs "default clock snapshot" property. |
| 1143 | |
| 1144 | @param[in] message |
| 1145 | Stream beginning message of which to set the default clock snapshot |
| 1146 | value to \bt_p{value}. |
| 1147 | @param[in] value |
| 1148 | New value (clock cycles) of the default clock snapshot of |
| 1149 | \bt_p{message}. |
| 1150 | |
| 1151 | @bt_pre_not_null{message} |
| 1152 | @bt_pre_hot{message} |
| 1153 | @bt_pre_is_sb_msg{message} |
| 1154 | @pre |
| 1155 | The \bt_stream_cls of \bt_p{message} has a |
| 1156 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 1157 | |
| 1158 | @sa bt_message_stream_beginning_borrow_default_clock_snapshot_const() — |
| 1159 | Borrows the default clock snapshot of a stream beginning message. |
| 1160 | */ |
| 1161 | extern |
| 1162 | void bt_message_stream_beginning_set_default_clock_snapshot( |
| 1163 | bt_message *message, uint64_t value); |
| 1164 | |
| 1165 | /*! |
| 1166 | @brief |
| 1167 | Borrows the default \bt_cs of the \bt_sb_msg \bt_p{message}. |
| 1168 | |
| 1169 | See the \ref api-msg-sb-prop-cs "default clock snapshot" property. |
| 1170 | |
| 1171 | @param[in] message |
| 1172 | Stream beginning message from which to borrow the default clock |
| 1173 | snapshot. |
| 1174 | @param[out] clock_snapshot |
| 1175 | <strong>If this function returns |
| 1176 | #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN</strong>, |
| 1177 | \bt_p{*clock_snapshot} is a \em borrowed reference of the default |
| 1178 | clock snapshot of \bt_p{message}. |
| 1179 | |
| 1180 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN |
| 1181 | The default clock snapshot of \bt_p{message} is known and returned |
| 1182 | as \bt_p{*clock_snapshot}. |
| 1183 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN |
| 1184 | \bt_p{message} has no default clock snapshot: its time is unknown. |
| 1185 | |
| 1186 | @bt_pre_not_null{message} |
| 1187 | @bt_pre_is_sb_msg{message} |
| 1188 | @pre |
| 1189 | The \bt_stream_cls of \bt_p{message} has a |
| 1190 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 1191 | @bt_pre_not_null{clock_snapshot} |
| 1192 | |
| 1193 | @sa bt_message_stream_beginning_set_default_clock_snapshot() — |
| 1194 | Sets the default clock snapshot of a stream beginning message. |
| 1195 | */ |
| 1196 | extern bt_message_stream_clock_snapshot_state |
| 1197 | bt_message_stream_beginning_borrow_default_clock_snapshot_const( |
| 1198 | const bt_message *message, |
| 1199 | const bt_clock_snapshot **clock_snapshot); |
| 1200 | |
| 1201 | /*! |
| 1202 | @brief |
| 1203 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 1204 | of the \bt_sb_msg \bt_p{message}. |
| 1205 | |
| 1206 | See the stream class's |
| 1207 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 1208 | property. |
| 1209 | |
| 1210 | This is a helper which is equivalent to |
| 1211 | |
| 1212 | @code |
| 1213 | bt_stream_class_borrow_default_clock_class_const( |
| 1214 | bt_stream_borrow_class_const( |
| 1215 | bt_message_stream_beginning_borrow_stream_const(message))) |
| 1216 | @endcode |
| 1217 | |
| 1218 | @param[in] message |
| 1219 | Stream beginning message from which to borrow its stream's class's |
| 1220 | default clock class. |
| 1221 | |
| 1222 | @returns |
| 1223 | \em Borrowed reference of the default clock class of |
| 1224 | the stream class of \bt_p{message}, or \c NULL if none. |
| 1225 | |
| 1226 | @bt_pre_not_null{message} |
| 1227 | @bt_pre_is_sb_msg{message} |
| 1228 | */ |
| 1229 | extern const bt_clock_class * |
| 1230 | bt_message_stream_beginning_borrow_stream_class_default_clock_class_const( |
| 1231 | const bt_message *message); |
| 1232 | |
| 1233 | /*! @} */ |
| 1234 | |
| 1235 | /*! |
| 1236 | @name Stream end message |
| 1237 | @{ |
| 1238 | */ |
| 1239 | |
| 1240 | /*! |
| 1241 | @brief |
| 1242 | Creates a \bt_se_msg for the \bt_stream \bt_p{stream} from the |
| 1243 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1244 | |
| 1245 | On success, the returned stream end message has the following |
| 1246 | property values: |
| 1247 | |
| 1248 | <table> |
| 1249 | <tr> |
| 1250 | <th>Property |
| 1251 | <th>Value |
| 1252 | <tr> |
| 1253 | <td>\ref api-msg-se-prop-stream "Stream" |
| 1254 | <td>\bt_p{stream} |
| 1255 | <tr> |
| 1256 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" |
| 1257 | <td>\em None |
| 1258 | </table> |
| 1259 | |
| 1260 | @param[in] self_message_iterator |
| 1261 | Self message iterator from which to create the stream end |
| 1262 | message. |
| 1263 | @param[in] stream |
| 1264 | Stream of which the message to create indicates the end. |
| 1265 | |
| 1266 | @returns |
| 1267 | New stream end message reference, or \c NULL on memory error. |
| 1268 | |
| 1269 | @bt_pre_not_null{self_message_iterator} |
| 1270 | @bt_pre_not_null{stream} |
| 1271 | |
| 1272 | @bt_post_success_frozen{stream} |
| 1273 | */ |
| 1274 | extern |
| 1275 | bt_message *bt_message_stream_end_create( |
| 1276 | bt_self_message_iterator *self_message_iterator, |
| 1277 | const bt_stream *stream); |
| 1278 | |
| 1279 | /*! |
| 1280 | @brief |
| 1281 | Borrows the \bt_stream of the \bt_se_msg \bt_p{message}. |
| 1282 | |
| 1283 | See the \ref api-msg-se-prop-stream "stream" property. |
| 1284 | |
| 1285 | @param[in] message |
| 1286 | Stream end message from which to borrow the stream. |
| 1287 | |
| 1288 | @returns |
| 1289 | @parblock |
| 1290 | \em Borrowed reference of the stream of \bt_p{message}. |
| 1291 | |
| 1292 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 1293 | @endparblock |
| 1294 | |
| 1295 | @bt_pre_not_null{message} |
| 1296 | @bt_pre_is_se_msg{message} |
| 1297 | |
| 1298 | @sa bt_message_stream_end_borrow_stream_const() — |
| 1299 | \c const version of this function. |
| 1300 | */ |
| 1301 | extern bt_stream *bt_message_stream_end_borrow_stream( |
| 1302 | bt_message *message); |
| 1303 | |
| 1304 | /*! |
| 1305 | @brief |
| 1306 | Borrows the \bt_stream of the \bt_se_msg \bt_p{message} |
| 1307 | (\c const version). |
| 1308 | |
| 1309 | See bt_message_stream_end_borrow_stream(). |
| 1310 | */ |
| 1311 | extern const bt_stream *bt_message_stream_end_borrow_stream_const( |
| 1312 | const bt_message *message); |
| 1313 | |
| 1314 | /*! |
| 1315 | @brief |
| 1316 | Sets the value, in clock cycles, of the default \bt_cs of the |
| 1317 | \bt_se_msg \bt_p{message} to \bt_p{value}. |
| 1318 | |
| 1319 | See the \ref api-msg-se-prop-cs "default clock snapshot" property. |
| 1320 | |
| 1321 | @param[in] message |
| 1322 | Stream end message of which to set the default clock snapshot |
| 1323 | value to \bt_p{value}. |
| 1324 | @param[in] value |
| 1325 | New value (clock cycles) of the default clock snapshot of |
| 1326 | \bt_p{message}. |
| 1327 | |
| 1328 | @bt_pre_not_null{message} |
| 1329 | @bt_pre_hot{message} |
| 1330 | @bt_pre_is_se_msg{message} |
| 1331 | @pre |
| 1332 | The \bt_stream_cls of \bt_p{message} has a |
| 1333 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 1334 | |
| 1335 | @sa bt_message_stream_end_borrow_default_clock_snapshot_const() — |
| 1336 | Borrows the default clock snapshot of a stream end message. |
| 1337 | */ |
| 1338 | extern |
| 1339 | void bt_message_stream_end_set_default_clock_snapshot( |
| 1340 | bt_message *message, uint64_t value); |
| 1341 | |
| 1342 | /*! |
| 1343 | @brief |
| 1344 | Borrows the default \bt_cs of the \bt_se_msg \bt_p{message}. |
| 1345 | |
| 1346 | See the \ref api-msg-se-prop-cs "default clock snapshot" property. |
| 1347 | |
| 1348 | @param[in] message |
| 1349 | Stream end message from which to borrow the default clock |
| 1350 | snapshot. |
| 1351 | @param[out] clock_snapshot |
| 1352 | <strong>If this function returns |
| 1353 | #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN</strong>, |
| 1354 | \bt_p{*clock_snapshot} is a \em borrowed reference of the default |
| 1355 | clock snapshot of \bt_p{message}. |
| 1356 | |
| 1357 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN |
| 1358 | The default clock snapshot of \bt_p{message} is known and returned |
| 1359 | as \bt_p{*clock_snapshot}. |
| 1360 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN |
| 1361 | \bt_p{message} has no default clock snapshot: its time is unknown. |
| 1362 | |
| 1363 | @bt_pre_not_null{message} |
| 1364 | @bt_pre_is_se_msg{message} |
| 1365 | @pre |
| 1366 | The \bt_stream_cls of \bt_p{message} has a |
| 1367 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 1368 | @bt_pre_not_null{clock_snapshot} |
| 1369 | |
| 1370 | @sa bt_message_stream_end_set_default_clock_snapshot() — |
| 1371 | Sets the default clock snapshot of a stream end message. |
| 1372 | */ |
| 1373 | extern bt_message_stream_clock_snapshot_state |
| 1374 | bt_message_stream_end_borrow_default_clock_snapshot_const( |
| 1375 | const bt_message *message, |
| 1376 | const bt_clock_snapshot **clock_snapshot); |
| 1377 | |
| 1378 | /*! |
| 1379 | @brief |
| 1380 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 1381 | of the \bt_se_msg \bt_p{message}. |
| 1382 | |
| 1383 | See the stream class's |
| 1384 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 1385 | property. |
| 1386 | |
| 1387 | This is a helper which is equivalent to |
| 1388 | |
| 1389 | @code |
| 1390 | bt_stream_class_borrow_default_clock_class_const( |
| 1391 | bt_stream_borrow_class_const( |
| 1392 | bt_message_stream_end_borrow_stream_const(message))) |
| 1393 | @endcode |
| 1394 | |
| 1395 | @param[in] message |
| 1396 | Stream end message from which to borrow its stream's class's |
| 1397 | default clock class. |
| 1398 | |
| 1399 | @returns |
| 1400 | \em Borrowed reference of the default clock class of |
| 1401 | the stream class of \bt_p{message}, or \c NULL if none. |
| 1402 | |
| 1403 | @bt_pre_not_null{message} |
| 1404 | @bt_pre_is_se_msg{message} |
| 1405 | */ |
| 1406 | extern const bt_clock_class * |
| 1407 | bt_message_stream_end_borrow_stream_class_default_clock_class_const( |
| 1408 | const bt_message *message); |
| 1409 | |
| 1410 | /*! @} */ |
| 1411 | |
| 1412 | /*! |
| 1413 | @name Event message |
| 1414 | @{ |
| 1415 | */ |
| 1416 | |
| 1417 | /*! |
| 1418 | @brief |
| 1419 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls |
| 1420 | \bt_p{event_class}, for the \bt_stream \bt_p{stream} from the |
| 1421 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1422 | |
| 1423 | @attention |
| 1424 | @parblock |
| 1425 | Only use this function if |
| 1426 | |
| 1427 | @code |
| 1428 | bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream)) |
| 1429 | @endcode |
| 1430 | |
| 1431 | returns #BT_FALSE and |
| 1432 | |
| 1433 | @code |
| 1434 | bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream)) |
| 1435 | @endcode |
| 1436 | |
| 1437 | returns \c NULL. |
| 1438 | |
| 1439 | Otherwise, use |
| 1440 | bt_message_event_create_with_default_clock_snapshot(), |
| 1441 | bt_message_event_create_with_packet(), or |
| 1442 | bt_message_event_create_with_packet_and_default_clock_snapshot(). |
| 1443 | @endparblock |
| 1444 | |
| 1445 | On success, the returned event message has the following property |
| 1446 | values: |
| 1447 | |
| 1448 | <table> |
| 1449 | <tr> |
| 1450 | <th>Property |
| 1451 | <th>Value |
| 1452 | <tr> |
| 1453 | <td>\ref api-msg-ev-prop-ev "Event" |
| 1454 | <td> |
| 1455 | An instance (with \bt_p_field that are not set) of |
| 1456 | \bt_p{event_class}. |
| 1457 | <tr> |
| 1458 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" |
| 1459 | <td>\em None |
| 1460 | </table> |
| 1461 | |
| 1462 | @param[in] self_message_iterator |
| 1463 | Self message iterator from which to create the event message. |
| 1464 | @param[in] event_class |
| 1465 | Class of the \bt_ev of the message to create. |
| 1466 | @param[in] stream |
| 1467 | Stream conceptually containing the event of the message to create. |
| 1468 | |
| 1469 | @returns |
| 1470 | New event message reference, or \c NULL on memory error. |
| 1471 | |
| 1472 | @bt_pre_not_null{self_message_iterator} |
| 1473 | @pre |
| 1474 | The \bt_stream_cls of \bt_p{event_class} is also the class of |
| 1475 | \bt_p{stream}, that is, |
| 1476 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> |
| 1477 | and |
| 1478 | <code>bt_stream_borrow_class_const(stream)</code> have the |
| 1479 | same value. |
| 1480 | @bt_pre_not_null{stream} |
| 1481 | @pre |
| 1482 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream))</code> |
| 1483 | returns #BT_FALSE. |
| 1484 | @pre |
| 1485 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream))</code> |
| 1486 | returns \c NULL. |
| 1487 | |
| 1488 | @bt_post_success_frozen{event_class} |
| 1489 | @bt_post_success_frozen{stream} |
| 1490 | */ |
| 1491 | extern |
| 1492 | bt_message *bt_message_event_create( |
| 1493 | bt_self_message_iterator *self_message_iterator, |
| 1494 | const bt_event_class *event_class, |
| 1495 | const bt_stream *stream); |
| 1496 | |
| 1497 | /*! |
| 1498 | @brief |
| 1499 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls |
| 1500 | \bt_p{event_class} and a default \bt_cs with the value |
| 1501 | \bt_p{clock_snapshot_value}, for the \bt_stream \bt_p{stream} from |
| 1502 | the \bt_msg_iter \bt_p{self_message_iterator}. |
| 1503 | |
| 1504 | @attention |
| 1505 | @parblock |
| 1506 | Only use this function if |
| 1507 | |
| 1508 | @code |
| 1509 | bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream)) |
| 1510 | @endcode |
| 1511 | |
| 1512 | returns #BT_FALSE and |
| 1513 | |
| 1514 | @code |
| 1515 | bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream)) |
| 1516 | @endcode |
| 1517 | |
| 1518 | does \em not return \c NULL. |
| 1519 | |
| 1520 | Otherwise, use |
| 1521 | bt_message_event_create(), |
| 1522 | bt_message_event_create_with_packet(), or |
| 1523 | bt_message_event_create_with_packet_and_default_clock_snapshot(). |
| 1524 | @endparblock |
| 1525 | |
| 1526 | On success, the returned event message has the following property |
| 1527 | values: |
| 1528 | |
| 1529 | <table> |
| 1530 | <tr> |
| 1531 | <th>Property |
| 1532 | <th>Value |
| 1533 | <tr> |
| 1534 | <td>\ref api-msg-ev-prop-ev "Event" |
| 1535 | <td> |
| 1536 | An instance (with \bt_p_field that are not set) of |
| 1537 | \bt_p{event_class}. |
| 1538 | <tr> |
| 1539 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" |
| 1540 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. |
| 1541 | </table> |
| 1542 | |
| 1543 | @param[in] self_message_iterator |
| 1544 | Self message iterator from which to create the event message. |
| 1545 | @param[in] event_class |
| 1546 | Class of the \bt_ev of the message to create. |
| 1547 | @param[in] stream |
| 1548 | Stream conceptually containing the event of the message to create. |
| 1549 | @param[in] clock_snapshot_value |
| 1550 | Value (clock cycles) of the default clock snapshot of |
| 1551 | \bt_p{message}. |
| 1552 | |
| 1553 | @returns |
| 1554 | New event message reference, or \c NULL on memory error. |
| 1555 | |
| 1556 | @bt_pre_not_null{self_message_iterator} |
| 1557 | @pre |
| 1558 | The \bt_stream_cls of \bt_p{event_class} is also the class of |
| 1559 | \bt_p{stream}, that is, |
| 1560 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> |
| 1561 | and |
| 1562 | <code>bt_stream_borrow_class_const(stream)</code> have the |
| 1563 | same value. |
| 1564 | @bt_pre_not_null{stream} |
| 1565 | @pre |
| 1566 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream))</code> |
| 1567 | returns #BT_FALSE. |
| 1568 | @pre |
| 1569 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream))</code> |
| 1570 | does \em not return \c NULL. |
| 1571 | |
| 1572 | @bt_post_success_frozen{event_class} |
| 1573 | @bt_post_success_frozen{stream} |
| 1574 | */ |
| 1575 | extern |
| 1576 | bt_message *bt_message_event_create_with_default_clock_snapshot( |
| 1577 | bt_self_message_iterator *self_message_iterator, |
| 1578 | const bt_event_class *event_class, |
| 1579 | const bt_stream *stream, uint64_t clock_snapshot_value); |
| 1580 | |
| 1581 | /*! |
| 1582 | @brief |
| 1583 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls |
| 1584 | \bt_p{event_class}, for the \bt_pkt \bt_p{packet} from the |
| 1585 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1586 | |
| 1587 | @attention |
| 1588 | @parblock |
| 1589 | Only use this function if |
| 1590 | |
| 1591 | @code |
| 1592 | bt_stream_class_supports_packets( |
| 1593 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1594 | @endcode |
| 1595 | |
| 1596 | returns #BT_TRUE and |
| 1597 | |
| 1598 | @code |
| 1599 | bt_stream_class_borrow_default_clock_class_const( |
| 1600 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1601 | @endcode |
| 1602 | |
| 1603 | returns \c NULL. |
| 1604 | |
| 1605 | Otherwise, use |
| 1606 | bt_message_event_create(), |
| 1607 | bt_message_event_create_with_default_clock_snapshot(), or |
| 1608 | bt_message_event_create_with_packet_and_default_clock_snapshot(). |
| 1609 | @endparblock |
| 1610 | |
| 1611 | On success, the returned event message has the following property |
| 1612 | values: |
| 1613 | |
| 1614 | <table> |
| 1615 | <tr> |
| 1616 | <th>Property |
| 1617 | <th>Value |
| 1618 | <tr> |
| 1619 | <td>\ref api-msg-ev-prop-ev "Event" |
| 1620 | <td> |
| 1621 | An instance (with \bt_p_field that are not set) of |
| 1622 | \bt_p{event_class}. |
| 1623 | <tr> |
| 1624 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" |
| 1625 | <td>\em None |
| 1626 | </table> |
| 1627 | |
| 1628 | @param[in] self_message_iterator |
| 1629 | Self message iterator from which to create the event message. |
| 1630 | @param[in] event_class |
| 1631 | Class of the \bt_ev of the message to create. |
| 1632 | @param[in] packet |
| 1633 | Packet conceptually containing the event of the message to create. |
| 1634 | |
| 1635 | @returns |
| 1636 | New event message reference, or \c NULL on memory error. |
| 1637 | |
| 1638 | @bt_pre_not_null{self_message_iterator} |
| 1639 | @pre |
| 1640 | The \bt_stream_cls of \bt_p{event_class} is also the stream class of |
| 1641 | \bt_p{packet}, that is, |
| 1642 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> |
| 1643 | and |
| 1644 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code> |
| 1645 | have the same value. |
| 1646 | @bt_pre_not_null{packet} |
| 1647 | @pre |
| 1648 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> |
| 1649 | returns #BT_TRUE. |
| 1650 | @pre |
| 1651 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> |
| 1652 | returns \c NULL. |
| 1653 | @pre |
| 1654 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 1655 | any, and all its contained \bt_p_field, recursively, are set. |
| 1656 | |
| 1657 | @bt_post_success_frozen{event_class} |
| 1658 | @bt_post_success_frozen{packet} |
| 1659 | */ |
| 1660 | extern |
| 1661 | bt_message *bt_message_event_create_with_packet( |
| 1662 | bt_self_message_iterator *self_message_iterator, |
| 1663 | const bt_event_class *event_class, |
| 1664 | const bt_packet *packet); |
| 1665 | |
| 1666 | /*! |
| 1667 | @brief |
| 1668 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls |
| 1669 | \bt_p{event_class} and a default \bt_cs with the value |
| 1670 | \bt_p{clock_snapshot_value}, for the \bt_pkt \bt_p{packet} from |
| 1671 | the \bt_msg_iter \bt_p{self_message_iterator}. |
| 1672 | |
| 1673 | @attention |
| 1674 | @parblock |
| 1675 | Only use this function if |
| 1676 | |
| 1677 | @code |
| 1678 | bt_stream_class_supports_packets( |
| 1679 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1680 | @endcode |
| 1681 | |
| 1682 | returns #BT_TRUE and |
| 1683 | |
| 1684 | @code |
| 1685 | bt_stream_class_borrow_default_clock_class_const( |
| 1686 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1687 | @endcode |
| 1688 | |
| 1689 | does \em not return \c NULL. |
| 1690 | |
| 1691 | Otherwise, use |
| 1692 | bt_message_event_create(), |
| 1693 | bt_message_event_create_with_default_clock_snapshot(), or |
| 1694 | bt_message_event_create_with_packet(). |
| 1695 | @endparblock |
| 1696 | |
| 1697 | On success, the returned event message has the following property |
| 1698 | values: |
| 1699 | |
| 1700 | <table> |
| 1701 | <tr> |
| 1702 | <th>Property |
| 1703 | <th>Value |
| 1704 | <tr> |
| 1705 | <td>\ref api-msg-ev-prop-ev "Event" |
| 1706 | <td> |
| 1707 | An instance (with \bt_p_field that are not set) of |
| 1708 | \bt_p{event_class}. |
| 1709 | <tr> |
| 1710 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" |
| 1711 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. |
| 1712 | </table> |
| 1713 | |
| 1714 | @param[in] self_message_iterator |
| 1715 | Self message iterator from which to create the event message. |
| 1716 | @param[in] event_class |
| 1717 | Class of the \bt_ev of the message to create. |
| 1718 | @param[in] packet |
| 1719 | Packet conceptually containing the event of the message to create. |
| 1720 | @param[in] clock_snapshot_value |
| 1721 | Value (clock cycles) of the default clock snapshot of |
| 1722 | \bt_p{message}. |
| 1723 | |
| 1724 | @returns |
| 1725 | New event message reference, or \c NULL on memory error. |
| 1726 | |
| 1727 | @bt_pre_not_null{self_message_iterator} |
| 1728 | @pre |
| 1729 | The \bt_stream_cls of \bt_p{event_class} is also the stream class of |
| 1730 | \bt_p{packet}, that is, |
| 1731 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> |
| 1732 | and |
| 1733 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code> |
| 1734 | have the same value. |
| 1735 | @bt_pre_not_null{packet} |
| 1736 | @pre |
| 1737 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> |
| 1738 | returns #BT_TRUE. |
| 1739 | @pre |
| 1740 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> |
| 1741 | does \em not return \c NULL. |
| 1742 | @pre |
| 1743 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 1744 | any, and all its contained \bt_p_field, recursively, are set. |
| 1745 | |
| 1746 | @bt_post_success_frozen{event_class} |
| 1747 | @bt_post_success_frozen{stream} |
| 1748 | */ |
| 1749 | extern |
| 1750 | bt_message *bt_message_event_create_with_packet_and_default_clock_snapshot( |
| 1751 | bt_self_message_iterator *self_message_iterator, |
| 1752 | const bt_event_class *event_class, |
| 1753 | const bt_packet *packet, uint64_t clock_snapshot_value); |
| 1754 | |
| 1755 | /*! |
| 1756 | @brief |
| 1757 | Borrows the \bt_ev of the \bt_ev_msg \bt_p{message}. |
| 1758 | |
| 1759 | See the \ref api-msg-ev-prop-ev "event" property. |
| 1760 | |
| 1761 | @param[in] message |
| 1762 | Event message from which to borrow the event. |
| 1763 | |
| 1764 | @returns |
| 1765 | @parblock |
| 1766 | \em Borrowed reference of the event of \bt_p{message}. |
| 1767 | |
| 1768 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 1769 | @endparblock |
| 1770 | |
| 1771 | @bt_pre_not_null{message} |
| 1772 | @bt_pre_is_ev_msg{message} |
| 1773 | |
| 1774 | @sa bt_message_event_borrow_event_const() — |
| 1775 | \c const version of this function. |
| 1776 | */ |
| 1777 | extern bt_event *bt_message_event_borrow_event( |
| 1778 | bt_message *message); |
| 1779 | |
| 1780 | /*! |
| 1781 | @brief |
| 1782 | Borrows the \bt_ev of the \bt_ev_msg \bt_p{message} |
| 1783 | (\c const version). |
| 1784 | |
| 1785 | See bt_message_event_borrow_event(). |
| 1786 | */ |
| 1787 | extern const bt_event *bt_message_event_borrow_event_const( |
| 1788 | const bt_message *message); |
| 1789 | |
| 1790 | /*! |
| 1791 | @brief |
| 1792 | Borrows the default \bt_cs of the \bt_ev_msg \bt_p{message}. |
| 1793 | |
| 1794 | See the \ref api-msg-ev-prop-cs "default clock snapshot" property. |
| 1795 | |
| 1796 | @param[in] message |
| 1797 | Event message from which to borrow the default clock snapshot. |
| 1798 | |
| 1799 | @returns |
| 1800 | Default clock snapshot of \bt_p{message}. |
| 1801 | |
| 1802 | @bt_pre_not_null{message} |
| 1803 | @bt_pre_is_ev_msg{message} |
| 1804 | @pre |
| 1805 | The \bt_stream_cls of \bt_p{message} has a |
| 1806 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". |
| 1807 | */ |
| 1808 | extern const bt_clock_snapshot * |
| 1809 | bt_message_event_borrow_default_clock_snapshot_const(const bt_message *message); |
| 1810 | |
| 1811 | /*! |
| 1812 | @brief |
| 1813 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 1814 | of the \bt_ev_msg \bt_p{message}. |
| 1815 | |
| 1816 | See the stream class's |
| 1817 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 1818 | property. |
| 1819 | |
| 1820 | This is a helper which is equivalent to |
| 1821 | |
| 1822 | @code |
| 1823 | bt_stream_class_borrow_default_clock_class_const( |
| 1824 | bt_stream_borrow_class_const( |
| 1825 | bt_event_borrow_stream_const( |
| 1826 | bt_message_event_borrow_event_const(message)))) |
| 1827 | @endcode |
| 1828 | |
| 1829 | @param[in] message |
| 1830 | Event message from which to borrow its stream's class's |
| 1831 | default clock class. |
| 1832 | |
| 1833 | @returns |
| 1834 | \em Borrowed reference of the default clock class of |
| 1835 | the stream class of \bt_p{message}, or \c NULL if none. |
| 1836 | |
| 1837 | @bt_pre_not_null{message} |
| 1838 | @bt_pre_is_ev_msg{message} |
| 1839 | */ |
| 1840 | extern const bt_clock_class * |
| 1841 | bt_message_event_borrow_stream_class_default_clock_class_const( |
| 1842 | const bt_message *message); |
| 1843 | |
| 1844 | /*! @} */ |
| 1845 | |
| 1846 | /*! |
| 1847 | @name Packet beginning message |
| 1848 | @{ |
| 1849 | */ |
| 1850 | |
| 1851 | /*! |
| 1852 | @brief |
| 1853 | Creates a \bt_pb_msg for the \bt_pkt \bt_p{packet} from the |
| 1854 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1855 | |
| 1856 | @attention |
| 1857 | @parblock |
| 1858 | Only use this function if |
| 1859 | |
| 1860 | @code |
| 1861 | bt_stream_class_packets_have_beginning_default_clock_snapshot( |
| 1862 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1863 | @endcode |
| 1864 | |
| 1865 | returns #BT_FALSE. |
| 1866 | |
| 1867 | Otherwise, use |
| 1868 | bt_message_packet_beginning_create_with_default_clock_snapshot(). |
| 1869 | @endparblock |
| 1870 | |
| 1871 | On success, the returned packet beginning message has the following |
| 1872 | property values: |
| 1873 | |
| 1874 | <table> |
| 1875 | <tr> |
| 1876 | <th>Property |
| 1877 | <th>Value |
| 1878 | <tr> |
| 1879 | <td>\ref api-msg-pb-prop-pkt "Packet" |
| 1880 | <td>\bt_p{packet} |
| 1881 | <tr> |
| 1882 | <td>\ref api-msg-pb-prop-cs "Default clock snapshot" |
| 1883 | <td>\em None |
| 1884 | </table> |
| 1885 | |
| 1886 | @param[in] self_message_iterator |
| 1887 | Self message iterator from which to create the packet beginning |
| 1888 | message. |
| 1889 | @param[in] packet |
| 1890 | Packet of which the message to create indicates the beginning. |
| 1891 | |
| 1892 | @returns |
| 1893 | New packet beginning message reference, or \c NULL on memory error. |
| 1894 | |
| 1895 | @bt_pre_not_null{self_message_iterator} |
| 1896 | @bt_pre_not_null{packet} |
| 1897 | @pre |
| 1898 | bt_stream_class_packets_have_beginning_default_clock_snapshot() |
| 1899 | returns #BT_FALSE for |
| 1900 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. |
| 1901 | @pre |
| 1902 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 1903 | any, and all its contained \bt_p_field, recursively, are set. |
| 1904 | |
| 1905 | @bt_post_success_frozen{packet} |
| 1906 | */ |
| 1907 | extern |
| 1908 | bt_message *bt_message_packet_beginning_create( |
| 1909 | bt_self_message_iterator *self_message_iterator, |
| 1910 | const bt_packet *packet); |
| 1911 | |
| 1912 | /*! |
| 1913 | @brief |
| 1914 | Creates a \bt_pb_msg having a default \bt_cs with the value |
| 1915 | \bt_p{clock_snapshot_value} for the \bt_pkt \bt_p{packet} from the |
| 1916 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 1917 | |
| 1918 | @attention |
| 1919 | @parblock |
| 1920 | Only use this function if |
| 1921 | |
| 1922 | @code |
| 1923 | bt_stream_class_packets_have_beginning_default_clock_snapshot( |
| 1924 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 1925 | @endcode |
| 1926 | |
| 1927 | returns #BT_TRUE. |
| 1928 | |
| 1929 | Otherwise, use |
| 1930 | bt_message_packet_beginning_create(). |
| 1931 | @endparblock |
| 1932 | |
| 1933 | On success, the returned packet beginning message has the following |
| 1934 | property values: |
| 1935 | |
| 1936 | <table> |
| 1937 | <tr> |
| 1938 | <th>Property |
| 1939 | <th>Value |
| 1940 | <tr> |
| 1941 | <td>\ref api-msg-pb-prop-pkt "Packet" |
| 1942 | <td>\bt_p{packet} |
| 1943 | <tr> |
| 1944 | <td>\ref api-msg-pb-prop-cs "Default clock snapshot" |
| 1945 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. |
| 1946 | </table> |
| 1947 | |
| 1948 | @param[in] self_message_iterator |
| 1949 | Self message iterator from which to create the packet beginning |
| 1950 | message. |
| 1951 | @param[in] packet |
| 1952 | Packet of which the message to create indicates the beginning. |
| 1953 | @param[in] clock_snapshot_value |
| 1954 | Value (clock cycles) of the default clock snapshot of |
| 1955 | \bt_p{message}. |
| 1956 | |
| 1957 | @returns |
| 1958 | New packet beginning message reference, or \c NULL on memory error. |
| 1959 | |
| 1960 | @bt_pre_not_null{self_message_iterator} |
| 1961 | @bt_pre_not_null{packet} |
| 1962 | @pre |
| 1963 | bt_stream_class_packets_have_beginning_default_clock_snapshot() |
| 1964 | returns #BT_TRUE for |
| 1965 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. |
| 1966 | @pre |
| 1967 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 1968 | any, and all its contained \bt_p_field, recursively, are set. |
| 1969 | |
| 1970 | @bt_post_success_frozen{packet} |
| 1971 | */ |
| 1972 | extern |
| 1973 | bt_message *bt_message_packet_beginning_create_with_default_clock_snapshot( |
| 1974 | bt_self_message_iterator *self_message_iterator, |
| 1975 | const bt_packet *packet, uint64_t clock_snapshot_value); |
| 1976 | |
| 1977 | /*! |
| 1978 | @brief |
| 1979 | Borrows the \bt_pkt of the \bt_pb_msg \bt_p{message}. |
| 1980 | |
| 1981 | See the \ref api-msg-pb-prop-pkt "packet" property. |
| 1982 | |
| 1983 | @param[in] message |
| 1984 | Packet beginning message from which to borrow the packet. |
| 1985 | |
| 1986 | @returns |
| 1987 | @parblock |
| 1988 | \em Borrowed reference of the packet of \bt_p{message}. |
| 1989 | |
| 1990 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 1991 | @endparblock |
| 1992 | |
| 1993 | @bt_pre_not_null{message} |
| 1994 | @bt_pre_is_pb_msg{message} |
| 1995 | |
| 1996 | @sa bt_message_packet_beginning_borrow_packet_const() — |
| 1997 | \c const version of this function. |
| 1998 | */ |
| 1999 | extern bt_packet *bt_message_packet_beginning_borrow_packet( |
| 2000 | bt_message *message); |
| 2001 | |
| 2002 | /*! |
| 2003 | @brief |
| 2004 | Borrows the \bt_pkt of the \bt_pb_msg \bt_p{message} |
| 2005 | (\c const version). |
| 2006 | |
| 2007 | See bt_message_packet_beginning_borrow_packet(). |
| 2008 | */ |
| 2009 | extern const bt_packet *bt_message_packet_beginning_borrow_packet_const( |
| 2010 | const bt_message *message); |
| 2011 | |
| 2012 | /*! |
| 2013 | @brief |
| 2014 | Borrows the default \bt_cs of the \bt_pb_msg \bt_p{message}. |
| 2015 | |
| 2016 | See the \ref api-msg-pb-prop-cs "default clock snapshot" property. |
| 2017 | |
| 2018 | @param[in] message |
| 2019 | Packet beginning message from which to borrow the default clock |
| 2020 | snapshot. |
| 2021 | |
| 2022 | @returns |
| 2023 | Default clock snapshot of \bt_p{message}. |
| 2024 | |
| 2025 | @bt_pre_not_null{message} |
| 2026 | @bt_pre_is_pb_msg{message} |
| 2027 | @pre |
| 2028 | The packets of the \bt_stream_cls of \bt_p{message} |
| 2029 | \ref api-tir-stream-cls-prop-pkt-beg-cs "have a beginning default clock snapshot". |
| 2030 | */ |
| 2031 | extern const bt_clock_snapshot * |
| 2032 | bt_message_packet_beginning_borrow_default_clock_snapshot_const( |
| 2033 | const bt_message *message); |
| 2034 | |
| 2035 | /*! |
| 2036 | @brief |
| 2037 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 2038 | of the \bt_pb_msg \bt_p{message}. |
| 2039 | |
| 2040 | See the stream class's |
| 2041 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 2042 | property. |
| 2043 | |
| 2044 | This is a helper which is equivalent to |
| 2045 | |
| 2046 | @code |
| 2047 | bt_stream_class_borrow_default_clock_class_const( |
| 2048 | bt_stream_borrow_class_const( |
| 2049 | bt_packet_borrow_stream_const( |
| 2050 | bt_message_packet_beginning_borrow_packet_const(message)))) |
| 2051 | @endcode |
| 2052 | |
| 2053 | @param[in] message |
| 2054 | Packet beginning message from which to borrow its stream's class's |
| 2055 | default clock class. |
| 2056 | |
| 2057 | @returns |
| 2058 | \em Borrowed reference of the default clock class of |
| 2059 | the stream class of \bt_p{message}, or \c NULL if none. |
| 2060 | |
| 2061 | @bt_pre_not_null{message} |
| 2062 | @bt_pre_is_pb_msg{message} |
| 2063 | */ |
| 2064 | extern const bt_clock_class * |
| 2065 | bt_message_packet_beginning_borrow_stream_class_default_clock_class_const( |
| 2066 | const bt_message *message); |
| 2067 | |
| 2068 | /*! @} */ |
| 2069 | |
| 2070 | /*! |
| 2071 | @name Packet end message |
| 2072 | @{ |
| 2073 | */ |
| 2074 | |
| 2075 | /*! |
| 2076 | @brief |
| 2077 | Creates a \bt_pe_msg for the \bt_pkt \bt_p{packet} from the |
| 2078 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 2079 | |
| 2080 | @attention |
| 2081 | @parblock |
| 2082 | Only use this function if |
| 2083 | |
| 2084 | @code |
| 2085 | bt_stream_class_packets_have_end_default_clock_snapshot( |
| 2086 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 2087 | @endcode |
| 2088 | |
| 2089 | returns #BT_FALSE. |
| 2090 | |
| 2091 | Otherwise, use |
| 2092 | bt_message_packet_end_create_with_default_clock_snapshot(). |
| 2093 | @endparblock |
| 2094 | |
| 2095 | On success, the returned packet end message has the following |
| 2096 | property values: |
| 2097 | |
| 2098 | <table> |
| 2099 | <tr> |
| 2100 | <th>Property |
| 2101 | <th>Value |
| 2102 | <tr> |
| 2103 | <td>\ref api-msg-pe-prop-pkt "Packet" |
| 2104 | <td>\bt_p{packet} |
| 2105 | <tr> |
| 2106 | <td>\ref api-msg-pe-prop-cs "Default clock snapshot" |
| 2107 | <td>\em None |
| 2108 | </table> |
| 2109 | |
| 2110 | @param[in] self_message_iterator |
| 2111 | Self message iterator from which to create the packet end message. |
| 2112 | @param[in] packet |
| 2113 | Packet of which the message to create indicates the end. |
| 2114 | |
| 2115 | @returns |
| 2116 | New packet end message reference, or \c NULL on memory error. |
| 2117 | |
| 2118 | @bt_pre_not_null{self_message_iterator} |
| 2119 | @bt_pre_not_null{packet} |
| 2120 | @pre |
| 2121 | bt_stream_class_packets_have_end_default_clock_snapshot() |
| 2122 | returns #BT_FALSE for |
| 2123 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. |
| 2124 | @pre |
| 2125 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 2126 | any, and all its contained \bt_p_field, recursively, are set. |
| 2127 | |
| 2128 | @bt_post_success_frozen{packet} |
| 2129 | */ |
| 2130 | extern |
| 2131 | bt_message *bt_message_packet_end_create( |
| 2132 | bt_self_message_iterator *self_message_iterator, |
| 2133 | const bt_packet *packet); |
| 2134 | |
| 2135 | /*! |
| 2136 | @brief |
| 2137 | Creates a \bt_pe_msg having a default \bt_cs with the value |
| 2138 | \bt_p{clock_snapshot_value} for the \bt_pkt \bt_p{packet} from the |
| 2139 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 2140 | |
| 2141 | @attention |
| 2142 | @parblock |
| 2143 | Only use this function if |
| 2144 | |
| 2145 | @code |
| 2146 | bt_stream_class_packets_have_end_default_clock_snapshot( |
| 2147 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) |
| 2148 | @endcode |
| 2149 | |
| 2150 | returns #BT_TRUE. |
| 2151 | |
| 2152 | Otherwise, use |
| 2153 | bt_message_packet_end_create(). |
| 2154 | @endparblock |
| 2155 | |
| 2156 | On success, the returned packet end message has the following |
| 2157 | property values: |
| 2158 | |
| 2159 | <table> |
| 2160 | <tr> |
| 2161 | <th>Property |
| 2162 | <th>Value |
| 2163 | <tr> |
| 2164 | <td>\ref api-msg-pe-prop-pkt "Packet" |
| 2165 | <td>\bt_p{packet} |
| 2166 | <tr> |
| 2167 | <td>\ref api-msg-pe-prop-cs "Default clock snapshot" |
| 2168 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. |
| 2169 | </table> |
| 2170 | |
| 2171 | @param[in] self_message_iterator |
| 2172 | Self message iterator from which to create the packet end |
| 2173 | message. |
| 2174 | @param[in] packet |
| 2175 | Packet of which the message to create indicates the end. |
| 2176 | @param[in] clock_snapshot_value |
| 2177 | Value (clock cycles) of the default clock snapshot of |
| 2178 | \bt_p{message}. |
| 2179 | |
| 2180 | @returns |
| 2181 | New packet end message reference, or \c NULL on memory error. |
| 2182 | |
| 2183 | @bt_pre_not_null{self_message_iterator} |
| 2184 | @bt_pre_not_null{packet} |
| 2185 | @pre |
| 2186 | bt_stream_class_packets_have_end_default_clock_snapshot() |
| 2187 | returns #BT_TRUE for |
| 2188 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. |
| 2189 | @pre |
| 2190 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if |
| 2191 | any, and all its contained \bt_p_field, recursively, are set. |
| 2192 | |
| 2193 | @bt_post_success_frozen{packet} |
| 2194 | */ |
| 2195 | extern |
| 2196 | bt_message *bt_message_packet_end_create_with_default_clock_snapshot( |
| 2197 | bt_self_message_iterator *self_message_iterator, |
| 2198 | const bt_packet *packet, uint64_t clock_snapshot_value); |
| 2199 | |
| 2200 | /*! |
| 2201 | @brief |
| 2202 | Borrows the \bt_pkt of the \bt_pe_msg \bt_p{message}. |
| 2203 | |
| 2204 | See the \ref api-msg-pe-prop-pkt "packet" property. |
| 2205 | |
| 2206 | @param[in] message |
| 2207 | Packet end message from which to borrow the packet. |
| 2208 | |
| 2209 | @returns |
| 2210 | @parblock |
| 2211 | \em Borrowed reference of the packet of \bt_p{message}. |
| 2212 | |
| 2213 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 2214 | @endparblock |
| 2215 | |
| 2216 | @bt_pre_not_null{message} |
| 2217 | @bt_pre_is_pe_msg{message} |
| 2218 | |
| 2219 | @sa bt_message_packet_end_borrow_packet_const() — |
| 2220 | \c const version of this function. |
| 2221 | */ |
| 2222 | extern bt_packet *bt_message_packet_end_borrow_packet( |
| 2223 | bt_message *message); |
| 2224 | |
| 2225 | /*! |
| 2226 | @brief |
| 2227 | Borrows the \bt_pkt of the \bt_pe_msg \bt_p{message} |
| 2228 | (\c const version). |
| 2229 | |
| 2230 | See bt_message_packet_end_borrow_packet(). |
| 2231 | */ |
| 2232 | extern const bt_packet *bt_message_packet_end_borrow_packet_const( |
| 2233 | const bt_message *message); |
| 2234 | |
| 2235 | /*! |
| 2236 | @brief |
| 2237 | Borrows the default \bt_cs of the \bt_pe_msg \bt_p{message}. |
| 2238 | |
| 2239 | See the \ref api-msg-pe-prop-cs "default clock snapshot" property. |
| 2240 | |
| 2241 | @param[in] message |
| 2242 | Packet end message from which to borrow the default clock |
| 2243 | snapshot. |
| 2244 | |
| 2245 | @returns |
| 2246 | Default clock snapshot of \bt_p{message}. |
| 2247 | |
| 2248 | @bt_pre_not_null{message} |
| 2249 | @bt_pre_is_pe_msg{message} |
| 2250 | @pre |
| 2251 | The packets of the \bt_stream_cls of \bt_p{message} |
| 2252 | \ref api-tir-stream-cls-prop-pkt-end-cs "have an end default clock snapshot". |
| 2253 | */ |
| 2254 | extern const bt_clock_snapshot * |
| 2255 | bt_message_packet_end_borrow_default_clock_snapshot_const( |
| 2256 | const bt_message *message); |
| 2257 | |
| 2258 | /*! |
| 2259 | @brief |
| 2260 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 2261 | of the \bt_pe_msg \bt_p{message}. |
| 2262 | |
| 2263 | See the stream class's |
| 2264 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 2265 | property. |
| 2266 | |
| 2267 | This is a helper which is equivalent to |
| 2268 | |
| 2269 | @code |
| 2270 | bt_stream_class_borrow_default_clock_class_const( |
| 2271 | bt_stream_borrow_class_const( |
| 2272 | bt_packet_borrow_stream_const( |
| 2273 | bt_message_packet_end_borrow_packet_const(message)))) |
| 2274 | @endcode |
| 2275 | |
| 2276 | @param[in] message |
| 2277 | Packet end message from which to borrow its stream's class's |
| 2278 | default clock class. |
| 2279 | |
| 2280 | @returns |
| 2281 | \em Borrowed reference of the default clock class of |
| 2282 | the stream class of \bt_p{message}, or \c NULL if none. |
| 2283 | |
| 2284 | @bt_pre_not_null{message} |
| 2285 | @bt_pre_is_pe_msg{message} |
| 2286 | */ |
| 2287 | extern const bt_clock_class * |
| 2288 | bt_message_packet_end_borrow_stream_class_default_clock_class_const( |
| 2289 | const bt_message *message); |
| 2290 | |
| 2291 | /*! @} */ |
| 2292 | |
| 2293 | /*! |
| 2294 | @name Discarded events message |
| 2295 | @{ |
| 2296 | */ |
| 2297 | |
| 2298 | /*! |
| 2299 | @brief |
| 2300 | Creates a \bt_disc_ev_msg for the \bt_stream \bt_p{stream} from the |
| 2301 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 2302 | |
| 2303 | @attention |
| 2304 | @parblock |
| 2305 | Only use this function if |
| 2306 | |
| 2307 | @code |
| 2308 | bt_stream_class_discarded_events_have_default_clock_snapshots( |
| 2309 | bt_stream_borrow_class_const(stream)) |
| 2310 | @endcode |
| 2311 | |
| 2312 | returns #BT_FALSE. |
| 2313 | |
| 2314 | Otherwise, use |
| 2315 | bt_message_discarded_events_create_with_default_clock_snapshots(). |
| 2316 | @endparblock |
| 2317 | |
| 2318 | On success, the returned discarded events message has the following |
| 2319 | property values: |
| 2320 | |
| 2321 | <table> |
| 2322 | <tr> |
| 2323 | <th>Property |
| 2324 | <th>Value |
| 2325 | <tr> |
| 2326 | <td>\ref api-msg-disc-ev-prop-stream "Stream" |
| 2327 | <td>\bt_p{stream} |
| 2328 | <tr> |
| 2329 | <td>\ref api-msg-disc-ev-prop-cs-beg "Beginning default clock snapshot" |
| 2330 | <td>\em None |
| 2331 | <tr> |
| 2332 | <td>\ref api-msg-disc-ev-prop-cs-end "End default clock snapshot" |
| 2333 | <td>\em None |
| 2334 | <tr> |
| 2335 | <td>\ref api-msg-disc-ev-prop-count "Discarded event count" |
| 2336 | <td>\em None |
| 2337 | </table> |
| 2338 | |
| 2339 | @param[in] self_message_iterator |
| 2340 | Self message iterator from which to create the discarded events |
| 2341 | message. |
| 2342 | @param[in] stream |
| 2343 | Stream from which the events were discarded. |
| 2344 | |
| 2345 | @returns |
| 2346 | New discarded events message reference, or \c NULL on memory error. |
| 2347 | |
| 2348 | @bt_pre_not_null{self_message_iterator} |
| 2349 | @bt_pre_not_null{stream} |
| 2350 | @pre |
| 2351 | <code>bt_stream_class_discarded_events_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> |
| 2352 | returns #BT_FALSE. |
| 2353 | |
| 2354 | @bt_post_success_frozen{stream} |
| 2355 | */ |
| 2356 | extern bt_message *bt_message_discarded_events_create( |
| 2357 | bt_self_message_iterator *self_message_iterator, |
| 2358 | const bt_stream *stream); |
| 2359 | |
| 2360 | /*! |
| 2361 | @brief |
| 2362 | Creates a \bt_disc_ev_msg having the beginning and end default |
| 2363 | \bt_p_cs with the values \bt_p{beginning_clock_snapshot_value} and |
| 2364 | \bt_p{end_clock_snapshot_value} for the \bt_stream \bt_p{stream} |
| 2365 | from the \bt_msg_iter \bt_p{self_message_iterator}. |
| 2366 | |
| 2367 | @attention |
| 2368 | @parblock |
| 2369 | Only use this function if |
| 2370 | |
| 2371 | @code |
| 2372 | bt_stream_class_discarded_events_have_default_clock_snapshots( |
| 2373 | bt_stream_borrow_class_const(stream)) |
| 2374 | @endcode |
| 2375 | |
| 2376 | returns #BT_TRUE. |
| 2377 | |
| 2378 | Otherwise, use |
| 2379 | bt_message_discarded_events_create(). |
| 2380 | @endparblock |
| 2381 | |
| 2382 | On success, the returned discarded events message has the following |
| 2383 | property values: |
| 2384 | |
| 2385 | <table> |
| 2386 | <tr> |
| 2387 | <th>Property |
| 2388 | <th>Value |
| 2389 | <tr> |
| 2390 | <td>\ref api-msg-disc-ev-prop-stream "Stream" |
| 2391 | <td>\bt_p{stream} |
| 2392 | <tr> |
| 2393 | <td>\ref api-msg-disc-ev-prop-cs-beg "Beginning default clock snapshot" |
| 2394 | <td>\bt_c_cs with the value \bt_p{beginning_clock_snapshot_value}. |
| 2395 | <tr> |
| 2396 | <td>\ref api-msg-disc-ev-prop-cs-end "End default clock snapshot" |
| 2397 | <td>\bt_c_cs with the value \bt_p{end_clock_snapshot_value}. |
| 2398 | <tr> |
| 2399 | <td>\ref api-msg-disc-ev-prop-count "Discarded event count" |
| 2400 | <td>\em None |
| 2401 | </table> |
| 2402 | |
| 2403 | @param[in] self_message_iterator |
| 2404 | Self message iterator from which to create the discarded events |
| 2405 | message. |
| 2406 | @param[in] stream |
| 2407 | Stream from which the events were discarded. |
| 2408 | @param[in] beginning_clock_snapshot_value |
| 2409 | Value (clock cycles) of the beginning default clock snapshot of |
| 2410 | \bt_p{message}. |
| 2411 | @param[in] end_clock_snapshot_value |
| 2412 | Value (clock cycles) of the end default clock snapshot of |
| 2413 | \bt_p{message}. |
| 2414 | |
| 2415 | @returns |
| 2416 | New discarded events message reference, or \c NULL on memory error. |
| 2417 | |
| 2418 | @bt_pre_not_null{self_message_iterator} |
| 2419 | @bt_pre_not_null{stream} |
| 2420 | @pre |
| 2421 | <code>bt_stream_class_discarded_events_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> |
| 2422 | returns #BT_TRUE. |
| 2423 | |
| 2424 | @bt_post_success_frozen{stream} |
| 2425 | */ |
| 2426 | extern bt_message *bt_message_discarded_events_create_with_default_clock_snapshots( |
| 2427 | bt_self_message_iterator *self_message_iterator, |
| 2428 | const bt_stream *stream, |
| 2429 | uint64_t beginning_clock_snapshot_value, |
| 2430 | uint64_t end_clock_snapshot_value); |
| 2431 | |
| 2432 | /*! |
| 2433 | @brief |
| 2434 | Borrows the \bt_stream of the \bt_disc_ev_msg \bt_p{message}. |
| 2435 | |
| 2436 | See the \ref api-msg-disc-ev-prop-stream "stream" property. |
| 2437 | |
| 2438 | @param[in] message |
| 2439 | Discarded events message from which to borrow the stream. |
| 2440 | |
| 2441 | @returns |
| 2442 | @parblock |
| 2443 | \em Borrowed reference of the stream of \bt_p{message}. |
| 2444 | |
| 2445 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 2446 | @endparblock |
| 2447 | |
| 2448 | @bt_pre_not_null{message} |
| 2449 | @bt_pre_is_disc_ev_msg{message} |
| 2450 | |
| 2451 | @sa bt_message_discarded_events_borrow_stream_const() — |
| 2452 | \c const version of this function. |
| 2453 | */ |
| 2454 | extern bt_stream *bt_message_discarded_events_borrow_stream( |
| 2455 | bt_message *message); |
| 2456 | |
| 2457 | /*! |
| 2458 | @brief |
| 2459 | Borrows the \bt_stream of the \bt_disc_ev_msg \bt_p{message} |
| 2460 | (\c const version). |
| 2461 | |
| 2462 | See bt_message_discarded_events_borrow_stream(). |
| 2463 | */ |
| 2464 | extern const bt_stream * |
| 2465 | bt_message_discarded_events_borrow_stream_const(const bt_message *message); |
| 2466 | |
| 2467 | /*! |
| 2468 | @brief |
| 2469 | Borrows the beginning default \bt_cs of the \bt_disc_ev_msg |
| 2470 | \bt_p{message}. |
| 2471 | |
| 2472 | See the |
| 2473 | \ref api-msg-disc-ev-prop-cs-beg "beginning default clock snapshot" |
| 2474 | property. |
| 2475 | |
| 2476 | @param[in] message |
| 2477 | Discarded events message from which to borrow the beginning default |
| 2478 | clock snapshot. |
| 2479 | |
| 2480 | @returns |
| 2481 | Beginning default clock snapshot of \bt_p{message}. |
| 2482 | |
| 2483 | @bt_pre_not_null{message} |
| 2484 | @bt_pre_is_disc_ev_msg{message} |
| 2485 | @pre |
| 2486 | The discarded packets messages of the \bt_stream_cls of |
| 2487 | \bt_p{message} |
| 2488 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". |
| 2489 | */ |
| 2490 | extern const bt_clock_snapshot * |
| 2491 | bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const( |
| 2492 | const bt_message *message); |
| 2493 | |
| 2494 | /*! |
| 2495 | @brief |
| 2496 | Borrows the end default \bt_cs of the \bt_disc_ev_msg |
| 2497 | \bt_p{message}. |
| 2498 | |
| 2499 | See the |
| 2500 | \ref api-msg-disc-ev-prop-cs-end "end default clock snapshot" |
| 2501 | property. |
| 2502 | |
| 2503 | @param[in] message |
| 2504 | Discarded events message from which to borrow the end default clock |
| 2505 | snapshot. |
| 2506 | |
| 2507 | @returns |
| 2508 | End default clock snapshot of \bt_p{message}. |
| 2509 | |
| 2510 | @bt_pre_not_null{message} |
| 2511 | @bt_pre_is_disc_ev_msg{message} |
| 2512 | @pre |
| 2513 | The discarded packets messages of the \bt_stream_cls of |
| 2514 | \bt_p{message} |
| 2515 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". |
| 2516 | */ |
| 2517 | extern const bt_clock_snapshot * |
| 2518 | bt_message_discarded_events_borrow_end_default_clock_snapshot_const( |
| 2519 | const bt_message *message); |
| 2520 | |
| 2521 | /*! |
| 2522 | @brief |
| 2523 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 2524 | of the \bt_disc_ev_msg \bt_p{message}. |
| 2525 | |
| 2526 | See the stream class's |
| 2527 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 2528 | property. |
| 2529 | |
| 2530 | This is a helper which is equivalent to |
| 2531 | |
| 2532 | @code |
| 2533 | bt_stream_class_borrow_default_clock_class_const( |
| 2534 | bt_stream_borrow_class_const( |
| 2535 | bt_message_discarded_events_borrow_stream_const(message))) |
| 2536 | @endcode |
| 2537 | |
| 2538 | @param[in] message |
| 2539 | Discarded events message from which to borrow its stream's class's |
| 2540 | default clock class. |
| 2541 | |
| 2542 | @returns |
| 2543 | \em Borrowed reference of the default clock class of |
| 2544 | the stream class of \bt_p{message}, or \c NULL if none. |
| 2545 | |
| 2546 | @bt_pre_not_null{message} |
| 2547 | @bt_pre_is_disc_ev_msg{message} |
| 2548 | */ |
| 2549 | extern const bt_clock_class * |
| 2550 | bt_message_discarded_events_borrow_stream_class_default_clock_class_const( |
| 2551 | const bt_message *message); |
| 2552 | |
| 2553 | /*! |
| 2554 | @brief |
| 2555 | Sets the number of discarded events of the \bt_disc_ev_msg |
| 2556 | \bt_p{message} to \bt_p{count}. |
| 2557 | |
| 2558 | See the \ref api-msg-disc-ev-prop-count "discarded event count" |
| 2559 | property. |
| 2560 | |
| 2561 | @param[in] message |
| 2562 | Discarded events message of which to set the number of discarded |
| 2563 | events to \bt_p{count}. |
| 2564 | @param[in] count |
| 2565 | New number of discarded events of \bt_p{message}. |
| 2566 | |
| 2567 | @bt_pre_not_null{message} |
| 2568 | @bt_pre_hot{message} |
| 2569 | @bt_pre_is_disc_ev_msg{message} |
| 2570 | |
| 2571 | @sa bt_message_discarded_events_get_count() — |
| 2572 | Returns the number of discarded events of a discarded events |
| 2573 | message. |
| 2574 | */ |
| 2575 | extern void bt_message_discarded_events_set_count(bt_message *message, |
| 2576 | uint64_t count); |
| 2577 | |
| 2578 | /*! |
| 2579 | @brief |
| 2580 | Returns the number of discarded events of the \bt_disc_ev_msg |
| 2581 | \bt_p{message}. |
| 2582 | |
| 2583 | See the \ref api-msg-disc-ev-prop-count "discarded event count" |
| 2584 | property. |
| 2585 | |
| 2586 | @param[in] message |
| 2587 | Discarded events message of which to get the number of discarded |
| 2588 | events. |
| 2589 | @param[out] count |
| 2590 | <strong>If this function returns |
| 2591 | #BT_PROPERTY_AVAILABILITY_AVAILABLE</strong>, \bt_p{*count} is |
| 2592 | the number of discarded events of \bt_p{message}. |
| 2593 | |
| 2594 | @retval #BT_PROPERTY_AVAILABILITY_AVAILABLE |
| 2595 | The number of discarded events of \bt_p{message} is available. |
| 2596 | @retval #BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE |
| 2597 | The number of discarded events of \bt_p{message} is not available. |
| 2598 | |
| 2599 | @bt_pre_not_null{message} |
| 2600 | @bt_pre_is_disc_ev_msg{message} |
| 2601 | @bt_pre_not_null{count} |
| 2602 | |
| 2603 | @sa bt_message_discarded_events_set_count() — |
| 2604 | Sets the number of discarded events of a discarded events message. |
| 2605 | */ |
| 2606 | extern bt_property_availability bt_message_discarded_events_get_count( |
| 2607 | const bt_message *message, uint64_t *count); |
| 2608 | |
| 2609 | /*! @} */ |
| 2610 | |
| 2611 | /*! |
| 2612 | @name Discarded packets message |
| 2613 | @{ |
| 2614 | */ |
| 2615 | |
| 2616 | /*! |
| 2617 | @brief |
| 2618 | Creates a \bt_disc_pkt_msg for the \bt_stream \bt_p{stream} from the |
| 2619 | \bt_msg_iter \bt_p{self_message_iterator}. |
| 2620 | |
| 2621 | @attention |
| 2622 | @parblock |
| 2623 | Only use this function if |
| 2624 | |
| 2625 | @code |
| 2626 | bt_stream_class_discarded_packets_have_default_clock_snapshots( |
| 2627 | bt_stream_borrow_class_const(stream)) |
| 2628 | @endcode |
| 2629 | |
| 2630 | returns #BT_FALSE. |
| 2631 | |
| 2632 | Otherwise, use |
| 2633 | bt_message_discarded_packets_create_with_default_clock_snapshots(). |
| 2634 | @endparblock |
| 2635 | |
| 2636 | On success, the returned discarded packets message has the following |
| 2637 | property values: |
| 2638 | |
| 2639 | <table> |
| 2640 | <tr> |
| 2641 | <th>Property |
| 2642 | <th>Value |
| 2643 | <tr> |
| 2644 | <td>\ref api-msg-disc-pkt-prop-stream "Stream" |
| 2645 | <td>\bt_p{stream} |
| 2646 | <tr> |
| 2647 | <td>\ref api-msg-disc-pkt-prop-cs-beg "Beginning default clock snapshot" |
| 2648 | <td>\em None |
| 2649 | <tr> |
| 2650 | <td>\ref api-msg-disc-pkt-prop-cs-end "End default clock snapshot" |
| 2651 | <td>\em None |
| 2652 | <tr> |
| 2653 | <td>\ref api-msg-disc-pkt-prop-count "Discarded packet count" |
| 2654 | <td>\em None |
| 2655 | </table> |
| 2656 | |
| 2657 | @param[in] self_message_iterator |
| 2658 | Self message iterator from which to create the discarded packets |
| 2659 | message. |
| 2660 | @param[in] stream |
| 2661 | Stream from which the packets were discarded. |
| 2662 | |
| 2663 | @returns |
| 2664 | New discarded packets message reference, or \c NULL on memory error. |
| 2665 | |
| 2666 | @bt_pre_not_null{self_message_iterator} |
| 2667 | @bt_pre_not_null{stream} |
| 2668 | @pre |
| 2669 | <code>bt_stream_class_discarded_packets_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> |
| 2670 | returns #BT_FALSE. |
| 2671 | |
| 2672 | @bt_post_success_frozen{stream} |
| 2673 | */ |
| 2674 | extern bt_message *bt_message_discarded_packets_create( |
| 2675 | bt_self_message_iterator *self_message_iterator, |
| 2676 | const bt_stream *stream); |
| 2677 | |
| 2678 | /*! |
| 2679 | @brief |
| 2680 | Creates a \bt_disc_pkt_msg having the beginning and end default |
| 2681 | \bt_p_cs with the values \bt_p{beginning_clock_snapshot_value} and |
| 2682 | \bt_p{end_clock_snapshot_value} for the \bt_stream \bt_p{stream} |
| 2683 | from the \bt_msg_iter \bt_p{self_message_iterator}. |
| 2684 | |
| 2685 | @attention |
| 2686 | @parblock |
| 2687 | Only use this function if |
| 2688 | |
| 2689 | @code |
| 2690 | bt_stream_class_discarded_packets_have_default_clock_snapshots( |
| 2691 | bt_stream_borrow_class_const(stream)) |
| 2692 | @endcode |
| 2693 | |
| 2694 | returns #BT_TRUE. |
| 2695 | |
| 2696 | Otherwise, use |
| 2697 | bt_message_discarded_packets_create(). |
| 2698 | @endparblock |
| 2699 | |
| 2700 | On success, the returned discarded packets message has the following |
| 2701 | property values: |
| 2702 | |
| 2703 | <table> |
| 2704 | <tr> |
| 2705 | <th>Property |
| 2706 | <th>Value |
| 2707 | <tr> |
| 2708 | <td>\ref api-msg-disc-pkt-prop-stream "Stream" |
| 2709 | <td>\bt_p{stream} |
| 2710 | <tr> |
| 2711 | <td>\ref api-msg-disc-pkt-prop-cs-beg "Beginning default clock snapshot" |
| 2712 | <td>\bt_c_cs with the value \bt_p{beginning_clock_snapshot_value}. |
| 2713 | <tr> |
| 2714 | <td>\ref api-msg-disc-pkt-prop-cs-end "End default clock snapshot" |
| 2715 | <td>\bt_c_cs with the value \bt_p{end_clock_snapshot_value}. |
| 2716 | <tr> |
| 2717 | <td>\ref api-msg-disc-pkt-prop-count "Discarded packet count" |
| 2718 | <td>\em None |
| 2719 | </table> |
| 2720 | |
| 2721 | @param[in] self_message_iterator |
| 2722 | Self message iterator from which to create the discarded packets |
| 2723 | message. |
| 2724 | @param[in] stream |
| 2725 | Stream from which the packets were discarded. |
| 2726 | @param[in] beginning_clock_snapshot_value |
| 2727 | Value (clock cycles) of the beginning default clock snapshot of |
| 2728 | \bt_p{message}. |
| 2729 | @param[in] end_clock_snapshot_value |
| 2730 | Value (clock cycles) of the end default clock snapshot of |
| 2731 | \bt_p{message}. |
| 2732 | |
| 2733 | @returns |
| 2734 | New discarded packets message reference, or \c NULL on memory error. |
| 2735 | |
| 2736 | @bt_pre_not_null{self_message_iterator} |
| 2737 | @bt_pre_not_null{stream} |
| 2738 | @pre |
| 2739 | <code>bt_stream_class_discarded_packets_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> |
| 2740 | returns #BT_TRUE. |
| 2741 | |
| 2742 | @bt_post_success_frozen{stream} |
| 2743 | */ |
| 2744 | extern bt_message *bt_message_discarded_packets_create_with_default_clock_snapshots( |
| 2745 | bt_self_message_iterator *self_message_iterator, |
| 2746 | const bt_stream *stream, uint64_t beginning_clock_snapshot_value, |
| 2747 | uint64_t end_clock_snapshot_value); |
| 2748 | |
| 2749 | /*! |
| 2750 | @brief |
| 2751 | Borrows the \bt_stream of the \bt_disc_pkt_msg \bt_p{message}. |
| 2752 | |
| 2753 | See the \ref api-msg-disc-ev-prop-stream "stream" property. |
| 2754 | |
| 2755 | @param[in] message |
| 2756 | Discarded packets message from which to borrow the stream. |
| 2757 | |
| 2758 | @returns |
| 2759 | @parblock |
| 2760 | \em Borrowed reference of the stream of \bt_p{message}. |
| 2761 | |
| 2762 | The returned pointer remains valid as long as \bt_p{message} exists. |
| 2763 | @endparblock |
| 2764 | |
| 2765 | @bt_pre_not_null{message} |
| 2766 | @bt_pre_is_disc_pkt_msg{message} |
| 2767 | |
| 2768 | @sa bt_message_discarded_packets_borrow_stream_const() — |
| 2769 | \c const version of this function. |
| 2770 | */ |
| 2771 | extern bt_stream *bt_message_discarded_packets_borrow_stream( |
| 2772 | bt_message *message); |
| 2773 | |
| 2774 | /*! |
| 2775 | @brief |
| 2776 | Borrows the \bt_stream of the \bt_disc_pkt_msg \bt_p{message} |
| 2777 | (\c const version). |
| 2778 | |
| 2779 | See bt_message_discarded_packets_borrow_stream(). |
| 2780 | */ |
| 2781 | extern const bt_stream * |
| 2782 | bt_message_discarded_packets_borrow_stream_const(const bt_message *message); |
| 2783 | |
| 2784 | /*! |
| 2785 | @brief |
| 2786 | Borrows the beginning default \bt_cs of the \bt_disc_pkt_msg |
| 2787 | \bt_p{message}. |
| 2788 | |
| 2789 | See the |
| 2790 | \ref api-msg-disc-pkt-prop-cs-beg "beginning default clock snapshot" |
| 2791 | property. |
| 2792 | |
| 2793 | @param[in] message |
| 2794 | Discarded packets message from which to borrow the beginning default |
| 2795 | clock snapshot. |
| 2796 | |
| 2797 | @returns |
| 2798 | Beginning default clock snapshot of \bt_p{message}. |
| 2799 | |
| 2800 | @bt_pre_not_null{message} |
| 2801 | @bt_pre_is_disc_pkt_msg{message} |
| 2802 | @pre |
| 2803 | The discarded packets messages of the \bt_stream_cls of |
| 2804 | \bt_p{message} |
| 2805 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". |
| 2806 | */ |
| 2807 | extern const bt_clock_snapshot * |
| 2808 | bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const( |
| 2809 | const bt_message *message); |
| 2810 | |
| 2811 | /*! |
| 2812 | @brief |
| 2813 | Borrows the end default \bt_cs of the \bt_disc_pkt_msg |
| 2814 | \bt_p{message}. |
| 2815 | |
| 2816 | See the |
| 2817 | \ref api-msg-disc-pkt-prop-cs-end "end default clock snapshot" |
| 2818 | property. |
| 2819 | |
| 2820 | @param[in] message |
| 2821 | Discarded packets message from which to borrow the end default clock |
| 2822 | snapshot. |
| 2823 | |
| 2824 | @returns |
| 2825 | End default clock snapshot of \bt_p{message}. |
| 2826 | |
| 2827 | @bt_pre_not_null{message} |
| 2828 | @bt_pre_is_disc_pkt_msg{message} |
| 2829 | @pre |
| 2830 | The discarded packets messages of the \bt_stream_cls of |
| 2831 | \bt_p{message} |
| 2832 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". |
| 2833 | */ |
| 2834 | extern const bt_clock_snapshot * |
| 2835 | bt_message_discarded_packets_borrow_end_default_clock_snapshot_const( |
| 2836 | const bt_message *message); |
| 2837 | |
| 2838 | /*! |
| 2839 | @brief |
| 2840 | Borrows the default \bt_clock_cls of the \bt_stream_cls |
| 2841 | of the \bt_disc_pkt_msg \bt_p{message}. |
| 2842 | |
| 2843 | See the stream class's |
| 2844 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" |
| 2845 | property. |
| 2846 | |
| 2847 | This is a helper which is equivalent to |
| 2848 | |
| 2849 | @code |
| 2850 | bt_stream_class_borrow_default_clock_class_const( |
| 2851 | bt_stream_borrow_class_const( |
| 2852 | bt_message_discarded_packets_borrow_stream_const(message))) |
| 2853 | @endcode |
| 2854 | |
| 2855 | @param[in] message |
| 2856 | Discarded packets message from which to borrow its stream's class's |
| 2857 | default clock class. |
| 2858 | |
| 2859 | @returns |
| 2860 | \em Borrowed reference of the default clock class of |
| 2861 | the stream class of \bt_p{message}, or \c NULL if none. |
| 2862 | |
| 2863 | @bt_pre_not_null{message} |
| 2864 | @bt_pre_is_disc_pkt_msg{message} |
| 2865 | */ |
| 2866 | extern const bt_clock_class * |
| 2867 | bt_message_discarded_packets_borrow_stream_class_default_clock_class_const( |
| 2868 | const bt_message *message); |
| 2869 | |
| 2870 | /*! |
| 2871 | @brief |
| 2872 | Sets the number of discarded packets of the \bt_disc_pkt_msg |
| 2873 | \bt_p{message} to \bt_p{count}. |
| 2874 | |
| 2875 | See the \ref api-msg-disc-ev-prop-count "discarded packet count" |
| 2876 | property. |
| 2877 | |
| 2878 | @param[in] message |
| 2879 | Discarded packets message of which to set the number of discarded |
| 2880 | packets to \bt_p{count}. |
| 2881 | @param[in] count |
| 2882 | New number of discarded packets of \bt_p{message}. |
| 2883 | |
| 2884 | @bt_pre_not_null{message} |
| 2885 | @bt_pre_hot{message} |
| 2886 | @bt_pre_is_disc_pkt_msg{message} |
| 2887 | |
| 2888 | @sa bt_message_discarded_packets_get_count() — |
| 2889 | Returns the number of discarded packets of a discarded packets |
| 2890 | message. |
| 2891 | */ |
| 2892 | extern void bt_message_discarded_packets_set_count(bt_message *message, |
| 2893 | uint64_t count); |
| 2894 | |
| 2895 | /*! |
| 2896 | @brief |
| 2897 | Returns the number of discarded packets of the \bt_disc_pkt_msg |
| 2898 | \bt_p{message}. |
| 2899 | |
| 2900 | See the \ref api-msg-disc-ev-prop-count "discarded packet count" |
| 2901 | property. |
| 2902 | |
| 2903 | @param[in] message |
| 2904 | Discarded packets message of which to get the number of discarded |
| 2905 | packets. |
| 2906 | @param[out] count |
| 2907 | <strong>If this function returns |
| 2908 | #BT_PROPERTY_AVAILABILITY_AVAILABLE</strong>, \bt_p{*count} is |
| 2909 | the number of discarded packets of \bt_p{message}. |
| 2910 | |
| 2911 | @retval #BT_PROPERTY_AVAILABILITY_AVAILABLE |
| 2912 | The number of discarded packets of \bt_p{message} is available. |
| 2913 | @retval #BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE |
| 2914 | The number of discarded packets of \bt_p{message} is not available. |
| 2915 | |
| 2916 | @bt_pre_not_null{message} |
| 2917 | @bt_pre_is_disc_pkt_msg{message} |
| 2918 | @bt_pre_not_null{count} |
| 2919 | |
| 2920 | @sa bt_message_discarded_packets_set_count() — |
| 2921 | Sets the number of discarded packets of a discarded packets message. |
| 2922 | */ |
| 2923 | extern bt_property_availability bt_message_discarded_packets_get_count( |
| 2924 | const bt_message *message, uint64_t *count); |
| 2925 | |
| 2926 | /*! @} */ |
| 2927 | |
| 2928 | /*! |
| 2929 | @name Message iterator inactivity message |
| 2930 | @{ |
| 2931 | */ |
| 2932 | |
| 2933 | /*! |
| 2934 | @brief |
| 2935 | Creates a \bt_inac_msg having a \bt_cs of a fictitious instance of |
| 2936 | the \bt_clock_cls \bt_p{clock_class} with the value |
| 2937 | \bt_p{clock_snapshot_value} from the \bt_msg_iter |
| 2938 | \bt_p{self_message_iterator}. |
| 2939 | |
| 2940 | On success, the returned message iterator inactivity message has the |
| 2941 | following property values: |
| 2942 | |
| 2943 | <table> |
| 2944 | <tr> |
| 2945 | <th>Property |
| 2946 | <th>Value |
| 2947 | <tr> |
| 2948 | <td>\ref api-msg-inac-prop-cs "Clock snapshot" |
| 2949 | <td> |
| 2950 | \bt_c_cs (snapshot of a fictitious instance of \bt_p{clock_class}) |
| 2951 | with the value \bt_p{clock_snapshot_value}. |
| 2952 | </table> |
| 2953 | |
| 2954 | @param[in] self_message_iterator |
| 2955 | Self message iterator from which to create the message iterator |
| 2956 | inactivity message. |
| 2957 | @param[in] clock_class |
| 2958 | Class of the fictitious instance of which |
| 2959 | \bt_p{clock_snapshot_value} is the value of its snapshot. |
| 2960 | @param[in] clock_snapshot_value |
| 2961 | Value (clock cycles) of the clock snapshot of \bt_p{message}. |
| 2962 | |
| 2963 | @returns |
| 2964 | New message iterator inactivity message reference, or \c NULL on |
| 2965 | memory error. |
| 2966 | |
| 2967 | @bt_pre_not_null{self_message_iterator} |
| 2968 | @bt_pre_not_null{clock_class} |
| 2969 | |
| 2970 | @bt_post_success_frozen{clock_class} |
| 2971 | */ |
| 2972 | extern |
| 2973 | bt_message *bt_message_message_iterator_inactivity_create( |
| 2974 | bt_self_message_iterator *self_message_iterator, |
| 2975 | const bt_clock_class *clock_class, |
| 2976 | uint64_t clock_snapshot_value); |
| 2977 | |
| 2978 | /*! |
| 2979 | @brief |
| 2980 | Borrows the \bt_cs of the \bt_inac_msg \bt_p{message}. |
| 2981 | |
| 2982 | See the \ref api-msg-inac-prop-cs "clock snapshot" property. |
| 2983 | |
| 2984 | @param[in] message |
| 2985 | Message iterator inactivity message from which to borrow the clock |
| 2986 | snapshot. |
| 2987 | |
| 2988 | @returns |
| 2989 | Clock snapshot of \bt_p{message}. |
| 2990 | |
| 2991 | @bt_pre_not_null{message} |
| 2992 | @bt_pre_is_inac_msg{message} |
| 2993 | */ |
| 2994 | extern const bt_clock_snapshot * |
| 2995 | bt_message_message_iterator_inactivity_borrow_clock_snapshot_const( |
| 2996 | const bt_message *message); |
| 2997 | |
| 2998 | /*! @} */ |
| 2999 | |
| 3000 | /*! |
| 3001 | @name Message reference count |
| 3002 | @{ |
| 3003 | */ |
| 3004 | |
| 3005 | /*! |
| 3006 | @brief |
| 3007 | Increments the \ref api-fund-shared-object "reference count" of |
| 3008 | the message \bt_p{message}. |
| 3009 | |
| 3010 | @param[in] message |
| 3011 | @parblock |
| 3012 | Message of which to increment the reference count. |
| 3013 | |
| 3014 | Can be \c NULL. |
| 3015 | @endparblock |
| 3016 | |
| 3017 | @sa bt_message_put_ref() — |
| 3018 | Decrements the reference count of a message. |
| 3019 | */ |
| 3020 | extern void bt_message_get_ref(const bt_message *message); |
| 3021 | |
| 3022 | /*! |
| 3023 | @brief |
| 3024 | Decrements the \ref api-fund-shared-object "reference count" of |
| 3025 | the message \bt_p{message}. |
| 3026 | |
| 3027 | @param[in] message |
| 3028 | @parblock |
| 3029 | Message of which to decrement the reference count. |
| 3030 | |
| 3031 | Can be \c NULL. |
| 3032 | @endparblock |
| 3033 | |
| 3034 | @sa bt_message_get_ref() — |
| 3035 | Increments the reference count of a message. |
| 3036 | */ |
| 3037 | extern void bt_message_put_ref(const bt_message *message); |
| 3038 | |
| 3039 | /*! |
| 3040 | @brief |
| 3041 | Decrements the reference count of the message \bt_p{_message}, and |
| 3042 | then sets \bt_p{_message} to \c NULL. |
| 3043 | |
| 3044 | @param _message |
| 3045 | @parblock |
| 3046 | Message of which to decrement the reference count. |
| 3047 | |
| 3048 | Can contain \c NULL. |
| 3049 | @endparblock |
| 3050 | |
| 3051 | @bt_pre_assign_expr{_message} |
| 3052 | */ |
| 3053 | #define BT_MESSAGE_PUT_REF_AND_RESET(_message) \ |
| 3054 | do { \ |
| 3055 | bt_message_put_ref(_message); \ |
| 3056 | (_message) = NULL; \ |
| 3057 | } while (0) |
| 3058 | |
| 3059 | /*! |
| 3060 | @brief |
| 3061 | Decrements the reference count of the message \bt_p{_dst}, sets |
| 3062 | \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL. |
| 3063 | |
| 3064 | This macro effectively moves a message reference from the expression |
| 3065 | \bt_p{_src} to the expression \bt_p{_dst}, putting the existing |
| 3066 | \bt_p{_dst} reference. |
| 3067 | |
| 3068 | @param _dst |
| 3069 | @parblock |
| 3070 | Destination expression. |
| 3071 | |
| 3072 | Can contain \c NULL. |
| 3073 | @endparblock |
| 3074 | @param _src |
| 3075 | @parblock |
| 3076 | Source expression. |
| 3077 | |
| 3078 | Can contain \c NULL. |
| 3079 | @endparblock |
| 3080 | |
| 3081 | @bt_pre_assign_expr{_dst} |
| 3082 | @bt_pre_assign_expr{_src} |
| 3083 | */ |
| 3084 | #define BT_MESSAGE_MOVE_REF(_dst, _src) \ |
| 3085 | do { \ |
| 3086 | bt_message_put_ref(_dst); \ |
| 3087 | (_dst) = (_src); \ |
| 3088 | (_src) = NULL; \ |
| 3089 | } while (0) |
| 3090 | |
| 3091 | /*! @} */ |
| 3092 | |
| 3093 | /*! |
| 3094 | @name Message Interchange Protocol version |
| 3095 | @{ |
| 3096 | */ |
| 3097 | |
| 3098 | /*! |
| 3099 | @brief |
| 3100 | Status codes for bt_get_greatest_operative_mip_version(). |
| 3101 | */ |
| 3102 | typedef enum bt_get_greatest_operative_mip_version_status { |
| 3103 | /*! |
| 3104 | @brief |
| 3105 | Success. |
| 3106 | */ |
| 3107 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 3108 | |
| 3109 | /*! |
| 3110 | @brief |
| 3111 | No match found. |
| 3112 | */ |
| 3113 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH = __BT_FUNC_STATUS_NO_MATCH, |
| 3114 | |
| 3115 | /*! |
| 3116 | @brief |
| 3117 | Out of memory. |
| 3118 | */ |
| 3119 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 3120 | |
| 3121 | /*! |
| 3122 | @brief |
| 3123 | Other error. |
| 3124 | */ |
| 3125 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 3126 | } bt_get_greatest_operative_mip_version_status; |
| 3127 | |
| 3128 | /*! |
| 3129 | @brief |
| 3130 | Computes the greatest \bt_mip version which |
| 3131 | you can use to create a trace processing \bt_graph to which you |
| 3132 | intend to \ref api-graph-lc-add "add components" described by the |
| 3133 | component descriptors \bt_p{component_descriptors}, and sets |
| 3134 | \bt_p{*mip_version} to the result. |
| 3135 | |
| 3136 | This function calls the |
| 3137 | \link api-comp-cls-dev-meth-mip "get supported MIP versions"\endlink |
| 3138 | method for each component descriptor in \bt_p{component_descriptors}, |
| 3139 | and then returns the greatest common (operative) MIP version, if any. |
| 3140 | The "get supported MIP versions" method receives \bt_p{logging_level} as |
| 3141 | its \bt_p{logging_level} parameter. |
| 3142 | |
| 3143 | If this function does not find an operative MIP version for the |
| 3144 | component descriptors of \bt_p{component_descriptors}, it returns |
| 3145 | #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH. |
| 3146 | |
| 3147 | @note |
| 3148 | As of \bt_name_version_min_maj, because bt_get_maximal_mip_version() |
| 3149 | returns 0, this function always sets \bt_p{*mip_version} to |
| 3150 | 0 on success. |
| 3151 | |
| 3152 | @param[in] component_descriptors |
| 3153 | Component descriptors for which to get the supported MIP versions |
| 3154 | to compute the greatest operative MIP version. |
| 3155 | @param[in] logging_level |
| 3156 | Logging level to use when calling the "get supported MIP versions" |
| 3157 | method for each component descriptor in |
| 3158 | \bt_p{component_descriptors}. |
| 3159 | @param[out] mip_version |
| 3160 | <strong>On success</strong>, \bt_p{*mip_version} is the greatest |
| 3161 | operative MIP version of all the component descriptors in |
| 3162 | \bt_p{component_descriptors}. |
| 3163 | |
| 3164 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_OK |
| 3165 | Success. |
| 3166 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH |
| 3167 | No operative MIP version exists for the component descriptors of |
| 3168 | \bt_p{component_descriptors}. |
| 3169 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_MEMORY_ERROR |
| 3170 | Out of memory. |
| 3171 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_ERROR |
| 3172 | Other error. |
| 3173 | |
| 3174 | @bt_pre_not_null{component_descriptors} |
| 3175 | @pre |
| 3176 | \bt_p{component_descriptors} contains one or more component |
| 3177 | descriptors. |
| 3178 | @bt_pre_not_null{mip_version} |
| 3179 | */ |
| 3180 | extern bt_get_greatest_operative_mip_version_status |
| 3181 | bt_get_greatest_operative_mip_version( |
| 3182 | const bt_component_descriptor_set *component_descriptors, |
| 3183 | bt_logging_level logging_level, uint64_t *mip_version); |
| 3184 | |
| 3185 | /*! |
| 3186 | @brief |
| 3187 | Returns the maximal available \bt_mip version as of |
| 3188 | \bt_name_version_min_maj. |
| 3189 | |
| 3190 | As of \bt_name_version_min_maj, this function returns |
| 3191 | \bt_max_mip_version. |
| 3192 | |
| 3193 | @returns |
| 3194 | Maximal available MIP version (\bt_max_mip_version). |
| 3195 | */ |
| 3196 | extern uint64_t bt_get_maximal_mip_version(void); |
| 3197 | |
| 3198 | /*! @} */ |
| 3199 | |
| 3200 | /*! @} */ |
| 3201 | |
| 3202 | #ifdef __cplusplus |
| 3203 | } |
| 3204 | #endif |
| 3205 | |
| 3206 | #endif /* BABELTRACE2_GRAPH_MESSAGE_H */ |