libptpmgmt  1.3
libptpmgmt library that provides the functionality of linuxptp pmc
Classes | Typedefs | Enumerations | Variables
types.h File Reference

Types, enumerators, and structers used by PTP management messages. More...

#include <map>
#include "bin.h"
#include "mngIds.h"
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TimeInterval_t
 
struct  Timestamp_t
 
struct  ClockIdentity_t
 
struct  PortIdentity_t
 
struct  PortAddress_t
 
struct  ClockQuality_t
 
struct  PTPText_t
 
struct  FaultRecord_t
 
struct  AcceptableMaster_t
 
struct  ManagementId_t
 
struct  MsgParams
 
struct  BaseMngTlv
 
struct  BaseSigTlv
 
struct  LinuxptpUnicastMaster_t
 

Typedefs

typedef uint8_t Nibble_t
 
typedef uint8_t UInteger8_t
 
typedef uint16_t UInteger16_t
 
typedef uint32_t UInteger32_t
 
typedef uint64_t UInteger48_t
 
typedef uint64_t UInteger64_t
 
typedef int8_t Integer8_t
 
typedef int16_t Integer16_t
 
typedef int32_t Integer32_t
 
typedef int64_t Integer48_t
 
typedef int64_t Integer64_t
 
typedef uint8_t Octet_t
 
typedef double Float64_t
 
typedef long double float_seconds
 
typedef long double float_nanoseconds
 

Enumerations

enum  MNG_PARSE_ERROR_e {
  MNG_PARSE_ERROR_OK , MNG_PARSE_ERROR_MSG , MNG_PARSE_ERROR_SIG , MNG_PARSE_ERROR_SMPTE ,
  MNG_PARSE_ERROR_INVALID_ID , MNG_PARSE_ERROR_INVALID_TLV , MNG_PARSE_ERROR_MISMATCH_TLV , MNG_PARSE_ERROR_SIZE_MISS ,
  MNG_PARSE_ERROR_TOO_SMALL , MNG_PARSE_ERROR_SIZE , MNG_PARSE_ERROR_VAL , MNG_PARSE_ERROR_HEADER ,
  MNG_PARSE_ERROR_ACTION , MNG_PARSE_ERROR_UNSUPPORT , MNG_PARSE_ERROR_MEM , MNG_PARSE_ERROR_AUTH ,
  MNG_PARSE_ERROR_AUTH_NONE , MNG_PARSE_ERROR_AUTH_WRONG , MNG_PARSE_ERROR_AUTH_NOKEY
}
 
enum  msgType_e : Nibble_t {
  Sync = 0 , Delay_Req = 1 , Pdelay_Req = 2 , Pdelay_Resp = 3 ,
  Follow_Up = 0x8 , Delay_Resp = 0x9 , Pdelay_Resp_Follow_Up = 0xa , Announce = 0xb ,
  Signaling = 0xc , Management = 0xd
}
 
enum  tlvType_e : uint16_t {
  MANAGEMENT = 0x0001 , MANAGEMENT_ERROR_STATUS = 0x0002 , ORGANIZATION_EXTENSION = 0x0003 , REQUEST_UNICAST_TRANSMISSION = 0x0004 ,
  GRANT_UNICAST_TRANSMISSION = 0x0005 , CANCEL_UNICAST_TRANSMISSION = 0x0006 , ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION = 0x0007 , PATH_TRACE = 0x0008 ,
  ALTERNATE_TIME_OFFSET_INDICATOR = 0x0009 , ORGANIZATION_EXTENSION_PROPAGATE = 0x4000 , ENHANCED_ACCURACY_METRICS = 0x4001 , ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE = 0x8000 ,
  L1_SYNC = 0x8001 , PORT_COMMUNICATION_AVAILABILITY = 0x8002 , PROTOCOL_ADDRESS = 0x8003 , SLAVE_RX_SYNC_TIMING_DATA = 0x8004 ,
  SLAVE_RX_SYNC_COMPUTED_DATA = 0x8005 , SLAVE_TX_EVENT_TIMESTAMPS = 0x8006 , CUMULATIVE_RATE_RATIO = 0x8007 , TLV_PAD = 0x8008 ,
  AUTHENTICATION = 0x8009 , SLAVE_DELAY_TIMING_DATA_NP = 0x7f00
}
 
