This document defines a standard format for wrapping a CTF 2 metadata stream (see CTF2-SPEC-2.0) into one or more packets.

Compliance

A CTF 2 producer is said to apply CTF2-PMETA-1.0 if it can encode a CTF 2 metadata stream as a packetized metadata stream as defined by this document.

A CTF 2 consumer is said to support CTF2-PMETA-1.0 if it can decode a packetized metadata stream, as defined by this document, as a CTF 2 metadata stream.

Packetized metadata stream layout

A packetized metadata stream is a sequence of metadata packets:

[metadata packet]
[metadata packet]
[metadata packet]
[metadata packet]
...

The layout of a metadata packet is:

[metadata packet header]
[metadata packet content]

Metadata packet header format

The fields of a metadata packet header are, in this order, and without any padding between the fields:

Table 1. Metadata packet header fields
Name Offset in metadata packet header (bits) Type Notes

Magic number

0

32-bit, unsigned integer, any byte order.

The field’s value must be 1976638807 (0x75d11d57), in any byte order (little-endian or big-endian). The byte order of this field indicates the byte order of the following fields, when needed.

Metadata stream’s UUID.

32

16 bytes.

This is a UUID assigned to all the metadata packets wrapping a given metadata stream.

Metadata packet’s checksum.

160

32-bit, unsigned integer, deduced byte order.

Producers and consumers must ignore this field as of CTF2-PMETA-1.0.

Metadata packet’s content size (bits)

192

32-bit, unsigned integer, deduced byte order.

This is the content size, in bits, of the metadata packet, including this header.

The value of this field must be a multiple of 8.

Metadata packet’s total size (bits)

224

32-bit, unsigned integer, deduced byte order.

This is the total size, in bits, of the whole metadata packet, including this header.

The difference between this total size and the packet’s content size is the padding size.

The value of this field must be a multiple of 8.

Content’s compression scheme

256

8-bit, unsigned integer

As of CTF2-PMETA-1.0, this field must be set to 0 (means no compression).

Content’s encryption scheme

264

8-bit, unsigned integer

As of CTF2-PMETA-1.0, this field must be set to 0 (means no encryption).

Content’s checksum scheme

272

8-bit, unsigned integer

As of CTF2-PMETA-1.0, this field must be set to 0 (means no checksum).

Metadata packet’s major version number

280

8-bit, unsigned integer

As of CTF2-PMETA-1.0, this field must be set to 2.

Metadata packet’s minor version number

288

8-bit, unsigned integer

As of CTF2-PMETA-1.0, this field must be set to 0.

Reserved

296

24-bit, unsigned integer

Producers and consumers must ignore this field as of CTF2-PMETA-1.0.

Metadata packet header’s size (bits)

320

32-bit, unsigned integer, deduced byte order.

Size of the whole metadata packet header, including this field and the following fields, if any.

Any unknown field of which the offset relative to the beginning of the metadata packet, in bits, is greater than the value of this field, must be ignored by consumers.

As of CTF2-PMETA-1.0, this field must be set to 352 (44 bytes).

Note that all the fields from the metadata packet’s magic number to the metadata packet’s minor version number (inclusive) are compatible with the metadata packet header format of Common Trace Format v1.8.2, section 7.1, with the following exceptions:

  • The metadata packet’s checksum field must be ignored.

  • The content’s compression scheme field must be set to 0.

  • The content’s encryption scheme field must be set to 0.

  • The content’s checksum scheme field must be set to 0.

  • The content’s checksum scheme field must be set to 0.

  • The metadata packet’s major version number field must be set to 2.

  • The metadata packet’s minor version number field must be set to 0.

Metadata packet content

The concatenated content bytes of all the metadata packets of a packetized metadata stream form the raw, JSON metadata stream of the CTF 2 trace as described by CTF2-SPEC-2.0.