Documentation
¶
Index ¶
- Constants
- func GrandmasterSettingsBinaryMsg(c *MsgPreparer, data GrandmasterSettings) ([]byte, error)
- func MgmtSetBinaryMsg[D MgmtData](c *MsgPreparer, data D) ([]byte, error)
- type Action
- type BinaryWriterTo
- type Client
- type ClientConfig
- type ClockAccuracy
- type ClockIdentity
- type ClockQuality
- type Control
- type CurrentDS
- type DefaultDS
- type DefaultDSFlags
- type GrandmasterSettings
- type GrandmasterSettingsMsg
- type Header
- type MessageType
- type MgmtData
- type MgmtErrorID
- type MgmtErrorStatus
- type MgmtErrorStatusMsg
- type MgmtID
- type MgmtMsg
- type MgmtMsgPrefix
- type MgmtMsgWithValue
- type MgmtValue
- type MsgPreparer
- type NullPTPMgmt
- type NullPTPMgmtMsg
- type ParentDS
- type PortIdentity
- type TLVType
- type TimeFlags
- type TimeInterval
- type TimePropertiesDS
- type TimePropertiesDSFlags
- type TimeSource
- type Transport
- type UTCProperties
- type UTCPropertiesMsg
Constants ¶
View Source
const ( ClockClassSyncPrimaryRef = 6 ClockClassHoldover = 7 ClockClassDegradedA = 52 ClockClassDegradedB = 187 ClockClassDefault = 248 ClockClassSlaveOnly = 255 )
View Source
const OffsetScaledLogVarianceUnknown = 0xffff
View Source
const PTP4LSocketPath = "/var/run/ptp4l"
View Source
const SizeofMgmtMsgPrefix = 52
Variables ¶
This section is empty.
Functions ¶
func GrandmasterSettingsBinaryMsg ¶
func GrandmasterSettingsBinaryMsg(c *MsgPreparer, data GrandmasterSettings) ([]byte, error)
func MgmtSetBinaryMsg ¶
func MgmtSetBinaryMsg[D MgmtData](c *MsgPreparer, data D) ([]byte, error)
Types ¶
type BinaryWriterTo ¶
type Client ¶
type Client struct { MsgPreparer T *Transport }
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
type ClientConfig ¶
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
func (*ClientConfig) SetDefaults ¶
func (cfg *ClientConfig) SetDefaults()
type ClockAccuracy ¶
type ClockAccuracy uint8
const ( ClockAccuracyWithin1ps ClockAccuracy = 0x17 + iota ClockAccuracyWithin2point5ps ClockAccuracyWithin10ps ClockAccuracyWithin25ps ClockAccuracyWithin100ps ClockAccuracyWithin250ps ClockAccuracyWithin1ns ClockAccuracyWithin2point5ns ClockAccuracyWithin10ns ClockAccuracyWithin25ns ClockAccuracyWithin100ns ClockAccuracyWithin250ns ClockAccuracyWithin1us ClockAccuracyWithin2point5us ClockAccuracyWithin10us ClockAccuracyWithin25us ClockAccuracyWithin100us ClockAccuracyWithin250us ClockAccuracyWithin1ms ClockAccuracyWithin2point5ms ClockAccuracyWithin10ms ClockAccuracyWithin25ms ClockAccuracyWithin100ms ClockAccuracyWithin250ms ClockAccuracyWithin1s ClockAccuracyWithin10s ClockAccuracyGreater10s ClockAccuracyUnknown = 0xFE )
func DurationToClockAccuracy ¶
func DurationToClockAccuracy(d time.Duration) ClockAccuracy
DurationToClockAccuracy converts a time.Duration to the appropriate ClockAccuracy value, rounding up to the next available accuracy level. Returns 0 for durations <= 0 or > 10s.
func (ClockAccuracy) Description ¶
func (a ClockAccuracy) Description() string
func (ClockAccuracy) String ¶
func (a ClockAccuracy) String() string
type ClockIdentity ¶
type ClockIdentity [8]byte
func AnyClockIdentity ¶
func AnyClockIdentity() ClockIdentity
type ClockQuality ¶
type ClockQuality struct { ClockClass uint8 // in the PTP standard this is not an enumeration ClockAccuracy ClockAccuracy OffsetScaledLogVariance uint16 }
type CurrentDS ¶
type CurrentDS struct { StepsRemoved uint16 OffsetFromMaster TimeInterval MeanPathDelay TimeInterval }
type DefaultDS ¶
type DefaultDS struct { Flags DefaultDSFlags NumberPorts uint16 Priority1 uint8 ClockQuality ClockQuality Priority2 uint8 ClockIdentity ClockIdentity DomainNumber uint8 // contains filtered or unexported fields }
func (DefaultDS) TwoStepFlag ¶
type DefaultDSFlags ¶
type DefaultDSFlags uint8
const ( DefaultDSFlagTSC DefaultDSFlags = 1 << iota DefaultDSFlagSO )
type GrandmasterSettings ¶
type GrandmasterSettings struct { ClockQuality ClockQuality UTCOffset int16 TimeFlags TimeFlags TimeSource TimeSource }
func (GrandmasterSettings) MgmtID ¶
func (GrandmasterSettings) MgmtID() MgmtID
type GrandmasterSettingsMsg ¶
type GrandmasterSettingsMsg = MgmtMsgWithValue[MgmtValue[GrandmasterSettings]]
type Header ¶
type Header struct { MajorSdoIDMessageType uint8 Version uint8 MessageLength uint16 DomainNumber uint8 MinorSdoID uint8 FlagField uint16 CorrectionField uint64 MessageTypeSpecific uint32 SourcePortIdentity PortIdentity SequenceID uint16 ControlField Control LogMessageInterval uint8 }
func (*Header) SetMajorSdoID ¶
func (*Header) SetMessageType ¶
func (h *Header) SetMessageType(mt MessageType)
type MgmtErrorID ¶
type MgmtErrorID uint16
const ( MEIDResponseTooBig MgmtErrorID MEIDNoSuchID MEIDWrongLength MEIDWrongValue MEIDNotSetable MEIDNotSupported MEIDUnpopulated MEIDGeneralError MgmtErrorID = 0xFFFE )
func (MgmtErrorID) String ¶
func (meid MgmtErrorID) String() string
type MgmtErrorStatus ¶
type MgmtErrorStatus struct { MgmtErrorID MgmtErrorID MgmtID MgmtID DisplayData *string // contains filtered or unexported fields }
func (*MgmtErrorStatus) WriteBinaryTo ¶
func (m *MgmtErrorStatus) WriteBinaryTo(w io.Writer) error
type MgmtErrorStatusMsg ¶
type MgmtErrorStatusMsg = MgmtMsgWithValue[MgmtErrorStatus]
func NewMgmtErrorStatusMsg ¶
func NewMgmtErrorStatusMsg(mes MgmtErrorStatus) *MgmtErrorStatusMsg
type MgmtMsg ¶
type MgmtMsg interface { encoding.BinaryMarshaler Prefix() *MgmtMsgPrefix Value() any }
func UnmarshalMgmtMsg ¶
type MgmtMsgPrefix ¶
type MgmtMsgWithValue ¶
type MgmtMsgWithValue[V any] struct { MgmtMsgPrefix V V }
func NewMgmtGetMsg ¶
func NewMgmtGetMsg(mid MgmtID) *MgmtMsgWithValue[MgmtID]
func NewMgmtSetMsg ¶
func NewMgmtSetMsg[D MgmtData](data D) *MgmtMsgWithValue[MgmtValue[D]]
func (*MgmtMsgWithValue[V]) MarshalBinary ¶
func (m *MgmtMsgWithValue[V]) MarshalBinary() ([]byte, error)
func (*MgmtMsgWithValue[V]) Prefix ¶
func (m *MgmtMsgWithValue[V]) Prefix() *MgmtMsgPrefix
func (*MgmtMsgWithValue[T]) SetLength ¶
func (m *MgmtMsgWithValue[T]) SetLength(l uint16)
func (*MgmtMsgWithValue[V]) Value ¶
func (m *MgmtMsgWithValue[V]) Value() any
type MsgPreparer ¶
type MsgPreparer struct { PortNumber uint16 DomainNumber uint8 MajorSdoID uint8 MinorSdoID uint8 // contains filtered or unexported fields }
func (*MsgPreparer) AllocSequenceID ¶
func (c *MsgPreparer) AllocSequenceID() uint16
func (*MsgPreparer) PrepareMsg ¶
func (c *MsgPreparer) PrepareMsg(m MgmtMsg)
type NullPTPMgmt ¶
type NullPTPMgmt struct{}
func (NullPTPMgmt) MgmtID ¶
func (NullPTPMgmt) MgmtID() MgmtID
type NullPTPMgmtMsg ¶
type NullPTPMgmtMsg = MgmtMsgWithValue[MgmtValue[NullPTPMgmt]]
type ParentDS ¶
type ParentDS struct { ParentPortIdentity PortIdentity ParentStats bool ObservedParentOffsetScaledLogVariance uint16 ObservedParentClockPhaseChangeRate int32 GrandmasterPriority1 uint8 GrandmasterClockQuality ClockQuality GrandmasterPriority2 uint8 GrandmasterIdentity ClockIdentity // contains filtered or unexported fields }
type PortIdentity ¶
type PortIdentity struct { ClockIdentity ClockIdentity PortNumber uint16 }
func AnyPortIdentity ¶
func AnyPortIdentity() PortIdentity
type TimeInterval ¶
type TimeInterval int64
func (TimeInterval) Duration ¶
func (ti TimeInterval) Duration() time.Duration
func (TimeInterval) Nanos ¶
func (ti TimeInterval) Nanos() float64
func (TimeInterval) String ¶
func (ti TimeInterval) String() string
type TimePropertiesDS ¶
type TimePropertiesDS struct { CurrentUTCOffset int16 Flags TimePropertiesDSFlags TimeSource uint8 }
func (TimePropertiesDS) MgmtID ¶
func (TimePropertiesDS) MgmtID() MgmtID
type TimePropertiesDSFlags ¶
type TimePropertiesDSFlags uint8
const ( TimePropertiesDSFlagLI61 TimePropertiesDSFlags = iota TimePropertiesDSFlagLI59 TimePropertiesDSFlagUTCV TimePropertiesDSFlagPTP TimePropertiesDSFlagTTRA TimePropertiesDSFlagFTRA )
type TimeSource ¶
type TimeSource uint8
const ( TimeSourceAtomicClock TimeSource = 0x10 TimeSourceGNSS TimeSource = 0x20 TimeSourceTerrestrialRadio TimeSource = 0x30 TimeSourceSerialTimeCode TimeSource = 0x39 TimeSourcePTP TimeSource = 0x40 TimeSourceNTP TimeSource = 0x50 TimeSourceHandSet TimeSource = 0x60 TimeSourceOther TimeSource = 0x90 TimeSourceInternalOscillator TimeSource = 0xA0 TimeSourceReserved TimeSource = 0xFF )
func (TimeSource) Description ¶
func (s TimeSource) Description() string
func (TimeSource) String ¶
func (s TimeSource) String() string
type Transport ¶
type Transport struct { Conn net.PacketConn RemoteAddr net.Addr // contains filtered or unexported fields }
func NewUnixTransport ¶
type UTCProperties ¶
type UTCProperties struct { CurrentUTCOffset int16 TimeFlags TimeFlags // Only Leap59, Leap61 and CurrentUTCOffsetValid are valid here // contains filtered or unexported fields }
func (UTCProperties) MgmtID ¶
func (UTCProperties) MgmtID() MgmtID
type UTCPropertiesMsg ¶
type UTCPropertiesMsg = MgmtMsgWithValue[MgmtValue[UTCProperties]]
Click to show internal directories.
Click to hide internal directories.