enum  actionField_e : uint8_t {
  GET = 0 , SET = 1 , RESPONSE = 2 , COMMAND = 3 ,
  ACKNOWLEDGE = 4
}
 
enum  managementErrorId_e : uint16_t {
  RESPONSE_TOO_BIG = 0x0001 , NO_SUCH_ID = 0x0002 , WRONG_LENGTH = 0x0003 , WRONG_VALUE = 0x0004 ,
  NOT_SETABLE = 0x0005 , NOT_SUPPORTED = 0x0006 , GENERAL_ERROR = 0xfffe
}
 
enum  clockType_e : uint16_t {
  ordinaryClock = 0x8000 , boundaryClock = 0x4000 , p2pTransparentClock = 0x2000 , e2eTransparentClock = 0x1000 ,
  managementClock = 0x0800
}
 
enum  networkProtocol_e : uint16_t {
  UDP_IPv4 = 1 , UDP_IPv6 = 2 , IEEE_802_3 = 3 , DeviceNet = 4 ,
  ControlNet = 5 , PROFINET = 6
}
 
enum  clockAccuracy_e : uint8_t {
  Accurate_within_1ps = 0x17 , Accurate_within_2_5ps = 0x18 , Accurate_within_10ps = 0x19 , Accurate_within_25ps = 0x1a ,
  Accurate_within_100ps = 0x1b , Accurate_within_250ps = 0x1c , Accurate_within_1ns = 0x1d , Accurate_within_2_5ns = 0x1e ,
  Accurate_within_10ns = 0x1f , Accurate_within_25ns = 0x20 , Accurate_within_100ns = 0x21 , Accurate_within_250ns = 0x22 ,
  Accurate_within_1us = 0x23 , Accurate_within_2_5us = 0x24 , Accurate_within_10us = 0x25 , Accurate_within_25us = 0x26 ,
  Accurate_within_100us = 0x27 , Accurate_within_250us = 0x28 , Accurate_within_1ms = 0x29 , Accurate_within_2_5ms = 0x2a ,
  Accurate_within_10ms = 0x2b , Accurate_within_25ms = 0x2c , Accurate_within_100ms = 0x2d , Accurate_within_250ms = 0x2e ,
  Accurate_within_1s = 0x2f , Accurate_within_10s = 0x30 , Accurate_more_10s = 0x31 , Accurate_Unknown = 0xfe
}
 
enum  faultRecord_e : uint8_t {
  F_Emergency = 0x00 , F_Alert = 0x01 , F_Critical = 0x02 , F_Error = 0x03 ,
  F_Warning = 0x04 , F_Notice = 0x05 , F_Informational = 0x06 , F_Debug = 0x07
}
 
enum  timeSource_e : uint8_t {
  ATOMIC_CLOCK = 0x10 , GNSS = 0x20 , GPS = 0x20 , TERRESTRIAL_RADIO = 0x30 ,
  SERIAL_TIME_CODE = 0x39 , PTP = 0x40 , NTP = 0x50 , HAND_SET = 0x60 ,
  OTHER = 0x90 , INTERNAL_OSCILLATOR = 0xa0
}
 
enum  portState_e : uint8_t {
  INITIALIZING = 1 , FAULTY = 2 , DISABLED = 3 , LISTENING = 4 ,
  PRE_MASTER = 5 , PRE_TIME_TRANSMITTER = 5 , MASTER = 6 , TIME_TRANSMITTER = 6 ,
  PASSIVE = 7 , UNCALIBRATED = 8 , SLAVE = 9 , TIME_RECEIVER = 9
}
 
enum  delayMechanism_e : uint8_t {
  AUTO = 0 , E2E = 1 , P2P = 2 , NO_MECHANISM = 0xfe ,
  COMMON_P2P = 3 , SPECIAL = 4
}
 
enum  implementSpecific_e { noImplementSpecific , linuxptp }
 
enum  SMPTEmasterLockingStatus_e : uint8_t {
  SMPTE_NOT_IN_USE = 0 , SMPTE_FREE_RUN = 1 , SMPTE_COLD_LOCKING = 2 , SMPTE_WARM_LOCKING = 3 ,
  SMPTE_LOCKED = 4
}
 
