6 #include <satcat5/ptp_client.h>
16 && (org_id == other.org_id)
17 && (org_sub == other.org_sub);
23 if (
type < 0x0008)
return false;
24 if (
type < 0x000A)
return true;
25 if (
type < 0x4000)
return false;
26 if (
type < 0x8000)
return true;
33 if (org_id || org_sub) {
34 wr->write_u16(length + 6);
35 wr->write_u24(org_id);
36 wr->write_u24(org_sub);
38 wr->write_u16(length);
45 *
this = TLV_HEADER_NONE;
48 type = rd->read_u16();
49 length = rd->read_u16();
56 if (type_org && length < 6)
return false;
59 org_id = rd->read_u24();
60 org_sub = rd->read_u24();
73 TlvHandler::~TlvHandler()
Limited read of next N bytes.
Abstract API for reading byte-streams and packets.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Abstract API for writing byte-streams and packets.
Client for the IEEE 1588-2019 Precision Time Protocol (PTP)
Users should derive custom TLV objects from this base class.
satcat5::ptp::Client *const m_client
Pointer to the associated PTP client.
virtual unsigned tlv_send(const satcat5::ptp::Header &hdr, satcat5::io::Writeable *wr)
Child class SHOULD override this method to append outgoing TLV(s).
virtual bool tlv_rcvd(const satcat5::ptp::Header &hdr, const satcat5::ptp::TlvHeader &tlv, satcat5::io::LimitedRead &rd)
Child class SHOULD override this method to read incoming TLV(s).
TlvHandler(satcat5::ptp::Client *client)
Only children should create or destroy the base class.
virtual void tlv_meas(satcat5::ptp::Measurement &meas)
Child class MAY override this method to read or modify each complete two-way handshake event.
void add(T *item)
Add new item to front or back, whichever is simpler.
void remove(T *item)
Remove the designated item from the list.
TLV metadata for the IEEE 1588-2019 Precision Time Protocol (PTP).
constexpr u16 TLVTYPE_ORG_EXT
Define some key tlvType values.
constexpr u16 TLVTYPE_ORG_EXT_P
Define some key tlvType values.
constexpr u16 TLVTYPE_ORG_EXT_NP
Define some key tlvType values.
Timestamps and metadata for a two-way time-transfer handshake.