| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com> |
| 5 | * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> |
| 7 | */ |
| 8 | |
| 9 | #ifndef LTTNG_INDEX_H |
| 10 | #define LTTNG_INDEX_H |
| 11 | |
| 12 | #include <stddef.h> |
| 13 | #include "compat/limits.h" |
| 14 | |
| 15 | #define CTF_INDEX_MAGIC 0xC1F1DCC1 |
| 16 | #define CTF_INDEX_MAJOR 1 |
| 17 | #define CTF_INDEX_MINOR 1 |
| 18 | #define CTF_INDEX_1_0_SIZE offsetof(struct ctf_packet_index, stream_instance_id) |
| 19 | |
| 20 | /* |
| 21 | * Header at the beginning of each index file. |
| 22 | * All integer fields are stored in big endian. |
| 23 | */ |
| 24 | struct ctf_packet_index_file_hdr |
| 25 | { |
| 26 | uint32_t magic; |
| 27 | uint32_t index_major; |
| 28 | uint32_t index_minor; |
| 29 | /* size of struct ctf_packet_index, in bytes. */ |
| 30 | uint32_t packet_index_len; |
| 31 | } __attribute__((__packed__)); |
| 32 | |
| 33 | /* |
| 34 | * Packet index generated for each trace packet store in a trace file. |
| 35 | * All integer fields are stored in big endian. |
| 36 | */ |
| 37 | struct ctf_packet_index |
| 38 | { |
| 39 | uint64_t offset; /* offset of the packet in the file, in bytes */ |
| 40 | uint64_t packet_size; /* packet size, in bits */ |
| 41 | uint64_t content_size; /* content size, in bits */ |
| 42 | uint64_t timestamp_begin; |
| 43 | uint64_t timestamp_end; |
| 44 | uint64_t events_discarded; |
| 45 | uint64_t stream_id; |
| 46 | /* CTF_INDEX 1.0 limit */ |
| 47 | uint64_t stream_instance_id; /* ID of the channel instance */ |
| 48 | uint64_t packet_seq_num; /* packet sequence number */ |
| 49 | } __attribute__((__packed__)); |
| 50 | |
| 51 | #endif /* LTTNG_INDEX_H */ |