enum  linuxptpTimeStamp_e : uint8_t {
  TS_SOFTWARE , TS_HARDWARE , TS_LEGACY_HW , TS_ONESTEP ,
  TS_P2P1STEP
}
 
enum  linuxptpPowerProfileVersion_e : uint16_t { IEEE_C37_238_VERSION_NONE , IEEE_C37_238_VERSION_2011 , IEEE_C37_238_VERSION_2017 }
 
enum  linuxptpUnicastState_e : uint8_t { UC_WAIT , UC_HAVE_ANN , UC_NEED_SYDY , UC_HAVE_SYDY }
 
enum  : uint8_t {
  F_LI_61 = (1 << 0) , F_LI_59 = (1 << 1) , F_UTCV = (1 << 2) , F_PTP = (1 << 3) ,
  F_TTRA = (1 << 4) , F_FTRA = (1 << 5)
}
 
enum  MsgParams_RcvAuth_e : uint8_t {
  RCV_AUTH_NONE = 0 , RCV_AUTH_MNG = (1 << 0) , RCV_AUTH_SIG_LAST = (1 << 1) , RCV_AUTH_SIG_ALL = (1 << 2) ,
  RCV_AUTH_ALL = 0x7 , RCV_AUTH_IGNORE = (1 << 3)
}
 

Variables

__PTPMGMT_NAMESPACE_BEGIN const int64_t INT48_MIN = -INT64_C(0x7fffffffffff) - 1
 
const int64_t INT48_MAX = INT64_C(0x7fffffffffff)
 
const uint64_t UINT48_MAX = UINT64_C(0xffffffffffff)
 
const size_t sizeof_UInteger48_t = 6
 
const size_t sizeof_Integer48_t = 6
 

Detailed Description

Types, enumerators, and structers used by PTP management messages.

Author
Erez Geva <ErezGeva2@gmail.com>

Typedef Documentation

◆ Float64_t

typedef double Float64_t

IEEE Std 754 binary64 (64-bit double-precision floating-point format)

◆ float_nanoseconds

typedef long double float_nanoseconds

Float nano-seconds

◆ float_seconds

typedef long double float_seconds

Float seconds used in Timestamp_t

◆ Integer16_t

typedef int16_t Integer16_t

IEEE 1588 Protocol signed 16 bits integer

◆ Integer32_t

typedef int32_t Integer32_t

IEEE 1588 Protocol signed 32 bits integer

◆ Integer48_t

typedef int64_t Integer48_t

IEEE 1588 Protocol signed 48 bits integer

◆ Integer64_t

typedef int64_t Integer64_t

IEEE 1588 Protocol signed 64 bits integer

◆ Integer8_t

typedef int8_t Integer8_t

IEEE 1588 Protocol signed 8 bits integer

◆ Nibble_t

typedef uint8_t Nibble_t

IEEE 1588 Protocol 2 x 4 bits integer

◆ Octet_t

typedef uint8_t Octet_t

IEEE 1588 protocol octet

◆ UInteger16_t

typedef uint16_t UInteger16_t

IEEE 1588 Protocol unsigned 16 bits integer

◆ UInteger32_t

typedef uint32_t UInteger32_t

IEEE 1588 Protocol unsigned 32 bits integer

◆ UInteger48_t

typedef uint64_t UInteger48_t

IEEE 1588 Protocol unsigned 48 bits integer

◆ UInteger64_t

typedef uint64_t UInteger64_t

IEEE 1588 Protocol unsigned 64 bits integer

◆ UInteger8_t

typedef uint8_t UInteger8_t

IEEE 1588 Protocol unsigned 8 bits integer

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint8_t

Clock time properties bit mask

Enumerator
F_LI_61 

The last minute of the current UTC day contains 61 seconds

F_LI_59 

the last minute of the current UTC day contains 59 seconds

F_UTCV 

Current UTC offset is valid

F_PTP 

The timescale of the grandmaster PTP Instance is PTP

F_TTRA 

timescale is traceable to a primary reference

F_FTRA 

The frequency determining the timescale is traceable to a primary reference

