libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
proc.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later
2  SPDX-FileCopyrightText: Copyright © 2021 Erez Geva <ErezGeva2@gmail.com> */
3 
12 #ifndef __PTPMGMT_PROC_H
13 #define __PTPMGMT_PROC_H
14 
15 #ifdef __cplusplus
16 #include <vector>
17 #include <cstdlib>
18 #include "types.h"
19 
20 __PTPMGMT_NAMESPACE_BEGIN
21 
24  uint16_t clockType;
34 };
36 struct USER_DESCRIPTION_t : public BaseMngTlv {
38 };
40 const uint16_t INITIALIZE_EVENT = 0x0000;
42 struct INITIALIZE_t : public BaseMngTlv {
43  uint16_t initializationKey;
44 };
46 struct FAULT_LOG_t : public BaseMngTlv {
48  std::vector<FaultRecord_t> faultRecords;
49 };
51 struct DEFAULT_DATA_SET_t : public BaseMngTlv {
57  uint8_t flags;
58  const uint8_t flagsMask = 0x3;
65 };
67 struct CURRENT_DATA_SET_t : public BaseMngTlv {
73 };
75 struct PARENT_DATA_SET_t : public BaseMngTlv {
81  uint8_t flags;
82  const uint8_t flagsMask = 0x1;
94 };
107  uint8_t flags;
108  const uint8_t flagsMask = 0x3f;
110 };
112 struct PORT_DATA_SET_t : public BaseMngTlv {
139 };
141 struct PRIORITY1_t : public BaseMngTlv {
143 };
145 struct PRIORITY2_t : public BaseMngTlv {
147 };
149 struct DOMAIN_t : public BaseMngTlv {
151 };
153 struct SLAVE_ONLY_t : public BaseMngTlv {
158  uint8_t flags;
159  const uint8_t flagsMask = 0x1;
160 };
165 };
171 };
176 };
178 struct VERSION_NUMBER_t : public BaseMngTlv {
185 };
187 struct TIME_t : public BaseMngTlv {
189 };
191 struct CLOCK_ACCURACY_t : public BaseMngTlv {
193 };
195 struct UTC_PROPERTIES_t : public BaseMngTlv {
203  uint8_t flags;
204  const uint8_t flagsMask = 0x7;
205 };
213  uint8_t flags;
214  const uint8_t flagsMask = 0x30;
215 };
222  uint8_t flags;
223  const uint8_t flagsMask = 0x8;
225 };
232  uint8_t flags;
233  const uint8_t flagsMask = 0x1;
234 };
236 struct PATH_TRACE_LIST_t : public BaseMngTlv {
237  std::vector<ClockIdentity_t> pathSequence;
238 };
245  uint8_t flags;
246  const uint8_t flagsMask = 0x1;
247 };
255  std::vector<PortAddress_t> PortAddress;
256 };
264  std::vector<PortAddress_t> PortAddress;
265 };
270 };
275  std::vector<AcceptableMaster_t> list;
276 };
283  uint8_t flags;
284  const uint8_t flagsMask = 0x1;
285 };
291 };
298  uint8_t flags;
299  const uint8_t flagsMask = 0x1;
305 };
313  uint8_t flags;
314  const uint8_t flagsMask = 0x1;
315 };
321 };
325 };
332 };
340  uint8_t flags;
341  const uint8_t flagsMask = 0x1;
346 };
352 };
362 };
364 struct PRIMARY_DOMAIN_t : public BaseMngTlv {
366 };
368 struct DELAY_MECHANISM_t : public BaseMngTlv {
373 };
380  uint8_t flags;
381  const uint8_t flagsMask = 0x1;
382 };
384 struct MASTER_ONLY_t : public BaseMngTlv {
389  uint8_t flags;
390  const uint8_t flagsMask = 0x1;
391 };
398  uint8_t flags;
399  const uint8_t flagsMask = 0x1;
400 };
407  uint8_t flags;
408  const uint8_t flagsMask = 0x1;
410 };
412 const float_nanoseconds P41 = 1ULL << 41;
416 struct TIME_STATUS_NP_t : public BaseMngTlv {
417  int64_t master_offset;
418  int64_t ingress_time;
426  uint16_t nanoseconds_msb;
428  uint64_t nanoseconds_lsb;
433 };
449  uint8_t flags;
450  const uint8_t flagsMask = 0x3f;
452 };
460 };
462 const int EVENT_BITMASK_CNT = 64;
464 const int NOTIFY_PORT_STATE = 0;
466 const int NOTIFY_TIME_SYNC = 1;
470 const int NOTIFY_CMLDS = 3;
475  uint16_t duration;
484  void setEvent(int event) {
485  std::div_t d;
486  if(div_event(event, d))
487  bitmask[d.quot] |= d.rem;
488  }
493  void clearEvent(int event) {
494  std::div_t d;
495  if(div_event(event, d))
496  bitmask[d.quot] &= ~d.rem;
497  }
501  void clearAll() {
502  memset(bitmask, 0, EVENT_BITMASK_CNT);
503  }
509  bool getEvent(int event) const {
510  std::div_t d;
511  if(div_event(event, d))
512  return (bitmask[d.quot] & d.rem) > 0;
513  return false;
514  }
517  static std::div_t div_event(int event) {
518  std::div_t d;
519  div_event_wo(event, d);
520  return d;
521  }
522  private:
524  static void div_event_wo(int event, std::div_t &d) {
525  d = div(event, 8);
526  d.rem = 1 << d.rem;
527  }
529  static bool div_event(int event, std::div_t &d) {
530  if(event < 0 || event >= EVENT_BITMASK_CNT)
531  return false;
532  div_event_wo(event, d);
533  return true;
534  }
536 };
546 };
548 const int MAX_MESSAGE_TYPES = 16;
550 const int STAT_SYNC = 0;
552 const int STAT_DELAY_REQ = 1;
554 const int STAT_PDELAY_REQ = 2;
556 const int STAT_PDELAY_RESP = 3;
558 const int STAT_FOLLOW_UP = 8;
560 const int STAT_DELAY_RESP = 9;
564 const int STAT_ANNOUNCE = 11;
566 const int STAT_SIGNALING = 12;
568 const int STAT_MANAGEMENT = 13;
572 struct PORT_STATS_NP_t : public BaseMngTlv {
578 };
580 const uint8_t SYNC_UNCERTAIN_FALSE = 0;
582 const uint8_t SYNC_UNCERTAIN_TRUE = 1;
584 const uint8_t SYNC_UNCERTAIN_DONTCARE = 0xff;
595  uint8_t val;
596 };
602  uint64_t announce_timeout;
603  uint64_t sync_timeout;
604  uint64_t delay_timeout;
613  uint64_t sync_mismatch;
614  uint64_t followup_mismatch;
615 };
622  std::vector<LinuxptpUnicastMaster_t> unicastMasters;
623 };
627 struct PORT_HWCLOCK_NP_t : public BaseMngTlv {
631 };
642 };
646 struct CMLDS_INFO_NP_t : public BaseMngTlv {
650  uint32_t as_capable;
651 };
652 
653 __PTPMGMT_NAMESPACE_END
654 #else /* __cplusplus */
655 #include "c/proc.h"
656 #endif /* __cplusplus */
657 
658 #endif /* __PTPMGMT_PROC_H */
PTP management TLV structures.
Types, enumerators, and structers used by C interface to PTP management messages.
Hold octets.
Definition: bin.h:28
const float_nanoseconds P41
Definition: proc.h:412
const int NOTIFY_PARENT_DATA_SET
Definition: proc.h:468
const int STAT_SIGNALING
Definition: proc.h:566
const uint16_t INITIALIZE_EVENT
Definition: proc.h:40
const uint8_t SYNC_UNCERTAIN_DONTCARE
Definition: proc.h:584
const int STAT_PDELAY_RESP_FOLLOW_UP
Definition: proc.h:562
const int STAT_MANAGEMENT
Definition: proc.h:568
const int MAX_MESSAGE_TYPES
Definition: proc.h:548
const int EVENT_BITMASK_CNT
Definition: proc.h:462
const int NOTIFY_TIME_SYNC
Definition: proc.h:466
const int NOTIFY_PORT_STATE
Definition: proc.h:464
const int NOTIFY_CMLDS
Definition: proc.h:470
const int STAT_SYNC
Definition: proc.h:550
const uint8_t SYNC_UNCERTAIN_TRUE
Definition: proc.h:582
const uint8_t SYNC_UNCERTAIN_FALSE
Definition: proc.h:580
const int STAT_PDELAY_REQ
Definition: proc.h:554
const int STAT_DELAY_REQ
Definition: proc.h:552
const int STAT_ANNOUNCE
Definition: proc.h:564
const int STAT_FOLLOW_UP
Definition: proc.h:558
const int STAT_DELAY_RESP
Definition: proc.h:560
const int STAT_PDELAY_RESP
Definition: proc.h:556
UInteger16_t maxTableSize
Definition: proc.h:290
Definition: proc.h:278
const uint8_t flagsMask
Definition: proc.h:284
uint8_t flags
Definition: proc.h:283
Definition: proc.h:272
Integer16_t actualTableSize
Definition: proc.h:273
std::vector< AcceptableMaster_t > list
Definition: proc.h:275
Definition: proc.h:293
Integer8_t logAlternateMulticastSyncInterval
Definition: proc.h:302
uint8_t flags
Definition: proc.h:298
const uint8_t flagsMask
Definition: proc.h:299
UInteger8_t numberOfAlternateMasters
Definition: proc.h:304
Definition: proc.h:307
UInteger8_t keyField
Definition: proc.h:308
uint8_t flags
Definition: proc.h:313
const uint8_t flagsMask
Definition: proc.h:314
Definition: proc.h:323
UInteger8_t maxKey
Definition: proc.h:324
Definition: proc.h:317
PTPText_t displayName
Definition: proc.h:320
UInteger8_t keyField
Definition: proc.h:318
Integer32_t currentOffset
Definition: proc.h:329
Integer32_t jumpSeconds
Definition: proc.h:330
UInteger8_t keyField
Definition: proc.h:328
UInteger48_t timeOfNextJump
Definition: proc.h:331
Definition: proc.h:167
UInteger8_t announceReceiptTimeout
Definition: proc.h:170
Definition: types.h:962
Definition: proc.h:191
clockAccuracy_e clockAccuracy
Definition: proc.h:192
Definition: proc.h:23
PortAddress_t protocolAddress
Definition: proc.h:28
PTPText_t physicalLayerProtocol
Definition: proc.h:25
uint16_t clockType
Definition: proc.h:24
PTPText_t revisionData
Definition: proc.h:31
Octet_t profileIdentity[6]
Definition: proc.h:33
Binary physicalAddress
Definition: proc.h:27
PTPText_t productDescription
Definition: proc.h:30
Octet_t manufacturerIdentity[3]
Definition: proc.h:29
UInteger16_t physicalAddressLength
Definition: proc.h:26
PTPText_t userDescription
Definition: proc.h:32
Definition: proc.h:646
TimeInterval_t meanLinkDelay
Definition: proc.h:647
uint32_t as_capable
Definition: proc.h:650
Integer32_t scaledNeighborRateRatio
Definition: proc.h:649
Definition: proc.h:67
TimeInterval_t offsetFromMaster
Definition: proc.h:70
UInteger16_t stepsRemoved
Definition: proc.h:68
TimeInterval_t meanPathDelay
Definition: proc.h:72
Definition: types.h:655
Definition: types.h:814
Definition: proc.h:51
uint8_t flags
Definition: proc.h:57
ClockQuality_t clockQuality
Definition: proc.h:61
UInteger8_t priority2
Definition: proc.h:62
ClockIdentity_t clockIdentity
Definition: proc.h:63
UInteger16_t numberPorts
Definition: proc.h:59
const uint8_t flagsMask
Definition: proc.h:58
UInteger8_t domainNumber
Definition: proc.h:64
UInteger8_t priority1
Definition: proc.h:60
Definition: proc.h:368
delayMechanism_e delayMechanism
Definition: proc.h:372
Definition: proc.h:149
UInteger8_t domainNumber
Definition: proc.h:150
const uint8_t flagsMask
Definition: proc.h:381
uint8_t flags
Definition: proc.h:380
Definition: proc.h:402
portState_e desiredState
Definition: proc.h:409
const uint8_t flagsMask
Definition: proc.h:408
uint8_t flags
Definition: proc.h:407
Definition: proc.h:46
UInteger16_t numberOfFaultRecords
Definition: proc.h:47
std::vector< FaultRecord_t > faultRecords
Definition: proc.h:48
Definition: proc.h:249
UInteger8_t actualTableSize
Definition: proc.h:253
std::vector< PortAddress_t > PortAddress
Definition: proc.h:255
Integer8_t logQueryInterval
Definition: proc.h:252
Definition: proc.h:437
Integer16_t currentUtcOffset
Definition: proc.h:439
timeSource_e timeSource
Definition: proc.h:451
const uint8_t flagsMask
Definition: proc.h:450
uint8_t flags
Definition: proc.h:449
ClockQuality_t clockQuality
Definition: proc.h:438
Definition: proc.h:393
const uint8_t flagsMask
Definition: proc.h:399
uint8_t flags
Definition: proc.h:398
Definition: proc.h:42
uint16_t initializationKey
Definition: proc.h:43
Definition: proc.h:162
Integer8_t logAnnounceInterval
Definition: proc.h:164
Definition: proc.h:348
Integer8_t logMinPdelayReqInterval
Definition: proc.h:351
Definition: proc.h:173
Integer8_t logSyncInterval
Definition: proc.h:175
Definition: proc.h:384
const uint8_t flagsMask
Definition: proc.h:390
uint8_t flags
Definition: proc.h:389
Definition: proc.h:75
PortIdentity_t parentPortIdentity
Definition: proc.h:76
const uint8_t flagsMask
Definition: proc.h:82
UInteger16_t observedParentOffsetScaledLogVariance
Definition: proc.h:85
ClockIdentity_t grandmasterIdentity
Definition: proc.h:93
Integer32_t observedParentClockPhaseChangeRate
Definition: proc.h:88
UInteger8_t grandmasterPriority2
Definition: proc.h:92
uint8_t flags
Definition: proc.h:81
UInteger8_t grandmasterPriority1
Definition: proc.h:89
ClockQuality_t grandmasterClockQuality
Definition: proc.h:91
Definition: proc.h:240
const uint8_t flagsMask
Definition: proc.h:246
uint8_t flags
Definition: proc.h:245
Definition: proc.h:236
std::vector< ClockIdentity_t > pathSequence
Definition: proc.h:237
Definition: proc.h:456
Integer32_t asCapable
Definition: proc.h:459
UInteger32_t neighborPropDelayThresh
Definition: proc.h:458
Definition: proc.h:112
Integer8_t logMinDelayReqInterval
Definition: proc.h:117
TimeInterval_t peerMeanPathDelay
Definition: proc.h:118
Integer8_t logSyncInterval
Definition: proc.h:125
Integer8_t logAnnounceInterval
Definition: proc.h:120
Integer8_t logMinPdelayReqInterval
Definition: proc.h:132
Nibble_t versionNumber
Definition: proc.h:138
portState_e portState
Definition: proc.h:114
delayMechanism_e delayMechanism
Definition: proc.h:129
UInteger8_t announceReceiptTimeout
Definition: proc.h:123
PortIdentity_t portIdentity
Definition: proc.h:113
Definition: proc.h:627
UInteger8_t flags
Definition: proc.h:630
Integer32_t phc_index
Definition: proc.h:629
PortIdentity_t portIdentity
Definition: proc.h:628
Definition: proc.h:540
linuxptpTimeStamp_e timestamping
Definition: proc.h:544
portState_e portState
Definition: proc.h:542
PortIdentity_t portIdentity
Definition: proc.h:541
PTPText_t interface
Definition: proc.h:545
Definition: proc.h:600
uint64_t qualification_timeout
Definition: proc.h:612
uint64_t unicast_request_timeout
Definition: proc.h:608
uint64_t delay_timeout
Definition: proc.h:604
uint64_t announce_timeout
Definition: proc.h:602
PortIdentity_t portIdentity
Definition: proc.h:601
uint64_t unicast_service_timeout
Definition: proc.h:606
uint64_t master_sync_timeout
Definition: proc.h:611
uint64_t followup_mismatch
Definition: proc.h:614
uint64_t sync_mismatch
Definition: proc.h:613
uint64_t sync_timeout
Definition: proc.h:603
uint64_t master_announce_timeout
Definition: proc.h:610
Definition: proc.h:572
uint64_t rxMsgType[MAX_MESSAGE_TYPES]
Definition: proc.h:575
PortIdentity_t portIdentity
Definition: proc.h:573
uint64_t txMsgType[MAX_MESSAGE_TYPES]
Definition: proc.h:577
Definition: proc.h:635
UInteger16_t grandmasterID
Definition: proc.h:638
UInteger32_t totalTimeInaccuracy
Definition: proc.h:641
UInteger32_t grandmasterTimeInaccuracy
Definition: proc.h:639
UInteger32_t networkTimeInaccuracy
Definition: proc.h:640
linuxptpPowerProfileVersion_e version
Definition: proc.h:637
Definition: proc.h:364
UInteger8_t primaryDomain
Definition: proc.h:365
Definition: proc.h:141
UInteger8_t priority1
Definition: proc.h:142
Definition: proc.h:145
UInteger8_t priority2
Definition: proc.h:146
Definition: types.h:828
Definition: types.h:762
Definition: types.h:717
Definition: proc.h:153
const uint8_t flagsMask
Definition: proc.h:159
uint8_t flags
Definition: proc.h:158
Definition: proc.h:474
void clearAll()
Definition: proc.h:501
void clearEvent(int event)
Definition: proc.h:493
uint16_t duration
Definition: proc.h:475
uint8_t bitmask[EVENT_BITMASK_CNT]
Definition: proc.h:476
void setEvent(int event)
Definition: proc.h:484
bool getEvent(int event) const
Definition: proc.h:509
Definition: proc.h:588
uint8_t val
Definition: proc.h:595
Definition: proc.h:217
uint8_t flags
Definition: proc.h:222
const uint8_t flagsMask
Definition: proc.h:223
timeSource_e timeSource
Definition: proc.h:224
Definition: proc.h:96
Integer16_t currentUtcOffset
Definition: proc.h:97
timeSource_e timeSource
Definition: proc.h:109
uint8_t flags
Definition: proc.h:107
const uint8_t flagsMask
Definition: proc.h:108
Definition: proc.h:416
ClockIdentity_t gmIdentity
Definition: proc.h:432
Integer32_t gmPresent
Definition: proc.h:431
int64_t ingress_time
Definition: proc.h:418
UInteger16_t gmTimeBaseIndicator
Definition: proc.h:424
uint16_t fractional_nanoseconds
Definition: proc.h:430
int64_t master_offset
Definition: proc.h:417
uint16_t nanoseconds_msb
Definition: proc.h:426
uint64_t nanoseconds_lsb
Definition: proc.h:428
Integer32_t cumulativeScaledRateOffset
Definition: proc.h:420
Integer32_t scaledLastGmPhaseChange
Definition: proc.h:422
Definition: proc.h:187
Timestamp_t currentTime
Definition: proc.h:188
Definition: proc.h:207
uint8_t flags
Definition: proc.h:213
const uint8_t flagsMask
Definition: proc.h:214
ClockIdentity_t clockIdentity
Definition: proc.h:355
delayMechanism_e delayMechanism
Definition: proc.h:360
UInteger16_t numberPorts
Definition: proc.h:356
UInteger8_t primaryDomain
Definition: proc.h:361
Definition: proc.h:334
const uint8_t flagsMask
Definition: proc.h:341
Integer8_t logMinPdelayReqInterval
Definition: proc.h:344
PortIdentity_t portIdentity
Definition: proc.h:335
uint8_t flags
Definition: proc.h:340
TimeInterval_t peerMeanPathDelay
Definition: proc.h:345
Definition: types.h:395
Definition: types.h:416
Definition: proc.h:267
UInteger16_t maxTableSize
Definition: proc.h:269
Definition: proc.h:619
Integer16_t actualTableSize
Definition: proc.h:620
std::vector< LinuxptpUnicastMaster_t > unicastMasters
Definition: proc.h:622
Definition: proc.h:258
std::vector< PortAddress_t > PortAddress
Definition: proc.h:264
Integer8_t logQueryInterval
Definition: proc.h:261
UInteger16_t actualTableSize
Definition: proc.h:262
Definition: proc.h:227
const uint8_t flagsMask
Definition: proc.h:233
uint8_t flags
Definition: proc.h:232
Definition: proc.h:36
PTPText_t userDescription
Definition: proc.h:37
Definition: proc.h:195
uint8_t flags
Definition: proc.h:203
Integer16_t currentUtcOffset
Definition: proc.h:196
const uint8_t flagsMask
Definition: proc.h:204
Definition: proc.h:178
Nibble_t versionNumber
Definition: proc.h:184
clockAccuracy_e
Definition: types.h:229
uint16_t UInteger16_t
Definition: types.h:40
linuxptpTimeStamp_e
Definition: types.h:347
uint64_t UInteger48_t
Definition: types.h:44
delayMechanism_e
Definition: types.h:299
portState_e
Definition: types.h:284
uint8_t Nibble_t
Definition: types.h:36
uint8_t UInteger8_t
Definition: types.h:38
long double float_nanoseconds
Definition: types.h:68
linuxptpPowerProfileVersion_e
Definition: types.h:363
uint32_t UInteger32_t
Definition: types.h:42
int8_t Integer8_t
Definition: types.h:50
uint8_t Octet_t
Definition: types.h:62
int16_t Integer16_t
Definition: types.h:52
int32_t Integer32_t
Definition: types.h:54
timeSource_e
Definition: types.h:271