gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PTPMessageCommon Class Reference

#include <avbts_message.hpp>

Inheritance diagram for PTPMessageCommon:
Inheritance graph
Collaboration diagram for PTPMessageCommon:
Collaboration graph

Public Member Functions

 PTPMessageCommon (IEEE1588Port *port)
 Creates the PTPMessageCommon interface. More...
 
virtual ~PTPMessageCommon (void)
 
unsigned char * getFlags (void)
 Gets a pointer to the flags field within the PTP message. More...
 
uint16_t getSequenceId (void)
 Gets the sequenceId value within a ptp message. More...
 
void setSequenceId (uint16_t seq)
 Sets the sequence ID value to the PTP message. More...
 
MessageType getMessageType (void)
 Gets the MessageType field within the PTP message. More...
 
long long getCorrectionField (void)
 Gets the correctionField value in a Little-Endian format. More...
 
void setCorrectionField (long long correctionAmount)
 Sets the correction field. It expects the host format. More...
 
void getPortIdentity (PortIdentity *identity)
 Gets PortIdentity field. More...
 
void setPortIdentity (PortIdentity *identity)
 Sets PortIdentity value. More...
 
Timestamp getTimestamp (void)
 Gets the current Timestamp value from the PTP message. More...
 
uint32_t getTimestampCounterValue (void)
 Gets the timestamp counter value set during the RX timestamp method. More...
 
void setTimestamp (Timestamp &timestamp)
 Sets the timestamp value. More...
 
bool garbage ()
 Gets the garbage collection status. More...
 
bool isSenderEqual (PortIdentity portIdentity)
 Determine whether the message was sent by given communication technology, uuid, and port id fields. More...
 
virtual void processMessage (IEEE1588Port *port)
 Generic interface for processing PTP message. More...
 
void buildCommonHeader (uint8_t *buf)
 Builds PTP common header. More...
 

Protected Member Functions

 PTPMessageCommon (void)
 

Protected Attributes

unsigned char versionPTP
 
uint16_t versionNetwork
 
MessageType messageType
 
PortIdentitysourcePortIdentity
 
uint16_t sequenceId
 
LegacyMessageType control
 
unsigned char flags [2]
 
uint16_t messageLength
 
char logMeanMessageInterval
 
long long correctionField
 
unsigned char domainNumber
 
Timestamp _timestamp
 
unsigned _timestamp_counter_value
 
bool _gc
 

Friends

PTPMessageCommonbuildPTPMessage (char *buf, int size, LinkLayerAddress *remote, IEEE1588Port *port)
 Builds a PTP message. More...
 

Detailed Description

Provides the PTPMessage common interface used during building of PTP messages.

Constructor & Destructor Documentation

PTPMessageCommon::PTPMessageCommon ( void  )
inlineprotected

Default constructor

PTPMessageCommon::PTPMessageCommon ( IEEE1588Port port)

Creates the PTPMessageCommon interface.

Parameters
portIEEE1588Port where the message interface is connected to.
virtual PTPMessageCommon::~PTPMessageCommon ( void  )
virtual

Destroys PTPMessageCommon interface

Member Function Documentation

void PTPMessageCommon::buildCommonHeader ( uint8_t *  buf)

Builds PTP common header.

Parameters
buf[out] PTP message
Returns
void
bool PTPMessageCommon::garbage ( )
inline

Gets the garbage collection status.

Returns
TRUE when it needs to be clean. FALSE otherwise.
long long PTPMessageCommon::getCorrectionField ( void  )
inline

Gets the correctionField value in a Little-Endian format.

Returns
correctionField
Todo:
Little endian format could be removed by adding endianess discovery on compile/run time.
unsigned char* PTPMessageCommon::getFlags ( void  )
inline

Gets a pointer to the flags field within the PTP message.

Returns
Pointer to the flags field
MessageType PTPMessageCommon::getMessageType ( void  )
inline

Gets the MessageType field within the PTP message.

Returns
MessageType
void PTPMessageCommon::getPortIdentity ( PortIdentity identity)

Gets PortIdentity field.

Parameters
identity[out] Source port identity
Returns
void
uint16_t PTPMessageCommon::getSequenceId ( void  )
inline

Gets the sequenceId value within a ptp message.

Returns
Sequence ID value
Timestamp PTPMessageCommon::getTimestamp ( void  )
inline

Gets the current Timestamp value from the PTP message.

Returns
Current Timestamp value
uint32_t PTPMessageCommon::getTimestampCounterValue ( void  )
inline

Gets the timestamp counter value set during the RX timestamp method.

Returns
timestamp counter value
bool PTPMessageCommon::isSenderEqual ( PortIdentity  portIdentity)

Determine whether the message was sent by given communication technology, uuid, and port id fields.

Parameters
portIdentityPortIdentity value
Returns
TRUE if sender equals to internal PTPCommon values, FALSE otherwise.
virtual void PTPMessageCommon::processMessage ( IEEE1588Port port)
virtual

Generic interface for processing PTP message.

Parameters
portIEEE1588 port
Returns
void

Reimplemented in PTPMessagePathDelayRespFollowUp, PTPMessagePathDelayResp, PTPMessagePathDelayReq, PTPMessageFollowUp, PTPMessageSync, and PTPMessageAnnounce.

void PTPMessageCommon::setCorrectionField ( long long  correctionAmount)
inline

Sets the correction field. It expects the host format.

Parameters
correctionAmount
Returns
void
Todo:
Little endian format could be removed by adding endianess discovery on compile/run time.
void PTPMessageCommon::setPortIdentity ( PortIdentity identity)

Sets PortIdentity value.

Parameters
identity[in] Source port identity value to be set.
Returns
void
void PTPMessageCommon::setSequenceId ( uint16_t  seq)
inline

Sets the sequence ID value to the PTP message.

Parameters
seqSequence id value to be set.
Returns
void
void PTPMessageCommon::setTimestamp ( Timestamp timestamp)
inline

Sets the timestamp value.

Parameters
timestamp[in] Reference to Timestamp value
Returns
void

Friends And Related Function Documentation

PTPMessageCommon* buildPTPMessage ( char *  buf,
int  size,
LinkLayerAddress remote,
IEEE1588Port port 
)
friend

Builds a PTP message.

Parameters
buf[in] message buffer to send
sizemessage length
remoteDestination link layer address
port[in] IEEE1588 port
Returns
PTP message instance of PTPMessageCommon

Member Data Documentation

bool PTPMessageCommon::_gc
protected

Garbage collection flag

Timestamp PTPMessageCommon::_timestamp
protected

PTP message timestamp

unsigned PTPMessageCommon::_timestamp_counter_value
protected

PTP timestamp counter value

LegacyMessageType PTPMessageCommon::control
protected

Control message type of LegacyMessageType

long long PTPMessageCommon::correctionField
protected

Correction Field (IEEE 1588-2008 table 21)

unsigned char PTPMessageCommon::domainNumber
protected

PTP domain number

unsigned char PTPMessageCommon::flags[2]
protected

PTP flags field

char PTPMessageCommon::logMeanMessageInterval
protected

LogMessageInterval (IEEE 1588-2008 table 24)

uint16_t PTPMessageCommon::messageLength
protected

PTP message length

MessageType PTPMessageCommon::messageType
protected

MessageType to be built

uint16_t PTPMessageCommon::sequenceId
protected

PTP message sequence ID

PortIdentity* PTPMessageCommon::sourcePortIdentity
protected

PortIdentity from source

uint16_t PTPMessageCommon::versionNetwork
protected

Network version

unsigned char PTPMessageCommon::versionPTP
protected

PTP version


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