RAVENNAKIT
Loading...
Searching...
No Matches
rav::ptp Namespace Reference

Classes

struct  BestAnnounceMessage
struct  ComparisonDataSet
 Contains the data needed to compare two PTP data sets. More...
class  ForeignMasterList
struct  CurrentDs
 Represents the data set as described in IEEE1588-2019: 8.2.2. More...
struct  DefaultDs
 Represents the default data set as described in IEEE1588-2019: 8.2.1. More...
struct  ParentDs
 Represents the parent data set as described in IEEE1588-2019: 8.2.3. More...
struct  PortDs
 Port data set. More...
struct  TimePropertiesDs
 Represents the time properties data set as described in IEEE1588-2019: 8.2.4. More...
class  BasicFilter
 Simple averaging filter. More...
struct  Measurement
class  RequestResponseDelaySequence
 This class captures all the data needed to calculate the mean path delay and the offset from the master clock using the request-response delay mechanism. More...
struct  Stats
 Holds different statistics of PTP measurements. More...
struct  AnnounceMessage
struct  DelayRespMessage
struct  FollowUpMessage
struct  Version
struct  MessageHeader
 Provides a view over given data, interpreting it as a PTP message header. More...
struct  PdelayReqMessage
struct  PdelayRespFollowUpMessage
struct  PdelayRespMessage
struct  SyncMessage
class  Instance
 Represents a PTP instance as defined in IEEE 1588-2019. More...
class  LocalClock
 Maintains a local clock corrected to the timebase of another time source, most likely a PTP master clock. More...
class  Port
struct  Profile
struct  ClockIdentity
 Represents a PTP clock identity. More...
struct  ClockQuality
 PTP Clock Quality IEEE1588-2019 section 7.6.2.5, Table 4. More...
struct  PortIdentity
 Represents a PTP port identity. More...
struct  SdoId
class  TimeInterval
 Represents a point in time. More...
struct  Timestamp
 A PTP timestamp, consisting of a seconds and nanoseconds part. More...

Typedefs

using DelayReqMessage = SyncMessage

Enumerations

enum class  State : uint8_t {
  undefined = 0x0 , initializing = 0x1 , faulty = 0x2 , disabled = 0x3 ,
  listening = 0x4 , pre_master = 0x5 , master = 0x6 , passive = 0x7 ,
  uncalibrated = 0x8 , slave = 0x9
}
 The PTP state. More...
enum class  ClockAccuracy : uint8_t {
  lt_1_ps = 0x17 , lt_2_5_ps = 0x18 , lt_10_ps = 0x19 , lt_25_ps = 0x1a ,
  lt_100_ps = 0x1b , lt_250_ps = 0x1c , lt_1_ns = 0x1d , lt_2_5_ns = 0x1e ,
  lt_10_ns = 0x1f , lt_25_ns = 0x20 , lt_100_ns = 0x21 , lt_250_ns = 0x22 ,
  lt_1_us = 0x23 , lt_2_5_us = 0x24 , lt_10_us = 0x25 , lt_25_us = 0x26 ,
  lt_100_us = 0x27 , lt_250_us = 0x28 , lt_1_ms = 0x29 , lt_2_5_ms = 0x2a ,
  lt_10_ms = 0x2b , lt_25_ms = 0x2c , lt_100_ms = 0x2d , lt_250_ms = 0x2e ,
  lt_1_s = 0x2f , lt_10_s = 0x30 , gt_10_s = 0x31 , unknown = 0xFE ,
  reserved = 0xFF
}
 IEEE1588-2019: 7.6.2.6, Table 5. More...
enum class  TimeSource : uint8_t {
  undefined = 0x0 , atomic_clock = 0x10 , gnss = 0x20 , terrestrial_radio = 0x30 ,
  serial_time_code = 0x39 , ptp = 0x40 , ntp = 0x50 , hand_set = 0x60 ,
  other = 0x90 , internal_oscillator = 0xA0 , reserved = 0xFF
}
 PTP Time source IEEE1588-2019: 7.6.2.8, Table 6. More...
enum class  StateDecisionCode {
  m1 , m2 , m3 , s1 ,
  p1 , p2
}
 State decision codes. More...
enum class  MessageType : uint8_t {
  sync = 0x0 , delay_req = 0x1 , p_delay_req = 0x2 , p_delay_resp = 0x3 ,
  reserved1 = 0x4 , reserved2 = 0x5 , reserved3 = 0x6 , reserved4 = 0x7 ,
  follow_up = 0x8 , delay_resp = 0x9 , p_delay_resp_follow_up = 0xa , announce = 0xb ,
  signaling = 0xc , management = 0xd , reserved5 = 0xe , reserved6 = 0xf
}
 PTP Message types. More...
enum class  DelayMechanism : uint8_t {
  undefined = 0x0 , e2e = 0x1 , p2p = 0x2 , common_ptp = 0x3 ,
  special = 0x4 , no_mechanism = 0xfe
}
 PTP Delay mechanism. More...
