]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Add some PTP definitions -- a Signaling packet structure and a TLV structure
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 5 Nov 2021 12:43:45 +0000 (12:43 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 5 Nov 2021 12:43:45 +0000 (12:43 +0000)
nqptp-ptp-definitions.h

index 01ea7d7ede29151453242c3aec420a1f92cac17b..3030f03bc4f40e7c053cd10693cbcbd044dde81b 100644 (file)
@@ -95,6 +95,15 @@ enum messageType {
   Reserved_F
 };
 
+// Table 34, part of
+enum tlvTypeValue {
+  Reserved,
+  MANAGEMENT,
+  MANAGEMENT_ERROR_STATUS,
+  ORGANIZATION_EXTENSION
+  // there are more, but not needed yet
+};
+
 // this is the Common Message Header
 struct __attribute__((__packed__)) ptp_common_message_header {
   uint8_t transportSpecificAndMessageID; // 0x11
@@ -158,6 +167,24 @@ struct __attribute__((__packed__)) ptp_pdelay_resp {
   uint8_t requestingPortIdentity[10];
 };
 
+// this is the structure of a TLV (14.3, Table 35, pp 135) without any space for the data
+struct __attribute__((__packed__)) ptp_tlv {
+  uint16_t tlvType;
+  uint16_t lengthField;
+  uint8_t organizationId[3];
+  uint8_t organizationSubType[3];
+  uint8_t dataField[0];
+};
+
+
+
+// this is the extra part for a Signaling message (13.12, pp 132) without any TLVs
+struct __attribute__((__packed__)) ptp_signaling {
+  uint8_t targetPortIdentity[10];
+  // to be followed by _one_ or more TLVs
+  struct ptp_tlv tlvs[0];
+};
+
 struct __attribute__((__packed__)) ptp_pdelay_req_message {
   struct ptp_common_message_header header;
   struct ptp_pdelay_req pdelay_req;
@@ -193,4 +220,10 @@ struct __attribute__((__packed__)) ptp_announce_message {
   struct ptp_announce announce;
 };
 
+struct __attribute__((__packed__)) ptp_signaling_message {
+  struct ptp_common_message_header header;
+  struct ptp_signaling signaling;
+};
+
+
 #endif
\ No newline at end of file