SatCat5
satcat5::ptp::Interface Class Referenceabstract

Detailed Description

Generic API for network ports that support PTP.

Network interfaces with PTP support must derive from this class.

PTP-compatible network interfaces must provide additional methods for accessing precise timestamps, and for inspecting incoming messages to determine their type. This class defines the minimum set of required methods.

Definition at line 27 of file ptp_interface.h.

#include <ptp_interface.h>

Inheritance diagram for satcat5::ptp::Interface:
[legend]
Collaboration diagram for satcat5::ptp::Interface:
[legend]

Public Member Functions

void ptp_callback (satcat5::poll::OnDemand *obj)
 Set callback object for PTP-related packet handling.
 
virtual satcat5::ptp::Time ptp_time_now ()=0
 Return the best available estimate of the current time. More...
 
virtual satcat5::ptp::Time ptp_tx_start ()=0
 Begin sending a timestamped message. More...
 
virtual satcat5::io::Writeableptp_tx_write ()=0
 Return an object suitable for writing the next PTP frame. More...
 
virtual satcat5::ptp::Time ptp_tx_timestamp ()=0
 Return timestamp of the most recent outgoing message. More...
 
virtual satcat5::io::Readableptp_rx_read ()=0
 Return an object suitable for reading the next PTP frame. More...
 
virtual satcat5::ptp::Time ptp_rx_timestamp ()=0
 Return timestamp of the current incoming message. More...
 
satcat5::ptp::PacketType ptp_rx_type () const
 Return the packet type for the most recent message.
 

Protected Member Functions

 Interface ()
 Constructor is not publicly accessible.
 
bool ptp_dispatch (const u8 *peek, unsigned length)
 Determine if an incoming packet is a PTP message. More...
 
void ptp_notify_now ()
 Notify the PTP callback object in immediate mode.
 
void ptp_notify_req ()
 Notify the PTP callback object in deferred mode.
 

Private Attributes

satcat5::poll::OnDemandm_ptp_callback
 
satcat5::ptp::PacketType m_ptp_rx_type
 

Member Function Documentation

◆ ptp_dispatch()

bool Interface::ptp_dispatch ( const u8 *  peek,
unsigned  length 
)
protected

Determine if an incoming packet is a PTP message.

Child class MUST call this method for each received packet. If this method returns true, call ptp_notify_now() or ptp_notify_req(). Otherwise, continue normal processing.

Definition at line 18 of file ptp_interface.cc.

◆ ptp_rx_read()

virtual satcat5::io::Readable* satcat5::ptp::Interface::ptp_rx_read ( )
pure virtual

Return an object suitable for reading the next PTP frame.

(This may be the primary interface or a separate pointer.) Child class MUST override this method.

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.

◆ ptp_rx_timestamp()

virtual satcat5::ptp::Time satcat5::ptp::Interface::ptp_rx_timestamp ( )
pure virtual

Return timestamp of the current incoming message.

Child class MUST override this method.

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.

◆ ptp_time_now()

virtual satcat5::ptp::Time satcat5::ptp::Interface::ptp_time_now ( )
pure virtual

Return the best available estimate of the current time.

(This method may be less accurate than Tx and Rx timestamps.)

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.

◆ ptp_tx_start()

virtual satcat5::ptp::Time satcat5::ptp::Interface::ptp_tx_start ( )
pure virtual

Begin sending a timestamped message.

Return effective one-step timestamp if known, otherwise zero. Child class MUST override this method.

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.

◆ ptp_tx_timestamp()

virtual satcat5::ptp::Time satcat5::ptp::Interface::ptp_tx_timestamp ( )
pure virtual

Return timestamp of the most recent outgoing message.

Child class MUST override this method.

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.

◆ ptp_tx_write()

virtual satcat5::io::Writeable* satcat5::ptp::Interface::ptp_tx_write ( )
pure virtual

Return an object suitable for writing the next PTP frame.

(This may be the primary interface or a separate pointer.) Child class MUST override this method.

Implemented in satcat5::port::Mailmap, and satcat5::test::EthernetInterface.


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