◆ actionField_e

enum actionField_e : uint8_t

PTP management action

Enumerator
GET 

Send a get message

SET 

Send a set message

RESPONSE 

Receive response for a get or a set message

COMMAND 

Send command message

ACKNOWLEDGE 

Receive acknowledge on command

◆ clockAccuracy_e

enum clockAccuracy_e : uint8_t

PTP clock accuracy

Enumerator
Accurate_within_1ps 

higher than 1 picosecond

Accurate_within_2_5ps 

higher than 2.5 picoseconds

Accurate_within_10ps 

higher than 10 picoseconds

Accurate_within_25ps 

higher than 25 picoseconds

Accurate_within_100ps 

higher than 100 picoseconds

Accurate_within_250ps 

higher than 250 picoseconds

Accurate_within_1ns 

higher than 1 nanosecond

Accurate_within_2_5ns 

higher than 2.5 nanoseconds

Accurate_within_10ns 

higher than 10 nanoseconds

Accurate_within_25ns 

higher than 25 nanoseconds

Accurate_within_100ns 

higher than 100 nanoseconds

Accurate_within_250ns 

higher than 250 nanoseconds

Accurate_within_1us 

higher than 1 microsecond

Accurate_within_2_5us 

higher than 2.5 microseconds

Accurate_within_10us 

higher than 10 microseconds

Accurate_within_25us 

higher than 25 microseconds

Accurate_within_100us 

higher than 100 microseconds

Accurate_within_250us 

higher than 250 microseconds

Accurate_within_1ms 

higher than 1 millisecond

Accurate_within_2_5ms 

higher than 2.5 milliseconds

Accurate_within_10ms 

higher than 10 milliseconds

Accurate_within_25ms 

higher than 25 milliseconds

Accurate_within_100ms 

higher than 100 milliseconds

Accurate_within_250ms 

higher than 250 milliseconds

Accurate_within_1s 

higher than 1 seconds

Accurate_within_10s 

higher than 10 seconds

Accurate_more_10s 

lower than 10 seconds

Accurate_Unknown 

Unknown

◆ clockType_e

enum clockType_e : uint16_t

PTP clock type bit mask

A PTP clock could act as more than a single type

Note
: Ruby's wrapping, capitalize first letter of enumerators values
Enumerator
ordinaryClock 

ordinary clock

boundaryClock 

boundary clock

p2pTransparentClock 

peer-to-peer transparent clock

e2eTransparentClock 

end-to-end transparent clock

managementClock 

management node (deprecated)

◆ delayMechanism_e

enum delayMechanism_e : uint8_t

Delay mechanizem

Enumerator
AUTO 

Automatic probing

Note
LinuxPTP value
E2E 

The PTP Port is configured to use the delay request-response mechanism.

P2P 

The PTP Port is configured to use the peer-to-peer delay mechanism.

NO_MECHANISM 

The PTP Port does not implement the delay mechanism.

COMMON_P2P 

The PTP Port is configured to use the Common Mean Link Delay Service option.

SPECIAL 

Special Ports do not use either delay mechanism.

◆ faultRecord_e

enum faultRecord_e : uint8_t

Fault record severity code

Enumerator
F_Emergency 

system is unusable

F_Alert 

immediate action needed

F_Critical 

critical conditions

F_Error 

error conditions

F_Warning 

warning conditions

F_Notice 

normal but significant condition

F_Informational 

informational messages

F_Debug 

debug-level messages

◆ implementSpecific_e

Specify Management TLV implementation-specific to use

Note
: Ruby's wrapping, capitalize first letter of enumerators values
Enumerator
noImplementSpecific 

Do not use any implementation-specific

linuxptp 

linuxptp project

◆ linuxptpPowerProfileVersion_e

linuxptp Power Profile version Specify the which power system profile to use

Enumerator
IEEE_C37_238_VERSION_NONE 

Do not use power system

IEEE_C37_238_VERSION_2011 

Use IEEE C37.238-2011 profile

IEEE_C37_238_VERSION_2017 

Use IEEE C37.238-2017 profile

◆ linuxptpTimeStamp_e

enum linuxptpTimeStamp_e : uint8_t

