SatCat5
satcat5::ptp::Header Struct Reference

Detailed Description

Struct representing the PTP header used for all message types.

This file defines the 34-byte header that is common to all PTP messages, defined in IEEE 1588-2019 Section 13.3. Most PTP messages append additional data after this header.

Definition at line 46 of file ptp_header.h.

#include <ptp_header.h>

Collaboration diagram for satcat5::ptp::Header:
[legend]

Public Member Functions

 Header (const Header &t)=default
 
Headeroperator= (const Header &t)=default
 
unsigned msglen () const
 Expected length of message fields, not including header. More...
 
void log_to (satcat5::log::LogBuffer &wr) const
 Log human-readable information about this header.
 
bool read_from (satcat5::io::Readable *rd)
 Read header contents from a given source.
 
void write_to (satcat5::io::Writeable *wr) const
 Write header contents to the given sink.
 

Public Attributes

u8 type
 messageType (0-15)
 
u8 version
 versionPTP only
 
u16 length
 messageLength
 
u8 domain
 domainNumber
 
u16 sdo_id
 majorSdoId + minorSdoId
 
u16 flags
 flagField
 
u64 correction
 correctionField
 
u32 subtype
 messageTypeSpecific
 
satcat5::ptp::PortId src_port
 sourcePortIdentity
 
u16 seq_id
 sequenceId
 
u8 control
 controlField
 
s8 log_interval
 logMessageInterval
 

Static Public Attributes

static constexpr unsigned HEADER_LEN = 34
 Header itself is exactly 34 bytes.
 
static constexpr u8 TYPE_SYNC = 0x0
 Message types (Section 13.3.2.3 / Table 36)
 
static constexpr u8 TYPE_DELAY_REQ = 0x1
 
static constexpr u8 TYPE_PDELAY_REQ = 0x2
 
static constexpr u8 TYPE_PDELAY_RESP = 0x3
 
static constexpr u8 TYPE_FOLLOW_UP = 0x8
 
static constexpr u8 TYPE_DELAY_RESP = 0x9
 
static constexpr u8 TYPE_PDELAY_RFU = 0xA
 
static constexpr u8 TYPE_ANNOUNCE = 0xB
 
static constexpr u8 TYPE_SIGNALING = 0xC
 
static constexpr u8 TYPE_MANAGEMENT = 0xD
 
static constexpr u16 FLAG_LEAP61 = (1u << 0)
 Flag definitions (Section 13.3.2.8 / Table 37)
 
static constexpr u16 FLAG_LEAP59 = (1u << 1)
 
static constexpr u16 FLAG_UTC_VALID = (1u << 2)
 
static constexpr u16 FLAG_PTP_TIMESCALE = (1u << 3)
 
static constexpr u16 FLAG_TIME_TRACEABLE = (1u << 4)
 
static constexpr u16 FLAG_FREQ_TRACEABLE = (1u << 5)
 
static constexpr u16 FLAG_UNCERTAIN = (1u << 6)
 
static constexpr u16 FLAG_ALT_MASTER = (1u << 8)
 
static constexpr u16 FLAG_TWO_STEP = (1u << 9)
 
static constexpr u16 FLAG_UNICAST = (1u << 10)
 
static constexpr u16 FLAG_PROFILE1 = (1u << 13)
 
static constexpr u16 FLAG_PROFILE2 = (1u << 14)
 
static constexpr u16 FLAG_SPTP = FLAG_PROFILE1
 SPTP uses the PROFILE1 flag, so define an alias.
 
static constexpr unsigned MAX_MSGLEN = 30
 

Member Function Documentation

◆ msglen()

unsigned Header::msglen ( ) const

Expected length of message fields, not including header.

i.e., the initial offset for parsing any attached TLVs.

Definition at line 43 of file ptp_header.cc.


The documentation for this struct was generated from the following files: