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