linuxptp timestamp Specify the underlaying Linux time stamps type that the daemon receive

Enumerator
TS_SOFTWARE 

Using system clock based with an offset that is maintain by driver

TS_HARDWARE 

network interface have a PTP Hardware clock, and the driver read the value

TS_LEGACY_HW 

Old hardware

TS_ONESTEP 

One step PTP, the driver writes the time stamp into the frame

TS_P2P1STEP 

One step PTP plus insert time to PDelay_Resp

◆ linuxptpUnicastState_e

enum linuxptpUnicastState_e : uint8_t

linuxptp timeReceiver side unicast negotiation state

Enumerator
UC_WAIT 

Wait for answer

UC_HAVE_ANN 

Have answer

UC_NEED_SYDY 

Need to stand by

UC_HAVE_SYDY 

In stand by

◆ managementErrorId_e

enum managementErrorId_e : uint16_t

PTP Management Error IDs

Enumerator
RESPONSE_TOO_BIG 

Response is too big

NO_SUCH_ID 

No such id

WRONG_LENGTH 

Wrong length

WRONG_VALUE 

Wrong value

NOT_SETABLE 

Not setable

NOT_SUPPORTED 

Not supported

GENERAL_ERROR 

General error

◆ MNG_PARSE_ERROR_e

Parsing and building errors

Enumerator
MNG_PARSE_ERROR_OK 

No error

MNG_PARSE_ERROR_MSG 

Error message

MNG_PARSE_ERROR_SIG 

Signalling message

MNG_PARSE_ERROR_SMPTE 

SMPTE message

MNG_PARSE_ERROR_INVALID_ID 

Invalid TLV mng id or action for TLV

MNG_PARSE_ERROR_INVALID_TLV 

Wrong TLV header

MNG_PARSE_ERROR_MISMATCH_TLV 

Mismatch TLV

MNG_PARSE_ERROR_SIZE_MISS 

Size mismatch of field with length

MNG_PARSE_ERROR_TOO_SMALL 

Buffer is too small

MNG_PARSE_ERROR_SIZE 

Size is even

MNG_PARSE_ERROR_VAL 

Value is out of range or invalid

MNG_PARSE_ERROR_HEADER 

Wrong value in header

MNG_PARSE_ERROR_ACTION 

Wrong action value

MNG_PARSE_ERROR_UNSUPPORT 

Do not know how to parse the TLV data

MNG_PARSE_ERROR_MEM 

Fail to allocate TLV data

MNG_PARSE_ERROR_AUTH 

Authentication error

MNG_PARSE_ERROR_AUTH_NONE 

Received without any Authentication

MNG_PARSE_ERROR_AUTH_WRONG 

Received Authentication with wrong ICV

MNG_PARSE_ERROR_AUTH_NOKEY 

Received Authentication with unkown key

◆ MsgParams_RcvAuth_e

enum MsgParams_RcvAuth_e : uint8_t

Receive Authentication modes

Enumerator
RCV_AUTH_NONE 

Ignore all Authentication TLVs

RCV_AUTH_MNG 

Proccess Authentication TLVs of All Managment packts

RCV_AUTH_SIG_LAST 

Proccess last Authentication TLVs of Signaling

RCV_AUTH_SIG_ALL 

Proccess all Authentication TLVs of Signaling

RCV_AUTH_ALL 

Proccess all Authentication TLVs

RCV_AUTH_IGNORE 

Continure proccess, with Authentication errors

◆ msgType_e

PTP messages type

Note
: 4 bits
Enumerator
Sync 

Synchronization event message

Delay_Req 

Delay request event message

Pdelay_Req 

Peer delay request event message

Pdelay_Resp 

Peer delay response event message

Follow_Up 

Follow up message

Delay_Resp 

Delay response

Pdelay_Resp_Follow_Up 

Peer delay response follow up message

Announce 

Announce message

Signaling 

Signalling message

Management 

Management message

◆ networkProtocol_e

enum networkProtocol_e : uint16_t

PTP using a network layer

Enumerator
UDP_IPv4 

UDP over IP version 4

UDP_IPv6 

UDP over IP version 6

IEEE_802_3 

Raw Ethernet using IEEE 802.3

DeviceNet 

DeviceNet