enum class  Error {
  invalid_data , invalid_header_length , invalid_message_length , only_ordinary_clock_supported ,
  only_slave_supported , failed_to_get_network_interfaces , network_interface_not_found , no_mac_address_available ,
  invalid_clock_identity , port_invalid , port_already_exists , too_many_ports
}

Functions

bool operator== (const Version &lhs, const Version &rhs)
bool operator!= (const Version &lhs, const Version &rhs)
bool operator== (const MessageHeader::FlagField &lhs, const MessageHeader::FlagField &rhs)
bool operator!= (const MessageHeader::FlagField &lhs, const MessageHeader::FlagField &rhs)
bool operator== (const MessageHeader &lhs, const MessageHeader &rhs)
bool operator!= (const MessageHeader &lhs, const MessageHeader &rhs)
const char * to_string (const State state)
 Converts a ptp_state to a string.
const char * to_string (const ClockAccuracy accuracy)
const char * to_string (const StateDecisionCode code)
 Converts a ptp_state_decision_code to a string.
const char * to_string (const MessageType type)
const char * to_string (const Error error)
void tag_invoke (const boost::json::value_from_tag &, boost::json::value &jv, const Instance::Configuration &config)
Instance::Configuration tag_invoke (const boost::json::value_to_tag< Instance::Configuration > &, const boost::json::value &jv)

Variables

constexpr uint8_t k_foreign_master_time_window = 4
constexpr uint8_t k_foreign_master_threshold = 2
static constexpr Profile DefaultProfile1
static constexpr Profile DefaultProfile2
static constexpr Profile DefaultProfile3

Typedef Documentation

◆ DelayReqMessage

Enumeration Type Documentation

◆ ClockAccuracy

enum class rav::ptp::ClockAccuracy : uint8_t
strong

IEEE1588-2019: 7.6.2.6, Table 5.

Enumerator
lt_1_ps 
lt_2_5_ps 
lt_10_ps 
lt_25_ps 
lt_100_ps 
lt_250_ps 
lt_1_ns 
lt_2_5_ns 
lt_10_ns 
lt_25_ns 
lt_100_ns 
lt_250_ns 
lt_1_us 
lt_2_5_us 
lt_10_us 
lt_25_us 
lt_100_us 
lt_250_us 
lt_1_ms 
lt_2_5_ms 
lt_10_ms 
lt_25_ms 
lt_100_ms 
lt_250_ms 
lt_1_s 
lt_10_s 
gt_10_s 
unknown 
reserved 

Definition at line 82 of file ptp_definitions.hpp.

◆ DelayMechanism

enum class rav::ptp::DelayMechanism : uint8_t
strong

PTP Delay mechanism.

IEEE1588-2019: 8.2.15.4.4, Table 21

Enumerator
undefined 
e2e 
p2p 
common_ptp 
special 
no_mechanism 

Definition at line 308 of file ptp_definitions.hpp.

◆ Error

enum class rav::ptp::Error
strong
Enumerator
invalid_data 
invalid_header_length 
invalid_message_length 
only_ordinary_clock_supported 
only_slave_supported 
failed_to_get_network_interfaces 
network_interface_not_found 
no_mac_address_available 
invalid_clock_identity 
port_invalid 
port_already_exists 
too_many_ports 

Definition at line 29 of file ptp_error.hpp.

◆ MessageType

enum class rav::ptp::MessageType : uint8_t
strong

PTP Message types.

IEEE1588-2019: Table 36

Enumerator
sync 
delay_req 
p_delay_req 
p_delay_resp 
reserved1 
reserved2 
reserved3 
reserved4 
follow_up 
delay_resp 
p_delay_resp_follow_up 
announce 
signaling 
management 
reserved5 
reserved6 

Definition at line 251 of file ptp_definitions.hpp.

◆ State

enum class rav::ptp::State : uint8_t
strong

The PTP state.

IEEE1588-2019: 8.2.15.3.1, 9.2.5, Table 27

Enumerator
undefined 
initializing 
faulty 
disabled 
listening 
pre_master 
master 
passive 
uncalibrated 
slave 

Definition at line 34 of file ptp_definitions.hpp.

◆ StateDecisionCode

enum class rav::ptp::StateDecisionCode
strong

State decision codes.

IEEE1588-2019: 9.3.1, 9.3.5, Table 30, 31, 32, 33.

Enumerator
m1 

The PTP Port is in the MASTER state because it is on a clockClass 1 through 127 PTP Instance and is a PTP Port of the Grandmaster PTP Instance of the domain.

m2 

The PTP Port is in the MASTER state because it is on a clockClass 128 or higher PTP Instance and is a PTP Port of the Grandmaster PTP Instance of the domain.

m3 

The PTP Port is in the MASTER state, but it is not a PTP Port on the Grandmaster PTP Instance of the domain.

s1 

The PTP Port is in the SLAVE state.

p1 

The PTP Port is in the PASSIVE state because it is on a clockClass 1 through 127 PTP Instance and is either not on the Grandmaster PTP Instance of the domain or is PASSIVE to break a timing loop.

p2 

The PTP Port is in the PASSIVE state because it is on a clockClass 128 or higher PTP Instance and is PASSIVE to break a timing loop.

Definition at line 204 of file ptp_definitions.hpp.

◆ TimeSource

enum class rav::ptp::TimeSource : uint8_t
strong

PTP Time source IEEE1588-2019: 7.6.2.8, Table 6.

Enumerator
undefined 
atomic_clock 
gnss 
terrestrial_radio 
serial_time_code 
ptp 
ntp 
hand_set 
other 
internal_oscillator 
reserved 

Definition at line 185 of file ptp_definitions.hpp.

Function Documentation

◆ operator!=() [1/3]

bool rav::ptp::operator!= ( const MessageHeader & lhs,
const MessageHeader & rhs )

◆ operator!=() [2/3]

bool rav::ptp::operator!= ( const MessageHeader::FlagField & lhs,
const MessageHeader::FlagField & rhs )

◆ operator!=() [3/3]

bool rav::ptp::operator!= ( const Version & lhs,
const Version & rhs )

◆ operator==() [1/3]

bool rav::ptp::operator== ( const MessageHeader & lhs,
const MessageHeader & rhs )

◆ operator==() [2/3]

bool rav::ptp::operator== ( const MessageHeader::FlagField & lhs,
const MessageHeader::FlagField & rhs )

◆ operator==() [3/3]

bool rav::ptp::operator== ( const Version & lhs,
const Version & rhs )

◆ tag_invoke() [1/2]

void rav::ptp::tag_invoke ( const boost::json::value_from_tag & ,
boost::json::value & jv,
const Instance::Configuration & config )

◆ tag_invoke() [2/2]

Instance::Configuration rav::ptp::tag_invoke ( const boost::json::value_to_tag< Instance::Configuration > & ,
const boost::json::value & jv )

◆ to_string() [1/5]

const char * rav::ptp::to_string ( const ClockAccuracy accuracy)
inline

Definition at line 117 of file ptp_definitions.hpp.

◆ to_string() [2/5]

const char * rav::ptp::to_string ( const Error error)
inline

Definition at line 44 of file ptp_error.hpp.

◆ to_string() [3/5]

const char * rav::ptp::to_string ( const MessageType type)
inline

Definition at line 270 of file ptp_definitions.hpp.

◆ to_string() [4/5]

const char * rav::ptp::to_string ( const State state)
inline

Converts a ptp_state to a string.

Parameters
stateThe state to convert.
Returns
The string representation of the state.

Definition at line 52 of file ptp_definitions.hpp.

◆ to_string() [5/5]

const char * rav::ptp::to_string ( const StateDecisionCode code)
inline

Converts a ptp_state_decision_code to a string.

Parameters
codeThe code to convert.
Returns
The string representation of the code.

Definition at line 228 of file ptp_definitions.hpp.

Variable Documentation

◆ DefaultProfile1

Profile rav::ptp::DefaultProfile1
staticconstexpr
Initial value:
{
"Default delay request-response profile",
1,
1,
0,
{0x00, 0x1B, 0x19, 0x01, 0x01, 0x00},
"This profile is specified by the IEEE Precise Networked Clock Synchronization Working Group of the IM/ST Committee.",
"A copy can be obtained by ordering IEEE Std 1588-2019 from the IEEE Standards Organization https://standards.ieee.org.",
{
0,
128,
128,
false,
0,
},
{
1,
{0, 4},
0,
{-1, 1},
0,
{0, 5},
3,
{2, 10},
},
{},
1.0,
}

Definition at line 77 of file ptp_profiles.hpp.

◆ DefaultProfile2

Profile rav::ptp::DefaultProfile2
staticconstexpr
Initial value:
{
"Default delay peer-to-peer delay profile",
2,
1,
0,
{0x00, 0x1B, 0x19, 0x02, 0x01, 0x00},
"This profile is specified by the IEEE Precise Networked Clock Synchronization Working Group of the IM/ST Committee.",
"A copy can be obtained by ordering IEEE Std 1588-2019 from the IEEE Standards Organization https://standards.ieee.org.",
{
0,
128,
128,
false,
0,
},
{
1,
{0, 4},
0,
{-1, 1},
0,
{0, 5},
3,
{2, 10},
},
{{
0,
}},
1.0,
}

Definition at line 106 of file ptp_profiles.hpp.

◆ DefaultProfile3

Profile rav::ptp::DefaultProfile3
staticconstexpr

Definition at line 137 of file ptp_profiles.hpp.

◆ k_foreign_master_threshold

uint8_t rav::ptp::k_foreign_master_threshold = 2
constexpr

Definition at line 32 of file ptp_constants.hpp.

◆ k_foreign_master_time_window

uint8_t rav::ptp::k_foreign_master_time_window = 4
constexpr

Definition at line 31 of file ptp_constants.hpp.