ControlNet 

ControlNet

PROFINET 

PROFINET

◆ portState_e

enum portState_e : uint8_t

Port state

Enumerator
INITIALIZING 

Initializing

FAULTY 

Faulty

DISABLED 

Disabled

LISTENING 

Listening

PRE_MASTER 

Pre timeTransmitter

PRE_TIME_TRANSMITTER 

Pre timeTransmitter

MASTER 

TimeTransmitter

TIME_TRANSMITTER 

TimeTransmitter

PASSIVE 

Passive

UNCALIBRATED 

Uncalibrated

SLAVE 

TimeReceiver

TIME_RECEIVER 

TimeReceiver

◆ SMPTEmasterLockingStatus_e

SMPTE master clock locking status

Enumerator
SMPTE_NOT_IN_USE 

Not in use

SMPTE_FREE_RUN 

Free Run

SMPTE_COLD_LOCKING 

In response to a disturbance, the grandmaster is re-locking quickly. In this situation, a rapid phase adjustment with a time discontinuity can be expected.

SMPTE_WARM_LOCKING 

In response to a disturbance, the grandmaster is re-locking slowly by means of a frequency adjustment, with no phase discontinuity. Time continuity is maintained.

SMPTE_LOCKED 

Locked, in normal operation and stable.

◆ timeSource_e

enum timeSource_e : uint8_t

Time source type

Enumerator
ATOMIC_CLOCK 

Atomic clock

GNSS 

Satellite navigation

GPS 

Satellite navigation

TERRESTRIAL_RADIO 

Terrestrial radio

SERIAL_TIME_CODE 

Serial time code

PTP 

PTP of a different domain

NTP 

IP Network time protocol

HAND_SET 

Manually set

OTHER 

Other

INTERNAL_OSCILLATOR 

Internal oscillator

◆ tlvType_e

enum tlvType_e : uint16_t

PTP messages TLV types

Note
: With new signalling TLVs from "IEEE Std 1588-2019@"
Enumerator
MANAGEMENT 

Management TLV

MANAGEMENT_ERROR_STATUS 

Management Error TLV

ORGANIZATION_EXTENSION 

Organization extension

REQUEST_UNICAST_TRANSMISSION 

Request unicast

GRANT_UNICAST_TRANSMISSION 

Grant unicast

CANCEL_UNICAST_TRANSMISSION 

Cancel unicast

ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION 

Ack cancel unicast

PATH_TRACE 

Path trace

ALTERNATE_TIME_OFFSET_INDICATOR 

Alternate time offset

ORGANIZATION_EXTENSION_PROPAGATE 

Organization extension

ENHANCED_ACCURACY_METRICS 

Enhanced accuracy

ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE 

Organization extension

L1_SYNC 

Layer 1 synchronization

PORT_COMMUNICATION_AVAILABILITY 

Port communication

PROTOCOL_ADDRESS 

Protocol address

SLAVE_RX_SYNC_TIMING_DATA 

TimeReceiver RX sync time

SLAVE_RX_SYNC_COMPUTED_DATA 

TimeReceiver RX sync

SLAVE_TX_EVENT_TIMESTAMPS 

TimeReceiver TX event

CUMULATIVE_RATE_RATIO 

Cumulative rate

TLV_PAD 

Padding TLV, ignored

AUTHENTICATION 

Authentication

SLAVE_DELAY_TIMING_DATA_NP 

TimeReceiver delay time note: linuxptp Experimental value

Variable Documentation

◆ INT48_MAX

const int64_t INT48_MAX = INT64_C(0x7fffffffffff)

Maximum value for signed integer 48 bits

◆ INT48_MIN

__PTPMGMT_NAMESPACE_BEGIN const int64_t INT48_MIN = -INT64_C(0x7fffffffffff) - 1

Minimum value for signed integer 48 bits

◆ sizeof_Integer48_t

const size_t sizeof_Integer48_t = 6

Integer48_t octets size

◆ sizeof_UInteger48_t

const size_t sizeof_UInteger48_t = 6

UInteger48_t octets size

◆ UINT48_MAX

const uint64_t UINT48_MAX = UINT64_C(0xffffffffffff)

Maximum value for unsigned integer 48 bits