Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ptp.c
blob0750c33c6bebcb1e116494ed10a0147b82ace71a
1 /* packet-ptp.c
2 * Routines for PTP (Precision Time Protocol) dissection
3 * Copyright 2004, Auges Tchouante <tchouante2001@yahoo.fr>
4 * Copyright 2004, Dominic Bechaz <bdo@zhwin.ch> , ZHW/InES
5 * Copyright 2004, Markus Seehofer <mseehofe@nt.hirschmann.de>
6 * Copyright 2006, Christian Schaer <scc@zhwin.ch>
7 * Copyright 2007, Markus Renz <Markus.Renz@hirschmann.de>
8 * Copyright 2010, Torrey Atcitty <torrey.atcitty@harman.com>
9 * Dave Olsen <dave.olsen@harman.com>
10 * Copyright 2013, Andreas Bachmann <bacr@zhaw.ch>, ZHAW/InES
11 * Copyright 2016, Uli Heilmeier <uh@heilmeier.eu>
12 * Copyright 2017, Adam Wujek <adam.wujek@cern.ch>
13 * Copyright 2022, Dr. Lars Völker <lars.voelker@technica-engineering.de>
14 * Copyright 2023, Adam Wujek <dev_public@wujek.eu> for CERN
15 * Copyright 2024, Patrik Thunström <patrik.thunstroem@technica-engineering.de>
16 * Copyright 2024, Dr. Lars Völker <lars.voelker@technica-engineering.de>
17 * Copyright 2024, Martin Ostertag <martin.ostertag@zhaw.ch>
18 * Aurel Hess <hesu@zhaw.ch>
20 * Revisions:
21 * - Markus Seehofer 09.08.2005 <mseehofe@nt.hirschmann.de>
22 * - Included the "startingBoundaryHops" field in
23 * ptp_management messages.
24 * - Christian Schaer 07.07.2006 <scc@zhwin.ch>
25 * - Added support for PTP version 2
26 * - Markus Renz 2007-06-01
27 * - updated support for PTPv2
28 * - Markus Renz added Management for PTPv2, update to Draft 2.2
29 * - Torrey Atcitty & Dave Olsen 05.14.2010
30 * - Added support for 802.1AS D7.0
31 * - Andreas Bachmann 08.07.2013 <bacr@zhaw.ch>
32 * - allow multiple TLVs
33 * - bugfix in logInterMessagePeriod uint8_t -> int8_t
34 * - Uli Heilmeier 21.03.2016 <uh@heilmeier.eu>
35 * - Added support for SMPTE TLV
36 * - Adam Wujek 17.10.2017 <adam.wujek@cern.ch>
37 * - Added support for White Rabbit TLV
38 * - Prashant Tripathi 19-02-2021 <prashant_tripathi@selinc.com>
39 * - Added support for C37.238-2017
40 * - Dr. Lars Völker 05-01-2022 <lars.voelker@technica-engineering.de>
41 * - Added analysis support
42 * - Adam Wujek 28.08.2023 <dev_public@wujek.eu>
43 * - Added support for L1Sync
44 * - Patrik Thunström 27.01.2024 <patrik.thunstroem@technica-engineering.de>
45 * - Improvements/corrections for cumulativeScaledRateOffset
46 * - Prashant Tripathi 31-07-2024 <prashant_tripathi@selinc.com>
47 * - Corrections to timeOfNextJump field in ATOI TLV
48 * - Patrik Thunström 24.09.2024 <patrik.thunstroem@technica-engineering.de>
49 * - Fix analysis association (Sync to Follow_Up etc.) in case of sequenceId resets
50 * - Dr. Lars Völker 28.11.2024 <lars.voelker@technica-engineering.de>
51 * - TLV rework
52 * - Martin Ostertag & Aurel Hess 09-12-2024 <martin.ostertag@zhaw.ch> & <hesu@zhaw.ch>
53 * - Added support for drift_tracking TLV (802.1ASdm)
56 * Wireshark - Network traffic analyzer
57 * By Gerald Combs <gerald@wireshark.org>
58 * Copyright 1998 Gerald Combs
60 * SPDX-License-Identifier: GPL-2.0-or-later
63 #include "config.h"
65 #include <math.h>
66 #include <locale.h>
68 #include <epan/packet.h>
69 #include <epan/tfs.h>
70 #include <epan/unit_strings.h>
71 #include <epan/etypes.h>
72 #include <epan/expert.h>
73 #include <epan/proto_data.h>
74 #include <epan/oui.h>
75 #include <epan/addr_resolv.h>
76 #include "packet-ptp.h"
78 #define NS_PER_S 1000000000
80 /**********************************************************/
81 /* Port definition's for PTP */
82 /**********************************************************/
83 #define PTP_PORT_RANGE "319-320"
85 /* END Port definition's for PTP */
86 void proto_register_ptp(void);
87 void proto_reg_handoff_ptp(void);
89 static int proto_ptp;
90 /* To keep the decimal point based on locale */
91 static char * decimal_point;
93 /***********************************************************************************/
94 /* Definitions and fields for PTPv1 dissection. */
95 /***********************************************************************************/
98 /**********************************************************/
99 /* Offsets of fields within a PTPv1 packet. */
100 /**********************************************************/
102 /* Common offsets for all Messages (Synch, Delay_Req, Follow_Up, Delay_Resp ....) */
103 #define PTP_VERSIONPTP_OFFSET 0
104 #define PTP_VERSIONNETWORK_OFFSET 2
105 #define PTP_SUBDOMAIN_OFFSET 4
106 #define PTP_MESSAGETYPE_OFFSET 20
107 #define PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET 21
108 #define PTP_SOURCEUUID_OFFSET 22
109 #define PTP_SOURCEPORTID_OFFSET 28
110 #define PTP_SEQUENCEID_OFFSET 30
111 #define PTP_CONTROLFIELD_OFFSET 32
112 #define PTP_FLAGS_OFFSET 34
113 #define PTP_FLAGS_LI61_OFFSET 34
114 #define PTP_FLAGS_LI59_OFFSET 34
115 #define PTP_FLAGS_BOUNDARY_CLOCK_OFFSET 34
116 #define PTP_FLAGS_ASSIST_OFFSET 34
117 #define PTP_FLAGS_EXT_SYNC_OFFSET 34
118 #define PTP_FLAGS_PARENT_STATS_OFFSET 34
119 #define PTP_FLAGS_SYNC_BURST_OFFSET 34
121 /* Offsets for PTP_Sync and Delay_Req (=SDR) messages */
122 #define PTP_SDR_ORIGINTIMESTAMP_OFFSET 40
123 #define PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET 40
124 #define PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET 44
125 #define PTP_SDR_EPOCHNUMBER_OFFSET 48
126 #define PTP_SDR_CURRENTUTCOFFSET_OFFSET 50
127 #define PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 53
128 #define PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET 54
129 #define PTP_SDR_GRANDMASTERPORTID_OFFSET 60
130 #define PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET 62
131 #define PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET 67
132 #define PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET 68
133 #define PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET 74
134 #define PTP_SDR_GRANDMASTERPREFERRED_OFFSET 77
135 #define PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET 79
136 #define PTP_SDR_SYNCINTERVAL_OFFSET 83
137 #define PTP_SDR_LOCALCLOCKVARIANCE_OFFSET 86
138 #define PTP_SDR_LOCALSTEPSREMOVED_OFFSET 90
139 #define PTP_SDR_LOCALCLOCKSTRATUM_OFFSET 95
140 #define PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET 96
141 #define PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET 101
142 #define PTP_SDR_PARENTUUID_OFFSET 102
143 #define PTP_SDR_PARENTPORTFIELD_OFFSET 110
144 #define PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET 114
145 #define PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET 116
146 #define PTP_SDR_UTCREASONABLE_OFFSET 123
148 /* Offsets for Follow_Up (=FU) messages */
149 #define PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET 42
150 #define PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET 44
151 #define PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET 44
152 #define PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET 48
154 /* Offsets for Delay_Resp (=DR) messages */
155 #define PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET 40
156 #define PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET 40
157 #define PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET 44
158 #define PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET 49
159 #define PTP_DR_REQUESTINGSOURCEUUID_OFFSET 50
160 #define PTP_DR_REQUESTINGSOURCEPORTID_OFFSET 56
161 #define PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET 58
163 /* Offsets for Management (=MM) messages */
164 #define PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET 41
165 #define PTP_MM_TARGETUUID_OFFSET 42
166 #define PTP_MM_TARGETPORTID_OFFSET 48
167 #define PTP_MM_STARTINGBOUNDARYHOPS_OFFSET 50
168 #define PTP_MM_BOUNDARYHOPS_OFFSET 52
169 #define PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET 55
170 #define PTP_MM_PARAMETERLENGTH_OFFSET 58
172 /* PARAMETERLENGTH > 0 */
173 #define PTP_MM_MESSAGEPARAMETERS_OFFSET 60
175 /* PTP_MM_CLOCK_IDENTITY (PARAMETERLENGTH = 64) */
176 #define PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET 63
177 #define PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET 64
178 #define PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET 74
179 #define PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET 76
181 /* PTP_MM_INITIALIZE_CLOCK (PARAMETERLENGTH = 4) */
182 #define PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET 62
184 /* PTP_MM_SET_SUBDOMAIN (PARAMETERLENGTH = 16) */
185 #define PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET 60
187 /* PTP_MM_DEFAULT_DATA_SET (PARAMETERLENGTH = 76) */
188 #define PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET 63
189 #define PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET 64
190 #define PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET 74
191 #define PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET 79
192 #define PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET 80
193 #define PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET 86
194 #define PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET 89
195 #define PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET 95
196 #define PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET 99
197 #define PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET 103
198 #define PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET 107
199 #define PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET 111
200 #define PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET 112
201 #define PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET 130
202 #define PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET 134
204 /* PTP_MM_UPDATE_DEFAULT_DATA_SET (PARAMETERLENGTH = 36) */
205 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET 63
206 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET 64
207 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET 70
208 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET 75
209 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET 79
210 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET 80
212 /* PTP_MM_CURRENT_DATA_SET (PARAMETERLENGTH = 20) */
213 #define PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET 62
214 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET 64
215 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET 64
216 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET 68
217 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET 72
218 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET 72
219 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET 76
221 /* PTP_MM_PARENT_DATA_SET (PARAMETERLENGTH = 90) */
222 #define PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET 63
223 #define PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET 64
224 #define PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET 74
225 #define PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET 78
226 #define PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET 83
227 #define PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET 87
228 #define PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET 90
229 #define PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET 95
230 #define PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET 98
231 #define PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET 100
232 #define PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET 107
233 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 111
234 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET 112
235 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET 122
236 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET 127
237 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET 128
238 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET 134
239 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET 139
240 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET 143
241 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET 146
243 /* PTP_MM_PORT_DATA_SET (PARAMETERLENGTH = 52) */
244 #define PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET 62
245 #define PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET 67
246 #define PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET 70
247 #define PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET 74
248 #define PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET 79
249 #define PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET 80
250 #define PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET 90
251 #define PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET 95
252 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET 97
253 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET 98
254 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET 99
255 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET 100
256 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET 106
257 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET 110
259 /* PTP_MM_GLOBAL_TIME_DATA_SET (PARAMETERLENGTH = 24) */
260 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET 60
261 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET 60
262 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET 64
263 #define PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET 70
264 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET 75
265 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET 79
266 #define PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET 82
268 /* PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES (PARAMETERLENGTH = 16) */
269 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET 62
270 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET 67
271 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET 71
272 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET 74
274 /* PTP_MM_GET_FOREIGN_DATA_SET (PARAMETERLENGTH = 4) */
275 #define PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET 62
277 /* PTP_MM_FOREIGN_DATA_SET (PARAMETERLENGTH = 28) */
278 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET 62
279 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET 66
280 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 71
281 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET 72
282 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET 82
283 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET 86
285 /* PTP_MM_SET_SYNC_INTERVAL (PARAMETERLENGTH = 4) */
286 #define PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET 62
288 /* PTP_MM_SET_TIME (PARAMETERLENGTH = 8) */
289 #define PTP_MM_SET_TIME_LOCALTIME_OFFSET 60
290 #define PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET 60
291 #define PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET 64
293 /* END Offsets of fields within a PTP packet. */
295 /**********************************************************/
296 /* flag-field-mask-definitions */
297 /**********************************************************/
298 #define PTP_FLAGS_LI61_BITMASK 0x0001
299 #define PTP_FLAGS_LI59_BITMASK 0x0002
300 #define PTP_FLAGS_BOUNDARY_CLOCK_BITMASK 0x0004
301 #define PTP_FLAGS_ASSIST_BITMASK 0x0008
302 #define PTP_FLAGS_EXT_SYNC_BITMASK 0x0010
303 #define PTP_FLAGS_PARENT_STATS_BITMASK 0x0020
304 #define PTP_FLAGS_SYNC_BURST_BITMASK 0x0040
306 /* END flag-field-mask-definitions */
308 /**********************************************************/
309 /* managementMessage definitions */
310 /**********************************************************/
311 #define PTP_MM_NULL 0
312 #define PTP_MM_OBTAIN_IDENTITY 1
313 #define PTP_MM_CLOCK_IDENTITY 2
314 #define PTP_MM_INITIALIZE_CLOCK 3
315 #define PTP_MM_SET_SUBDOMAIN 4
316 #define PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER 5
317 #define PTP_MM_SET_DESIGNATED_PREFERRED_MASTER 6
318 #define PTP_MM_GET_DEFAULT_DATA_SET 7
319 #define PTP_MM_DEFAULT_DATA_SET 8
320 #define PTP_MM_UPDATE_DEFAULT_DATA_SET 9
321 #define PTP_MM_GET_CURRENT_DATA_SET 10
322 #define PTP_MM_CURRENT_DATA_SET 11
323 #define PTP_MM_GET_PARENT_DATA_SET 12
324 #define PTP_MM_PARENT_DATA_SET 13
325 #define PTP_MM_GET_PORT_DATA_SET 14
326 #define PTP_MM_PORT_DATA_SET 15
327 #define PTP_MM_GET_GLOBAL_TIME_DATA_SET 16
328 #define PTP_MM_GLOBAL_TIME_DATA_SET 17
329 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES 18
330 #define PTP_MM_GOTO_FAULTY_STATE 19
331 #define PTP_MM_GET_FOREIGN_DATA_SET 20
332 #define PTP_MM_FOREIGN_DATA_SET 21
333 #define PTP_MM_SET_SYNC_INTERVAL 22
334 #define PTP_MM_DISABLE_PORT 23
335 #define PTP_MM_ENABLE_PORT 24
336 #define PTP_MM_DISABLE_BURST 25
337 #define PTP_MM_ENABLE_BURST 26
338 #define PTP_MM_SET_TIME 27
340 static const value_string ptp_managementMessageKey_vals[] = {
341 {PTP_MM_NULL , "PTP_MM_NULL"},
342 {PTP_MM_OBTAIN_IDENTITY , "PTP_MM_OBTAIN_IDENTITY"},
343 {PTP_MM_CLOCK_IDENTITY , "PTP_MM_CLOCK_IDENTITY"},
344 {PTP_MM_INITIALIZE_CLOCK , "PTP_MM_INITIALIZE_CLOCK"},
345 {PTP_MM_SET_SUBDOMAIN , "PTP_MM_SET_SUBDOMAIN"},
346 {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER , "PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER"},
347 {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER , "PTP_MM_SET_DESIGNATED_PREFERRED_MASTER"},
348 {PTP_MM_GET_DEFAULT_DATA_SET , "PTP_MM_GET_DEFAULT_DATA_SET"},
349 {PTP_MM_DEFAULT_DATA_SET , "PTP_MM_DEFAULT_DATA_SET"},
350 {PTP_MM_UPDATE_DEFAULT_DATA_SET , "PTP_MM_UPDATE_DEFAULT_DATA_SET"},
351 {PTP_MM_GET_CURRENT_DATA_SET , "PTP_MM_GET_CURRENT_DATA_SET"},
352 {PTP_MM_CURRENT_DATA_SET , "PTP_MM_CURRENT_DATA_SET"},
353 {PTP_MM_GET_PARENT_DATA_SET , "PTP_MM_GET_PARENT_DATA_SET"},
354 {PTP_MM_PARENT_DATA_SET , "PTP_MM_PARENT_DATA_SET"},
355 {PTP_MM_GET_PORT_DATA_SET , "PTP_MM_GET_PORT_DATA_SET"},
356 {PTP_MM_PORT_DATA_SET , "PTP_MM_PORT_DATA_SET"},
357 {PTP_MM_GET_GLOBAL_TIME_DATA_SET , "PTP_MM_GET_GLOBAL_TIME_DATA_SET"},
358 {PTP_MM_GLOBAL_TIME_DATA_SET , "PTP_MM_GLOBAL_TIME_DATA_SET"},
359 {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES , "PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES"},
360 {PTP_MM_GOTO_FAULTY_STATE , "PTP_MM_GOTO_FAULTY_STATE"},
361 {PTP_MM_GET_FOREIGN_DATA_SET , "PTP_MM_GET_FOREIGN_DATA_SET"},
362 {PTP_MM_FOREIGN_DATA_SET , "PTP_MM_FOREIGN_DATA_SET"},
363 {PTP_MM_SET_SYNC_INTERVAL , "PTP_MM_SET_SYNC_INTERVAL"},
364 {PTP_MM_DISABLE_PORT , "PTP_MM_DISABLE_PORT"},
365 {PTP_MM_ENABLE_PORT , "PTP_MM_ENABLE_PORT"},
366 {PTP_MM_DISABLE_BURST , "PTP_MM_DISABLE_BURST"},
367 {PTP_MM_ENABLE_BURST , "PTP_MM_ENABLE_BURST"},
368 {PTP_MM_SET_TIME , "PTP_MM_SET_TIME"},
369 {0 , NULL}
371 static value_string_ext ptp_managementMessageKey_vals_ext =
372 VALUE_STRING_EXT_INIT(ptp_managementMessageKey_vals);
374 /* same again but better readable text for info column */
375 static const value_string ptp_managementMessageKey_infocolumn_vals[] = {
376 {PTP_MM_NULL , "Null"},
377 {PTP_MM_OBTAIN_IDENTITY , "Obtain Identity"},
378 {PTP_MM_CLOCK_IDENTITY , "Clock Identity"},
379 {PTP_MM_INITIALIZE_CLOCK , "Initialize Clock"},
380 {PTP_MM_SET_SUBDOMAIN , "Set Subdomain"},
381 {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER , "Clear Designated Preferred Master"},
382 {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER , "Set Designated Preferred Master"},
383 {PTP_MM_GET_DEFAULT_DATA_SET , "Get Default Data Set"},
384 {PTP_MM_DEFAULT_DATA_SET , "Default Data Set"},
385 {PTP_MM_UPDATE_DEFAULT_DATA_SET , "Update Default Data Set"},
386 {PTP_MM_GET_CURRENT_DATA_SET , "Get Current Data Set"},
387 {PTP_MM_CURRENT_DATA_SET , "Current Data Set"},
388 {PTP_MM_GET_PARENT_DATA_SET , "Get Parent Data Set"},
389 {PTP_MM_PARENT_DATA_SET , "Parent Data Set"},
390 {PTP_MM_GET_PORT_DATA_SET , "Get Port Data Set"},
391 {PTP_MM_PORT_DATA_SET , "Port Data Set"},
392 {PTP_MM_GET_GLOBAL_TIME_DATA_SET , "Get Global Time Data Set"},
393 {PTP_MM_GLOBAL_TIME_DATA_SET , "Global Time Data Set"},
394 {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES , "Update Global Time Properties"},
395 {PTP_MM_GOTO_FAULTY_STATE , "Goto Faulty State"},
396 {PTP_MM_GET_FOREIGN_DATA_SET , "Get Foreign Data Set"},
397 {PTP_MM_FOREIGN_DATA_SET , "Foreign Data Set"},
398 {PTP_MM_SET_SYNC_INTERVAL , "Set Sync Interval"},
399 {PTP_MM_DISABLE_PORT , "Disable Port"},
400 {PTP_MM_ENABLE_PORT , "Enable Port"},
401 {PTP_MM_DISABLE_BURST , "Disable Burst"},
402 {PTP_MM_ENABLE_BURST , "Enable Burst"},
403 {PTP_MM_SET_TIME , "Set Time"},
404 {0 , NULL}
406 static value_string_ext ptp_managementMessageKey_infocolumn_vals_ext =
407 VALUE_STRING_EXT_INIT(ptp_managementMessageKey_infocolumn_vals);
409 /* END managementMessage definitions */
411 /**********************************************************/
412 /* CommunicationId definitions */
413 /**********************************************************/
414 #define PTP_CLOSED 0
415 #define PTP_ETHER 1
416 #define PTP_FFBUS 4
417 #define PTP_PROFIBUS 5
418 #define PTP_LON 6
419 #define PTP_DNET 7
420 #define PTP_SDS 8
421 #define PTP_CONTROLNET 9
422 #define PTP_CANOPEN 10
423 #define PTP_IEEE1394 243
424 #define PTP_IEEE802_11A 244
425 #define PTP_IEEE_WIRELESS 245
426 #define PTP_INFINIBAND 246
427 #define PTP_BLUETOOTH 247
428 #define PTP_IEEE802_15_1 248
429 #define PTP_IEEE1451_3 249
430 #define PTP_IEEE1451_5 250
431 #define PTP_USB 251
432 #define PTP_ISA 252
433 #define PTP_PCI 253
434 #define PTP_VXI 254
435 #define PTP_DEFAULT 255
437 static const value_string ptp_communicationid_vals[] = {
438 {PTP_CLOSED , "Closed system outside the scope of this standard."},
439 {PTP_ETHER , "IEEE 802.3 (Ethernet)"},
440 {PTP_FFBUS , "FOUNDATION Fieldbus"},
441 {PTP_PROFIBUS , "PROFIBUS"},
442 {PTP_LON , "LonTalk"},
443 {PTP_DNET , "DeviceNet"},
444 {PTP_SDS , "SmartDistributedSystem"},
445 {PTP_CONTROLNET , "ControlNet"},
446 {PTP_CANOPEN , "CANopen"},
447 {PTP_IEEE1394 , "IEEE 1394"},
448 {PTP_IEEE802_11A , "IEEE 802.11a"},
449 {PTP_IEEE_WIRELESS , "IEEE 802.11b"},
450 {PTP_INFINIBAND , "InfiniBand"},
451 {PTP_BLUETOOTH , "Bluetooth wireless"},
452 {PTP_IEEE802_15_1 , "IEEE 802.15.1"},
453 {PTP_IEEE1451_3 , "IEEE 1451.3"},
454 {PTP_IEEE1451_5 , "IEEE 1451.5"},
455 {PTP_USB , "USB bus"},
456 {PTP_ISA , "ISA bus"},
457 {PTP_PCI , "PCI bus"},
458 {PTP_VXI , "VXI bus"},
459 {PTP_DEFAULT , "Default value"},
460 {0 , NULL}
462 static value_string_ext ptp_communicationid_vals_ext =
463 VALUE_STRING_EXT_INIT(ptp_communicationid_vals);
465 /* END CommunicationId definitions */
467 /**********************************************************/
468 /* PTP message types (PTP_CONTROL field) */
469 /**********************************************************/
470 #define PTP_SYNC_MESSAGE 0x00
471 #define PTP_DELAY_REQ_MESSAGE 0x01
472 #define PTP_FOLLOWUP_MESSAGE 0x02
473 #define PTP_DELAY_RESP_MESSAGE 0x03
474 #define PTP_MANAGEMENT_MESSAGE 0x04
475 #define PTP_OTHER_MESSAGE 0x05
477 static const value_string ptp_controlfield_vals[] = {
478 {PTP_SYNC_MESSAGE , "Sync Message"},
479 {PTP_DELAY_REQ_MESSAGE , "Delay_Req Message"},
480 {PTP_FOLLOWUP_MESSAGE , "Follow_Up Message"},
481 {PTP_DELAY_RESP_MESSAGE , "Delay_Resp Message"},
482 {PTP_MANAGEMENT_MESSAGE , "Management Message"},
483 {PTP_OTHER_MESSAGE , "Other Message"},
484 {0, NULL }
487 /* END PTP message types */
489 /**********************************************************/
490 /* Channel values for the PTP_MESSAGETYPE field */
491 /**********************************************************/
492 #define PTP_MESSAGETYPE_EVENT 0x01
493 #define PTP_MESSAGETYPE_GENERAL 0x02
495 static const value_string ptp_messagetype_vals[] = {
496 {PTP_MESSAGETYPE_EVENT , "Event Message"},
497 {PTP_MESSAGETYPE_GENERAL , "General Message"},
498 {0 , NULL}
501 /* END channel values for the PTP_MESSAGETYPE field */
503 /**********************************************************/
504 /* Initialize the protocol and registered fields */
505 /**********************************************************/
507 static int hf_ptp_versionptp;
508 static int hf_ptp_versionnetwork;
509 static int hf_ptp_subdomain;
510 static int hf_ptp_messagetype;
511 static int hf_ptp_sourcecommunicationtechnology;
512 static int hf_ptp_sourceuuid;
513 static int hf_ptp_sourceportid;
514 static int hf_ptp_sequenceid;
515 static int hf_ptp_controlfield;
516 static int hf_ptp_flags;
517 static int hf_ptp_flags_li61;
518 static int hf_ptp_flags_li59;
519 static int hf_ptp_flags_boundary_clock;
520 static int hf_ptp_flags_assist;
521 static int hf_ptp_flags_ext_sync;
522 static int hf_ptp_flags_parent;
523 static int hf_ptp_flags_sync_burst;
525 /* Fields for ptp_sync and delay_req (=sdr) messages */
526 static int hf_ptp_sdr_origintimestamp; /* Field for seconds & nanoseconds */
527 static int hf_ptp_sdr_origintimestamp_seconds;
528 static int hf_ptp_sdr_origintimestamp_nanoseconds;
529 static int hf_ptp_sdr_epochnumber;
530 static int hf_ptp_sdr_currentutcoffset;
531 static int hf_ptp_sdr_grandmastercommunicationtechnology;
532 static int hf_ptp_sdr_grandmasterclockuuid;
533 static int hf_ptp_sdr_grandmasterportid;
534 static int hf_ptp_sdr_grandmastersequenceid;
535 static int hf_ptp_sdr_grandmasterclockstratum;
536 static int hf_ptp_sdr_grandmasterclockidentifier;
537 static int hf_ptp_sdr_grandmasterclockvariance;
538 static int hf_ptp_sdr_grandmasterpreferred;
539 static int hf_ptp_sdr_grandmasterisboundaryclock;
540 static int hf_ptp_sdr_syncinterval;
541 static int hf_ptp_sdr_localclockvariance;
542 static int hf_ptp_sdr_localstepsremoved;
543 static int hf_ptp_sdr_localclockstratum;
544 static int hf_ptp_sdr_localclockidentifier;
545 static int hf_ptp_sdr_parentcommunicationtechnology;
546 static int hf_ptp_sdr_parentuuid;
547 static int hf_ptp_sdr_parentportfield;
548 static int hf_ptp_sdr_estimatedmastervariance;
549 static int hf_ptp_sdr_estimatedmasterdrift;
550 static int hf_ptp_sdr_utcreasonable;
552 /* Fields for follow_up (=fu) messages */
553 static int hf_ptp_fu_associatedsequenceid;
554 static int hf_ptp_fu_preciseorigintimestamp;
555 static int hf_ptp_fu_preciseorigintimestamp_seconds;
556 static int hf_ptp_fu_preciseorigintimestamp_nanoseconds;
558 /* Fields for delay_resp (=dr) messages */
559 static int hf_ptp_dr_delayreceipttimestamp;
560 static int hf_ptp_dr_delayreceipttimestamp_seconds;
561 static int hf_ptp_dr_delayreceipttimestamp_nanoseconds;
562 static int hf_ptp_dr_requestingsourcecommunicationtechnology;
563 static int hf_ptp_dr_requestingsourceuuid;
564 static int hf_ptp_dr_requestingsourceportid;
565 static int hf_ptp_dr_requestingsourcesequenceid;
567 /* Fields for management (=mm) messages */
568 static int hf_ptp_mm_targetcommunicationtechnology;
569 static int hf_ptp_mm_targetuuid;
570 static int hf_ptp_mm_targetportid;
571 static int hf_ptp_mm_startingboundaryhops;
572 static int hf_ptp_mm_boundaryhops;
573 static int hf_ptp_mm_managementmessagekey;
574 static int hf_ptp_mm_parameterlength;
575 /* parameterlength > 0 */
576 /* static int hf_ptp_mm_messageparameters; */
577 /* ptp_mm_clock_identity (parameterlength = 64) */
578 static int hf_ptp_mm_clock_identity_clockcommunicationtechnology;
579 static int hf_ptp_mm_clock_identity_clockuuidfield;
580 static int hf_ptp_mm_clock_identity_clockportfield;
581 static int hf_ptp_mm_clock_identity_manufactureridentity;
583 /* ptp_mm_initialize_clock (parameterlength = 4) */
584 static int hf_ptp_mm_initialize_clock_initialisationkey;
586 /* ptp_mm_set_subdomain (parameterlength = 16) */
587 static int hf_ptp_mm_set_subdomain_subdomainname;
589 /* ptp_mm_default_data_set (parameterlength = 76) */
590 static int hf_ptp_mm_default_data_set_clockcommunicationtechnology;
591 static int hf_ptp_mm_default_data_set_clockuuidfield;
592 static int hf_ptp_mm_default_data_set_clockportfield;
593 static int hf_ptp_mm_default_data_set_clockstratum;
594 static int hf_ptp_mm_default_data_set_clockidentifier;
595 static int hf_ptp_mm_default_data_set_clockvariance;
596 static int hf_ptp_mm_default_data_set_clockfollowupcapable;
597 static int hf_ptp_mm_default_data_set_preferred;
598 static int hf_ptp_mm_default_data_set_initializable;
599 static int hf_ptp_mm_default_data_set_externaltiming;
600 static int hf_ptp_mm_default_data_set_isboundaryclock;
601 static int hf_ptp_mm_default_data_set_syncinterval;
602 static int hf_ptp_mm_default_data_set_subdomainname;
603 static int hf_ptp_mm_default_data_set_numberports;
604 static int hf_ptp_mm_default_data_set_numberforeignrecords;
606 /* ptp_mm_update_default_data_set (parameterlength = 36) */
607 static int hf_ptp_mm_update_default_data_set_clockstratum;
608 static int hf_ptp_mm_update_default_data_set_clockidentifier;
609 static int hf_ptp_mm_update_default_data_set_clockvariance;
610 static int hf_ptp_mm_update_default_data_set_preferred;
611 static int hf_ptp_mm_update_default_data_set_syncinterval;
612 static int hf_ptp_mm_update_default_data_set_subdomainname;
614 /* ptp_mm_current_data_set (parameterlength = 20) */
615 static int hf_ptp_mm_current_data_set_stepsremoved;
616 static int hf_ptp_mm_current_data_set_offsetfrommaster;
617 static int hf_ptp_mm_current_data_set_offsetfrommasterseconds;
618 static int hf_ptp_mm_current_data_set_offsetfrommasternanoseconds;
619 static int hf_ptp_mm_current_data_set_onewaydelay;
620 static int hf_ptp_mm_current_data_set_onewaydelayseconds;
621 static int hf_ptp_mm_current_data_set_onewaydelaynanoseconds;
623 /* ptp_mm_parent_data_set (parameterlength = 90) */
624 static int hf_ptp_mm_parent_data_set_parentcommunicationtechnology;
625 static int hf_ptp_mm_parent_data_set_parentuuid;
626 static int hf_ptp_mm_parent_data_set_parentportid;
627 static int hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber;
628 static int hf_ptp_mm_parent_data_set_parentfollowupcapable;
629 static int hf_ptp_mm_parent_data_set_parentexternaltiming;
630 static int hf_ptp_mm_parent_data_set_parentvariance;
631 static int hf_ptp_mm_parent_data_set_parentstats;
632 static int hf_ptp_mm_parent_data_set_observedvariance;
633 static int hf_ptp_mm_parent_data_set_observeddrift;
634 static int hf_ptp_mm_parent_data_set_utcreasonable;
635 static int hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology;
636 static int hf_ptp_mm_parent_data_set_grandmasteruuidfield;
637 static int hf_ptp_mm_parent_data_set_grandmasterportidfield;
638 static int hf_ptp_mm_parent_data_set_grandmasterstratum;
639 static int hf_ptp_mm_parent_data_set_grandmasteridentifier;
640 static int hf_ptp_mm_parent_data_set_grandmastervariance;
641 static int hf_ptp_mm_parent_data_set_grandmasterpreferred;
642 static int hf_ptp_mm_parent_data_set_grandmasterisboundaryclock;
643 static int hf_ptp_mm_parent_data_set_grandmastersequencenumber;
645 /* ptp_mm_port_data_set (parameterlength = 52) */
646 static int hf_ptp_mm_port_data_set_returnedportnumber;
647 static int hf_ptp_mm_port_data_set_portstate;
648 static int hf_ptp_mm_port_data_set_lastsynceventsequencenumber;
649 static int hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber;
650 static int hf_ptp_mm_port_data_set_portcommunicationtechnology;
651 static int hf_ptp_mm_port_data_set_portuuidfield;
652 static int hf_ptp_mm_port_data_set_portidfield;
653 static int hf_ptp_mm_port_data_set_burstenabled;
654 static int hf_ptp_mm_port_data_set_subdomainaddressoctets;
655 static int hf_ptp_mm_port_data_set_eventportaddressoctets;
656 static int hf_ptp_mm_port_data_set_generalportaddressoctets;
657 static int hf_ptp_mm_port_data_set_subdomainaddress;
658 static int hf_ptp_mm_port_data_set_eventportaddress;
659 static int hf_ptp_mm_port_data_set_generalportaddress;
661 /* ptp_mm_global_time_data_set (parameterlength = 24) */
662 static int hf_ptp_mm_global_time_data_set_localtime;
663 static int hf_ptp_mm_global_time_data_set_localtimeseconds;
664 static int hf_ptp_mm_global_time_data_set_localtimenanoseconds;
665 static int hf_ptp_mm_global_time_data_set_currentutcoffset;
666 static int hf_ptp_mm_global_time_data_set_leap59;
667 static int hf_ptp_mm_global_time_data_set_leap61;
668 static int hf_ptp_mm_global_time_data_set_epochnumber;
670 /* ptp_mm_update_global_time_properties (parameterlength = 16) */
671 static int hf_ptp_mm_update_global_time_properties_currentutcoffset;
672 static int hf_ptp_mm_update_global_time_properties_leap59;
673 static int hf_ptp_mm_update_global_time_properties_leap61;
674 /* static int hf_ptp_mm_update_global_time_properties_epochnumber; */
676 /* ptp_mm_get_foreign_data_set (parameterlength = 4) */
677 static int hf_ptp_mm_get_foreign_data_set_recordkey;
679 /* ptp_mm_foreign_data_set (parameterlength = 28) */
680 static int hf_ptp_mm_foreign_data_set_returnedportnumber;
681 static int hf_ptp_mm_foreign_data_set_returnedrecordnumber;
682 static int hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology;
683 static int hf_ptp_mm_foreign_data_set_foreignmasteruuidfield;
684 static int hf_ptp_mm_foreign_data_set_foreignmasterportidfield;
685 static int hf_ptp_mm_foreign_data_set_foreignmastersyncs;
687 /* ptp_mm_set_sync_interval (parameterlength = 4) */
688 static int hf_ptp_mm_set_sync_interval_syncinterval;
690 /* ptp_mm_set_time (parameterlength = 8) */
691 static int hf_ptp_mm_set_time_localtime;
692 static int hf_ptp_mm_set_time_localtimeseconds;
693 static int hf_ptp_mm_set_time_localtimenanoseconds;
695 /* END Initialize the protocol and registered fields */
697 /* Initialize the subtree pointers */
698 static int ett_ptp;
699 static int ett_ptp_flags;
700 static int ett_ptp_time;
701 static int ett_ptp_time2;
703 /* END Definitions and fields for PTPv1 dissection. */
709 /***********************************************************************************/
710 /* Definitions and fields for PTPv2 dissection. */
711 /***********************************************************************************/
714 /**********************************************************/
715 /* Offsets of fields within a PTPv2 packet. */
716 /**********************************************************/
718 /* Common offsets for all Messages (Sync, Delay_Req, Follow_Up, Delay_Resp ....) */
719 #define PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET 0
720 #define PTP_V2_VERSIONPTP_OFFSET 1
721 #define PTP_V2_MINORVERSIONPTP_OFFSET PTP_V2_VERSIONPTP_OFFSET
722 #define PTP_V2_MESSAGE_LENGTH_OFFSET 2
723 #define PTP_V2_DOMAIN_NUMBER_OFFSET 4
724 #define PTP_V2_MINORSDOID_OFFSET 5
725 #define PTP_V2_FLAGS_OFFSET 6
726 #define PTP_V2_CORRECTION_OFFSET 8
727 #define PTP_V2_CLOCKIDENTITY_OFFSET 20
728 #define PTP_V2_SOURCEPORTID_OFFSET 28
729 #define PTP_V2_SEQUENCEID_OFFSET 30
731 /* Common Offset for TLVs (relative from start of TLV) */
732 #define PTP_V2_TLV_TYPE_OFFSET 0
733 #define PTP_V2_TLV_LENGTH_OFFSET 2
734 #define PTP_V2_TLV_HEADER_LENGTH 4
735 #define PTP_V2_TLV_ORGANIZATIONSUBTYPE_OFFSET 7
737 /* Offsets for PTP_Follow_Up (=FU) messages */
738 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET 34
739 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET 40
741 /* Offsets for PTP_PDelayResponse (=PDRS) messages */
742 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET 34
743 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET 40
744 #define PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET 44
745 #define PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET 52
747 /* Offsets for PTP_PDelayResponseFollowUp (=PDFU) messages */
748 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET 34
749 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET 40
750 #define PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET 44
751 #define PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET 52
753 /* PTPv2.1 L1 SYNC flags field length */
754 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS_BASIC_FORMAT 2
755 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS_EXT_FORMAT 3
757 /* Defined in 10.6.4.4.5 */
758 #define PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_ORG_SUB_TYPE 4
759 /* Defined in 10.6.4.5.5 */
760 #define PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_MESSSAGEINTERVAL_ORG_SUB_TYPE 5
762 /**********************************************************/
763 /* Message Interval Request flag-field-mask-definitions */
764 /**********************************************************/
765 #define PTP_AS_FLAGS_COMP_NEIGHBOR_RATE_RATIO_BITMASK 0x02
766 #define PTP_AS_FLAGS_COMP_MEAN_LINK_DELAY_BITMASK 0x04
767 #define PTP_AS_FLAGS_ONE_STEP_RECEIVE_CAPABLE 0x08
769 /* Offsets for PTP_V2_Management (=MM) messages */
770 #define PTP_V2_MM_ACTION_OFFSET 46
771 #define PTP_V2_MM_RESERVED_OFFSET 47
773 /* Management TLV */
774 #define PTP_V2_MM_TLV_TYPE_OFFSET 48
775 #define PTP_V2_MM_TLV_MANAGEMENTID_OFFSET 52
776 #define PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET 52
778 /* TLV Types */
779 #define PTP_V2_TLV_TYPE_RESERVED 0x0000
780 #define PTP_V2_TLV_TYPE_MANAGEMENT 0x0001
781 #define PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS 0x0002
782 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION 0x0003
783 #define PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION 0x0004
784 #define PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION 0x0005
785 #define PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION 0x0006
786 #define PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION 0x0007
787 #define PTP_V2_TLV_TYPE_PATH_TRACE 0x0008
788 #define PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR 0x0009
789 #define PTP_V2_TLV_TYPE_AUTHENTICATION 0x2000
790 #define PTP_V2_TLV_TYPE_AUTHENTICATION_CHALLENGE 0x2001
791 #define PTP_V2_TLV_TYPE_SECURITY_ASSOCIATION_UPDATE 0x2002
792 #define PTP_V2_TLV_TYPE_CUM_FREQ_SCALE_FACTOR_OFFSET 0x2003
793 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_PROPAGATE 0x4000
794 #define PTP_V2_TLV_TYPE_ENHANCED_ACCURACY_METRICS 0x4001
795 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE 0x8000
796 #define PTP_V2_TLV_TYPE_L1_SYNC 0x8001
797 #define PTP_V2_TLV_TYPE_PORT_COMMUNICATION_AVAILABILITY 0x8002
798 #define PTP_V2_TLV_TYPE_PROTOCOL_ADDRESS 0x8003
799 #define PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_TIMING_DATA 0x8004
800 #define PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_COMPUTED_DATA 0x8005
801 #define PTP_V2_TLV_TYPE_SLAVE_TX_EVENT_TIMESTAMPS 0x8006
802 #define PTP_V2_TLV_TYPE_CUMULATIVE_RATE_RATIO 0x8007
803 #define PTP_V2_TLV_TYPE_PAD 0x8008
804 #define PTP_V2_TLV_TYPE_AUTHENTICATION2 0x8009
806 /* Signaling TLV Object IDs */
807 #define PTP_AS_TLV_OID_TYPE_802 0x0080C2
809 /* PTPv2 Management clockType Boolean[16] Bits mask */
810 #define CLOCKTYPE_ORDINARY_CLOCK 0x8000
811 #define CLOCKTYPE_BOUNDARY_CLOCK 0x4000
812 #define CLOCKTYPE_P2P_TC 0x2000
813 #define CLOCKTYPE_E2E_TC 0x1000
814 #define CLOCKTYPE_MANAGEMENT_NODE 0x0800
815 #define CLOCKTYPE_RESERVED 0x07FF
817 /* PTPv2 Management IDs */
818 #define PTP_V2_MM_ID_NULL_MANAGEMENT 0x0000
819 #define PTP_V2_MM_ID_CLOCK_DESCRIPTION 0x0001
820 #define PTP_V2_MM_ID_USER_DESCRIPTION 0x0002
821 #define PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE 0x0003
822 #define PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE 0x0004
823 #define PTP_V2_MM_ID_INITIALIZE 0x0005
824 #define PTP_V2_MM_ID_FAULT_LOG 0x0006
825 #define PTP_V2_MM_ID_FAULT_LOG_RESET 0x0007
826 #define PTP_V2_MM_ID_DEFAULT_DATA_SET 0x2000
827 #define PTP_V2_MM_ID_CURRENT_DATA_SET 0x2001
828 #define PTP_V2_MM_ID_PARENT_DATA_SET 0x2002
829 #define PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET 0x2003
830 #define PTP_V2_MM_ID_PORT_DATA_SET 0x2004
831 #define PTP_V2_MM_ID_PRIORITY1 0x2005
832 #define PTP_V2_MM_ID_PRIORITY2 0x2006
833 #define PTP_V2_MM_ID_DOMAIN 0x2007
834 #define PTP_V2_MM_ID_SLAVE_ONLY 0x2008
835 #define PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL 0x2009
836 #define PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT 0x200A
837 #define PTP_V2_MM_ID_LOG_SYNC_INTERVAL 0x200B
838 #define PTP_V2_MM_ID_VERSION_NUMBER 0x200C
839 #define PTP_V2_MM_ID_ENABLE_PORT 0x200D
840 #define PTP_V2_MM_ID_DISABLE_PORT 0x200E
841 #define PTP_V2_MM_ID_TIME 0x200F
842 #define PTP_V2_MM_ID_CLOCK_ACCURACY 0x2010
843 #define PTP_V2_MM_ID_UTC_PROPERTIES 0x2011
844 #define PTP_V2_MM_ID_TRACEABILITY_PROPERTIES 0x2012
845 #define PTP_V2_MM_ID_TIMESCALE_PROPERTIES 0x2013
846 #define PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE 0x2014
847 #define PTP_V2_MM_ID_PATH_TRACE_LIST 0x2015
848 #define PTP_V2_MM_ID_PATH_TRACE_ENABLE 0x2016
849 #define PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE 0x2017
850 #define PTP_V2_MM_ID_UNICAST_MASTER_TABLE 0x2018
851 #define PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE 0x2019
852 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE 0x201A
853 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED 0x201B
854 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE 0x201C
855 #define PTP_V2_MM_ID_ALTERNATE_MASTER 0x201D
856 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE 0x201E
857 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME 0x201F
858 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY 0x2020
859 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES 0x2021
860 #define PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED 0x3001
861 #define PTP_V2_MM_ID_MASTER_ONLY 0x3002
862 #define PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE 0x3003
863 #define PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET 0x3004
864 #define PTP_V2_MM_ID_TC_DEFAULT_DATA_SET 0x4000
865 #define PTP_V2_MM_ID_TC_PORT_DATA_SET 0x4001
866 #define PTP_V2_MM_ID_PRIMARY_DOMAIN 0x4002
867 #define PTP_V2_MM_ID_DELAY_MECHANISM 0x6000
868 #define PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
870 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNC_FLAGS1_OFFSET */
871 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK 0x1 << 8
872 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK 0x2 << 8
873 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK 0x4 << 8
874 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK 0x8 << 8
875 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RESERVED_BITMASK 0xF0 << 8
877 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNC_FLAGS2_OFFSET */
878 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK 0x1
879 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK 0x2
880 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK 0x4
881 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_BITMASK 0xF8
883 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNCEXT_FLAGS3_OFFSET */
884 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_TCT_BITMASK 0x1
885 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_POV_BITMASK 0x2
886 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_FOV_BITMASK 0x4
887 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_BITMASK 0xF8
889 /* Bitmasks for reserved values for standard and extended versions of L1_SYNC frames */
890 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK \
891 (PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RESERVED_BITMASK \
892 | PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_BITMASK)
893 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_ALL_BITMASK \
894 (PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK << 8 \
895 | PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_BITMASK)
897 /* Subtypes for the OUI_IEEE_802_1 organization ID (802.1AS) */
898 #define PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_INFORMATION_TLV 1
899 #define PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_MSG_INTERVAL_REQ_TLV 2
900 #define PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_CSN_TLV 3
901 #define PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_DRIFT_TRACKING_TLV 6
903 /* Subtypes for the OUI_IEEE_C37_238 organization ID */
904 #define PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C37238TLV 1 /* Defined in IEEE Std C37.238-2011 */
905 #define PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV 2 /* Defined in IEEE Std C37.238-2017 */
907 /* Subtypes for the PTP_V2_OE_ORG_ID_SMPTE organization ID */
908 #define PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV 1
910 /* Subtypes for the OUI_CERN organization ID */
911 #define PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV 0xdead01
913 /* Subtypes for ITU-T organization ID */
914 #define PTP_V2_INTERFACE_RATE_TLV 0x000002
916 /* MESSAGE ID for the PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV */
917 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_NULL_WR_TLV 0x0000
918 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_SLAVE_PRESENT 0x1000
919 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCK 0x1001
920 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCKED 0x1002
921 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE 0x1003
922 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED 0x1004
923 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_WR_MODE_ON 0x1005
924 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_ANN_SUFIX 0x2000
926 /* Bitmasks for WRTLV_FLAGS */
927 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK 0x3
928 #define PTP_V2_TLV_OE_CERN_WRFLAGS_CALIBRATED_BITMASK 0x4
929 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRMODEON_BITMASK 0x8
931 /* Values for PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK */
932 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_NON_WR 0
933 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_ONLY 1
934 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_S_ONLY 2
935 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_AND_S 3
937 #define PTP_V2_MAJORSDOID_ASPACKET_BITMASK 0x10
940 /**********************************************************/
941 /* flag-field-mask-definitions */
942 /**********************************************************/
943 #define PTP_V2_FLAGS_LI61_BITMASK 0x0001
944 #define PTP_V2_FLAGS_LI59_BITMASK 0x0002
945 #define PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK 0x0004
946 #define PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK 0x0008
947 #define PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK 0x0010
948 #define PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK 0x0020
949 #define PTP_V2_FLAGS_SYNCHRONIZATION_UNCERTAIN_BITMASK 0x0040
950 #define PTP_V2_FLAGS_ALTERNATE_BITMASK 0x0100
951 #define PTP_V2_FLAGS_TWO_STEP_BITMASK 0x0200
952 #define PTP_V2_FLAGS_UNICAST_BITMASK 0x0400
953 #define PTP_V2_FLAGS_SPECIFIC1_BITMASK 0x2000
954 #define PTP_V2_FLAGS_SPECIFIC2_BITMASK 0x4000
955 #define PTP_V2_FLAGS_SECURITY_BITMASK 0x8000
957 #define PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_DROP 0x01
958 #define PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_COLOR 0x02
960 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_CURRENT 0x01
961 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_NEXT 0x02
962 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_PREVIOUS 0x04
964 #define PTP_V2_FLAGS_OE_SMPTE_LEAP_SECOND_JUMP_CHANGE 0x01
966 /**********************************************************/
967 /* PTP v2 message ids (ptp messageid field) */
968 /**********************************************************/
969 #define PTP_V2_SYNC_MESSAGE 0x00
970 #define PTP_V2_DELAY_REQ_MESSAGE 0x01
971 #define PTP_V2_PEER_DELAY_REQ_MESSAGE 0x02
972 #define PTP_V2_PEER_DELAY_RESP_MESSAGE 0x03
973 #define PTP_V2_FOLLOWUP_MESSAGE 0x08
974 #define PTP_V2_DELAY_RESP_MESSAGE 0x09
975 #define PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE 0x0A
976 #define PTP_V2_ANNOUNCE_MESSAGE 0x0B
977 #define PTP_V2_SIGNALING_MESSAGE 0x0C
978 #define PTP_V2_MANAGEMENT_MESSAGE 0x0D
981 static const value_string ptp_v2_managementID_vals[] = {
982 {PTP_V2_MM_ID_NULL_MANAGEMENT, "NULL_MANAGEMENT"},
983 {PTP_V2_MM_ID_CLOCK_DESCRIPTION, "CLOCK_DESCRIPTION"},
984 {PTP_V2_MM_ID_USER_DESCRIPTION, "USER_DESCRIPTION"},
985 {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE, "SAVE_IN_NON_VOLATILE_STORAGE"},
986 {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE, "RESET_NON_VOLATILE_STORAGE"},
987 {PTP_V2_MM_ID_INITIALIZE, "INITIALIZE"},
988 {PTP_V2_MM_ID_FAULT_LOG, "FAULT_LOG"},
989 {PTP_V2_MM_ID_FAULT_LOG_RESET, "FAULT_LOG_RESET"},
990 {PTP_V2_MM_ID_DEFAULT_DATA_SET, "DEFAULT_DATA_SET"},
991 {PTP_V2_MM_ID_CURRENT_DATA_SET, "CURRENT_DATA_SET"},
992 {PTP_V2_MM_ID_PARENT_DATA_SET, "PARENT_DATA_SET"},
993 {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET, "TIME_PROPERTIES_DATA_SET"},
994 {PTP_V2_MM_ID_PORT_DATA_SET, "PORT_DATA_SET"},
995 {PTP_V2_MM_ID_PRIORITY1, "PRIORITY1"},
996 {PTP_V2_MM_ID_PRIORITY2, "PRIORITY2"},
997 {PTP_V2_MM_ID_DOMAIN, "DOMAIN"},
998 {PTP_V2_MM_ID_SLAVE_ONLY, "SLAVE_ONLY"},
999 {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL, "LOG_ANNOUNCE_INTERVAL"},
1000 {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT, "ANNOUNCE_RECEIPT_TIMEOUT"},
1001 {PTP_V2_MM_ID_LOG_SYNC_INTERVAL, "LOG_SYNC_INTERVAL"},
1002 {PTP_V2_MM_ID_VERSION_NUMBER, "VERSION_NUMBER"},
1003 {PTP_V2_MM_ID_ENABLE_PORT, "ENABLE_PORT"},
1004 {PTP_V2_MM_ID_DISABLE_PORT, "DISABLE_PORT"},
1005 {PTP_V2_MM_ID_TIME, "TIME"},
1006 {PTP_V2_MM_ID_CLOCK_ACCURACY, "CLOCK_ACCURACY"},
1007 {PTP_V2_MM_ID_UTC_PROPERTIES, "UTC_PROPERTIES"},
1008 {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES, "TRACEABILITY_PROPERTIES"},
1009 {PTP_V2_MM_ID_TIMESCALE_PROPERTIES, "TIMESCALE_PROPERTIES"},
1010 {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE, "UNICAST_NEGOTIATION_ENABLE"},
1011 {PTP_V2_MM_ID_PATH_TRACE_LIST, "PATH_TRACE_LIST"},
1012 {PTP_V2_MM_ID_PATH_TRACE_ENABLE, "PATH_TRACE_ENABLE"},
1013 {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE, "GRANDMASTER_CLUSTER_TABLE"},
1014 {PTP_V2_MM_ID_UNICAST_MASTER_TABLE, "UNICAST_MASTER_TABLE"},
1015 {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE, "UNICAST_MASTER_MAX_TABLE_SIZE"},
1016 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE, "ACCEPTABLE_MASTER_TABLE"},
1017 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED, "ACCEPTABLE_MASTER_TABLE_ENABLED"},
1018 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE, "ACCEPTABLE_MASTER_MAX_TABLE_SIZE"},
1019 {PTP_V2_MM_ID_ALTERNATE_MASTER, "ALTERNATE_MASTER"},
1020 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE, "ALTERNATE_TIME_OFFSET_ENABLE"},
1021 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME, "ALTERNATE_TIME_OFFSET_NAME"},
1022 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY, "ALTERNATE_TIME_OFFSET_MAX_KEY"},
1023 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES, "ALTERNATE_TIME_OFFSET_PROPERTIES"},
1024 {PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED, "EXTERNAL_PORT_CONFIGURATION_ENABLED"},
1025 {PTP_V2_MM_ID_MASTER_ONLY, "MASTER_ONLY"},
1026 {PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE, "HOLDOVER_UPGRADE_ENABLE"},
1027 {PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET, "EXT_PORT_CONFIG_PORT_DATA_SET"},
1028 {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET, "TC_DEFAULT_DATA_SET"},
1029 {PTP_V2_MM_ID_TC_PORT_DATA_SET, "TC_PORT_DATA_SET"},
1030 {PTP_V2_MM_ID_PRIMARY_DOMAIN, "PRIMARY_DOMAIN"},
1031 {PTP_V2_MM_ID_DELAY_MECHANISM, "DELAY_MECHANISM"},
1032 {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL, "LOG_MIN_PDELAY_REQ_INTERVAL"},
1033 {0, NULL}
1035 static value_string_ext ptp_v2_managementID_vals_ext = VALUE_STRING_EXT_INIT(ptp_v2_managementID_vals);
1037 /* same again but better readable text for info column */
1038 static const value_string ptp_v2_managementID_infocolumn_vals[] = {
1039 {PTP_V2_MM_ID_NULL_MANAGEMENT, "Null management"},
1040 {PTP_V2_MM_ID_CLOCK_DESCRIPTION, "Clock description"},
1041 {PTP_V2_MM_ID_USER_DESCRIPTION, "User description"},
1042 {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE, "Save in non volatile storage"},
1043 {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE, "Reset non volatile storage"},
1044 {PTP_V2_MM_ID_INITIALIZE, "Initialize"},
1045 {PTP_V2_MM_ID_FAULT_LOG, "Fault log"},
1046 {PTP_V2_MM_ID_FAULT_LOG_RESET, "Fault log reset"},
1047 {PTP_V2_MM_ID_DEFAULT_DATA_SET, "Default dataset"},
1048 {PTP_V2_MM_ID_CURRENT_DATA_SET, "Current dataset"},
1049 {PTP_V2_MM_ID_PARENT_DATA_SET, "Parent dataset"},
1050 {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET, "Time properties dataset"},
1051 {PTP_V2_MM_ID_PORT_DATA_SET, "Port dataset"},
1052 {PTP_V2_MM_ID_PRIORITY1, "Priority 1"},
1053 {PTP_V2_MM_ID_PRIORITY2, "Priority 2"},
1054 {PTP_V2_MM_ID_DOMAIN, "Domain"},
1055 {PTP_V2_MM_ID_SLAVE_ONLY, "Slave only"},
1056 {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL, "Log announce interval"},
1057 {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT, "Announce receipt timeout"},
1058 {PTP_V2_MM_ID_LOG_SYNC_INTERVAL, "Log sync interval"},
1059 {PTP_V2_MM_ID_VERSION_NUMBER, "Version number"},
1060 {PTP_V2_MM_ID_ENABLE_PORT, "Enable port"},
1061 {PTP_V2_MM_ID_DISABLE_PORT, "Disable port"},
1062 {PTP_V2_MM_ID_TIME, "Time"},
1063 {PTP_V2_MM_ID_CLOCK_ACCURACY, "Clock accuracy"},
1064 {PTP_V2_MM_ID_UTC_PROPERTIES, "UTC properties"},
1065 {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES, "Traceability properties"},
1066 {PTP_V2_MM_ID_TIMESCALE_PROPERTIES, "Timescale properties"},
1067 {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE, "Unicast negotiation enable"},
1068 {PTP_V2_MM_ID_PATH_TRACE_LIST, "Path trace list"},
1069 {PTP_V2_MM_ID_PATH_TRACE_ENABLE, "Path trace enable"},
1070 {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE, "Grandmaster cluster table"},
1071 {PTP_V2_MM_ID_UNICAST_MASTER_TABLE, "Unicast master table"},
1072 {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE, "Unicast master max table size"},
1073 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE, "Acceptable master table"},
1074 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED, "Acceptable master table enabled"},
1075 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE, "Acceptable master max table size"},
1076 {PTP_V2_MM_ID_ALTERNATE_MASTER, "Alternate master"},
1077 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE, "Alternate time offset enable"},
1078 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME, "Alternate time offset name"},
1079 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY, "Alternate time offset max key"},
1080 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES, "Alternate time offset properties"},
1081 {PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED, "External port configuration enabled"},
1082 {PTP_V2_MM_ID_MASTER_ONLY, "Master only"},
1083 {PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE, "Holdover upgrade enable"},
1084 {PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET, "External port config port data set"},
1085 {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET, "Transparent clock default dataset"},
1086 {PTP_V2_MM_ID_TC_PORT_DATA_SET, "Transparent clock port dataset"},
1087 {PTP_V2_MM_ID_PRIMARY_DOMAIN, "Primary domain"},
1088 {PTP_V2_MM_ID_DELAY_MECHANISM, "Delay mechanism"},
1089 {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL, "Log min pdelay req. interval"},
1090 {0, NULL}
1092 static value_string_ext ptp_v2_managementID_infocolumn_vals_ext = VALUE_STRING_EXT_INIT(ptp_v2_managementID_infocolumn_vals);
1094 static const value_string ptp_v2_TLV_type_vals[] = {
1095 {PTP_V2_TLV_TYPE_RESERVED, "Reserved"},
1096 {PTP_V2_TLV_TYPE_MANAGEMENT, "Management"},
1097 {PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS, "Management error status"},
1098 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION, "Organization extension"},
1099 {PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION, "Request unicast transmission"},
1100 {PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION, "Grant unicast transmission"},
1101 {PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION, "Cancel unicast transmission"},
1102 {PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION, "Acknowledge cancel unicast transmission"},
1103 {PTP_V2_TLV_TYPE_PATH_TRACE, "Path trace"},
1104 {PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR, "Alternate time offset indicator"},
1105 {PTP_V2_TLV_TYPE_AUTHENTICATION, "Authentication"},
1106 {PTP_V2_TLV_TYPE_AUTHENTICATION_CHALLENGE, "Authentication challenge"},
1107 {PTP_V2_TLV_TYPE_SECURITY_ASSOCIATION_UPDATE, "Security association update"},
1108 {PTP_V2_TLV_TYPE_CUM_FREQ_SCALE_FACTOR_OFFSET, "Cum. freq. scale factor offset"},
1109 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_PROPAGATE, "Organization extension propagate"},
1110 {PTP_V2_TLV_TYPE_ENHANCED_ACCURACY_METRICS, "Enhanced accuracy metrics"},
1111 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE, "Organization extension do not propagate"},
1112 {PTP_V2_TLV_TYPE_L1_SYNC, "L1 sync"},
1113 {PTP_V2_TLV_TYPE_PORT_COMMUNICATION_AVAILABILITY, "Port communication availability"},
1114 {PTP_V2_TLV_TYPE_PROTOCOL_ADDRESS, "Protocol address"},
1115 {PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_TIMING_DATA, "Slave rx sync timing data"},
1116 {PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_COMPUTED_DATA, "Slave rx sync computed data"},
1117 {PTP_V2_TLV_TYPE_SLAVE_TX_EVENT_TIMESTAMPS, "Slave tx event timestamps"},
1118 {PTP_V2_TLV_TYPE_CUMULATIVE_RATE_RATIO, "Cumulative rate ratio"},
1119 {PTP_V2_TLV_TYPE_PAD, "Pad"},
1120 {PTP_V2_TLV_TYPE_AUTHENTICATION2, "Authentication"},
1121 {0, NULL}
1123 static value_string_ext ptp_v2_TLV_type_vals_ext = VALUE_STRING_EXT_INIT(ptp_v2_TLV_type_vals);
1126 static const value_string ptp_v2_networkProtocol_vals[] = {
1127 {0x0000, "Reserved"},
1128 {0x0001, "UDP/IPv4"},
1129 {0x0002, "UDP/IPv6"},
1130 {0x0003, "IEEE 802.3"},
1131 {0x0004, "DeviceNet"},
1132 {0x0005, "ControlNet"},
1133 {0x0006, "PROFINET"},
1134 {0x0007, "Reserved"},
1135 {0xFFFE, "Unknown Protocol"},
1136 {0xFFFF, "Reserved"},
1137 {0, NULL}
1139 static value_string_ext ptp_v2_networkProtocol_vals_ext = VALUE_STRING_EXT_INIT(ptp_v2_networkProtocol_vals);
1142 static const value_string ptp_v2_messagetype_vals[] = {
1143 {PTP_V2_SYNC_MESSAGE, "Sync Message"},
1144 {PTP_V2_DELAY_REQ_MESSAGE, "Delay_Req Message"},
1145 {PTP_V2_PEER_DELAY_REQ_MESSAGE, "Peer_Delay_Req Message"},
1146 {PTP_V2_PEER_DELAY_RESP_MESSAGE, "Peer_Delay_Resp Message"},
1147 {PTP_V2_FOLLOWUP_MESSAGE, "Follow_Up Message"},
1148 {PTP_V2_DELAY_RESP_MESSAGE, "Delay_Resp Message"},
1149 {PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE, "Peer_Delay_Resp_Follow_Up Message"},
1150 {PTP_V2_ANNOUNCE_MESSAGE, "Announce Message"},
1151 {PTP_V2_SIGNALING_MESSAGE, "Signaling Message"},
1152 {PTP_V2_MANAGEMENT_MESSAGE, "Management Message"},
1153 {0, NULL }
1155 static value_string_ext ptp_v2_messagetype_vals_ext = VALUE_STRING_EXT_INIT(ptp_v2_messagetype_vals);
1157 static const value_string ptp_v2_clockAccuracy_vals[] = {
1158 {0x17, "The time is accurate to within 1 ps"},
1159 {0x18, "The time is accurate to within 2,5 ps"},
1160 {0x19, "The time is accurate to within 10 ps"},
1161 {0x1A, "The time is accurate to within 25 ps"},
1162 {0x1B, "The time is accurate to within 100 ps"},
1163 {0x1C, "The time is accurate to within 250 ps"},
1164 {0x1D, "The time is accurate to within 1 ns"},
1165 {0x1E, "The time is accurate to within 2,5 ns"},
1166 {0x1F, "The time is accurate to within 10 ns"},
1167 {0x20, "The time is accurate to within 25 ns"},
1168 {0x21, "The time is accurate to within 100 ns"},
1169 {0x22, "The time is accurate to within 250 ns"},
1170 {0x23, "The time is accurate to within 1 us"},
1171 {0x24, "The time is accurate to within 2,5 us"},
1172 {0x25, "The time is accurate to within 10 us"},
1173 {0x26, "The time is accurate to within 25 us"},
1174 {0x27, "The time is accurate to within 100 us"},
1175 {0x28, "The time is accurate to within 250 us"},
1176 {0x29, "The time is accurate to within 1 ms"},
1177 {0x2A, "The time is accurate to within 2,5 ms"},
1178 {0x2B, "The time is accurate to within 10 ms"},
1179 {0x2C, "The time is accurate to within 25 ms"},
1180 {0x2D, "The time is accurate to within 100 ms"},
1181 {0x2E, "The time is accurate to within 250 ms"},
1182 {0x2F, "The time is accurate to within 1 s"},
1183 {0x30, "The time is accurate to within 10 s"},
1184 {0x31, "The time is accurate to >10 s"},
1185 {0x32, "reserved"},
1186 {0x80, "For use by alternate PTP profiles"},
1187 {0xFE, "Accuracy Unknown"},
1188 {0xFF, "reserved"},
1189 {0, NULL}
1191 /* Exposed in packet-ptp.h */
1192 value_string_ext ptp_v2_clockAccuracy_vals_ext =
1193 VALUE_STRING_EXT_INIT(ptp_v2_clockAccuracy_vals);
1195 static const value_string ptp_v2_timeSource_vals[] = {
1196 {0x10, "ATOMIC_CLOCK"},
1197 {0x20, "GPS"},
1198 {0x30, "TERRESTRIAL_RADIO"},
1199 {0x39, "SERIAL_TIME_CODE"},
1200 {0x40, "PTP"},
1201 {0x50, "NTP"},
1202 {0x60, "HAND_SET"},
1203 {0x90, "OTHER"},
1204 {0xA0, "INTERNAL_OSCILLATOR"},
1205 {0xFF, "reserved"},
1206 {0, NULL}
1208 /* Exposed in packet-ptp.h */
1209 value_string_ext ptp_v2_timeSource_vals_ext =
1210 VALUE_STRING_EXT_INIT(ptp_v2_timeSource_vals);
1212 static const value_string ptp_v2_mm_action_vals[] = {
1213 {0x0, "GET"},
1214 {0x1, "SET"},
1215 {0x2, "RESPONSE"},
1216 {0x3, "COMMAND"},
1217 {0x4, "ACKNOWLEDGE"},
1218 {0, NULL}
1221 static const value_string ptp_v2_severityCode_vals[] = {
1222 {0x00, "Emergency: system is unusable"},
1223 {0x01, "Alert: immediate action needed"},
1224 {0x02, "Critical: critical conditions"},
1225 {0x03, "Error: error conditions"},
1226 {0x04, "Warning: warning conditions"},
1227 {0x05, "Notice: normal but significant condition"},
1228 {0x06, "Informational: informational messages"},
1229 {0x07, "Debug: debug-level messages"},
1230 {0x08, "Reserved"},
1231 {0xFF, "Reserved"},
1232 {0, NULL}
1234 static value_string_ext ptp_v2_severityCode_vals_ext =
1235 VALUE_STRING_EXT_INIT(ptp_v2_severityCode_vals);
1237 static const value_string ptp_v2_portState_vals[] = {
1238 {0x01, "INITIALIZING"},
1239 {0x02, "FAULTY"},
1240 {0x03, "DISABLED"},
1241 {0x04, "LISTENING"},
1242 {0x05, "PRE_MASTER"},
1243 {0x06, "MASTER"},
1244 {0x07, "PASSIVE"},
1245 {0x08, "UNCALIBRATED"},
1246 {0x09, "SLAVE"},
1247 {0, NULL}
1249 /* Exposed in packet-ptp.h */
1250 value_string_ext ptp_v2_portState_vals_ext =
1251 VALUE_STRING_EXT_INIT(ptp_v2_portState_vals);
1253 /* Exposed in packet-ptp.h */
1254 const value_string ptp_v2_delayMechanism_vals[] = {
1255 {0x01, "E2E"},
1256 {0x02, "P2P"},
1257 {0x03, "COMMON_P2P"},
1258 {0x04, "SPECIAL"},
1259 {0xFE, "NO_MECHANISM"},
1260 {0, NULL}
1263 static const value_string ptp_v2_managementErrorId_vals[] = {
1264 {0x0000, "Reserved"},
1265 {0x0001, "RESPONSE_TOO_BIG"},
1266 {0x0002, "NO_SUCH_ID"},
1267 {0x0003, "WRONG_LENGTH"},
1268 {0x0004, "WRONG_VALUE"},
1269 {0x0005, "NOT_SETABLE"},
1270 {0x0006, "NOT_SUPPORTED"},
1271 {0x0007, "Reserved"},
1272 {0xFFFE, "GENERAL_ERROR"},
1273 {0xFFFF, "Reserved"},
1274 {0, NULL}
1276 static value_string_ext ptp_v2_managementErrorId_vals_ext =
1277 VALUE_STRING_EXT_INIT(ptp_v2_managementErrorId_vals);
1279 static const value_string ptp_v2_org_802_1_subtype_vals[] = {
1280 {PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_INFORMATION_TLV, "Follow_Up information TLV"},
1281 {PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_MSG_INTERVAL_REQ_TLV, "Message interval request TLV"},
1282 {PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_CSN_TLV, "CSN TLV"},
1283 {PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_DRIFT_TRACKING_TLV, "Follow_Up drift tracking TLV"},
1284 {0, NULL}
1287 static const value_string ptp_v2_org_802_1_no_propagate_subtype_vals[] = {
1288 {PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_ORG_SUB_TYPE, "gPTP-capable TLV"},
1289 {PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_MESSSAGEINTERVAL_ORG_SUB_TYPE, "gPTP-capable message interval request TLV"},
1290 {0, NULL}
1293 static const value_string ptp_v2_org_ieee_c37_238_2017_subtype_vals[] = {
1294 {PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV, "IEEE_C37_238_2017 TLV"},
1295 {0, NULL}
1298 static const value_string ptp_v2_org_smpte_subtype_vals[] = {
1299 {PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV, "Version"},
1300 {0, NULL}
1303 static const value_string ptp_v2_org_cern_subtype_vals[] = {
1304 {PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV, "White Rabbit"},
1305 {0, NULL}
1308 static const value_string ptp_v2_org_itut_subtype_vals[] = {
1309 {PTP_V2_INTERFACE_RATE_TLV, "Interface Rate TLV"},
1310 {0, NULL}
1313 static const value_string ptp_v2_org_cern_wrMessageID_vals[] = {
1314 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_NULL_WR_TLV, "NULL_WR_TLV"},
1315 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_SLAVE_PRESENT,"SLAVE_PRESENT"},
1316 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCK, "LOCK"},
1317 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCKED, "LOCKED"},
1318 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE, "CALIBRATE"},
1319 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED, "CALIBRATED"},
1320 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_WR_MODE_ON, "WR_MODE_ON"},
1321 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_ANN_SUFIX, "ANN_SUFIX"},
1322 {0, NULL}
1325 static const value_string ptp_v2_tlv_oe_cern_wrFlags_wrConfig_vals[] = {
1326 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_NON_WR, "NON WR"},
1327 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_ONLY, "WR_M_ONLY"},
1328 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_S_ONLY, "WR_S_ONLY"},
1329 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_AND_S, "WR_M_AND_S"},
1330 {0, NULL}
1333 static const value_string ptp_v2_org_smpte_subtype_masterlockingstatus_vals[] = {
1334 {0, "Not in use"},
1335 {1, "Free Run"},
1336 {2, "Cold Locking"},
1337 {3, "Warm Locking"},
1338 {4, "Locked"},
1339 {0, NULL}
1342 /**********************************************************/
1343 /* MajorSdoId values for the PTPv2 */
1344 /**********************************************************/
1345 // 802.1AS 10.6.2.2.1 majorSdoId
1346 static const value_string ptpv2_majorsdoid_vals[] = {
1347 {0x1, "gPTP Domain"},
1348 {0x2, "CMLDS"},
1349 {0, NULL}
1352 /* END PTPv2 MajorSdoId values */
1354 /**********************************************************/
1355 /* Initialize the protocol and registered fields */
1356 /**********************************************************/
1358 static int hf_ptp_v2_majorsdoid;
1359 static int hf_ptp_v2_messagetype;
1360 static int hf_ptp_v2_minorversionptp;
1361 static int hf_ptp_v2_versionptp;
1362 static int hf_ptp_v2_messagelength;
1363 static int hf_ptp_v2_minorsdoid;
1364 static int hf_ptp_v2_domainnumber;
1365 static int hf_ptp_v2_flags;
1366 static int hf_ptp_v2_flags_alternatemaster;
1367 static int hf_ptp_v2_flags_twostep;
1368 static int hf_ptp_v2_flags_unicast;
1369 static int hf_ptp_v2_flags_specific1;
1370 static int hf_ptp_v2_flags_specific2;
1371 static int hf_ptp_v2_flags_security;
1372 static int hf_ptp_v2_flags_li61;
1373 static int hf_ptp_v2_flags_li59;
1374 static int hf_ptp_v2_flags_utcoffsetvalid;
1375 static int hf_ptp_v2_flags_ptptimescale;
1376 static int hf_ptp_v2_flags_timetraceable;
1377 static int hf_ptp_v2_flags_frequencytraceable;
1378 static int hf_ptp_v2_correction;
1379 static int hf_ptp_v2_correctionsubns;
1380 static int hf_ptp_v2_messagetypespecific;
1381 static int hf_ptp_v2_clockidentity;
1382 static int hf_ptp_v2_clockidentity_manuf;
1383 static int hf_ptp_v2_sourceportid;
1384 static int hf_ptp_v2_sequenceid;
1385 static int hf_ptp_v2_controlfield;
1386 static int hf_ptp_v2_controlfield_default;
1387 static int hf_ptp_v2_logmessageperiod;
1388 static int hf_ptp_v2_flags_synchronizationUncertain;
1391 /* Fields for PTP_Announce (=an) messages */
1392 /* static int hf_ptp_v2_an_origintimestamp; */ /* Field for seconds & nanoseconds */
1393 static int hf_ptp_v2_an_reserved1;
1394 static int hf_ptp_v2_an_reserved2;
1395 static int hf_ptp_v2_an_origintimestamp_seconds;
1396 static int hf_ptp_v2_an_origintimestamp_nanoseconds;
1397 static int hf_ptp_v2_an_origincurrentutcoffset;
1398 static int hf_ptp_v2_an_timesource;
1399 static int hf_ptp_v2_an_localstepsremoved;
1400 static int hf_ptp_v2_an_grandmasterclockidentity;
1401 static int hf_ptp_v2_an_grandmasterclockclass;
1402 static int hf_ptp_v2_an_grandmasterclockaccuracy;
1403 static int hf_ptp_v2_an_grandmasterclockvariance;
1404 static int hf_ptp_v2_an_priority1;
1405 static int hf_ptp_v2_an_priority2;
1408 /* Fields for general TLVs handling */
1409 static int hf_ptp_tlv_tlvtype;
1410 static int hf_ptp_tlv_lengthfield;
1411 static int hf_ptp_tlv_unparsed_payload;
1412 /* Fields for the ORGANIZATION_EXTENSION TLV */
1413 static int hf_ptp_tlv_oe_organizationid;
1414 static int hf_ptp_tlv_oe_organizationsubtype;
1415 static int hf_ptp_tlv_oe_organizationsubtype_802_1;
1416 static int hf_ptp_tlv_oe_organizationsubtype_802_1_no_propagate;
1418 /* Fields for PTP_Announce TLVs */
1419 static int hf_ptp_v2_oe_tlv_ieee_c37_238_2017_organizationsubtype;
1420 static int hf_ptp_v2_oe_tlv_datafield;
1422 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
1423 static int hf_ptp_v2_an_tlv_oe_cern_subtype;
1424 static int hf_ptp_v2_an_tlv_oe_cern_wrMessageID;
1425 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags;
1426 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig;
1427 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated;
1428 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn;
1430 /* Fields for IEEE_C37_238 TLV (OE TLV subtype) */
1431 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid;
1432 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy;
1433 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy;
1434 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved;
1436 /* Additional Fields for IEEE_C37_238-2017 TLV (OE TLV subtype) */
1437 static int hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved;
1438 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy;
1440 /* Fields for SMPTE TLV (OE TLV subtype) */
1441 static int hf_ptp_v2_oe_tlv_smpte_subtype;
1442 static int hf_ptp_v2_oe_tlv_subtype_smpte_data;
1443 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate;
1444 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator;
1445 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator;
1446 static int hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus;
1447 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags;
1448 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop;
1449 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color;
1450 static int hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset;
1451 static int hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds;
1452 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump;
1453 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam;
1454 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam;
1455 static int hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset;
1456 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving;
1457 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current;
1458 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next;
1459 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous;
1460 static int hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump;
1461 static int hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change;
1462 /* Fields for the ALTERNATE_TIME_OFFSET_INDICATOR TLV */
1463 static int hf_ptp_v2_atoi_tlv_keyfield;
1464 static int hf_ptp_v2_atoi_tlv_currentoffset;
1465 static int hf_ptp_v2_atoi_tlv_jumpseconds;
1466 static int hf_ptp_v2_atoi_tlv_timeofnextjump;
1467 static int hf_ptp_v2_atoi_tlv_displayname;
1468 static int hf_ptp_v2_atoi_tlv_displayname_length;
1469 /* Field for the PATH TRACE TLV */
1470 static int hf_ptp_v2_an_tlv_pathsequence;
1472 /* Fields for an undissected TLV */
1473 static int hf_ptp_v2_an_tlv_data;
1475 /* Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages */
1476 /* static int hf_ptp_v2_sdr_origintimestamp; */ /* Field for seconds & nanoseconds */
1477 static int hf_ptp_v2_sdr_origintimestamp_seconds;
1478 static int hf_ptp_v2_sdr_origintimestamp_nanoseconds;
1479 static int hf_ptp_v2_sync_reserved;
1482 /* Fields for PTP_Follow_Up (=fu) messages */
1483 /* static int hf_ptp_v2_fu_preciseorigintimestamp; */ /* Field for seconds & nanoseconds */
1484 static int hf_ptp_v2_fu_preciseorigintimestamp_seconds;
1485 static int hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds;
1486 static int hf_ptp_v2_fu_preciseorigintimestamp_32bit;
1487 /* Fields for the Follow_Up Information TLV */
1488 static int hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset;
1489 static int hf_ptp_as_fu_tlv_cumulative_rate_ratio; /* Remove scale and offset from above */
1490 static int hf_ptp_as_fu_tlv_gm_base_indicator;
1491 static int hf_ptp_as_fu_tlv_last_gm_phase_change;
1492 static int hf_ptp_as_fu_tlv_scaled_last_gm_freq_change;
1493 /* Fields for the Drift_Tracking TLV */
1494 static int hf_ptp_as_dt_tlv_sync_egress_timestamp_seconds;
1495 static int hf_ptp_as_dt_tlv_sync_egress_timestamp_fractional_nanoseconds;
1496 static int hf_ptp_as_dt_tlv_sync_grandmaster_identity;
1497 static int hf_ptp_as_dt_tlv_sync_steps_removed;
1498 static int hf_ptp_as_dt_tlv_rate_ratio_drift;
1499 static int hf_ptp_as_dt_tlv_rate_ratio_drift_ppm;
1501 /* Fields for PTP_DelayResponse (=dr) messages */
1502 /* static int hf_ptp_v2_dr_receivetimestamp; */ /* Field for seconds & nanoseconds */
1503 static int hf_ptp_v2_dr_receivetimestamp_seconds;
1504 static int hf_ptp_v2_dr_receivetimestamp_nanoseconds;
1505 static int hf_ptp_v2_dr_requestingportidentity;
1506 static int hf_ptp_v2_dr_requestingsourceportid;
1509 /* Fields for PTP_PDelayRequest (=pdrq) messages */
1510 /* static int hf_ptp_v2_pdrq_origintimestamp; */ /* Field for seconds & nanoseconds */
1511 static int hf_ptp_v2_pdrq_origintimestamp_seconds;
1512 static int hf_ptp_v2_pdrq_origintimestamp_nanoseconds;
1513 static int hf_ptp_v2_pdrq_reserved;
1516 /* Fields for PTP_PDelayResponse (=pdrs) messages */
1517 /* static int hf_ptp_v2_pdrs_requestreceipttimestamp; */ /* Field for seconds & nanoseconds */
1518 static int hf_ptp_v2_pdrs_requestreceipttimestamp_seconds;
1519 static int hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds;
1520 static int hf_ptp_v2_pdrs_requestingportidentity;
1521 static int hf_ptp_v2_pdrs_requestingsourceportid;
1524 /* Fields for PTP_PDelayResponseFollowUp (=pdfu) messages */
1525 /* static int hf_ptp_v2_pdfu_responseorigintimestamp; */ /* Field for seconds & nanoseconds */
1526 static int hf_ptp_v2_pdfu_responseorigintimestamp_seconds;
1527 static int hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds;
1528 static int hf_ptp_v2_pdfu_requestingportidentity;
1529 static int hf_ptp_v2_pdfu_requestingsourceportid;
1532 /* Fields for PTP_Signaling (=sig) messages */
1533 static int hf_ptp_v2_sig_targetportidentity;
1534 static int hf_ptp_v2_sig_targetportid;
1535 static int hf_ptp_v2_sig_tlv_data;
1536 static int hf_ptp_v2_sig_tlv_messageType;
1537 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod;
1538 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod_period;
1539 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate;
1540 static int hf_ptp_v2_sig_tlv_durationField;
1541 static int hf_ptp_v2_sig_tlv_renewalInvited;
1542 static int hf_ptp_v2_sig_tlv_maintainRequest;
1543 static int hf_ptp_v2_sig_tlv_maintainGrant;
1544 static int hf_ptp_v2_sig_tlv_reserved;
1546 /* Fields for the Message Interval Request TLV */
1547 static int hf_ptp_as_sig_tlv_link_delay_interval;
1548 static int hf_ptp_as_sig_tlv_time_sync_interval;
1549 static int hf_ptp_as_sig_tlv_announce_interval;
1550 static int hf_ptp_as_sig_tlv_flags;
1551 static int hf_ptp_as_sig_tlv_flags_comp_rate_ratio;
1552 static int hf_ptp_as_sig_tlv_flags_comp_mean_link_delay;
1553 static int hf_ptp_as_sig_tlv_flags_one_step_receive_capable;
1554 static int hf_ptp_as_sig_tlv_gptp_capable_message_interval;
1555 static int hf_ptp_as_sig_tlv_gptp_capable_reserved;
1556 static int hf_ptp_as_sig_tlv_reserved;
1558 /* Fields for 802.1AS CSN TLV */
1559 static int hf_ptp_as_csn_upstream_tx_time;
1560 static int hf_ptp_as_csn_neighbor_rate_ratio;
1561 static int hf_ptp_as_csn_mean_link_delay;
1562 static int hf_ptp_as_csn_delay_asymmetry;
1563 static int hf_ptp_as_csn_domain_number;
1565 /* Fields for L1SYNC TLV */
1566 static int hf_ptp_v2_sig_tlv_flags2;
1567 static int hf_ptp_v2_sig_tlv_flags3;
1568 static int hf_ptp_v2_sig_tlv_l1sync_flags2_reserved;
1569 static int hf_ptp_v2_sig_tlv_l1sync_flags3_reserved;
1570 static int hf_ptp_v2_sig_tlv_l1sync_flags2_tcr;
1571 static int hf_ptp_v2_sig_tlv_l1sync_flags3_tcr;
1572 static int hf_ptp_v2_sig_tlv_l1sync_flags2_rcr;
1573 static int hf_ptp_v2_sig_tlv_l1sync_flags3_rcr;
1574 static int hf_ptp_v2_sig_tlv_l1sync_flags2_cr;
1575 static int hf_ptp_v2_sig_tlv_l1sync_flags3_cr;
1576 static int hf_ptp_v2_sig_tlv_l1sync_flags2_ope;
1577 static int hf_ptp_v2_sig_tlv_l1sync_flags3_ope;
1578 static int hf_ptp_v2_sig_tlv_l1sync_flags2_itc;
1579 static int hf_ptp_v2_sig_tlv_l1sync_flags3_itc;
1580 static int hf_ptp_v2_sig_tlv_l1sync_flags2_irc;
1581 static int hf_ptp_v2_sig_tlv_l1sync_flags3_irc;
1582 static int hf_ptp_v2_sig_tlv_l1sync_flags2_ic;
1583 static int hf_ptp_v2_sig_tlv_l1sync_flags3_ic;
1584 static int hf_ptp_v2_sig_tlv_l1sync_flags3_tct;
1585 static int hf_ptp_v2_sig_tlv_l1sync_flags3_pov;
1586 static int hf_ptp_v2_sig_tlv_l1sync_flags3_fov;
1587 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns;
1588 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns;
1589 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s;
1590 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns;
1591 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns;
1592 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns;
1593 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s;
1594 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns;
1596 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
1597 static int hf_ptp_v2_sig_oe_tlv_cern_subtype;
1598 static int hf_ptp_v2_sig_oe_tlv_cern_wrMessageID;
1600 static int hf_ptp_v2_sig_oe_tlv_cern_calSendPattern;
1601 static int hf_ptp_v2_sig_oe_tlv_cern_calRety;
1602 static int hf_ptp_v2_sig_oe_tlv_cern_calPeriod;
1603 static int hf_ptp_v2_sig_oe_tlv_cern_deltaTx;
1604 static int hf_ptp_v2_sig_oe_tlv_cern_deltaRx;
1606 static int hf_ptp_v2_sig_oe_tlv_itut_subtype;
1607 static int hf_ptp_v2_sig_tlv_interface_bit_period;
1608 static int hf_ptp_v2_sig_tlv_numberbits_before_timestamp;
1609 static int hf_ptp_v2_sig_tlv_numberbits_after_timestamp;
1611 /* Fields for PTP_Management (=mm) messages */
1612 static int hf_ptp_v2_mm_targetportidentity;
1613 static int hf_ptp_v2_mm_targetportid;
1614 static int hf_ptp_v2_mm_startingboundaryhops;
1615 static int hf_ptp_v2_mm_boundaryhops;
1616 static int hf_ptp_v2_mm_action;
1617 static int hf_ptp_v2_mm_reserved1;
1618 static int hf_ptp_v2_mm_reserved2;
1620 /* management TLV */
1621 static int hf_ptp_v2_mm_tlvType;
1622 static int hf_ptp_v2_mm_lengthField;
1623 static int hf_ptp_v2_mm_managementId;
1624 static int hf_ptp_v2_mm_data;
1625 /* Management dataField */
1627 static int hf_ptp_v2_mm_clockType;
1628 static int hf_ptp_v2_mm_clockType_ordinaryClock;
1629 static int hf_ptp_v2_mm_clockType_boundaryClock;
1630 static int hf_ptp_v2_mm_clockType_p2p_transparentClock;
1631 static int hf_ptp_v2_mm_clockType_e2e_transparentClock;
1632 static int hf_ptp_v2_mm_clockType_managementNode;
1633 static int hf_ptp_v2_mm_clockType_reserved;
1634 static int hf_ptp_v2_mm_physicalLayerProtocol;
1635 static int hf_ptp_v2_mm_physicalLayerProtocol_length;
1636 static int hf_ptp_v2_mm_physicalAddressLength;
1637 static int hf_ptp_v2_mm_physicalAddress;
1638 static int hf_ptp_v2_mm_protocolAddress;
1639 static int hf_ptp_v2_mm_protocolAddress_networkProtocol;
1640 static int hf_ptp_v2_mm_protocolAddress_length;
1641 static int hf_ptp_v2_mm_manufacturerIdentity;
1643 static int hf_ptp_v2_mm_reserved;
1644 static int hf_ptp_v2_mm_productDescription;
1645 static int hf_ptp_v2_mm_productDescription_length;
1646 static int hf_ptp_v2_mm_revisionData;
1647 static int hf_ptp_v2_mm_revisionData_length;
1648 static int hf_ptp_v2_mm_userDescription;
1649 static int hf_ptp_v2_mm_userDescription_length;
1650 static int hf_ptp_v2_mm_profileIdentity;
1651 static int hf_ptp_v2_mm_pad;
1653 static int hf_ptp_v2_mm_numberOfFaultRecords;
1654 /* static int hf_ptp_v2_mm_faultRecord; */
1656 static int hf_ptp_v2_mm_initializationKey;
1657 static int hf_ptp_v2_mm_severityCode;
1658 static int hf_ptp_v2_mm_faultRecordLength;
1659 /* static int hf_ptp_v2_mm_faultTime; */
1660 static int hf_ptp_v2_mm_faultTime_s;
1661 static int hf_ptp_v2_mm_faultTime_ns;
1662 static int hf_ptp_v2_mm_faultValue;
1663 static int hf_ptp_v2_mm_faultName;
1664 static int hf_ptp_v2_mm_faultName_length;
1665 static int hf_ptp_v2_mm_faultValue_length;
1666 static int hf_ptp_v2_mm_faultDescription;
1667 static int hf_ptp_v2_mm_faultDescription_length;
1668 static int hf_ptp_v2_mm_currentTime_s;
1669 static int hf_ptp_v2_mm_currentTime_ns;
1670 static int hf_ptp_v2_mm_clockAccuracy;
1671 static int hf_ptp_v2_mm_priority1;
1672 static int hf_ptp_v2_mm_priority2;
1673 static int hf_ptp_v2_mm_dds_SO;
1674 static int hf_ptp_v2_mm_TSC;
1675 static int hf_ptp_v2_mm_numberPorts;
1676 static int hf_ptp_v2_mm_clockclass;
1677 static int hf_ptp_v2_mm_clockaccuracy;
1678 static int hf_ptp_v2_mm_clockvariance;
1679 static int hf_ptp_v2_mm_clockidentity;
1680 static int hf_ptp_v2_mm_domainNumber;
1681 static int hf_ptp_v2_mm_SO;
1682 static int hf_ptp_v2_mm_stepsRemoved;
1683 static int hf_ptp_v2_mm_parentIdentity;
1684 static int hf_ptp_v2_mm_parentPort;
1685 static int hf_ptp_v2_mm_parentStats;
1686 static int hf_ptp_v2_mm_observedParentOffsetScaledLogVariance;
1687 static int hf_ptp_v2_mm_observedParentClockPhaseChangeRate;
1688 static int hf_ptp_v2_mm_grandmasterPriority1;
1689 static int hf_ptp_v2_mm_grandmasterPriority2;
1690 static int hf_ptp_v2_mm_grandmasterclockclass;
1691 static int hf_ptp_v2_mm_grandmasterclockaccuracy;
1692 static int hf_ptp_v2_mm_grandmasterclockvariance;
1693 static int hf_ptp_v2_mm_grandmasterIdentity;
1694 static int hf_ptp_v2_mm_currentUtcOffset;
1695 static int hf_ptp_v2_mm_LI_61;
1696 static int hf_ptp_v2_mm_LI_59;
1697 static int hf_ptp_v2_mm_UTCV;
1698 static int hf_ptp_v2_mm_PTP;
1699 static int hf_ptp_v2_mm_TTRA;
1700 static int hf_ptp_v2_mm_FTRA;
1701 static int hf_ptp_v2_mm_timesource;
1702 static int hf_ptp_v2_mm_offset_ns;
1703 static int hf_ptp_v2_mm_pathDelay_ns;
1704 static int hf_ptp_v2_mm_offset_subns;
1705 static int hf_ptp_v2_mm_pathDelay_subns;
1706 static int hf_ptp_v2_mm_PortNumber;
1707 static int hf_ptp_v2_mm_portState;
1708 static int hf_ptp_v2_mm_logMinDelayReqInterval;
1709 static int hf_ptp_v2_mm_peerMeanPathDelay_ns;
1710 static int hf_ptp_v2_mm_peerMeanPathDelay_subns;
1711 static int hf_ptp_v2_mm_logAnnounceInterval;
1712 static int hf_ptp_v2_mm_announceReceiptTimeout;
1713 static int hf_ptp_v2_mm_logSyncInterval;
1714 static int hf_ptp_v2_mm_delayMechanism;
1715 static int hf_ptp_v2_mm_logMinPdelayReqInterval;
1716 static int hf_ptp_v2_mm_versionNumber;
1717 static int hf_ptp_v2_mm_primaryDomain;
1718 static int hf_ptp_v2_mm_faultyFlag;
1719 static int hf_ptp_v2_mm_managementErrorId;
1720 static int hf_ptp_v2_mm_displayData;
1721 static int hf_ptp_v2_mm_displayData_length;
1722 static int hf_ptp_v2_mm_ucEN;
1723 static int hf_ptp_v2_mm_ptEN;
1724 static int hf_ptp_v2_mm_atEN;
1725 static int hf_ptp_v2_mm_keyField;
1726 static int hf_ptp_v2_mm_displayName;
1727 static int hf_ptp_v2_mm_displayName_length;
1728 static int hf_ptp_v2_mm_maxKey;
1729 static int hf_ptp_v2_mm_currentOffset;
1730 static int hf_ptp_v2_mm_jumpSeconds;
1731 static int hf_ptp_v2_mm_nextjumpSeconds;
1732 static int hf_ptp_v2_mm_logAlternateMulticastSyncInterval;
1733 static int hf_ptp_v2_mm_numberOfAlternateMasters;
1734 static int hf_ptp_v2_mm_transmitAlternateMulticastSync;
1736 /* Fields for analysis code*/
1737 static int hf_ptp_v2_analysis_sync_to_followup;
1738 static int hf_ptp_v2_analysis_followup_to_sync;
1739 static int hf_ptp_v2_analysis_pdelayreq_to_pdelayres;
1740 static int hf_ptp_v2_analysis_pdelayres_to_pdelayreq;
1741 static int hf_ptp_v2_analysis_pdelayres_to_pdelayfup;
1742 static int hf_ptp_v2_analysis_pdelayfup_to_pdelayres;
1743 static int hf_ptp_v2_analysis_sync_timestamp;
1744 static int hf_ptp_v2_analysis_sync_timestamp_seconds;
1745 static int hf_ptp_v2_analysis_sync_timestamp_nanoseconds;
1746 static int hf_ptp_v2_analysis_sync_period;
1747 static int hf_ptp_v2_analysis_sync_rateRatio;
1748 static int hf_ptp_v2_analysis_sync_rateRatio_ppm;
1749 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled;
1750 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled_seconds;
1751 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled_nanoseconds;
1752 static int hf_ptp_v2_analysis_pdelay_mpd_scaled;
1753 static int hf_ptp_v2_analysis_pdelay_period;
1754 static int hf_ptp_v2_analysis_pdelay_neighRateRatio;
1755 static int hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm;
1757 /* Initialize the subtree pointers */
1758 static int ett_ptp_v2;
1759 static int ett_ptp_v2_flags;
1760 static int ett_ptp_v2_clockidentity;
1761 static int ett_ptp_v2_correction;
1762 static int ett_ptp_v2_time;
1763 static int ett_ptp_v2_time2;
1764 static int ett_ptp_v2_managementData;
1765 static int ett_ptp_v2_clockType;
1766 static int ett_ptp_v2_physicalLayerProtocol;
1767 static int ett_ptp_v2_protocolAddress;
1768 static int ett_ptp_v2_faultRecord;
1769 static int ett_ptp_v2_ptptext;
1770 static int ett_ptp_v2_timeInterval;
1771 static int ett_ptp_v2_tlv;
1772 static int ett_ptp_v2_tlv_log_period;
1773 static int ett_ptp_v2_sig_l1sync_flags;
1774 static int ett_ptp_as_sig_tlv_flags;
1775 static int ett_ptp_oe_wr_flags;
1776 static int ett_ptp_oe_smpte_data;
1777 static int ett_ptp_oe_smpte_framerate;
1778 static int ett_ptp_oe_smpte_timeaddress;
1779 static int ett_ptp_oe_smpte_daylightsaving;
1780 static int ett_ptp_oe_smpte_leapsecondjump;
1781 static int ett_ptp_analysis_timestamp;
1782 static int ett_ptp_analysis_mean_propagation_delay;
1784 /* static int ett_ptp_v2_timesource;
1785 static int ett_ptp_v2_priority; */
1786 static int ett_ptp_v2_majorsdoid;
1788 static expert_field ei_ptp_v2_msg_len_too_large;
1789 static expert_field ei_ptp_v2_msg_len_too_small;
1790 static expert_field ei_ptp_v2_sync_no_followup;
1791 static expert_field ei_ptp_v2_sync_no_fup_tlv;
1792 static expert_field ei_ptp_v2_sync_with_fup_tlv;
1793 static expert_field ei_ptp_v2_followup_no_sync;
1794 static expert_field ei_ptp_v2_followup_no_tlv;
1795 static expert_field ei_ptp_v2_pdreq_no_pdresp;
1796 static expert_field ei_ptp_v2_pdresp_no_pdreq;
1797 static expert_field ei_ptp_v2_pdresp_no_pdfup;
1798 static expert_field ei_ptp_v2_pdresp_twostep;
1799 static expert_field ei_ptp_v2_pdfup_no_pdresp;
1800 static expert_field ei_ptp_v2_period_invalid;
1801 static expert_field ei_ptp_v2_as_tlv_in_non_as;
1803 /* END Definitions and fields for PTPv2 dissection. */
1806 * Analysis
1808 * The analysis code cannot access the internal data of the PTP participants and
1809 * therefore the values calculated are based on the capture timestamps.
1813 /* Config for Analysis features */
1814 static bool ptp_analyze_messages = true;
1815 static bool ptp_analyze_messages_with_minor_version = false;
1816 static unsigned ptp_analysis_max_consecutive_delta = 10;
1818 /* Definitions for Analysis features */
1820 /* 1588 defines related messages (with matching seqIds) should be sent "as soon as possible".
1821 * 802.1AS formalizes a requirement of max 10ms for the same in "Annex B - Performance requirements".
1822 * A 1 second threshold gives good margin, while not causing analysis issues in case of resets.
1823 * In case of rapid sequence number resets <1s apart, incorrect message associations can still happen.
1825 #define PTP_ANALYSIS_MAX_ALLOWED_DELTA_SECS 1.0
1827 /* Allow to register TLV subdissectors */
1828 static dissector_table_t ptpv2_tlv_org_id_subdissector_table;
1830 typedef struct ptp_frame_info_sync {
1831 uint32_t sync_frame_num;
1832 uint32_t fup_frame_num;
1833 bool sync_two_step;
1835 nstime_t sync_ts;
1837 uint64_t timestamp_s;
1838 uint32_t timestamp_ns;
1839 int64_t correction_ns;
1840 uint16_t correction_subns;
1842 bool calculated_timestamp_valid;
1843 nstime_t calculated_timestamp;
1845 bool syncInterval_valid;
1846 double syncInterval;
1848 bool syncRateRatio_valid;
1849 double syncRateRatio;
1850 int32_t syncRateRatio_ppm;
1851 } ptp_frame_info_sync_t;
1853 typedef struct ptp_frame_info_pdelay {
1854 uint32_t pdelay_req_frame_num;
1855 uint32_t pdelay_res_frame_num;
1856 uint32_t pdelay_fup_frame_num;
1857 bool pdelay_res_two_step;
1859 nstime_t pdelay_req_ts;
1861 uint64_t pdelay_req_recv_ts_s;
1862 uint32_t pdelay_req_recv_ts_ns;
1864 uint64_t pdelay_res_send_ts_s;
1865 uint32_t pdelay_res_send_ts_ns;
1867 nstime_t pdelay_res_ts;
1869 nstime_t mean_propagation_delay_unscaled;
1870 double mean_propagation_delay_scaled;
1872 bool pdelayInterval_valid;
1873 double pdelayInterval;
1875 bool neighborRateRatio_valid;
1876 double neighborRateRatio;
1877 int32_t neighborRateRatio_ppm;
1878 } ptp_frame_info_pdelay_t;
1880 typedef struct ptp_frame_info {
1881 uint8_t messagetype;
1882 union {
1883 ptp_frame_info_sync_t sync;
1884 ptp_frame_info_pdelay_t pdelay;
1887 struct ptp_frame_info *prev;
1888 nstime_t ref_time;
1889 } ptp_frame_info_t;
1891 #define PTP_FRAME_INFO_SYNC_SEEN(fi) ((fi) != NULL && (fi)->messagetype == PTP_V2_SYNC_MESSAGE && (fi)->sync.sync_frame_num != 0)
1892 #define PTP_FRAME_INFO_SYNC_COMPLETE(fi) ((fi) != NULL && (fi)->messagetype == PTP_V2_SYNC_MESSAGE && (fi)->sync.sync_frame_num != 0 && (fi)->sync.fup_frame_num != 0)
1893 #define PTP_FRAME_INFO_PDELAY_REQ_SEEN(fi) ((fi) != NULL && (fi)->messagetype == PTP_V2_PEER_DELAY_REQ_MESSAGE && (fi)->pdelay.pdelay_req_frame_num != 0)
1894 #define PTP_FRAME_INFO_PDELAY_COMPLETE(fi) ((fi) != NULL && (fi)->messagetype == PTP_V2_PEER_DELAY_REQ_MESSAGE && (fi)->pdelay.pdelay_req_frame_num != 0 && (fi)->pdelay.pdelay_res_frame_num != 0 && (fi)->pdelay.pdelay_fup_frame_num != 0)
1896 typedef struct ptp_clock_info {
1897 wmem_map_t *frames;
1898 } ptp_clock_info_t;
1900 static wmem_map_t *ptp_clocks;
1903 * PTP major ver 4 bit
1904 * PTP min ver 4 bit (shift!)
1905 * MajorSdoId 4 bit
1906 * MessageType 4 bit (shift!)
1907 * MinorSdoId 1 Byte
1908 * Domain 1 Byte
1909 * PortID 2 Byte
1910 * SeqID 2 Byte
1912 static uint64_t
1913 calculate_frame_key(uint8_t ptp_major, uint8_t ptp_minor, uint8_t majorsdoid, uint8_t minorsdoid, uint8_t messagetype, uint8_t domain, uint16_t portid, uint16_t seqid) {
1914 if (!ptp_analyze_messages_with_minor_version) {
1915 ptp_minor = 0;
1918 DISSECTOR_ASSERT(ptp_minor % 16 == 0);
1919 DISSECTOR_ASSERT(ptp_major <= 15);
1920 DISSECTOR_ASSERT(majorsdoid % 16 == 0);
1921 DISSECTOR_ASSERT(messagetype <= 15);
1923 uint64_t ret = (uint64_t)ptp_minor << 56 | (uint64_t)ptp_major << 56 | (uint64_t)majorsdoid << 48 | (uint64_t)messagetype << 48 | (uint64_t)minorsdoid << 40 | (uint64_t)domain << 32 |
1924 (uint64_t)portid << 16 | (uint64_t)seqid;
1925 return ret;
1928 static ptp_frame_info_t *
1929 get_frame_info_and_opt_create(packet_info *pinfo, uint8_t ptp_major, uint8_t ptp_minor, uint8_t majorsdoid, uint8_t minorsdoid, uint8_t messagetype, uint8_t domain, uint64_t clockidentity, uint16_t portid, uint16_t seqid, bool create_missing, double delta_cutoff) {
1930 DISSECTOR_ASSERT(ptp_clocks != NULL);
1932 ptp_clock_info_t *clock_info = (ptp_clock_info_t *)wmem_map_lookup(ptp_clocks, &clockidentity);
1934 if (clock_info == NULL)
1936 uint64_t* new_clockid = wmem_new(wmem_file_scope(), uint64_t);
1937 *new_clockid = clockidentity;
1938 clock_info = wmem_new0(wmem_file_scope(), ptp_clock_info_t);
1939 clock_info->frames = NULL;
1940 wmem_map_insert(ptp_clocks, new_clockid, clock_info);
1943 if (clock_info->frames == NULL)
1945 clock_info->frames = wmem_map_new(wmem_file_scope(), g_int64_hash, g_int64_equal);
1948 uint64_t key2 = calculate_frame_key(ptp_major, ptp_minor, majorsdoid, minorsdoid, messagetype, domain, portid, seqid);
1949 ptp_frame_info_t *tmp = (ptp_frame_info_t *)wmem_map_lookup(clock_info->frames, &key2);
1951 if (tmp != NULL)
1953 /* Is this a real match or did have wrapped the ptp seqid? */
1954 /* This check also handles sequenceIds resets due to restarts. */
1955 nstime_t delta_time;
1956 nstime_delta(&delta_time, &(pinfo->abs_ts), &(tmp->ref_time));
1957 double delta_secs = nstime_to_sec(&delta_time);
1959 if (fabs(delta_secs) > delta_cutoff)
1961 /* Not our match! */
1962 tmp = NULL;
1966 if (tmp == NULL && create_missing)
1968 uint64_t* new_key2 = wmem_new(wmem_file_scope(), uint64_t);
1969 *new_key2 = key2;
1970 tmp = wmem_new0(wmem_file_scope(), ptp_frame_info_t);
1971 tmp->prev = NULL;
1972 if (messagetype == PTP_V2_PEER_DELAY_REQ_MESSAGE) {
1973 tmp->pdelay.neighborRateRatio_valid = false;
1975 wmem_map_insert(clock_info->frames, new_key2, tmp);
1977 nstime_copy(&(tmp->ref_time), &(pinfo->abs_ts));
1980 return tmp;
1983 static ptp_frame_info_t *
1984 create_frame_info(packet_info *pinfo, uint8_t ptp_major, uint8_t ptp_minor, uint8_t majorsdoid, uint8_t minorsdoid, uint8_t messagetype, uint8_t domain, uint64_t clockidentity, uint16_t portid, uint16_t seqid) {
1985 ptp_frame_info_t *ret = get_frame_info_and_opt_create(pinfo, ptp_major, ptp_minor, majorsdoid, minorsdoid, messagetype, domain, clockidentity, portid, seqid, true, PTP_ANALYSIS_MAX_ALLOWED_DELTA_SECS);
1987 uint16_t seqid_prev = seqid == 0 ? UINT16_MAX : seqid - 1;
1988 ret->prev = get_frame_info_and_opt_create(pinfo, ptp_major, ptp_minor, majorsdoid, minorsdoid, messagetype, domain, clockidentity, portid, seqid_prev, false, (double)ptp_analysis_max_consecutive_delta);
1990 return ret;
1994 /* forward declaration of local functions for v1 and v2 */
1996 static bool
1997 is_ptp_v1(tvbuff_t *tvb);
1999 static void
2000 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
2002 static bool
2003 is_ptp_v2(tvbuff_t *tvb);
2005 static void
2006 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool ptpv2_oE);
2008 /**********************************************************/
2009 /* Implementation of the functions */
2010 /**********************************************************/
2013 /* Code to dissect the packet */
2015 static int
2016 dissect_ptp_oE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
2017 /* PTP over Ethernet only available with PTPv2 */
2018 dissect_ptp_v2(tvb, pinfo, tree, true);
2019 return tvb_captured_length(tvb);
2022 static int
2023 dissect_ptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
2024 if(is_ptp_v1(tvb))
2025 dissect_ptp_v1(tvb, pinfo, tree);
2026 else if(is_ptp_v2(tvb))
2027 dissect_ptp_v2(tvb, pinfo, tree, false);
2029 return tvb_captured_length(tvb);
2033 /* Code to check if packet is PTPv1 */
2035 static bool
2036 is_ptp_v1(tvbuff_t *tvb) {
2037 uint16_t version_ptp;
2039 version_ptp = tvb_get_ntohs(tvb, PTP_VERSIONPTP_OFFSET);
2041 if( version_ptp == 1) return true;
2042 else return false;
2046 /* Code to check if packet is PTPv2 */
2048 static bool
2049 is_ptp_v2(tvbuff_t *tvb) {
2050 uint8_t version_ptp;
2052 version_ptp = 0x0F & tvb_get_uint8(tvb, PTP_V2_VERSIONPTP_OFFSET);
2054 if( version_ptp == 2) return true;
2055 else return false;
2059 /* Code to actually dissect the PTPv1 packets */
2061 static void
2062 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
2063 uint8_t ptp_control_field, ptp_mm_messagekey = 0;
2064 nstime_t ts; /* time structure with seconds and nanoseconds */
2066 /* Set up structures needed to add the protocol subtree and manage it */
2067 proto_item *ti, *flags_ti, *time_ti, *time2_ti;
2068 proto_tree *ptp_tree = NULL, *ptp_flags_tree, *ptp_time_tree, *ptp_time2_tree;
2070 /* Make entries in Protocol column and Info column on summary display */
2071 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv1");
2074 /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
2076 ptp_control_field = tvb_get_uint8 (tvb, PTP_CONTROLFIELD_OFFSET);
2077 /* MGMT packet? */
2078 if (ptp_control_field == PTP_MANAGEMENT_MESSAGE ){
2079 /* Get the managementMessageKey */
2080 ptp_mm_messagekey = tvb_get_uint8(tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET);
2083 /* Create and set the string for "Info" column */
2084 switch(ptp_control_field){
2085 case PTP_SYNC_MESSAGE:{
2086 col_set_str(pinfo->cinfo, COL_INFO, "Sync Message");
2087 break;
2089 case PTP_DELAY_REQ_MESSAGE:{
2090 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Request Message");
2091 break;
2093 case PTP_FOLLOWUP_MESSAGE:{
2094 col_set_str(pinfo->cinfo, COL_INFO, "Follow_Up Message");
2095 break;
2097 case PTP_DELAY_RESP_MESSAGE:{
2098 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Response Message");
2099 break;
2101 case PTP_MANAGEMENT_MESSAGE:{
2102 col_add_fstr(pinfo->cinfo, COL_INFO, "Management Message (%s)",
2103 val_to_str_ext(ptp_mm_messagekey,
2104 &ptp_managementMessageKey_infocolumn_vals_ext,
2105 "Unknown message key %u"));
2106 break;
2108 default:{
2109 col_set_str(pinfo->cinfo, COL_INFO, "Unknown Message");
2110 break;
2114 if (tree) {
2116 /* create display subtree for the protocol */
2117 ti = proto_tree_add_item(tree, proto_ptp, tvb, 0, -1, ENC_NA);
2119 ptp_tree = proto_item_add_subtree(ti, ett_ptp);
2121 proto_tree_add_item(ptp_tree,
2122 hf_ptp_versionptp, tvb, PTP_VERSIONPTP_OFFSET, 2, ENC_BIG_ENDIAN);
2124 proto_tree_add_item(ptp_tree,
2125 hf_ptp_versionnetwork, tvb, PTP_VERSIONNETWORK_OFFSET, 2, ENC_BIG_ENDIAN);
2127 proto_tree_add_item(ptp_tree,
2128 hf_ptp_subdomain, tvb, PTP_SUBDOMAIN_OFFSET, 16, ENC_ASCII);
2130 proto_tree_add_item(ptp_tree,
2131 hf_ptp_messagetype, tvb, PTP_MESSAGETYPE_OFFSET, 1, ENC_BIG_ENDIAN);
2133 proto_tree_add_item(ptp_tree,
2134 hf_ptp_sourcecommunicationtechnology, tvb, PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2136 proto_tree_add_item(ptp_tree,
2137 hf_ptp_sourceuuid, tvb, PTP_SOURCEUUID_OFFSET, 6, ENC_NA);
2139 proto_tree_add_item(ptp_tree,
2140 hf_ptp_sourceportid, tvb, PTP_SOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2142 proto_tree_add_item(ptp_tree,
2143 hf_ptp_sequenceid, tvb, PTP_SEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2145 proto_tree_add_item(ptp_tree,
2146 hf_ptp_controlfield, tvb, PTP_CONTROLFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
2148 /* Subtree for the flag-field */
2149 /* TODO: use proto_tree_add_bitmask_list() ? */
2150 flags_ti = proto_tree_add_item(ptp_tree,
2151 hf_ptp_flags, tvb, PTP_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
2153 ptp_flags_tree = proto_item_add_subtree(flags_ti, ett_ptp_flags);
2155 proto_tree_add_item(ptp_flags_tree,
2156 hf_ptp_flags_li61, tvb, PTP_FLAGS_LI61_OFFSET, 2, ENC_BIG_ENDIAN);
2158 proto_tree_add_item(ptp_flags_tree,
2159 hf_ptp_flags_li59, tvb, PTP_FLAGS_LI59_OFFSET, 2, ENC_BIG_ENDIAN);
2161 proto_tree_add_item(ptp_flags_tree,
2162 hf_ptp_flags_boundary_clock, tvb, PTP_FLAGS_BOUNDARY_CLOCK_OFFSET, 2, ENC_BIG_ENDIAN);
2164 proto_tree_add_item(ptp_flags_tree,
2165 hf_ptp_flags_assist, tvb, PTP_FLAGS_ASSIST_OFFSET, 2, ENC_BIG_ENDIAN);
2167 proto_tree_add_item(ptp_flags_tree,
2168 hf_ptp_flags_ext_sync, tvb, PTP_FLAGS_EXT_SYNC_OFFSET, 2, ENC_BIG_ENDIAN);
2170 proto_tree_add_item(ptp_flags_tree,
2171 hf_ptp_flags_parent, tvb, PTP_FLAGS_PARENT_STATS_OFFSET, 2, ENC_BIG_ENDIAN);
2173 proto_tree_add_item(ptp_flags_tree,
2174 hf_ptp_flags_sync_burst, tvb, PTP_FLAGS_SYNC_BURST_OFFSET, 2, ENC_BIG_ENDIAN);
2176 /* The rest of the ptp-dissector depends on the control-field */
2178 switch(ptp_control_field){
2179 case PTP_SYNC_MESSAGE:
2180 case PTP_DELAY_REQ_MESSAGE:{
2182 /* Subtree for the timestamp-field */
2183 ts.secs = tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET);
2184 ts.nsecs = tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET);
2185 if(tree){
2186 time_ti = proto_tree_add_time(ptp_tree,
2187 hf_ptp_sdr_origintimestamp, tvb, PTP_SDR_ORIGINTIMESTAMP_OFFSET, 8, &ts);
2189 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2191 proto_tree_add_item(ptp_time_tree,
2192 hf_ptp_sdr_origintimestamp_seconds, tvb,
2193 PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2195 proto_tree_add_item(ptp_time_tree, hf_ptp_sdr_origintimestamp_nanoseconds, tvb,
2196 PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2199 proto_tree_add_item(ptp_tree,
2200 hf_ptp_sdr_epochnumber, tvb, PTP_SDR_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2202 proto_tree_add_item(ptp_tree,
2203 hf_ptp_sdr_currentutcoffset, tvb, PTP_SDR_CURRENTUTCOFFSET_OFFSET, 2, ENC_BIG_ENDIAN);
2205 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmastercommunicationtechnology, tvb,
2206 PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2208 proto_tree_add_item(ptp_tree,
2209 hf_ptp_sdr_grandmasterclockuuid, tvb, PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET, 6, ENC_NA);
2211 proto_tree_add_item(ptp_tree,
2212 hf_ptp_sdr_grandmasterportid, tvb, PTP_SDR_GRANDMASTERPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2214 proto_tree_add_item(ptp_tree,
2215 hf_ptp_sdr_grandmastersequenceid, tvb, PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2217 proto_tree_add_item(ptp_tree,
2218 hf_ptp_sdr_grandmasterclockstratum, tvb,
2219 PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2221 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterclockidentifier, tvb,
2222 PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET, 4, ENC_ASCII);
2224 proto_tree_add_item(ptp_tree,
2225 hf_ptp_sdr_grandmasterclockvariance, tvb,
2226 PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2228 proto_tree_add_item(ptp_tree,
2229 hf_ptp_sdr_grandmasterpreferred, tvb, PTP_SDR_GRANDMASTERPREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2231 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterisboundaryclock, tvb,
2232 PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2234 proto_tree_add_item(ptp_tree,
2235 hf_ptp_sdr_syncinterval, tvb, PTP_SDR_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2237 proto_tree_add_item(ptp_tree,
2238 hf_ptp_sdr_localclockvariance, tvb, PTP_SDR_LOCALCLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2240 proto_tree_add_item(ptp_tree,
2241 hf_ptp_sdr_localstepsremoved, tvb, PTP_SDR_LOCALSTEPSREMOVED_OFFSET, 2, ENC_BIG_ENDIAN);
2243 proto_tree_add_item(ptp_tree,
2244 hf_ptp_sdr_localclockstratum, tvb, PTP_SDR_LOCALCLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2246 proto_tree_add_item(ptp_tree,
2247 hf_ptp_sdr_localclockidentifier, tvb, PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET, 4, ENC_ASCII);
2249 proto_tree_add_item(ptp_tree, hf_ptp_sdr_parentcommunicationtechnology, tvb,
2250 PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2252 proto_tree_add_item(ptp_tree,
2253 hf_ptp_sdr_parentuuid, tvb, PTP_SDR_PARENTUUID_OFFSET, 6, ENC_NA);
2255 proto_tree_add_item(ptp_tree,
2256 hf_ptp_sdr_parentportfield, tvb, PTP_SDR_PARENTPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2258 proto_tree_add_item(ptp_tree,
2259 hf_ptp_sdr_estimatedmastervariance, tvb,
2260 PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2262 proto_tree_add_item(ptp_tree,
2263 hf_ptp_sdr_estimatedmasterdrift, tvb, PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET, 4, ENC_BIG_ENDIAN);
2265 proto_tree_add_item(ptp_tree,
2266 hf_ptp_sdr_utcreasonable, tvb, PTP_SDR_UTCREASONABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2267 break;
2269 case PTP_FOLLOWUP_MESSAGE:{
2270 proto_tree_add_item(ptp_tree,
2271 hf_ptp_fu_associatedsequenceid, tvb, PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2273 /* Subtree for the timestamp-field */
2274 ts.secs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET);
2275 ts.nsecs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET);
2276 if(tree){
2277 time_ti = proto_tree_add_time(ptp_tree,
2278 hf_ptp_fu_preciseorigintimestamp, tvb,
2279 PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET, 8, &ts);
2281 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2283 proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_seconds, tvb,
2284 PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2286 proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_nanoseconds, tvb,
2287 PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2289 break;
2291 case PTP_DELAY_RESP_MESSAGE:{
2292 /* Subtree for the timestamp-field */
2293 ts.secs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET);
2294 ts.nsecs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET);
2295 if(tree){
2296 time_ti = proto_tree_add_time(ptp_tree,
2297 hf_ptp_dr_delayreceipttimestamp, tvb,
2298 PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET, 8, &ts);
2300 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2302 proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_seconds, tvb,
2303 PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2305 proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_nanoseconds, tvb,
2306 PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2309 proto_tree_add_item(ptp_tree, hf_ptp_dr_requestingsourcecommunicationtechnology, tvb,
2310 PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2312 proto_tree_add_item(ptp_tree,
2313 hf_ptp_dr_requestingsourceuuid, tvb, PTP_DR_REQUESTINGSOURCEUUID_OFFSET, 6, ENC_NA);
2315 proto_tree_add_item(ptp_tree,
2316 hf_ptp_dr_requestingsourceportid, tvb, PTP_DR_REQUESTINGSOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2318 proto_tree_add_item(ptp_tree,
2319 hf_ptp_dr_requestingsourcesequenceid, tvb,
2320 PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2321 break;
2323 case PTP_MANAGEMENT_MESSAGE:{
2324 proto_tree_add_item(ptp_tree, hf_ptp_mm_targetcommunicationtechnology, tvb,
2325 PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2327 proto_tree_add_item(ptp_tree,
2328 hf_ptp_mm_targetuuid, tvb, PTP_MM_TARGETUUID_OFFSET, 6, ENC_NA);
2330 proto_tree_add_item(ptp_tree,
2331 hf_ptp_mm_targetportid, tvb, PTP_MM_TARGETPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2333 proto_tree_add_item(ptp_tree,
2334 hf_ptp_mm_startingboundaryhops, tvb, PTP_MM_STARTINGBOUNDARYHOPS_OFFSET, 2, ENC_BIG_ENDIAN);
2336 proto_tree_add_item(ptp_tree,
2337 hf_ptp_mm_boundaryhops, tvb, PTP_MM_BOUNDARYHOPS_OFFSET, 2, ENC_BIG_ENDIAN);
2340 proto_tree_add_item(ptp_tree,
2341 hf_ptp_mm_managementmessagekey, tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET, 1, ENC_BIG_ENDIAN);
2343 proto_tree_add_item(ptp_tree,
2344 hf_ptp_mm_parameterlength, tvb, PTP_MM_PARAMETERLENGTH_OFFSET, 2, ENC_BIG_ENDIAN);
2346 switch(ptp_mm_messagekey){
2347 case PTP_MM_CLOCK_IDENTITY:{
2348 proto_tree_add_item(ptp_tree,
2349 hf_ptp_mm_clock_identity_clockcommunicationtechnology, tvb,
2350 PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2352 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockuuidfield, tvb,
2353 PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET, 6, ENC_NA);
2355 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockportfield, tvb,
2356 PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2358 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_manufactureridentity, tvb,
2359 PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET, 48, ENC_NA);
2360 break;
2362 case PTP_MM_INITIALIZE_CLOCK:{
2363 proto_tree_add_item(ptp_tree, hf_ptp_mm_initialize_clock_initialisationkey, tvb,
2364 PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET, 2, ENC_BIG_ENDIAN);
2365 break;
2367 case PTP_MM_SET_SUBDOMAIN:{
2368 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_subdomain_subdomainname, tvb,
2369 PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2370 break;
2372 case PTP_MM_DEFAULT_DATA_SET:{
2373 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockcommunicationtechnology,
2374 tvb, PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET,
2375 1, ENC_BIG_ENDIAN);
2377 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockuuidfield, tvb,
2378 PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET, 6, ENC_NA);
2380 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockportfield, tvb,
2381 PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2383 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockstratum, tvb,
2384 PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2386 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockidentifier, tvb,
2387 PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, ENC_NA);
2389 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockvariance, tvb,
2390 PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2392 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockfollowupcapable, tvb,
2393 PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2395 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_preferred, tvb,
2396 PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2398 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_initializable, tvb,
2399 PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2401 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_externaltiming, tvb,
2402 PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET, 1, ENC_BIG_ENDIAN);
2404 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_isboundaryclock, tvb,
2405 PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2407 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_syncinterval, tvb,
2408 PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2410 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_subdomainname, tvb,
2411 PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2413 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberports, tvb,
2414 PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET, 2, ENC_BIG_ENDIAN);
2416 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberforeignrecords, tvb,
2417 PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET, 2, ENC_BIG_ENDIAN);
2418 break;
2420 case PTP_MM_UPDATE_DEFAULT_DATA_SET:{
2421 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockstratum, tvb,
2422 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2424 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockidentifier, tvb,
2425 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, ENC_NA);
2427 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockvariance, tvb,
2428 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2430 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_preferred, tvb,
2431 PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2433 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_syncinterval, tvb,
2434 PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2436 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_subdomainname, tvb,
2437 PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2438 break;
2440 case PTP_MM_CURRENT_DATA_SET:{
2441 proto_tree_add_item(ptp_tree, hf_ptp_mm_current_data_set_stepsremoved, tvb,
2442 PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET, 2, ENC_BIG_ENDIAN);
2444 /* Subtree for offset from master */
2445 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET);
2447 ts.nsecs = tvb_get_ntohl(tvb,
2448 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET);
2450 if (ts.nsecs & 0x80000000) ts.nsecs = ts.nsecs & 0x7FFFFFFF;
2452 if(tree){
2453 time_ti = proto_tree_add_time(ptp_tree,
2454 hf_ptp_mm_current_data_set_offsetfrommaster, tvb,
2455 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET, 8, &ts);
2457 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2459 proto_tree_add_item(ptp_time_tree,
2460 hf_ptp_mm_current_data_set_offsetfrommasterseconds, tvb,
2461 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2463 proto_tree_add_item(ptp_time_tree,
2464 hf_ptp_mm_current_data_set_offsetfrommasternanoseconds, tvb,
2465 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2468 /* Subtree for offset from master */
2469 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET);
2471 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET);
2473 if(tree){
2474 time2_ti = proto_tree_add_time(ptp_tree,
2475 hf_ptp_mm_current_data_set_onewaydelay, tvb,
2476 PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET, 8, &ts);
2478 ptp_time2_tree = proto_item_add_subtree(time2_ti, ett_ptp_time2);
2480 proto_tree_add_item(ptp_time2_tree, hf_ptp_mm_current_data_set_onewaydelayseconds,
2481 tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2483 proto_tree_add_item(ptp_time2_tree,
2484 hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
2485 tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2487 break;
2489 case PTP_MM_PARENT_DATA_SET:{
2490 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
2491 tvb, PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET,
2492 1, ENC_BIG_ENDIAN);
2494 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentuuid, tvb,
2495 PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET, 6, ENC_NA);
2497 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentportid, tvb,
2498 PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2500 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
2501 tvb, PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET,
2502 2, ENC_BIG_ENDIAN);
2504 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentfollowupcapable, tvb,
2505 PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2507 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentexternaltiming, tvb,
2508 PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET, 1, ENC_BIG_ENDIAN);
2510 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentvariance, tvb,
2511 PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2513 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentstats, tvb,
2514 PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET, 1, ENC_BIG_ENDIAN);
2516 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observedvariance, tvb,
2517 PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2519 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observeddrift, tvb,
2520 PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET, 4, ENC_BIG_ENDIAN);
2522 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_utcreasonable, tvb,
2523 PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2525 proto_tree_add_item(ptp_tree,
2526 hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
2527 tvb, PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
2528 ENC_BIG_ENDIAN);
2530 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteruuidfield, tvb,
2531 PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET, 6, ENC_NA);
2533 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterportidfield, tvb,
2534 PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2536 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterstratum, tvb,
2537 PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2539 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteridentifier, tvb,
2540 PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET, 4, ENC_NA);
2542 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastervariance, tvb,
2543 PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2545 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterpreferred, tvb,
2546 PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2548 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterisboundaryclock, tvb,
2549 PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2551 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastersequencenumber, tvb,
2552 PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2553 break;
2555 case PTP_MM_PORT_DATA_SET:{
2556 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_returnedportnumber, tvb,
2557 PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2559 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portstate, tvb,
2560 PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET, 1, ENC_BIG_ENDIAN);
2562 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastsynceventsequencenumber, tvb,
2563 PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2565 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
2566 tvb, PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET,
2567 2, ENC_BIG_ENDIAN);
2569 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portcommunicationtechnology, tvb,
2570 PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2572 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portuuidfield, tvb,
2573 PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET, 6, ENC_NA);
2575 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portidfield, tvb,
2576 PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2578 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_burstenabled, tvb,
2579 PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET, 1, ENC_BIG_ENDIAN);
2581 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddressoctets, tvb,
2582 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2584 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddressoctets, tvb,
2585 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2587 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddressoctets, tvb,
2588 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2590 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddress, tvb,
2591 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET, 4, ENC_NA);
2593 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddress, tvb,
2594 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET, 2, ENC_NA);
2596 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddress, tvb,
2597 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET, 2, ENC_NA);
2598 break;
2600 case PTP_MM_GLOBAL_TIME_DATA_SET:{
2601 /* Subtree for local time */
2602 ts.secs = tvb_get_ntohl(tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET);
2604 ts.nsecs = tvb_get_ntohl(tvb,
2605 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET);
2607 if(tree){
2608 time_ti = proto_tree_add_time(ptp_tree,
2609 hf_ptp_mm_global_time_data_set_localtime, tvb,
2610 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET, 8, &ts);
2612 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2614 proto_tree_add_item(ptp_time_tree,
2615 hf_ptp_mm_global_time_data_set_localtimeseconds, tvb,
2616 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2618 proto_tree_add_item(ptp_time_tree,
2619 hf_ptp_mm_global_time_data_set_localtimenanoseconds,
2620 tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2623 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_currentutcoffset, tvb,
2624 PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET, 2, ENC_BIG_ENDIAN);
2626 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap59, tvb,
2627 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET, 1, ENC_BIG_ENDIAN);
2629 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap61, tvb,
2630 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET, 1, ENC_BIG_ENDIAN);
2632 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_epochnumber, tvb,
2633 PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2634 break;
2636 case PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES:{
2637 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_currentutcoffset,
2638 tvb, PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET,
2639 2, ENC_BIG_ENDIAN);
2641 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap59, tvb,
2642 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET, 1, ENC_BIG_ENDIAN);
2644 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap61, tvb,
2645 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET, 1, ENC_BIG_ENDIAN);
2647 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2648 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2649 break;
2651 case PTP_MM_GET_FOREIGN_DATA_SET:{
2652 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2653 PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET, 2, ENC_BIG_ENDIAN);
2654 break;
2656 case PTP_MM_FOREIGN_DATA_SET:{
2657 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedportnumber, tvb,
2658 PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2660 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedrecordnumber, tvb,
2661 PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2663 proto_tree_add_item(ptp_tree,
2664 hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
2665 tvb, PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
2666 ENC_BIG_ENDIAN);
2668 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasteruuidfield, tvb,
2669 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET, 6, ENC_NA);
2671 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasterportidfield, tvb,
2672 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2674 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmastersyncs, tvb,
2675 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET, 2, ENC_BIG_ENDIAN);
2676 break;
2678 case PTP_MM_SET_SYNC_INTERVAL:{
2679 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_sync_interval_syncinterval, tvb,
2680 PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET, 2, ENC_BIG_ENDIAN);
2681 break;
2683 case PTP_MM_SET_TIME:{
2684 /* Subtree for local time */
2685 ts.secs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET);
2687 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET);
2689 if(tree){
2690 time_ti = proto_tree_add_time(ptp_tree, hf_ptp_mm_set_time_localtime, tvb,
2691 PTP_MM_SET_TIME_LOCALTIME_OFFSET, 8, &ts);
2693 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2695 proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimeseconds, tvb,
2696 PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2698 proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimenanoseconds,
2699 tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2701 break;
2703 default :{
2704 /* - don't dissect any further. */
2705 break;
2708 break;
2710 default :{
2711 /* Not a valid MessageType - can't dissect. */
2712 break;
2719 /* Code to dissect PTPText */
2720 static void
2721 dissect_ptp_v2_text(tvbuff_t *tvb, int *cur_offset, proto_tree *tree, int hf_ptp_v2_mm_ptptext, int hf_ptp_v2_mm_ptptext_length) {
2722 uint8_t length = 0;
2723 proto_item *ptptext_ti;
2724 proto_tree *ptptext_subtree;
2726 length = tvb_get_uint8 (tvb, *cur_offset);
2728 if (tree)
2730 ptptext_ti = proto_tree_add_item(tree, hf_ptp_v2_mm_ptptext, tvb,
2731 *cur_offset+1, length, ENC_BIG_ENDIAN);
2733 ptptext_subtree = proto_item_add_subtree(ptptext_ti, ett_ptp_v2_ptptext);
2734 /* subtree */
2735 proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext_length, tvb,
2736 *cur_offset, 1, ENC_BIG_ENDIAN);
2737 proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext, tvb,
2738 *cur_offset+1, length, ENC_ASCII|ENC_NA);
2740 *cur_offset = *cur_offset + length + 1;
2744 void
2745 dissect_ptp_v2_timeInterval(tvbuff_t *tvb, int *cur_offset, proto_tree *tree, const char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns, proto_tree **tree_out, int64_t *ns_out) {
2746 double time_double;
2747 int64_t time_ns;
2748 uint16_t time_subns;
2749 proto_tree *ptptimeInterval_subtree;
2751 time_ns = tvb_get_ntoh64(tvb, *cur_offset);
2752 /* TODO: should flag 'too big' if see distinguished value of 0x7FFFFFFFFFFFFFFF?
2753 * https://standards.ieee.org/wp-content/uploads/import/documents/interpretations/1588-2008_interp.pdf
2754 * notes that this field can cope with about 40 hours.. */
2755 time_double = (1.0*time_ns) / 65536.0;
2756 time_ns = time_ns >> 16;
2757 time_subns = tvb_get_ntohs(tvb, *cur_offset+6);
2759 ptptimeInterval_subtree = proto_tree_add_subtree_format(tree, tvb, *cur_offset, 8,
2760 ett_ptp_v2_timeInterval, NULL, "%s: %f nanoseconds", name, time_double);
2762 proto_tree_add_int64(ptptimeInterval_subtree,
2763 hf_ptp_v2_timeInterval_ns, tvb, *cur_offset, 6, time_ns);
2765 proto_tree_add_double(ptptimeInterval_subtree,
2766 hf_ptp_v2_timeInterval_subns, tvb, *cur_offset+6, 2, (time_subns/65536.0));
2768 /* Set output args */
2769 *cur_offset = *cur_offset + 8;
2770 if (tree_out) *tree_out = ptptimeInterval_subtree;
2771 if (ns_out) *ns_out = time_ns;
2774 static void
2775 dissect_ptp_v2_timetstamp(tvbuff_t *tvb, int *cur_offset, proto_tree *tree, const char* name, int hf_ptp_v2_timestamp_s, int hf_ptp_v2_timestamp_ns) {
2776 int64_t time_s;
2777 uint32_t time_ns;
2778 proto_tree *ptptimestamp_subtree;
2780 time_s = tvb_get_ntoh48(tvb, *cur_offset);
2781 time_ns = tvb_get_ntohl(tvb, *cur_offset + 6);
2783 ptptimestamp_subtree = proto_tree_add_subtree_format(tree,
2784 tvb,
2785 *cur_offset,
2787 ett_ptp_v2_timeInterval,
2788 NULL,
2789 "%s: %" PRIu64 "%s%09" PRId32 " nanoseconds",
2790 name, time_s, decimal_point, time_ns);
2792 proto_tree_add_uint64(ptptimestamp_subtree,
2793 hf_ptp_v2_timestamp_s,
2794 tvb,
2795 *cur_offset,
2797 time_s);
2799 proto_tree_add_int(ptptimestamp_subtree,
2800 hf_ptp_v2_timestamp_ns,
2801 tvb,
2802 *cur_offset + 6,
2804 time_ns);
2806 *cur_offset = *cur_offset + 10;
2809 /* Code to actually dissect the PTPv2 packets */
2811 static int
2812 dissect_ptp_v2_tlv_tlvtype_length(tvbuff_t *tvb, int offset_orig, proto_tree *ptp_tlv_tree) {
2813 int offset = offset_orig;
2815 proto_tree_add_item(ptp_tlv_tree, hf_ptp_tlv_tlvtype, tvb, offset, 2, ENC_BIG_ENDIAN);
2816 offset += 2;
2818 proto_tree_add_item(ptp_tlv_tree, hf_ptp_tlv_lengthfield, tvb, offset, 2, ENC_BIG_ENDIAN);
2819 offset += 2;
2821 return offset - offset_orig;
2824 static int
2825 dissect_ptp_v2_tlv_org_fields(tvbuff_t *tvb, int offset_orig, proto_tree *ptp_tlv_tree, int hf_orgsubtype) {
2826 int offset = offset_orig + dissect_ptp_v2_tlv_tlvtype_length(tvb, offset_orig, ptp_tlv_tree);
2828 proto_tree_add_item(ptp_tlv_tree, hf_ptp_tlv_oe_organizationid, tvb, offset, 3, ENC_BIG_ENDIAN);
2829 offset += 3;
2831 proto_tree_add_item(ptp_tlv_tree, hf_orgsubtype, tvb, offset, 3, ENC_BIG_ENDIAN);
2832 offset += 3;
2834 return offset - offset_orig;
2837 static int
2838 disect_ptp_v2_tlvs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item *ti_root, proto_tree *ptp_tree, uint8_t ptp_v2_messageid, uint16_t ptp_v2_flags, bool is_802_1as) {
2839 int offset_orig = offset;
2840 proto_item *ti;
2841 proto_item *ti_tlv = ti_root;
2843 bool as_followup_tlv_present = false;
2845 while (true) {
2846 int offset_loopstart = offset;
2848 if (tvb_reported_length_remaining(tvb, offset) < PTP_V2_TLV_HEADER_LENGTH) {
2849 /* broken TLV or maybe just a few bytes at end left */
2850 break;
2853 uint16_t tlv_type = tvb_get_ntohs(tvb, offset + PTP_V2_TLV_TYPE_OFFSET);
2854 uint16_t tlv_length = tvb_get_ntohs(tvb, offset + PTP_V2_TLV_LENGTH_OFFSET);
2856 switch (tlv_type) {
2857 case PTP_V2_TLV_TYPE_MANAGEMENT: {
2858 proto_item *managementData_ti, *clockType_ti, *protocolAddress_ti;
2859 proto_tree *ptp_managementData_tree, *ptp_clockType_tree, *ptp_protocolAddress_tree;
2861 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Management TLV");
2862 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
2864 uint32_t ptp_v2_managementId;
2865 proto_tree_add_item_ret_uint(ptp_tlv_tree, hf_ptp_v2_mm_managementId, tvb, offset, 2, ENC_BIG_ENDIAN, &ptp_v2_managementId);
2866 offset += 2;
2868 if (tlv_length <= 2) {
2869 /* no data */
2870 break;
2873 managementData_ti = proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_mm_data, tvb, offset, tlv_length - 2, ENC_NA);
2874 ptp_managementData_tree = proto_item_add_subtree(managementData_ti, ett_ptp_v2_managementData);
2876 switch (ptp_v2_managementId) {
2877 case PTP_V2_MM_ID_NULL_MANAGEMENT: {
2878 /* no data in NULL management */
2879 break;
2881 case PTP_V2_MM_ID_CLOCK_DESCRIPTION: {
2882 uint32_t N = 0, S = 0;
2883 clockType_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockType, tvb, offset, 2, ENC_BIG_ENDIAN);
2885 ptp_clockType_tree = proto_item_add_subtree(clockType_ti, ett_ptp_v2_clockType);
2886 /* ClockType Subtree */
2887 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_ordinaryClock, tvb, offset, 2, ENC_BIG_ENDIAN);
2888 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_boundaryClock, tvb, offset, 2, ENC_BIG_ENDIAN);
2889 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_p2p_transparentClock, tvb, offset, 2, ENC_BIG_ENDIAN);
2890 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_e2e_transparentClock, tvb, offset, 2, ENC_BIG_ENDIAN);
2891 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_managementNode, tvb, offset, 2, ENC_BIG_ENDIAN);
2892 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2893 offset += 2;
2895 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_physicalLayerProtocol, hf_ptp_v2_mm_physicalLayerProtocol_length);
2897 proto_tree_add_item_ret_uint(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddressLength, tvb, offset, 2, ENC_BIG_ENDIAN, &S);
2898 offset += 2;
2900 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddress, tvb, offset, S, ENC_NA);
2901 offset += S;
2903 N = tvb_get_ntohs(tvb, offset + 2);
2905 protocolAddress_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_protocolAddress, tvb, offset + 4, N, ENC_NA);
2906 ptp_protocolAddress_tree = proto_item_add_subtree(protocolAddress_ti, ett_ptp_v2_protocolAddress);
2907 /* physicalLayerProtocol subtree */
2908 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_networkProtocol, tvb, offset, 2, ENC_BIG_ENDIAN);
2909 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2910 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress, tvb, offset + 4, N, ENC_NA);
2911 N += 4;
2912 offset += N;
2914 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_manufacturerIdentity, tvb, offset, 3, ENC_NA);
2915 offset += 3;
2917 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
2918 offset += 1;
2920 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_productDescription, hf_ptp_v2_mm_productDescription_length);
2921 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_revisionData, hf_ptp_v2_mm_revisionData_length);
2922 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
2924 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_profileIdentity, tvb, offset, 6, ENC_NA);
2925 offset += 6;
2927 /* Pad to even length */
2928 if ((offset - offset_loopstart) % 2) {
2929 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb, offset, 1, ENC_NA);
2930 offset += 1;
2932 break;
2934 case PTP_V2_MM_ID_USER_DESCRIPTION: {
2936 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
2938 /* Pad to even length */
2939 if ((offset - offset_loopstart) % 2) {
2940 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb, offset, 1, ENC_NA);
2941 offset += 1;
2943 break;
2945 case PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE: {
2946 /* no data */
2947 break;
2949 case PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE: {
2950 /* no data */
2951 break;
2953 case PTP_V2_MM_ID_INITIALIZE: {
2954 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_initializationKey, tvb, offset, 2, ENC_BIG_ENDIAN);
2955 offset += 2;
2956 break;
2958 case PTP_V2_MM_ID_FAULT_LOG: {
2959 uint16_t ii, num = 0;
2960 proto_tree *ptpError_subtree;
2962 num = tvb_get_ntohs(tvb, offset);
2964 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfFaultRecords, tvb, offset, 2, ENC_BIG_ENDIAN);
2965 offset += 2;
2967 for (ii = 0; ii < num; ii++) {
2968 ptpError_subtree = proto_tree_add_subtree(ptp_managementData_tree, tvb, offset, tvb_get_ntohs(tvb, offset),
2969 ett_ptp_v2_faultRecord, NULL, "Fault record");
2971 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultRecordLength, tvb, offset, 2, ENC_BIG_ENDIAN);
2972 offset += 2;
2974 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_s, tvb, offset, 6, ENC_BIG_ENDIAN);
2975 offset += 6;
2977 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_ns, tvb, offset, 4, ENC_BIG_ENDIAN);
2978 offset += 4;
2980 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_severityCode, tvb, offset, 1, ENC_NA);
2981 offset += 1;
2983 dissect_ptp_v2_text(tvb, &offset, ptpError_subtree, hf_ptp_v2_mm_faultName, hf_ptp_v2_mm_faultName_length);
2985 dissect_ptp_v2_text(tvb, &offset, ptpError_subtree, hf_ptp_v2_mm_faultValue, hf_ptp_v2_mm_faultValue_length);
2987 dissect_ptp_v2_text(tvb, &offset, ptpError_subtree, hf_ptp_v2_mm_faultDescription, hf_ptp_v2_mm_faultDescription_length);
2990 /* Pad to even length */
2991 if ((offset - offset_loopstart) % 2) {
2992 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb, offset, 1, ENC_NA);
2993 offset += 1;
2995 break;
2997 case PTP_V2_MM_ID_FAULT_LOG_RESET: {
2998 /* no data */
2999 break;
3001 case PTP_V2_MM_ID_DEFAULT_DATA_SET: {
3002 // XXX: change to relative offset!
3003 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TSC, tvb, offset, 1, ENC_NA);
3004 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_dds_SO, tvb, offset, 1, ENC_NA);
3005 offset += 1;
3007 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3008 offset += 1;
3010 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb, offset, 2, ENC_BIG_ENDIAN);
3011 offset += 2;
3013 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb, offset, 1, ENC_NA);
3014 offset += 1;
3016 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockclass, tvb, offset, 1, ENC_NA);
3017 offset += 1;
3019 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockaccuracy, tvb, offset, 1, ENC_NA);
3020 offset += 1;
3022 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockvariance, tvb, offset, 2, ENC_BIG_ENDIAN);
3023 offset += 2;
3025 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb, offset, 1, ENC_NA);
3026 offset += 1;
3028 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3029 offset += 8;
3031 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb, offset, 1, ENC_NA);
3032 offset += 1;
3034 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3035 offset += 1;
3037 break;
3039 case PTP_V2_MM_ID_CURRENT_DATA_SET: {
3040 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_stepsRemoved, tvb, offset, 2, ENC_BIG_ENDIAN);
3041 offset += 2;
3043 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_managementData_tree, "Offset from Master",
3044 hf_ptp_v2_mm_offset_ns, hf_ptp_v2_mm_offset_subns, NULL, NULL);
3045 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_managementData_tree, "Mean path delay",
3046 hf_ptp_v2_mm_pathDelay_ns, hf_ptp_v2_mm_pathDelay_subns, NULL, NULL);
3047 break;
3049 case PTP_V2_MM_ID_PARENT_DATA_SET: {
3050 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentIdentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3051 offset += 8;
3053 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentPort, tvb, offset, 2, ENC_BIG_ENDIAN);
3054 offset += 2;
3056 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentStats, tvb, offset, 1, ENC_NA);
3057 offset += 1;
3059 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3060 offset += 1;
3062 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentOffsetScaledLogVariance, tvb, offset, 2, ENC_BIG_ENDIAN);
3063 offset += 2;
3065 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentClockPhaseChangeRate, tvb, offset, 4, ENC_BIG_ENDIAN);
3066 offset += 4;
3068 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority1, tvb, offset, 1, ENC_NA);
3069 offset += 1;
3071 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockclass, tvb, offset, 1, ENC_NA);
3072 offset += 1;
3074 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockaccuracy, tvb, offset, 1, ENC_NA);
3075 offset += 1;
3077 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockvariance, tvb, offset, 2, ENC_BIG_ENDIAN);
3078 offset += 2;
3080 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority2, tvb, offset, 1, ENC_NA);
3081 offset += 1;
3083 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterIdentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3084 offset += 8;
3086 break;
3088 case PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET: {
3089 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb, offset, 2, ENC_BIG_ENDIAN);
3090 offset += 2;
3092 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb, offset, 1, ENC_NA);
3093 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb, offset, 1, ENC_NA);
3094 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb, offset, 1, ENC_NA);
3095 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb, offset, 1, ENC_NA);
3096 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb, offset, 1, ENC_NA);
3097 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb, offset, 1, ENC_NA);
3098 offset += 1;
3100 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb, offset, 1, ENC_NA);
3101 offset += 1;
3103 break;
3105 case PTP_V2_MM_ID_PORT_DATA_SET: {
3106 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3107 offset += 8;
3109 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb, offset, 2, ENC_BIG_ENDIAN);
3110 offset += 2;
3112 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_portState, tvb, offset, 1, ENC_NA);
3113 offset += 1;
3115 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinDelayReqInterval, tvb, offset, 1, ENC_NA);
3116 offset += 1;
3118 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_managementData_tree, "Peer mean path delay",
3119 hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns, NULL, NULL);
3121 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb, offset, 1, ENC_NA);
3122 offset += 1;
3124 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb, offset, 1, ENC_NA);
3125 offset += 1;
3127 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb, offset, 1, ENC_NA);
3128 offset += 1;
3130 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb, offset, 1, ENC_NA);
3131 offset += 1;
3133 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb, offset, 1, ENC_NA);
3134 offset += 1;
3136 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb, offset, 1, ENC_NA);
3137 offset += 1;
3139 break;
3141 case PTP_V2_MM_ID_PRIORITY1: {
3142 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb, offset, 1, ENC_NA);
3143 offset += 1;
3145 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3146 offset += 1;
3148 break;
3150 case PTP_V2_MM_ID_PRIORITY2: {
3151 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb, offset, 1, ENC_NA);
3152 offset += 1;
3154 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3155 offset += 1;
3157 break;
3159 case PTP_V2_MM_ID_DOMAIN: {
3160 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb, offset, 1, ENC_NA);
3161 offset += 1;
3163 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3164 offset += 1;
3166 break;
3168 case PTP_V2_MM_ID_SLAVE_ONLY: {
3169 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_SO, tvb, offset, 1, ENC_NA);
3170 offset += 1;
3172 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3173 offset += 1;
3175 break;
3177 case PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL: {
3178 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb, offset, 1, ENC_NA);
3179 offset += 1;
3181 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3182 offset += 1;
3184 break;
3186 case PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT: {
3187 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb, offset, 1, ENC_NA);
3188 offset += 1;
3190 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3191 offset += 1;
3193 break;
3195 case PTP_V2_MM_ID_LOG_SYNC_INTERVAL: {
3196 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb, offset, 1, ENC_NA);
3197 offset += 1;
3199 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3200 offset += 1;
3202 break;
3204 case PTP_V2_MM_ID_VERSION_NUMBER: {
3205 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb, offset, 1, ENC_NA);
3206 offset += 1;
3208 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3209 offset += 1;
3211 break;
3213 case PTP_V2_MM_ID_ENABLE_PORT: {
3214 /* no data */
3215 break;
3217 case PTP_V2_MM_ID_DISABLE_PORT: {
3218 /* no data */
3219 break;
3221 case PTP_V2_MM_ID_TIME: {
3222 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_s, tvb, offset, 6, ENC_BIG_ENDIAN);
3223 offset += 6;
3225 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_ns, tvb, offset, 4, ENC_BIG_ENDIAN);
3226 offset += 4;
3228 break;
3230 case PTP_V2_MM_ID_CLOCK_ACCURACY: {
3231 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockAccuracy, tvb, offset, 1, ENC_NA);
3232 offset += 1;
3234 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3235 offset += 1;
3237 break;
3239 case PTP_V2_MM_ID_UTC_PROPERTIES: {
3240 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb, offset, 2, ENC_BIG_ENDIAN);
3241 offset += 2;
3243 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb, offset, 1, ENC_NA);
3244 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb, offset, 1, ENC_NA);
3245 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb, offset, 1, ENC_NA);
3246 offset += 1;
3248 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3249 offset += 1;
3251 break;
3253 case PTP_V2_MM_ID_TRACEABILITY_PROPERTIES: {
3254 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb, offset, 1, ENC_NA);
3255 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb, offset, 1, ENC_NA);
3256 offset += 1;
3258 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3259 offset += 1;
3261 break;
3263 case PTP_V2_MM_ID_TIMESCALE_PROPERTIES: {
3264 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb, offset, 1, ENC_NA);
3265 offset += 1;
3267 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb, offset, 1, ENC_NA);
3268 offset += 1;
3270 break;
3272 case PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE: {
3273 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ucEN, tvb, offset, 1, ENC_NA);
3274 offset += 1;
3276 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3277 offset += 1;
3279 break;
3281 case PTP_V2_MM_ID_PATH_TRACE_LIST: {
3282 uint16_t i = 0;
3283 /* one or more ClockIdentity */
3284 for (i = 0; i < (tlv_length / 8); i++)
3286 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3287 offset += 8;
3290 break;
3292 case PTP_V2_MM_ID_PATH_TRACE_ENABLE: {
3293 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ptEN, tvb, offset, 1, ENC_NA);
3294 offset += 1;
3296 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3297 offset += 1;
3299 break;
3301 case PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE: {
3302 /* ToDo */
3303 break;
3305 case PTP_V2_MM_ID_UNICAST_MASTER_TABLE: {
3306 /* ToDo */
3307 break;
3309 case PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE: {
3310 /* ToDo */
3311 break;
3313 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE: {
3314 /* ToDo */
3315 break;
3317 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED: {
3318 /* ToDo */
3319 break;
3321 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE: {
3322 /* ToDo */
3323 break;
3325 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE: {
3326 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb, offset, 1, ENC_NA);
3327 offset += 1;
3329 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_atEN, tvb, offset, 1, ENC_NA);
3330 offset += 1;
3332 break;
3334 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME:
3336 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb, offset, 1, ENC_NA);
3337 offset += 1;
3339 dissect_ptp_v2_text(tvb, &offset, ptp_managementData_tree, hf_ptp_v2_mm_displayName, hf_ptp_v2_mm_displayName_length);
3341 /* Pad to even length */
3342 if ((offset - offset_loopstart) % 2) {
3343 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb, offset, 1, ENC_NA);
3344 offset += 1;
3346 break;
3348 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY: {
3349 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_maxKey, tvb, offset, 1, ENC_NA);
3350 offset += 1;
3352 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3353 offset += 1;
3355 break;
3357 case PTP_V2_MM_ID_ALTERNATE_MASTER: {
3358 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_transmitAlternateMulticastSync, tvb, offset, 1, ENC_NA);
3359 offset += 1;
3361 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfAlternateMasters, tvb, offset, 1, ENC_NA);
3362 offset += 1;
3364 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAlternateMulticastSyncInterval, tvb, offset, 1, ENC_NA);
3365 offset += 1;
3367 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3368 offset += 1;
3370 break;
3372 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES: {
3373 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb, offset, 1, ENC_NA);
3374 offset += 1;
3376 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentOffset, tvb, offset, 4, ENC_BIG_ENDIAN);
3377 offset += 4;
3379 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_jumpSeconds, tvb, offset, 4, ENC_BIG_ENDIAN);
3380 offset += 4;
3382 uint64_t timeStamp = tvb_get_ntohl(tvb, offset);
3383 timeStamp = timeStamp << 16;
3384 timeStamp = timeStamp | tvb_get_ntohs(tvb, offset + 4);
3386 proto_tree_add_uint64(ptp_managementData_tree, hf_ptp_v2_mm_nextjumpSeconds, tvb, offset, 6, timeStamp);
3387 offset += 6;
3389 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3390 offset += 1;
3392 break;
3394 case PTP_V2_MM_ID_TC_DEFAULT_DATA_SET: {
3395 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3396 offset += 8;
3398 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb, offset, 2, ENC_BIG_ENDIAN);
3399 offset += 2;
3401 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb, offset, 1, ENC_NA);
3402 offset += 1;
3404 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb, offset, 1, ENC_NA);
3405 offset += 1;
3407 break;
3409 case PTP_V2_MM_ID_TC_PORT_DATA_SET: {
3410 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
3411 offset += 8;
3413 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb, offset, 2, ENC_BIG_ENDIAN);
3414 offset += 2;
3416 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_faultyFlag, tvb, offset, 1, ENC_NA);
3417 offset += 1;
3419 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb, offset, 1, ENC_NA);
3420 offset += 1;
3422 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_managementData_tree, "Peer mean path delay",
3423 hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns, NULL, NULL);
3424 break;
3426 case PTP_V2_MM_ID_PRIMARY_DOMAIN: {
3427 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb, offset, 1, ENC_NA);
3428 offset += 1;
3430 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3431 offset += 1;
3433 break;
3435 case PTP_V2_MM_ID_DELAY_MECHANISM: {
3436 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb, offset, 1, ENC_NA);
3437 offset += 1;
3439 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3440 offset += 1;
3442 break;
3444 case PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL: {
3445 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb, offset, 1, ENC_NA);
3446 offset += 1;
3448 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb, offset, 1, ENC_NA);
3449 offset += 1;
3451 break;
3453 default:
3455 /* no data */
3456 break;
3458 } /* switch(ptp_v2_managementId) */
3459 break;
3462 case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS: {
3463 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Management Error Status TLV");
3464 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3466 int offset_tmp = offset;
3467 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementErrorId, tvb, offset, 2, ENC_BIG_ENDIAN);
3468 offset += 2;
3470 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementId, tvb, offset, 2, ENC_BIG_ENDIAN);
3471 offset += 2;
3473 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_reserved, tvb, offset, 4, ENC_NA);
3474 offset += 4;
3476 /* optional Field! */
3477 if (tlv_length - (offset - offset_tmp) > 0) {
3478 dissect_ptp_v2_text(tvb, &offset, ptp_tree, hf_ptp_v2_mm_displayData, hf_ptp_v2_mm_displayData_length);
3480 /* Pad to even length */
3481 if ((offset - offset_tmp) % 2) {
3482 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_pad, tvb, offset, 1, ENC_NA);
3483 offset += 1;
3486 break;
3489 case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION: {
3490 uint32_t org_id = tvb_get_ntoh24(tvb, offset + PTP_V2_TLV_HEADER_LENGTH);
3491 uint32_t subtype = tvb_get_ntoh24(tvb, offset + PTP_V2_TLV_ORGANIZATIONSUBTYPE_OFFSET);
3493 switch (org_id) {
3494 case OUI_IEEE_802_1: {
3495 switch (subtype) {
3496 case PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_INFORMATION_TLV: {
3497 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Follow_Up information TLV");
3498 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1);
3500 int32_t scaled_rate;
3501 proto_tree_add_item_ret_int(ptp_tlv_tree, hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset, tvb, offset, 4, ENC_BIG_ENDIAN, &scaled_rate);
3502 /* The cumulative scaled rate offset is(rateRatio - 1.0) * 2 ^ 41 */
3503 ti = proto_tree_add_double(ptp_tlv_tree, hf_ptp_as_fu_tlv_cumulative_rate_ratio, tvb, offset, 4, 1.0 + ((double)scaled_rate / (UINT64_C(1) << 41)));
3504 proto_item_set_generated(ti);
3505 offset += 4;
3507 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_gm_base_indicator, tvb, offset, 2, ENC_BIG_ENDIAN);
3508 offset += 2;
3510 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_last_gm_phase_change, tvb, offset, 12, ENC_NA);
3511 offset += 12;
3513 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_scaled_last_gm_freq_change, tvb, offset, 4, ENC_BIG_ENDIAN);
3514 offset += 4;
3516 as_followup_tlv_present = true;
3517 break;
3520 case PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_MSG_INTERVAL_REQ_TLV: {
3521 static int * const msg_interval_req_flags[] = {
3522 &hf_ptp_as_sig_tlv_flags_one_step_receive_capable,
3523 &hf_ptp_as_sig_tlv_flags_comp_mean_link_delay,
3524 &hf_ptp_as_sig_tlv_flags_comp_rate_ratio,
3525 NULL
3528 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Message interval request TLV");
3529 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1);
3531 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_link_delay_interval, tvb, offset, 1, ENC_NA);
3532 offset += 1;
3534 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_time_sync_interval, tvb, offset, 1, ENC_NA);
3535 offset += 1;
3537 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_announce_interval, tvb, offset, 1, ENC_NA);
3538 offset += 1;
3540 proto_tree_add_bitmask(ptp_tlv_tree, tvb, offset, hf_ptp_as_sig_tlv_flags, ett_ptp_as_sig_tlv_flags, msg_interval_req_flags, ENC_BIG_ENDIAN);
3541 offset += 1;
3543 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_reserved, tvb, offset, 2, ENC_NA);
3544 offset += 2;
3546 break;
3549 case PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_CSN_TLV: {
3550 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "CSN TLV");
3551 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1);
3553 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_csn_upstream_tx_time, tvb, offset, 12, ENC_NA);
3554 offset += 12;
3556 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_csn_neighbor_rate_ratio, tvb, offset, 4, ENC_BIG_ENDIAN);
3557 offset += 4;
3559 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_csn_mean_link_delay, tvb, offset, 12, ENC_NA);
3560 offset += 12;
3562 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_csn_delay_asymmetry, tvb, offset, 12, ENC_NA);
3563 offset += 12;
3565 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_csn_domain_number, tvb, offset, 1, ENC_NA);
3566 offset += 1;
3567 break;
3570 case PTP_V2_OE_ORG_IEEE_802_1_SUBTYPE_FOLLOWUP_DRIFT_TRACKING_TLV: {
3571 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Drift Tracking TLV");
3572 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1);
3574 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_dt_tlv_sync_egress_timestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
3575 offset += 6;
3577 /* Converting the fractionalNanoseconds to a double */
3578 guint32 nanoseconds = tvb_get_ntohl(tvb, offset);
3579 guint16 fractional_nanoseconds = tvb_get_ntohs(tvb, offset + 4);
3580 double combined_timestamp = nanoseconds + (fractional_nanoseconds / (double)(1 << 16));
3581 proto_tree_add_double(ptp_tlv_tree, hf_ptp_as_dt_tlv_sync_egress_timestamp_fractional_nanoseconds, tvb, offset, 6, combined_timestamp);
3582 offset += 6;
3584 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_dt_tlv_sync_grandmaster_identity, tvb, offset, 8, ENC_BIG_ENDIAN);
3585 offset += 8;
3587 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_dt_tlv_sync_steps_removed, tvb, offset, 2, ENC_BIG_ENDIAN);
3588 offset += 2;
3590 int32_t rate_ratio_drift;
3591 proto_tree_add_item_ret_int(ptp_tlv_tree, hf_ptp_as_dt_tlv_rate_ratio_drift, tvb, offset, 4, ENC_BIG_ENDIAN, &rate_ratio_drift);
3592 ti = proto_tree_add_double(ptp_tlv_tree, hf_ptp_as_dt_tlv_rate_ratio_drift_ppm, tvb, offset, 4, ((double)rate_ratio_drift / (UINT64_C(1) << 41)) * 1e6);
3593 proto_item_set_generated(ti);
3594 offset += 4;
3595 break;
3598 } /* end of switch (subtype) */
3600 if (!is_802_1as) {
3601 /* Expert Info ? */
3602 expert_add_info(pinfo, ti_tlv, &ei_ptp_v2_as_tlv_in_non_as);
3605 break;
3608 case OUI_IEEE_C37_238: {
3609 switch (subtype) {
3610 case PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C37238TLV: {
3611 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "IEEE_C37_238 TLV");
3612 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype);
3614 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid, tvb, offset, 2, ENC_BIG_ENDIAN);
3615 offset += 2;
3617 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy, tvb, offset, 4, ENC_BIG_ENDIAN);
3618 offset += 4;
3620 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy, tvb, offset, 4, ENC_BIG_ENDIAN);
3621 offset += 4;
3623 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3624 offset += 2;
3626 break;
3628 case PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV: {
3629 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "IEEE_C37_238 2017 TLV");
3630 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype);
3632 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_ieee_c37_238_2017_organizationsubtype, tvb, offset, 3, ENC_BIG_ENDIAN);
3633 offset += 3;
3635 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid, tvb, offset, 2, ENC_BIG_ENDIAN);
3636 offset += 2;
3638 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved, tvb, offset, 4, ENC_BIG_ENDIAN);
3639 offset += 4;
3641 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy, tvb, offset, 4, ENC_BIG_ENDIAN);
3642 offset += 4;
3644 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3645 offset += 2;
3647 break;
3650 } /* end of switch (subtype) */
3651 break;
3652 } /* end of OUI_IEEE_C37_238 */
3654 case OUI_SMPTE: {
3655 switch (subtype) {
3656 case PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV: {
3657 proto_item *smptedata_ti, *systemframerate_ti, *timeaddressflags_ti, *daylightsavingflags_ti, *leapsecondjumpflags_ti;
3658 proto_tree *ptp_smptedata_tree, *ptp_framerate_tree, *ptp_timeaddress_tree, *ptp_daylightsaving_tree, *ptp_leapsecondjump_tree;
3660 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Version TLV");
3661 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_v2_oe_tlv_smpte_subtype);
3663 smptedata_ti = proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_oe_tlv_subtype_smpte_data, tvb, offset, 42, ENC_NA);
3664 ptp_smptedata_tree = proto_item_add_subtree(smptedata_ti, ett_ptp_oe_smpte_data);
3665 systemframerate_ti = proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate, tvb, offset, 8, ENC_NA);
3666 ptp_framerate_tree = proto_item_add_subtree(systemframerate_ti, ett_ptp_oe_smpte_framerate);
3667 proto_tree_add_item(ptp_framerate_tree, hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator, tvb, offset, 4, ENC_BIG_ENDIAN);
3668 proto_tree_add_item(ptp_framerate_tree, hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
3669 offset += 8;
3671 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus, tvb, offset, 1, ENC_NA);
3672 offset += 1;
3674 timeaddressflags_ti = proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags, tvb, offset, 1, ENC_NA);
3675 ptp_timeaddress_tree = proto_item_add_subtree(timeaddressflags_ti, ett_ptp_oe_smpte_timeaddress);
3676 proto_tree_add_item(ptp_timeaddress_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop, tvb, offset, 1, ENC_NA);
3677 proto_tree_add_item(ptp_timeaddress_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color, tvb, offset, 1, ENC_NA);
3678 offset += 1;
3680 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset, tvb, offset, 4, ENC_BIG_ENDIAN);
3681 offset += 4;
3683 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
3684 offset += 4;
3686 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump, tvb, offset, 6, ENC_BIG_ENDIAN);
3687 offset += 6;
3689 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam, tvb, offset, 6, ENC_BIG_ENDIAN);
3690 offset += 6;
3692 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam, tvb, offset, 6, ENC_BIG_ENDIAN);
3693 offset += 6;
3695 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset, tvb, offset, 4, ENC_BIG_ENDIAN);
3696 offset += 4;
3698 daylightsavingflags_ti = proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving, tvb, offset, 1, ENC_NA);
3699 ptp_daylightsaving_tree = proto_item_add_subtree(daylightsavingflags_ti, ett_ptp_oe_smpte_daylightsaving);
3700 proto_tree_add_item(ptp_daylightsaving_tree, hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current, tvb, offset, 1, ENC_NA);
3701 proto_tree_add_item(ptp_daylightsaving_tree, hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next, tvb, offset, 1, ENC_NA);
3702 proto_tree_add_item(ptp_daylightsaving_tree, hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous, tvb, offset, 1, ENC_NA);
3703 offset += 1;
3705 leapsecondjumpflags_ti = proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump, tvb, offset, 1, ENC_NA);
3706 ptp_leapsecondjump_tree = proto_item_add_subtree(leapsecondjumpflags_ti, ett_ptp_oe_smpte_leapsecondjump);
3707 proto_tree_add_item(ptp_leapsecondjump_tree, hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change, tvb, offset, 1, ENC_NA);
3708 offset += 1;
3709 break;
3712 break;
3715 case OUI_CERN: {
3716 switch (subtype) {
3717 case PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV: {
3718 static int * const wr_flags[] = {
3719 &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn,
3720 &hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated,
3721 &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig,
3722 NULL
3725 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "CERN White Rabbit TLV");
3726 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_v2_an_tlv_oe_cern_subtype);
3728 uint32_t wr_message_id;
3729 proto_tree_add_item_ret_uint(ptp_tlv_tree, hf_ptp_v2_an_tlv_oe_cern_wrMessageID, tvb, offset, 2, ENC_BIG_ENDIAN, &wr_message_id);
3730 offset += 2;
3732 col_append_str(pinfo->cinfo, COL_INFO, " WR ");
3733 col_append_str(pinfo->cinfo, COL_INFO, val_to_str(wr_message_id, ptp_v2_org_cern_wrMessageID_vals, "Unknown PTP WR Message (%u)"));
3735 switch (wr_message_id) {
3736 case PTP_V2_OE_ORG_CERN_WRMESSAGEID_ANN_SUFIX:
3737 /* TODO: This should only happen for Announce messages! */
3738 proto_tree_add_bitmask(ptp_tlv_tree, tvb, offset, hf_ptp_v2_an_tlv_oe_cern_wrFlags, ett_ptp_oe_wr_flags, wr_flags, ENC_BIG_ENDIAN);
3739 offset += 2;
3740 break;
3742 case PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE:
3743 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_cern_calSendPattern, tvb, offset, 1, ENC_NA);
3744 offset += 1;
3746 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_cern_calRety, tvb, offset, 1, ENC_NA);
3747 offset += 1;
3749 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_cern_calPeriod, tvb, offset, 4, ENC_BIG_ENDIAN);
3750 offset += 4;
3751 break;
3753 case PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED:
3754 proto_tree_add_double(ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_cern_deltaTx, tvb, offset, 8, (double)(tvb_get_ntoh64(tvb, offset)) / (1 << 16));
3755 offset += 8;
3757 proto_tree_add_double(ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_cern_deltaRx, tvb, offset, 8, (double)(tvb_get_ntoh64(tvb, offset)) / (1 << 16));
3758 offset += 8;
3759 break;
3762 break;
3765 } /* end of switch (subtype) */
3766 break;
3768 case OUI_ITU_T: {
3769 switch (subtype) {
3770 case PTP_V2_INTERFACE_RATE_TLV: {
3771 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Interface Rate TLV");
3772 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_v2_sig_oe_tlv_itut_subtype);
3774 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_interface_bit_period, tvb, offset, 8, ENC_BIG_ENDIAN);
3775 offset += 8;
3777 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_numberbits_before_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN);
3778 offset += 2;
3780 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_numberbits_after_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN);
3781 offset += 2;
3782 break;
3785 } /* end of switch (subtype) */
3788 break;
3791 } /* end of switch (org_id) */
3793 break;
3794 } /* end of case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION */
3796 case PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION:
3797 /* yes we fall through as the message is basically the same */
3798 case PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION: {
3799 proto_tree *ptp_tlv_tree;
3800 if (tlv_type == PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION) {
3801 ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Request unicast transmission TLV");
3802 } else {
3803 ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Grant unicast transmission TLV");
3805 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3807 /* 16.1.4.1.3 messageType / 16.1.4.2.3 messageType*/
3808 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb, offset, 1, ENC_NA);
3809 offset += 1;
3811 /* 16.1.4.1.4 logInterMessagePeriod / 16.1.4.2.4 logInterMessagePeriod*/
3812 uint8_t log_inter_message_period = tvb_get_uint8(tvb, offset);
3813 double period = pow(2, log_inter_message_period);
3815 proto_item *ptp_tlv_period = proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod, tvb, offset, 1, ENC_NA);
3816 proto_tree *ptp_tlv_period_tree = proto_item_add_subtree(ptp_tlv_period, ett_ptp_v2_tlv_log_period);
3818 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_period, tvb, offset, 1, log_inter_message_period, "every %lg seconds", period);
3820 if (period > 0) {
3821 double rate = 1 / period;
3822 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate, tvb, offset, 1, log_inter_message_period, "%lg packets/sec", rate);
3823 } else {
3824 proto_tree_add_expert_format(ptp_tlv_period_tree, pinfo, &ei_ptp_v2_period_invalid, tvb, offset, 1, "Invalid InterMessagePeriod: %lg", period);
3826 offset += 1;
3828 /* 16.1.4.1.5 durationField / 16.1.4.2.5 durationField */
3829 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb, offset, 4, ENC_BIG_ENDIAN);
3830 offset += 4;
3832 if (tlv_type == PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION) {
3833 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_reserved, tvb, offset, 1, ENC_NA);
3834 offset += 1;
3836 /* 16.1.4.2.6 renewalInvited */
3837 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_renewalInvited, tvb, offset, 1, ENC_NA);
3838 offset += 1;
3841 break;
3844 case PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION:
3845 /* yes we fall through as the message is basically the same */
3846 case PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION: {
3847 proto_tree *ptp_tlv_tree;
3848 if (tlv_type == PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION) {
3849 ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Cancel unicast transmission TLV");
3850 } else {
3851 ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Acknowledge cancel unicast transmission TLV");
3853 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3855 /* 16.1.4.3.3 messageType / 16.1.4.4.3 messageType */
3856 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb, offset, 1, ENC_NA);
3857 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_maintainRequest, tvb, offset, 1, ENC_NA);
3858 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_maintainGrant, tvb, offset, 1, ENC_NA);
3859 offset += 1;
3861 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_reserved, tvb, offset, 1, ENC_NA);
3862 offset += 1;
3864 break;
3867 case PTP_V2_TLV_TYPE_PATH_TRACE: {
3868 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Path trace TLV");
3869 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3871 int tlv_end = offset + tlv_length + PTP_V2_TLV_HEADER_LENGTH;
3873 while (offset + 8 <= tlv_end) {
3874 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_an_tlv_pathsequence, tvb, offset, 8, ENC_BIG_ENDIAN);
3875 offset += 8;
3878 break;
3881 case PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR: {
3882 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "Alternate time offset indicator TLV");
3883 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3885 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_atoi_tlv_keyfield, tvb, offset, 1, ENC_NA);
3886 offset += 1;
3888 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_atoi_tlv_currentoffset, tvb, offset, 4, ENC_BIG_ENDIAN);
3889 offset += 4;
3891 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_atoi_tlv_jumpseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
3892 offset += 4;
3894 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_atoi_tlv_timeofnextjump, tvb, offset, 6, ENC_NA);
3895 offset += 6;
3897 dissect_ptp_v2_text(tvb, &offset, ptp_tlv_tree, hf_ptp_v2_atoi_tlv_displayname, hf_ptp_v2_atoi_tlv_displayname_length);
3898 /* offset was updated */
3899 break;
3902 case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE: {
3903 uint32_t org_id = tvb_get_ntoh24(tvb, offset + PTP_V2_TLV_HEADER_LENGTH);
3904 uint32_t subtype = tvb_get_ntoh24(tvb, offset + PTP_V2_TLV_ORGANIZATIONSUBTYPE_OFFSET);
3906 switch (org_id) {
3907 case OUI_IEEE_802_1:
3908 switch (subtype) {
3909 case PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_ORG_SUB_TYPE: {
3910 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "gPTP-capable TLV");
3911 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1_no_propagate);
3913 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_gptp_capable_message_interval, tvb, offset, 1, ENC_NA);
3914 offset += 1;
3916 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_flags, tvb, offset, 1, ENC_NA);
3917 offset += 1;
3919 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_gptp_capable_reserved, tvb, offset, 4, ENC_NA);
3920 offset += 4;
3922 break;
3925 case PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_MESSSAGEINTERVAL_ORG_SUB_TYPE: {
3926 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "gPTP-capable message interval request TLV");
3927 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype_802_1_no_propagate);
3929 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_gptp_capable_message_interval, tvb, offset, 1, ENC_NA);
3930 offset += 1;
3932 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_sig_tlv_gptp_capable_reserved, tvb, offset, 3, ENC_NA);
3933 offset += 3;
3935 break;
3938 } /* end of switch (subtype)*/
3939 break;
3941 } /* end of switch (org_id) */
3943 break;
3945 case PTP_V2_TLV_TYPE_L1_SYNC: {
3946 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, &ti_tlv, "L1 sync TLV");
3947 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
3949 /* Version with 2 bytes flags field */
3950 static int * const data_mode_flags2[] = {
3951 &hf_ptp_v2_sig_tlv_l1sync_flags2_ope,
3952 &hf_ptp_v2_sig_tlv_l1sync_flags2_cr,
3953 &hf_ptp_v2_sig_tlv_l1sync_flags2_rcr,
3954 &hf_ptp_v2_sig_tlv_l1sync_flags2_tcr,
3955 &hf_ptp_v2_sig_tlv_l1sync_flags2_ic,
3956 &hf_ptp_v2_sig_tlv_l1sync_flags2_irc,
3957 &hf_ptp_v2_sig_tlv_l1sync_flags2_itc,
3958 &hf_ptp_v2_sig_tlv_l1sync_flags2_reserved,
3959 NULL
3962 /* Version with 3 bytes flags field */
3963 static int * const data_mode_flags3[] = {
3964 &hf_ptp_v2_sig_tlv_l1sync_flags3_ope,
3965 &hf_ptp_v2_sig_tlv_l1sync_flags3_cr,
3966 &hf_ptp_v2_sig_tlv_l1sync_flags3_rcr,
3967 &hf_ptp_v2_sig_tlv_l1sync_flags3_tcr,
3968 &hf_ptp_v2_sig_tlv_l1sync_flags3_ic,
3969 &hf_ptp_v2_sig_tlv_l1sync_flags3_irc,
3970 &hf_ptp_v2_sig_tlv_l1sync_flags3_itc,
3971 &hf_ptp_v2_sig_tlv_l1sync_flags3_fov,
3972 &hf_ptp_v2_sig_tlv_l1sync_flags3_pov,
3973 &hf_ptp_v2_sig_tlv_l1sync_flags3_tct,
3974 &hf_ptp_v2_sig_tlv_l1sync_flags3_reserved,
3975 NULL
3978 /* Get the value of flags */
3979 uint16_t l1sync_flags = tvb_get_ntohs(tvb, offset);
3981 /* Check if the frame has extended format of L1_SYNC flags field */
3982 bool is_ext_format = (l1sync_flags & PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK) == PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK;
3983 uint8_t flags_len = is_ext_format ? PTP_V2_SIG_TLV_L1SYNC_FLAGS_EXT_FORMAT : PTP_V2_SIG_TLV_L1SYNC_FLAGS_BASIC_FORMAT;
3985 if (!is_ext_format) {
3986 proto_tree_add_bitmask(ptp_tlv_tree, tvb, offset, hf_ptp_v2_sig_tlv_flags2, ett_ptp_v2_sig_l1sync_flags, data_mode_flags2, ENC_BIG_ENDIAN);
3987 offset += flags_len;
3988 } else {
3989 proto_tree_add_bitmask(ptp_tlv_tree, tvb, offset, hf_ptp_v2_sig_tlv_flags3, ett_ptp_v2_sig_l1sync_flags, data_mode_flags3, ENC_BIG_ENDIAN);
3990 offset += flags_len;
3992 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_tlv_tree, "phaseOffsetTx",
3993 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns, hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns, NULL, NULL);
3994 /* offset was updated */
3996 dissect_ptp_v2_timetstamp(tvb, &offset, ptp_tlv_tree, "phaseOffsetTxTimestamp",
3997 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s, hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns);
3998 /* offset was updated */
4000 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_tlv_tree, "freqOffsetTx",
4001 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns, hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns, NULL, NULL);
4002 /* offset was updated */
4004 dissect_ptp_v2_timetstamp(tvb, &offset, ptp_tlv_tree, "freqOffsetTxTimestamp",
4005 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s, hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns);
4006 /* offset was updated */
4009 break;
4012 } /* end of switch (tlv_type) */
4014 /* check first we have a registered subdissector for the organizationId */
4015 if (offset == offset_loopstart && tlv_type == PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION) {
4016 uint32_t org_id = tvb_get_uint24(tvb, offset + PTP_V2_TLV_HEADER_LENGTH, ENC_BIG_ENDIAN);
4017 dissector_handle_t handle = dissector_get_uint_handle(ptpv2_tlv_org_id_subdissector_table, org_id);
4018 if (handle != NULL) {
4019 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH);
4020 ptp_v2_tlv_org_ext_info_t ptp_v2_info;
4021 ptp_v2_info.is_802_1as = is_802_1as;
4022 ptp_v2_info.ptp_v2_flags = ptp_v2_flags;
4023 ptp_v2_info.ptp_v2_messageid = ptp_v2_messageid;
4024 offset += call_dissector_only(handle, sub_tvb, pinfo, ptp_tree, &ptp_v2_info);
4028 if (offset == offset_loopstart) {
4029 /* unknown TLV! */
4030 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, offset, tlv_length + PTP_V2_TLV_HEADER_LENGTH, ett_ptp_v2_tlv, NULL, "Unknown TLV");
4032 if (tlv_type == PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION) {
4033 offset += dissect_ptp_v2_tlv_org_fields(tvb, offset, ptp_tlv_tree, hf_ptp_tlv_oe_organizationsubtype);
4034 } else {
4035 offset += dissect_ptp_v2_tlv_tlvtype_length(tvb, offset, ptp_tlv_tree);
4038 /* unparsed bytes */
4039 proto_tree_add_item(ptp_tlv_tree, hf_ptp_tlv_unparsed_payload, tvb, offset, tlv_length + 4 - (offset - offset_loopstart), ENC_NA);
4040 offset += tlv_length + 4 - (offset - offset_loopstart);
4043 if (offset < offset_loopstart + PTP_V2_TLV_HEADER_LENGTH + tlv_length) {
4044 /* unparsed bytes!*/
4045 offset = offset_loopstart + PTP_V2_TLV_HEADER_LENGTH + tlv_length;
4049 /* check if required TLVs are present and forbidden are absent*/
4050 if (is_802_1as) {
4051 if (ptp_v2_messageid == PTP_V2_SYNC_MESSAGE && ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) != PTP_V2_FLAGS_TWO_STEP_BITMASK) && !as_followup_tlv_present) {
4052 expert_add_info(pinfo, ti_tlv, &ei_ptp_v2_sync_no_fup_tlv);
4054 if (ptp_v2_messageid == PTP_V2_SYNC_MESSAGE && ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK) && as_followup_tlv_present) {
4055 expert_add_info(pinfo, ti_tlv, &ei_ptp_v2_sync_with_fup_tlv);
4057 if (ptp_v2_messageid == PTP_V2_FOLLOWUP_MESSAGE && !as_followup_tlv_present) {
4058 expert_add_info(pinfo, ti_tlv, &ei_ptp_v2_followup_no_tlv);
4062 return offset - offset_orig;
4065 static void
4066 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool ptpv2_oE) {
4067 int offset = 0;
4069 uint8_t ptp_v2_ver = 0;
4070 uint8_t ptp_v2_minorver = 0;
4071 uint8_t ptp_v2_domain = 0;
4072 uint8_t ptp_v2_minorsdoid = 0;
4073 uint64_t ptp_v2_correction = 0;
4074 uint64_t ptp_v2_clockid = 0;
4075 uint16_t ptp_v2_sourceportid = 0;
4076 uint16_t ptp_v2_seqid = 0;
4077 uint64_t ptp_v2_clockidref = 0;
4078 uint16_t ptp_v2_sourceportidref = 0;
4080 /* Set up structures needed to add the protocol subtree and manage it */
4081 proto_item *ti = NULL, *msg_len_item = NULL, *clockidentity_ti, *ti_root = NULL;
4082 proto_tree *ptp_tree = NULL, *ptp_clockidentity_tree;
4084 /* Make entries in Protocol column and Info column on summary display */
4085 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv2");
4087 /* Get majorSdoId bit to determine whether this is an AS packet or not */
4088 uint8_t ptp_v2_majorsdoid = 0xF0 & tvb_get_uint8 (tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET);
4090 /* 802.1AS is indicated by majorSdoId = 1 and Ethernet, WIFI, EPON, or CSN transport */
4091 bool is_802_1as = (ptp_v2_majorsdoid & PTP_V2_MAJORSDOID_ASPACKET_BITMASK) && (ptpv2_oE == true);
4093 /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
4094 uint8_t ptp_v2_messageid = 0x0F & tvb_get_uint8 (tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET);
4096 uint16_t msg_len = tvb_get_ntohs(tvb, PTP_V2_MESSAGE_LENGTH_OFFSET);
4098 uint16_t ptp_v2_flags = tvb_get_uint16(tvb, PTP_V2_FLAGS_OFFSET, ENC_BIG_ENDIAN);
4100 if (ptp_analyze_messages)
4102 ptp_v2_ver = 0x0F & tvb_get_uint8(tvb, PTP_V2_VERSIONPTP_OFFSET);
4103 ptp_v2_minorver = 0xF0 & tvb_get_uint8(tvb, PTP_V2_MINORVERSIONPTP_OFFSET);
4104 ptp_v2_domain = tvb_get_uint8(tvb, PTP_V2_DOMAIN_NUMBER_OFFSET);
4105 ptp_v2_minorsdoid = tvb_get_uint8(tvb, PTP_V2_MINORSDOID_OFFSET);
4106 ptp_v2_clockid = tvb_get_uint64(tvb, PTP_V2_CLOCKIDENTITY_OFFSET, ENC_BIG_ENDIAN);
4107 ptp_v2_sourceportid = tvb_get_uint16(tvb, PTP_V2_SOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
4108 ptp_v2_seqid = tvb_get_uint16(tvb, PTP_V2_SEQUENCEID_OFFSET, ENC_BIG_ENDIAN);
4109 ptp_v2_correction = tvb_get_uint64(tvb, PTP_V2_CORRECTION_OFFSET, ENC_BIG_ENDIAN);
4111 switch (ptp_v2_messageid)
4113 case PTP_V2_PEER_DELAY_RESP_MESSAGE:
4114 ptp_v2_clockidref = tvb_get_uint64(tvb, PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET, ENC_BIG_ENDIAN);
4115 ptp_v2_sourceportidref = tvb_get_uint16(tvb, PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
4116 break;
4117 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:
4118 ptp_v2_clockidref = tvb_get_uint64(tvb, PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET, ENC_BIG_ENDIAN);
4119 ptp_v2_sourceportidref = tvb_get_uint16(tvb, PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
4120 break;
4123 if (!(pinfo->fd->visited))
4125 ptp_frame_info_t *frame_info = NULL;
4126 switch (ptp_v2_messageid)
4128 case PTP_V2_SYNC_MESSAGE:
4129 frame_info = create_frame_info(pinfo, ptp_v2_ver, ptp_v2_minorver, ptp_v2_majorsdoid, ptp_v2_minorsdoid, PTP_V2_SYNC_MESSAGE, ptp_v2_domain, ptp_v2_clockid, ptp_v2_sourceportid, ptp_v2_seqid);
4130 frame_info->messagetype = PTP_V2_SYNC_MESSAGE;
4131 frame_info->sync.sync_two_step = (ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK;
4132 frame_info->sync.sync_ts = pinfo->abs_ts;
4133 /* Rapid sequence number resets can be detected here checking for non-zero frame_info->sync.sync_frame_num */
4134 frame_info->sync.sync_frame_num = pinfo->num;
4136 if (!frame_info->sync.sync_two_step) {
4137 /* In 1-step mode, the sync carries the followup information, so we set fup to sync */
4138 frame_info->sync.fup_frame_num = pinfo->num;
4139 frame_info->sync.timestamp_s = tvb_get_uint48(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
4140 frame_info->sync.timestamp_ns = tvb_get_uint32(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
4141 frame_info->sync.correction_ns = ptp_v2_correction >> 16;
4142 frame_info->sync.correction_subns = ptp_v2_correction % 16;
4144 break;
4145 case PTP_V2_FOLLOWUP_MESSAGE:
4146 frame_info = create_frame_info(pinfo, ptp_v2_ver, ptp_v2_minorver, ptp_v2_majorsdoid, ptp_v2_minorsdoid, PTP_V2_SYNC_MESSAGE, ptp_v2_domain, ptp_v2_clockid, ptp_v2_sourceportid, ptp_v2_seqid);
4147 frame_info->messagetype = PTP_V2_SYNC_MESSAGE;
4148 frame_info->sync.fup_frame_num = pinfo->num;
4149 frame_info->sync.timestamp_s = tvb_get_uint48(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
4150 frame_info->sync.timestamp_ns = tvb_get_uint32(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
4151 frame_info->sync.correction_ns = ptp_v2_correction >> 16;
4152 frame_info->sync.correction_subns = ptp_v2_correction % 16;
4153 break;
4154 case PTP_V2_PEER_DELAY_REQ_MESSAGE:
4155 frame_info = create_frame_info(pinfo, ptp_v2_ver, ptp_v2_minorver, ptp_v2_majorsdoid, ptp_v2_minorsdoid, PTP_V2_PEER_DELAY_REQ_MESSAGE, ptp_v2_domain, ptp_v2_clockid, ptp_v2_sourceportid, ptp_v2_seqid);
4156 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
4157 frame_info->pdelay.pdelay_req_frame_num = pinfo->num;
4158 frame_info->pdelay.pdelay_req_ts = pinfo->abs_ts;
4159 break;
4160 case PTP_V2_PEER_DELAY_RESP_MESSAGE:
4161 frame_info = create_frame_info(pinfo, ptp_v2_ver, ptp_v2_minorver, ptp_v2_majorsdoid, ptp_v2_minorsdoid, PTP_V2_PEER_DELAY_REQ_MESSAGE, ptp_v2_domain, ptp_v2_clockidref, ptp_v2_sourceportidref, ptp_v2_seqid);
4162 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
4163 frame_info->pdelay.pdelay_res_frame_num = pinfo->num;
4164 frame_info->pdelay.pdelay_res_two_step = (ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK;
4165 frame_info->pdelay.pdelay_res_ts = pinfo->abs_ts;
4166 frame_info->pdelay.pdelay_req_recv_ts_s = tvb_get_uint48(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
4167 frame_info->pdelay.pdelay_req_recv_ts_ns = tvb_get_uint32(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
4168 break;
4169 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:
4170 frame_info = create_frame_info(pinfo, ptp_v2_ver, ptp_v2_minorver, ptp_v2_majorsdoid, ptp_v2_minorsdoid, PTP_V2_PEER_DELAY_REQ_MESSAGE, ptp_v2_domain, ptp_v2_clockidref, ptp_v2_sourceportidref, ptp_v2_seqid);
4171 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
4172 frame_info->pdelay.pdelay_fup_frame_num = pinfo->num;
4173 frame_info->pdelay.pdelay_res_send_ts_s = tvb_get_uint48(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
4174 frame_info->pdelay.pdelay_res_send_ts_ns = tvb_get_uint32(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
4175 break;
4178 if (frame_info != NULL) {
4179 p_add_proto_data(wmem_file_scope(), pinfo, proto_ptp, 0, frame_info);
4182 if PTP_FRAME_INFO_SYNC_SEEN(frame_info) {
4184 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info) && !frame_info->sync.calculated_timestamp_valid) {
4185 /* calculate two step sync timestamp */
4187 nstime_t ts = NSTIME_INIT_SECS_NSECS(frame_info->sync.timestamp_s, frame_info->sync.timestamp_ns);
4189 /* we are ignoring subns */
4190 int64_t corr_s = frame_info->sync.correction_ns / NS_PER_S;
4191 int32_t corr_ns = frame_info->sync.correction_ns % NS_PER_S;
4192 nstime_t corr = NSTIME_INIT_SECS_NSECS(corr_s, corr_ns);
4194 nstime_sum(&(frame_info->sync.calculated_timestamp), &(ts), &(corr));
4195 frame_info->sync.calculated_timestamp_valid = true;
4198 if PTP_FRAME_INFO_SYNC_SEEN(frame_info->prev) {
4199 nstime_t delta_capture_ts;
4200 nstime_delta(&delta_capture_ts, &(frame_info->sync.sync_ts), &(frame_info->prev->sync.sync_ts));
4202 frame_info->sync.syncInterval = nstime_to_sec(&delta_capture_ts);
4203 if (frame_info->sync.syncInterval > 0)
4204 frame_info->sync.syncInterval_valid = true;
4206 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info->prev) && frame_info->sync.calculated_timestamp_valid && frame_info->prev->sync.calculated_timestamp_valid) {
4207 nstime_t delta_sync_ts;
4208 nstime_delta(&delta_sync_ts, &(frame_info->sync.calculated_timestamp), &(frame_info->prev->sync.calculated_timestamp));
4210 if (frame_info->sync.syncInterval_valid) {
4211 frame_info->sync.syncRateRatio = nstime_to_sec(&delta_sync_ts) / nstime_to_sec(&delta_capture_ts);
4212 frame_info->sync.syncRateRatio_valid = true;
4213 frame_info->sync.syncRateRatio_ppm =
4214 (int32_t)((1.0 - frame_info->sync.syncRateRatio) * 1000 * 1000);
4220 if (PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info) && PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info->prev)) {
4221 nstime_t t4_delta;
4222 nstime_delta(&t4_delta, &frame_info->pdelay.pdelay_res_ts, &frame_info->prev->pdelay.pdelay_res_ts);
4224 frame_info->pdelay.pdelayInterval = nstime_to_sec(&t4_delta);
4225 if (frame_info->pdelay.pdelayInterval > 0)
4226 frame_info->pdelay.pdelayInterval_valid = true;
4228 if (PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) && PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info->prev)) {
4229 /* lets calculate rate t3_delta / t4_delta */
4230 nstime_t t3_delta;
4231 nstime_t t3_curr = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_res_send_ts_s, frame_info->pdelay.pdelay_res_send_ts_ns);
4232 nstime_t t3_prev = NSTIME_INIT_SECS_NSECS(frame_info->prev->pdelay.pdelay_res_send_ts_s, frame_info->prev->pdelay.pdelay_res_send_ts_ns);
4233 nstime_delta(&t3_delta, &t3_curr, &t3_prev);
4235 if (frame_info->pdelay.pdelayInterval_valid) {
4236 frame_info->pdelay.neighborRateRatio = nstime_to_sec(&t3_delta) / nstime_to_sec(&t4_delta);
4237 frame_info->pdelay.neighborRateRatio_valid = true;
4238 frame_info->pdelay.neighborRateRatio_ppm =
4239 (int32_t)((1.0 - frame_info->pdelay.neighborRateRatio) * 1000 * 1000);
4244 if PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) {
4245 /* lets calculate peer delay: T4 - T1 - (t3 - t2) */
4246 nstime_t t2 = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_req_recv_ts_s, frame_info->pdelay.pdelay_req_recv_ts_ns);
4247 nstime_t t3 = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_res_send_ts_s, frame_info->pdelay.pdelay_res_send_ts_ns);
4248 nstime_t peer_delta_t3_t2;
4249 nstime_delta(&peer_delta_t3_t2, &t3, &t2);
4251 nstime_delta(&frame_info->pdelay.mean_propagation_delay_unscaled, &(frame_info->pdelay.pdelay_res_ts), &(frame_info->pdelay.pdelay_req_ts));
4252 double delta_t4_t1 = nstime_to_sec(&(frame_info->pdelay.mean_propagation_delay_unscaled));
4253 nstime_subtract(&frame_info->pdelay.mean_propagation_delay_unscaled, &peer_delta_t3_t2);
4255 /* now take only 1/2 of it */
4256 frame_info->pdelay.mean_propagation_delay_unscaled.nsecs /= 2;
4257 if ((frame_info->pdelay.mean_propagation_delay_unscaled.secs % 2) == 1) {
4258 frame_info->pdelay.mean_propagation_delay_unscaled.secs -= 1;
4259 frame_info->pdelay.mean_propagation_delay_unscaled.nsecs += NS_PER_S / 2;
4261 frame_info->pdelay.mean_propagation_delay_unscaled.secs /= 2;
4263 /* lets scale by neighborRateRatio. converted to the capture timestamp timescale. */
4264 if (frame_info->pdelay.neighborRateRatio_valid) {
4265 double delta_t3_t2 = nstime_to_sec(&peer_delta_t3_t2);
4266 frame_info->pdelay.mean_propagation_delay_scaled = 0.5 * (delta_t4_t1 - frame_info->pdelay.neighborRateRatio * delta_t3_t2);
4272 /* Extend Info column with managementId */
4273 /* Create and set the string for "Info" column */
4274 if ( ptp_v2_messageid == PTP_V2_MANAGEMENT_MESSAGE ) {
4275 uint16_t tlv_type;
4276 /* Get TLV Type */
4277 tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
4278 /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */
4279 switch(tlv_type)
4281 case PTP_V2_TLV_TYPE_MANAGEMENT:
4283 uint16_t ptp_v2_mm_managementId;
4284 uint8_t ptp_v2_management_action;
4285 /* Get the managementId */
4286 ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET);
4287 ptp_v2_management_action = 0x0F & tvb_get_uint8(tvb, PTP_V2_MM_ACTION_OFFSET);
4288 col_add_fstr(pinfo->cinfo, COL_INFO, "Management (%s) %s",
4289 val_to_str_ext(ptp_v2_mm_managementId, &ptp_v2_managementID_infocolumn_vals_ext, "Unknown management Id %u"),
4290 val_to_str(ptp_v2_management_action, ptp_v2_mm_action_vals, "Unknown Action %u"));
4291 break;
4293 case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS:
4295 uint16_t ptp_v2_mm_managementId;
4296 /* Get the managementErrorId */
4297 ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET);
4298 col_add_fstr(pinfo->cinfo, COL_INFO, "Management Error Message (%s)",
4299 val_to_str_ext(ptp_v2_mm_managementId, &ptp_v2_managementErrorId_vals_ext, "Unknown Error Id %u"));
4300 break;
4302 default:
4303 col_add_str(pinfo->cinfo, COL_INFO,
4304 val_to_str_ext(ptp_v2_messageid, &ptp_v2_messagetype_vals_ext, "Unknown PTP Message (%u)"));
4305 break;
4307 } else {
4308 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext(ptp_v2_messageid, &ptp_v2_messagetype_vals_ext, "Unknown PTP Message (%u)"));
4311 if (tree) {
4312 ti_root = proto_tree_add_item(tree, proto_ptp, tvb, offset, -1, ENC_NA);
4313 ptp_tree = proto_item_add_subtree(ti_root, ett_ptp_v2);
4315 proto_tree_add_item(ptp_tree, hf_ptp_v2_majorsdoid, tvb, offset, 1, ENC_NA);
4316 proto_tree_add_item(ptp_tree, hf_ptp_v2_messagetype, tvb, offset, 1, ENC_NA);
4317 offset += 1;
4319 proto_tree_add_item(ptp_tree, hf_ptp_v2_minorversionptp, tvb, offset, 1, ENC_NA);
4320 proto_tree_add_item(ptp_tree, hf_ptp_v2_versionptp, tvb, offset, 1, ENC_NA);
4321 offset += 1;
4323 msg_len_item = proto_tree_add_item(ptp_tree, hf_ptp_v2_messagelength, tvb, offset, 2, ENC_BIG_ENDIAN);
4324 offset += 2;
4328 * Sanity-check the message length.
4330 if (msg_len > tvb_reported_length(tvb)) {
4331 /* Bogus message length - runs past the end of the packet */
4332 expert_add_info(pinfo, msg_len_item, &ei_ptp_v2_msg_len_too_large);
4333 } else if (msg_len < PTP_V2_MESSAGE_LENGTH_OFFSET + 2) {
4334 /* Bogus message length - not long enough to include the message length field */
4335 expert_add_info(pinfo, msg_len_item, &ei_ptp_v2_msg_len_too_small);
4336 return;
4337 } else {
4339 * Set the length of this tvbuff to the message length, chopping
4340 * off extra data.
4342 set_actual_length(tvb, msg_len);
4343 proto_item_set_len(ti_root, msg_len);
4346 if (tree) {
4347 static int * const ptp_flags[] = {
4348 &hf_ptp_v2_flags_security,
4349 &hf_ptp_v2_flags_specific2,
4350 &hf_ptp_v2_flags_specific1,
4351 &hf_ptp_v2_flags_unicast,
4352 &hf_ptp_v2_flags_twostep,
4353 &hf_ptp_v2_flags_alternatemaster,
4354 &hf_ptp_v2_flags_synchronizationUncertain,
4355 &hf_ptp_v2_flags_frequencytraceable,
4356 &hf_ptp_v2_flags_timetraceable,
4357 &hf_ptp_v2_flags_ptptimescale,
4358 &hf_ptp_v2_flags_utcoffsetvalid,
4359 &hf_ptp_v2_flags_li59,
4360 &hf_ptp_v2_flags_li61,
4361 NULL
4364 ptp_frame_info_t *frame_info = (ptp_frame_info_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_ptp, 0);
4366 proto_tree_add_item(ptp_tree, hf_ptp_v2_domainnumber, tvb, offset, 1, ENC_NA);
4367 offset += 1;
4369 proto_tree_add_item(ptp_tree, hf_ptp_v2_minorsdoid, tvb, offset, 1, ENC_NA);
4370 offset += 1;
4372 proto_tree_add_bitmask(ptp_tree, tvb, offset, hf_ptp_v2_flags, ett_ptp_v2_flags, ptp_flags, ENC_BIG_ENDIAN);
4373 offset += 2;
4375 dissect_ptp_v2_timeInterval(tvb, &offset, ptp_tree, "correctionField", hf_ptp_v2_correction, hf_ptp_v2_correctionsubns, NULL, NULL);
4376 /* offset was updated */
4378 proto_tree_add_item(ptp_tree, hf_ptp_v2_messagetypespecific, tvb, offset, 4, ENC_BIG_ENDIAN);
4379 offset += 4;
4381 clockidentity_ti = proto_tree_add_item(ptp_tree, hf_ptp_v2_clockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4383 /* EUI-64: vendor ID | 0xFF - 0xFE | card ID */
4384 if (tvb_get_ntohs(tvb, offset + 3) == 0xFFFE) {
4385 ptp_clockidentity_tree = proto_item_add_subtree(clockidentity_ti, ett_ptp_v2_clockidentity);
4387 const char *manuf_name = tvb_get_manuf_name(tvb, offset);
4388 proto_tree_add_bytes_format_value(ptp_clockidentity_tree, hf_ptp_v2_clockidentity_manuf, tvb, offset, 3, NULL, "%s", manuf_name);
4390 offset += 8;
4392 proto_tree_add_item(ptp_tree, hf_ptp_v2_sourceportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4393 offset += 2;
4395 proto_tree_add_item(ptp_tree, hf_ptp_v2_sequenceid, tvb, offset, 2, ENC_BIG_ENDIAN);
4396 offset += 2;
4398 /* IEEE 802.1AS defines the control field to be 0x00, so we turn off resolution */
4399 if (is_802_1as) {
4400 proto_tree_add_item(ptp_tree, hf_ptp_v2_controlfield_default, tvb, offset, 1, ENC_NA);
4401 } else {
4402 proto_tree_add_item(ptp_tree, hf_ptp_v2_controlfield, tvb, offset, 1, ENC_NA);
4404 offset += 1;
4406 int logmsgperiod;
4407 ti = proto_tree_add_item_ret_int(ptp_tree, hf_ptp_v2_logmessageperiod, tvb, offset, 1, ENC_NA, &logmsgperiod);
4409 /* 127 is special */
4410 if (ptp_analyze_messages && logmsgperiod != 127) {
4411 proto_item_append_text(ti, " (%.6f s)", pow(2.0, (double)logmsgperiod));
4414 offset += 1;
4416 switch(ptp_v2_messageid) {
4417 case PTP_V2_ANNOUNCE_MESSAGE:{
4419 /* In 802.1AS there is no origin timestamp in an Announce Message */
4420 if(!is_802_1as){
4421 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4422 offset += 6;
4424 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4425 offset += 4;
4426 } else {
4427 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_reserved1, tvb, offset, 10, ENC_NA);
4428 offset += 10;
4431 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origincurrentutcoffset, tvb, offset, 2, ENC_BIG_ENDIAN);
4432 offset += 2;
4434 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_reserved2, tvb, offset, 1, ENC_NA);
4435 offset += 1;
4437 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority1, tvb, offset, 1, ENC_NA);
4438 offset += 1;
4440 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockclass, tvb, offset, 1, ENC_NA);
4441 offset += 1;
4443 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockaccuracy, tvb, offset, 1, ENC_NA);
4444 offset += 1;
4446 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockvariance, tvb, offset, 2, ENC_BIG_ENDIAN);
4447 offset += 2;
4449 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority2, tvb, offset, 1, ENC_NA);
4450 offset += 1;
4452 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4453 offset += 8;
4455 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_localstepsremoved, tvb, offset, 2, ENC_BIG_ENDIAN);
4456 offset += 2;
4458 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_timesource, tvb, offset, 1, ENC_NA);
4459 offset += 1;
4461 disect_ptp_v2_tlvs(tvb, offset, pinfo, ti_root, ptp_tree, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4462 break;
4465 case PTP_V2_SYNC_MESSAGE:
4466 if (is_802_1as && ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK)) {
4467 /* IEEE 802.1AS 2-step does not have Origin Timestamp in Sync! See 11.4.3 */
4468 proto_tree_add_item(ptp_tree, hf_ptp_v2_sync_reserved, tvb, offset, 10, ENC_NA);
4469 offset += 10;
4470 } else {
4471 /* regular PTP or 802.1AS 1-step */
4472 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4473 offset += 6;
4475 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4476 offset += 4;
4479 disect_ptp_v2_tlvs(tvb, offset, pinfo, ti_root, ptp_tree, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4481 if (ptp_analyze_messages) {
4482 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info)) {
4483 if (frame_info->sync.syncInterval_valid) {
4484 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_period, tvb, 0, 0, frame_info->sync.syncInterval);
4485 proto_item_append_text(ti, " %s", "s");
4486 proto_item_set_generated(ti);
4489 if ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK) {
4490 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_sync_to_followup, tvb, 0, 0, frame_info->sync.fup_frame_num);
4491 proto_item_set_generated(ti);
4492 } else {
4493 if (frame_info->sync.calculated_timestamp_valid) {
4494 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_timestamp, tvb, 0, 0, nstime_to_sec(&(frame_info->sync.calculated_timestamp)));
4495 proto_item_set_generated(ti);
4496 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_timestamp);
4497 ti = proto_tree_add_uint64(ts_tree, hf_ptp_v2_analysis_sync_timestamp_seconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.secs);
4498 proto_item_set_generated(ti);
4499 ti = proto_tree_add_uint(ts_tree, hf_ptp_v2_analysis_sync_timestamp_nanoseconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.nsecs);
4500 proto_item_set_generated(ti);
4503 if (frame_info->sync.syncRateRatio_valid) {
4504 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio, tvb, 0, 0, frame_info->sync.syncRateRatio);
4505 proto_item_set_generated(ti);
4506 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio_ppm, tvb, 0, 0, frame_info->sync.syncRateRatio_ppm);
4507 proto_item_set_generated(ti);
4510 } else if ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK) {
4511 /* No FollowUp found! */
4512 expert_add_info(pinfo, ti_root, &ei_ptp_v2_sync_no_followup);
4516 break;
4518 case PTP_V2_DELAY_REQ_MESSAGE:{
4519 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4520 offset += 6;
4522 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4523 offset += 4;
4525 disect_ptp_v2_tlvs(tvb, offset, pinfo, ti_root, ptp_tree, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4527 break;
4530 case PTP_V2_FOLLOWUP_MESSAGE:{
4531 proto_item *ti_tstamp;
4532 uint64_t ts_sec;
4533 uint32_t ts_ns;
4535 proto_tree_add_item_ret_uint64(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN, &ts_sec);
4536 proto_tree_add_item_ret_uint(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds, tvb, offset + 6, 4, ENC_BIG_ENDIAN, &ts_ns);
4537 ti_tstamp = proto_tree_add_bytes_format_value(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_32bit, tvb, offset, 10,
4538 NULL, "%"PRIu64, (ts_sec * NS_PER_S + ts_ns) % UINT64_C(0x100000000));
4539 proto_item_set_hidden(ti_tstamp);
4540 proto_item_set_generated(ti_tstamp);
4541 offset += 10;
4543 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4545 if (ptp_analyze_messages) {
4546 if (frame_info != NULL) {
4547 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info) && frame_info->sync.sync_two_step) {
4548 if (frame_info->sync.calculated_timestamp_valid) {
4549 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_timestamp, tvb, 0, 0, nstime_to_sec(&(frame_info->sync.calculated_timestamp)));
4550 proto_item_set_generated(ti);
4551 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_timestamp);
4552 ti = proto_tree_add_uint64(ts_tree, hf_ptp_v2_analysis_sync_timestamp_seconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.secs);
4553 proto_item_set_generated(ti);
4554 ti = proto_tree_add_uint(ts_tree, hf_ptp_v2_analysis_sync_timestamp_nanoseconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.nsecs);
4555 proto_item_set_generated(ti);
4558 if (frame_info->sync.syncRateRatio_valid) {
4559 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio, tvb, 0, 0, frame_info->sync.syncRateRatio);
4560 proto_item_set_generated(ti);
4561 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio_ppm, tvb, 0, 0, frame_info->sync.syncRateRatio_ppm);
4562 proto_item_set_generated(ti);
4565 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_followup_to_sync, tvb, 0, 0, frame_info->sync.sync_frame_num);
4566 proto_item_set_generated(ti);
4567 } else {
4568 /* No 2-step Sync found! */
4569 expert_add_info(pinfo, ti_root, &ei_ptp_v2_followup_no_sync);
4574 break;
4577 case PTP_V2_DELAY_RESP_MESSAGE:{
4578 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4579 offset += 6;
4581 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4582 offset += 4;
4584 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingportidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4585 offset += 8;
4587 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingsourceportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4588 offset += 2;
4590 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4592 break;
4595 case PTP_V2_PEER_DELAY_REQ_MESSAGE:{
4596 /* In 802.1AS there is no origin timestamp in a Pdelay_Req Message */
4597 if(!is_802_1as){
4598 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4599 offset += 6;
4601 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4602 offset += 4;
4603 } else {
4604 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_reserved, tvb, offset, 10, ENC_NA);
4605 offset += 10;
4607 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_reserved, tvb, offset, 10, ENC_NA);
4608 offset += 10;
4610 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4612 if (ptp_analyze_messages) {
4613 if (frame_info != NULL) {
4614 if PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info) {
4615 if (frame_info->pdelay.pdelayInterval_valid) {
4616 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_period, tvb, 0, 0, frame_info->pdelay.pdelayInterval);
4617 proto_item_append_text(ti, " %s", "s");
4618 proto_item_set_generated(ti);
4622 if (frame_info->pdelay.pdelay_res_frame_num != 0) {
4623 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayreq_to_pdelayres, tvb, 0, 0, frame_info->pdelay.pdelay_res_frame_num);
4624 proto_item_set_generated(ti);
4625 } else {
4626 /* No Response found! */
4627 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdreq_no_pdresp);
4631 break;
4634 case PTP_V2_PEER_DELAY_RESP_MESSAGE:{
4635 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4636 offset += 6;
4638 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4639 offset += 4;
4641 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingportidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4642 offset += 8;
4644 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingsourceportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4645 offset += 2;
4647 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4649 if (ptp_analyze_messages) {
4650 if (frame_info != NULL) {
4651 if (frame_info->pdelay.pdelay_req_frame_num != 0) {
4652 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayres_to_pdelayreq, tvb, 0, 0, frame_info->pdelay.pdelay_req_frame_num);
4653 proto_item_set_generated(ti);
4654 } else {
4655 /* No Request found! */
4656 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_no_pdreq);
4658 if (frame_info->pdelay.pdelay_fup_frame_num != 0) {
4659 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayres_to_pdelayfup, tvb, 0, 0, frame_info->pdelay.pdelay_fup_frame_num);
4660 proto_item_set_generated(ti);
4661 } else {
4662 /* No Follow Up found! */
4663 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_no_pdfup);
4665 if (PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) && frame_info->pdelay.pdelay_res_two_step == false) {
4666 /* Two step false but follow up received! */
4667 /* According to 802.1AS-2011/2022 2-step must be true on pDelay Req */
4668 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_twostep);
4672 break;
4675 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:{
4676 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN);
4677 offset += 6;
4679 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN);
4680 offset += 4;
4682 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingportidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4683 offset += 8;
4685 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingsourceportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4686 offset += 2;
4688 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4690 if (ptp_analyze_messages) {
4691 if (frame_info != NULL) {
4692 if PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) {
4693 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_mpd_unscaled, tvb, 0, 0, nstime_to_sec(&frame_info->pdelay.mean_propagation_delay_unscaled));
4694 proto_item_set_generated(ti);
4695 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_mean_propagation_delay);
4696 ti = proto_tree_add_int64(ts_tree, hf_ptp_v2_analysis_pdelay_mpd_unscaled_seconds, tvb, 0, 0, frame_info->pdelay.mean_propagation_delay_unscaled.secs);
4697 proto_item_set_generated(ti);
4698 ti = proto_tree_add_int(ts_tree, hf_ptp_v2_analysis_pdelay_mpd_unscaled_nanoseconds, tvb, 0, 0, frame_info->pdelay.mean_propagation_delay_unscaled.nsecs);
4699 proto_item_set_generated(ti);
4701 if (frame_info->pdelay.neighborRateRatio_valid) {
4702 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_mpd_scaled, tvb, 0, 0, frame_info->pdelay.mean_propagation_delay_scaled);
4703 proto_item_set_generated(ti);
4704 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_neighRateRatio, tvb, 0, 0, frame_info->pdelay.neighborRateRatio);
4705 proto_item_set_generated(ti);
4706 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm, tvb, 0, 0, frame_info->pdelay.neighborRateRatio_ppm);
4707 proto_item_set_generated(ti);
4711 if (frame_info->pdelay.pdelay_res_frame_num != 0) {
4712 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayfup_to_pdelayres, tvb, 0, 0, frame_info->pdelay.pdelay_res_frame_num);
4713 proto_item_set_generated(ti);
4714 } else {
4715 /* No Response found! */
4716 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdfup_no_pdresp);
4720 break;
4723 case PTP_V2_SIGNALING_MESSAGE:{
4724 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4725 offset += 8;
4727 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4728 offset += 2;
4730 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4732 break;
4735 case PTP_V2_MANAGEMENT_MESSAGE: {
4736 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
4737 offset += 8;
4739 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportid, tvb, offset, 2, ENC_BIG_ENDIAN);
4740 offset += 2;
4742 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_startingboundaryhops, tvb, offset, 1, ENC_NA);
4743 offset += 1;
4745 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_boundaryhops, tvb, offset, 1, ENC_NA);
4746 offset += 1;
4748 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_reserved1, tvb, offset, 1, ENC_NA);
4749 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_action, tvb, offset, 1, ENC_NA);
4750 offset += 1;
4752 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_reserved2, tvb, offset, 1, ENC_NA);
4753 offset += 1;
4755 disect_ptp_v2_tlvs(tvb, offset, pinfo, ptp_tree, ti_root, ptp_v2_messageid, ptp_v2_flags, is_802_1as);
4757 break;
4758 } /* case Management Message */
4759 } /* switch message ID */
4760 } /* tree */
4764 /* Register the protocol with Wireshark */
4766 void
4767 proto_register_ptp(void) {
4768 static hf_register_info hf[] = {
4769 /* PTPv1 fields **********************************************************/
4770 /* Common fields for all frames */
4771 { &hf_ptp_versionptp,
4772 { "versionPTP", "ptp.versionptp",
4773 FT_UINT16, BASE_DEC, NULL, 0x00,
4774 NULL, HFILL }
4776 { &hf_ptp_versionnetwork,
4777 { "versionNetwork", "ptp.versionnetwork",
4778 FT_UINT16, BASE_DEC, NULL, 0x00,
4779 NULL, HFILL }
4781 { &hf_ptp_subdomain,
4782 { "subdomain", "ptp.subdomain",
4783 FT_STRING, BASE_NONE, NULL, 0x00,
4784 NULL, HFILL }
4786 { &hf_ptp_messagetype,
4787 { "messageType", "ptp.messagetype",
4788 FT_UINT8, BASE_DEC, VALS(ptp_messagetype_vals), 0x00,
4789 NULL, HFILL }
4791 { &hf_ptp_sourcecommunicationtechnology,
4792 { "sourceCommunicationTechnology", "ptp.sourcecommunicationtechnology",
4793 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
4794 NULL, HFILL }
4796 { &hf_ptp_sourceuuid,
4797 { "sourceUuid", "ptp.sourceuuid",
4798 FT_ETHER, BASE_NONE, NULL, 0x00,
4799 NULL, HFILL }
4801 { &hf_ptp_sourceportid,
4802 { "sourcePortId", "ptp.sourceportid",
4803 FT_UINT16, BASE_DEC, NULL, 0x00,
4804 NULL, HFILL }
4806 { &hf_ptp_sequenceid,
4807 { "sequenceId", "ptp.sequenceid",
4808 FT_UINT16, BASE_DEC, NULL, 0x00,
4809 NULL, HFILL }
4811 { &hf_ptp_controlfield,
4812 { "controlField", "ptp.controlfield",
4813 FT_UINT8, BASE_DEC, VALS(ptp_controlfield_vals), 0x00,
4814 NULL, HFILL }
4816 /* THE FLAGS-FIELD */
4817 { &hf_ptp_flags,
4818 { "flags", "ptp.flags",
4819 FT_UINT16, BASE_HEX, NULL, 0x00,
4820 NULL, HFILL }
4822 { &hf_ptp_flags_li61,
4823 { "PTP_LI61", "ptp.flags.li61",
4824 FT_BOOLEAN, 16, NULL, PTP_FLAGS_LI61_BITMASK,
4825 NULL, HFILL }
4827 { &hf_ptp_flags_li59,
4828 { "PTP_LI59", "ptp.flags.li59",
4829 FT_BOOLEAN, 16, NULL, PTP_FLAGS_LI59_BITMASK,
4830 NULL, HFILL }
4832 { &hf_ptp_flags_boundary_clock,
4833 { "PTP_BOUNDARY_CLOCK", "ptp.flags.boundary_clock",
4834 FT_BOOLEAN, 16, NULL, PTP_FLAGS_BOUNDARY_CLOCK_BITMASK,
4835 NULL, HFILL }
4837 { &hf_ptp_flags_assist,
4838 { "PTP_ASSIST", "ptp.flags.assist",
4839 FT_BOOLEAN, 16, NULL, PTP_FLAGS_ASSIST_BITMASK,
4840 NULL, HFILL }
4842 { &hf_ptp_flags_ext_sync,
4843 { "PTP_EXT_SYNC", "ptp.flags.ext_sync",
4844 FT_BOOLEAN, 16, NULL, PTP_FLAGS_EXT_SYNC_BITMASK,
4845 NULL, HFILL }
4847 { &hf_ptp_flags_parent,
4848 { "PTP_PARENT_STATS", "ptp.flags.parent_stats",
4849 FT_BOOLEAN, 16, NULL, PTP_FLAGS_PARENT_STATS_BITMASK,
4850 NULL, HFILL }
4852 { &hf_ptp_flags_sync_burst,
4853 { "PTP_SYNC_BURST", "ptp.flags.sync_burst",
4854 FT_BOOLEAN, 16, NULL, PTP_FLAGS_SYNC_BURST_BITMASK,
4855 NULL, HFILL }
4857 /* END OF THE FLAG-FIELD */
4859 /* offsets for ptp_sync and delay_req (=sdr) messages */
4860 { &hf_ptp_sdr_origintimestamp,
4861 { "originTimestamp", "ptp.sdr.origintimestamp",
4862 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4863 NULL, HFILL }
4865 { &hf_ptp_sdr_origintimestamp_seconds,
4866 { "originTimestamp (seconds)", "ptp.sdr.origintimestamp_seconds",
4867 FT_UINT32, BASE_DEC, NULL, 0x00,
4868 NULL, HFILL }
4870 { &hf_ptp_sdr_origintimestamp_nanoseconds,
4871 { "originTimestamp (nanoseconds)", "ptp.sdr.origintimestamp_nanoseconds",
4872 FT_INT32, BASE_DEC, NULL, 0x00,
4873 NULL, HFILL }
4875 { &hf_ptp_sdr_epochnumber,
4876 { "epochNumber", "ptp.sdr.epochnumber",
4877 FT_UINT16, BASE_DEC, NULL, 0x00,
4878 NULL, HFILL }
4880 { &hf_ptp_sdr_currentutcoffset,
4881 { "currentUTCOffset", "ptp.sdr.currentutcoffset",
4882 FT_INT16, BASE_DEC, NULL, 0x00,
4883 NULL, HFILL }
4885 { &hf_ptp_sdr_grandmastercommunicationtechnology,
4886 { "grandmasterCommunicationTechnology", "ptp.sdr.grandmastercommunicationtechnology",
4887 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
4888 NULL, HFILL }
4890 { &hf_ptp_sdr_grandmasterclockuuid,
4891 { "grandMasterClockUuid", "ptp.sdr.grandmasterclockuuid",
4892 FT_ETHER, BASE_NONE, NULL, 0x00,
4893 NULL, HFILL }
4895 { &hf_ptp_sdr_grandmasterportid,
4896 { "grandmasterPortId", "ptp.sdr.grandmasterportid",
4897 FT_UINT16, BASE_DEC, NULL, 0x00,
4898 NULL, HFILL }
4900 { &hf_ptp_sdr_grandmastersequenceid,
4901 { "grandmasterSequenceId", "ptp.sdr.grandmastersequenceid",
4902 FT_UINT16, BASE_DEC, NULL, 0x00,
4903 NULL, HFILL }
4905 { &hf_ptp_sdr_grandmasterclockstratum,
4906 { "grandmasterClockStratum", "ptp.sdr.grandmasterclockstratum",
4907 FT_UINT8, BASE_DEC, NULL, 0x00,
4908 NULL, HFILL }
4910 { &hf_ptp_sdr_grandmasterclockidentifier,
4911 { "grandmasterClockIdentifier", "ptp.sdr.grandmasterclockidentifier",
4912 FT_STRING, BASE_NONE, NULL, 0x00,
4913 NULL, HFILL }
4915 { &hf_ptp_sdr_grandmasterclockvariance,
4916 { "grandmasterClockVariance", "ptp.sdr.grandmasterclockvariance",
4917 FT_INT16, BASE_DEC, NULL, 0x00,
4918 NULL, HFILL }
4920 { &hf_ptp_sdr_grandmasterpreferred,
4921 { "grandmasterPreferred", "ptp.sdr.grandmasterpreferred",
4922 FT_UINT8, BASE_DEC, NULL, 0x00,
4923 NULL, HFILL }
4925 { &hf_ptp_sdr_grandmasterisboundaryclock,
4926 { "grandmasterIsBoundaryClock", "ptp.sdr.grandmasterisboundaryclock",
4927 FT_UINT8, BASE_DEC, NULL, 0x00,
4928 NULL, HFILL }
4930 { &hf_ptp_sdr_syncinterval,
4931 { "syncInterval", "ptp.sdr.syncinterval",
4932 FT_INT8, BASE_DEC, NULL, 0x00,
4933 NULL, HFILL }
4935 { &hf_ptp_sdr_localclockvariance,
4936 { "localClockVariance", "ptp.sdr.localclockvariance",
4937 FT_INT16, BASE_DEC, NULL, 0x00,
4938 NULL, HFILL }
4940 { &hf_ptp_sdr_localstepsremoved,
4941 { "localStepsRemoved", "ptp.sdr.localstepsremoved",
4942 FT_UINT16, BASE_DEC, NULL, 0x00,
4943 NULL, HFILL }
4945 { &hf_ptp_sdr_localclockstratum,
4946 { "localClockStratum", "ptp.sdr.localclockstratum",
4947 FT_UINT8, BASE_DEC, NULL, 0x00,
4948 NULL, HFILL }
4950 { &hf_ptp_sdr_localclockidentifier,
4951 { "localClockIdentifier", "ptp.sdr.localclockidentifier",
4952 FT_STRING, BASE_NONE, NULL, 0x00,
4953 NULL, HFILL }
4955 { &hf_ptp_sdr_parentcommunicationtechnology,
4956 { "parentCommunicationTechnology", "ptp.sdr.parentcommunicationtechnology",
4957 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
4958 NULL, HFILL }
4960 { &hf_ptp_sdr_parentuuid,
4961 { "parentUuid", "ptp.sdr.parentuuid",
4962 FT_ETHER, BASE_NONE, NULL, 0x00,
4963 NULL, HFILL }
4965 { &hf_ptp_sdr_parentportfield,
4966 { "parentPortField", "ptp.sdr.parentportfield",
4967 FT_UINT16, BASE_DEC, NULL, 0x00,
4968 NULL, HFILL }
4970 { &hf_ptp_sdr_estimatedmastervariance,
4971 { "estimatedMasterVariance", "ptp.sdr.estimatedmastervariance",
4972 FT_INT16, BASE_DEC, NULL, 0x00,
4973 NULL, HFILL }
4975 { &hf_ptp_sdr_estimatedmasterdrift,
4976 { "estimatedMasterDrift", "ptp.sdr.estimatedmasterdrift",
4977 FT_INT32, BASE_DEC, NULL, 0x00,
4978 NULL, HFILL }
4980 { &hf_ptp_sdr_utcreasonable,
4981 { "utcReasonable", "ptp.sdr.utcreasonable",
4982 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4983 NULL, HFILL }
4985 /* offsets for follow_up (=fu) messages */
4986 { &hf_ptp_fu_associatedsequenceid,
4987 { "associatedSequenceId", "ptp.fu.associatedsequenceid",
4988 FT_UINT16, BASE_DEC, NULL, 0x00,
4989 NULL, HFILL }
4991 { &hf_ptp_fu_preciseorigintimestamp,
4992 { "preciseOriginTimestamp", "ptp.fu.preciseorigintimestamp",
4993 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4994 NULL, HFILL }
4996 { &hf_ptp_fu_preciseorigintimestamp_seconds,
4997 { "preciseOriginTimestamp (seconds)", "ptp.fu.preciseorigintimestamp_seconds",
4998 FT_UINT32, BASE_DEC, NULL, 0x00,
4999 NULL, HFILL }
5001 { &hf_ptp_fu_preciseorigintimestamp_nanoseconds,
5002 { "preciseOriginTimestamp (nanoseconds)", "ptp.fu.preciseorigintimestamp_nanoseconds",
5003 FT_INT32, BASE_DEC, NULL, 0x00,
5004 NULL, HFILL }
5006 /* offsets for delay_resp (=dr) messages */
5007 { &hf_ptp_dr_delayreceipttimestamp,
5008 { "delayReceiptTimestamp", "ptp.dr.delayreceipttimestamp",
5009 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5010 NULL, HFILL }
5012 { &hf_ptp_dr_delayreceipttimestamp_seconds,
5013 { "delayReceiptTimestamp (Seconds)", "ptp.dr.delayreceipttimestamp_seconds",
5014 FT_UINT32, BASE_DEC, NULL, 0x00,
5015 NULL, HFILL }
5017 { &hf_ptp_dr_delayreceipttimestamp_nanoseconds,
5018 { "delayReceiptTimestamp (nanoseconds)", "ptp.dr.delayreceipttimestamp_nanoseconds",
5019 FT_INT32, BASE_DEC, NULL, 0x00,
5020 NULL, HFILL }
5022 { &hf_ptp_dr_requestingsourcecommunicationtechnology,
5023 { "requestingSourceCommunicationTechnology", "ptp.dr.requestingsourcecommunicationtechnology",
5024 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5025 NULL, HFILL }
5027 { &hf_ptp_dr_requestingsourceuuid,
5028 { "requestingSourceUuid", "ptp.dr.requestingsourceuuid",
5029 FT_ETHER, BASE_NONE, NULL, 0x00,
5030 NULL, HFILL }
5032 { &hf_ptp_dr_requestingsourceportid,
5033 { "requestingSourcePortId", "ptp.dr.requestingsourceportid",
5034 FT_UINT16, BASE_DEC, NULL, 0x00,
5035 NULL, HFILL }
5037 { &hf_ptp_dr_requestingsourcesequenceid,
5038 { "requestingSourceSequenceId", "ptp.dr.requestingsourcesequenceid",
5039 FT_UINT16, BASE_DEC, NULL, 0x00,
5040 NULL, HFILL }
5042 /* offsets for management (=mm) messages */
5043 { &hf_ptp_mm_targetcommunicationtechnology,
5044 { "targetCommunicationTechnology", "ptp.mm.targetcommunicationtechnology",
5045 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5046 NULL, HFILL }
5048 { &hf_ptp_mm_targetuuid,
5049 { "targetUuid", "ptp.mm.targetuuid",
5050 FT_ETHER, BASE_NONE, NULL, 0x00,
5051 NULL, HFILL }
5053 { &hf_ptp_mm_targetportid,
5054 { "targetPortId", "ptp.mm.targetportid",
5055 FT_UINT16, BASE_DEC, NULL, 0x00,
5056 NULL, HFILL }
5058 { &hf_ptp_mm_startingboundaryhops,
5059 { "startingBoundaryHops", "ptp.mm.startingboundaryhops",
5060 FT_INT16, BASE_DEC, NULL, 0x00,
5061 NULL, HFILL }
5063 { &hf_ptp_mm_boundaryhops,
5064 { "boundaryHops", "ptp.mm.boundaryhops",
5065 FT_INT16, BASE_DEC, NULL, 0x00,
5066 NULL, HFILL }
5068 { &hf_ptp_mm_managementmessagekey,
5069 { "managementMessageKey", "ptp.mm.managementmessagekey",
5070 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_managementMessageKey_vals_ext, 0x00,
5071 NULL, HFILL }
5073 { &hf_ptp_mm_parameterlength,
5074 { "parameterLength", "ptp.mm.parameterlength",
5075 FT_UINT16, BASE_DEC, NULL, 0x00,
5076 NULL, HFILL }
5078 /* parameterlength > 0 */
5079 #if 0
5080 { &hf_ptp_mm_messageparameters,
5081 { "messageParameters", "ptp.mm.messageparameters",
5082 FT_BYTES, BASE_NONE, NULL, 0x00,
5083 NULL, HFILL }
5085 #endif
5086 /* ptp_mm_clock_identity (parameterlength = 64) */
5087 { &hf_ptp_mm_clock_identity_clockcommunicationtechnology,
5088 { "clockCommunicationTechnology", "ptp.mm.clock.identity.clockcommunicationtechnology",
5089 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5090 NULL, HFILL }
5092 { &hf_ptp_mm_clock_identity_clockuuidfield,
5093 { "clockUuidField", "ptp.mm.clock.identity.clockuuidfield",
5094 FT_ETHER, BASE_NONE, NULL, 0x00,
5095 NULL, HFILL }
5097 { &hf_ptp_mm_clock_identity_clockportfield,
5098 { "clockPortField", "ptp.mm.clock.identity.clockportfield",
5099 FT_UINT16, BASE_DEC, NULL, 0x00,
5100 NULL, HFILL }
5102 { &hf_ptp_mm_clock_identity_manufactureridentity,
5103 { "manufacturerIdentity", "ptp.mm.clock.identity.manufactureridentity",
5104 FT_BYTES, BASE_NONE, NULL, 0x00,
5105 NULL, HFILL }
5108 /* ptp_mm_initialize_clock (parameterlength = 4) */
5109 { &hf_ptp_mm_initialize_clock_initialisationkey,
5110 { "initialisationKey", "ptp.mm.initialize.clock.initialisationkey",
5111 FT_UINT16, BASE_DEC, NULL, 0x00,
5112 NULL, HFILL }
5114 /* ptp_mm_set_subdomain (parameterlength = 16) */
5115 { &hf_ptp_mm_set_subdomain_subdomainname,
5116 { "subdomainName", "ptp.mm.set.subdomain.subdomainname",
5117 FT_STRING, BASE_NONE, NULL, 0x00,
5118 NULL, HFILL }
5120 /* ptp_mm_default_data_set (parameterlength = 76) */
5121 { &hf_ptp_mm_default_data_set_clockcommunicationtechnology,
5122 { "clockCommunicationTechnology", "ptp.mm.default.data.set.clockcommunicationtechnology",
5123 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5124 NULL, HFILL }
5126 { &hf_ptp_mm_default_data_set_clockuuidfield,
5127 { "clockUuidField", "ptp.mm.default.data.set.clockuuidfield",
5128 FT_ETHER, BASE_NONE, NULL, 0x00,
5129 NULL, HFILL }
5131 { &hf_ptp_mm_default_data_set_clockportfield,
5132 { "clockPortField", "ptp.mm.default.data.set.clockportfield",
5133 FT_UINT16, BASE_DEC, NULL, 0x00,
5134 NULL, HFILL }
5136 { &hf_ptp_mm_default_data_set_clockstratum,
5137 { "clockStratum", "ptp.mm.default.data.set.clockstratum",
5138 FT_UINT8, BASE_DEC, NULL, 0x00,
5139 NULL, HFILL }
5141 { &hf_ptp_mm_default_data_set_clockidentifier,
5142 { "clockIdentifier", "ptp.mm.default.data.set.clockidentifier",
5143 FT_BYTES, BASE_NONE, NULL, 0x00,
5144 NULL, HFILL }
5146 { &hf_ptp_mm_default_data_set_clockvariance,
5147 { "clockVariance", "ptp.mm.default.data.set.clockvariance",
5148 FT_UINT16, BASE_DEC, NULL, 0x00,
5149 NULL, HFILL }
5151 { &hf_ptp_mm_default_data_set_clockfollowupcapable,
5152 { "clockFollowupCapable", "ptp.mm.default.data.set.clockfollowupcapable",
5153 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5154 NULL, HFILL }
5156 { &hf_ptp_mm_default_data_set_preferred,
5157 { "preferred", "ptp.mm.default.data.set.preferred",
5158 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5159 NULL, HFILL }
5161 { &hf_ptp_mm_default_data_set_initializable,
5162 { "initializable", "ptp.mm.default.data.set.initializable",
5163 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5164 NULL, HFILL }
5166 { &hf_ptp_mm_default_data_set_externaltiming,
5167 { "externalTiming", "ptp.mm.default.data.set.externaltiming",
5168 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5169 NULL, HFILL }
5171 { &hf_ptp_mm_default_data_set_isboundaryclock,
5172 { "isBoundaryClock", "ptp.mm.default.data.set.isboundaryclock",
5173 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5174 NULL, HFILL }
5176 { &hf_ptp_mm_default_data_set_syncinterval,
5177 { "syncInterval", "ptp.mm.default.data.set.syncinterval",
5178 FT_INT8, BASE_DEC, NULL, 0x00,
5179 NULL, HFILL }
5181 { &hf_ptp_mm_default_data_set_subdomainname,
5182 { "subDomainName", "ptp.mm.default.data.set.subdomainname",
5183 FT_STRING, BASE_NONE, NULL, 0x00,
5184 NULL, HFILL }
5186 { &hf_ptp_mm_default_data_set_numberports,
5187 { "numberPorts", "ptp.mm.default.data.set.numberports",
5188 FT_UINT16, BASE_DEC, NULL, 0x00,
5189 NULL, HFILL }
5191 { &hf_ptp_mm_default_data_set_numberforeignrecords,
5192 { "numberForeignRecords", "ptp.mm.default.data.set.numberforeignrecords",
5193 FT_UINT16, BASE_DEC, NULL, 0x00,
5194 NULL, HFILL }
5196 /* ptp_mm_update_default_data_set (parameterlength = 36) */
5197 { &hf_ptp_mm_update_default_data_set_clockstratum,
5198 { "clockStratum", "ptp.mm.update.default.data.set.clockstratum",
5199 FT_UINT8, BASE_DEC, NULL, 0x00,
5200 NULL, HFILL }
5202 { &hf_ptp_mm_update_default_data_set_clockidentifier,
5203 { "clockIdentifier", "ptp.mm.update.default.data.set.clockidentifier",
5204 FT_BYTES, BASE_NONE, NULL, 0x00,
5205 NULL, HFILL }
5207 { &hf_ptp_mm_update_default_data_set_clockvariance,
5208 { "clockVariance", "ptp.mm.update.default.data.set.clockvariance",
5209 FT_UINT16, BASE_DEC, NULL, 0x00,
5210 NULL, HFILL }
5212 { &hf_ptp_mm_update_default_data_set_preferred,
5213 { "preferred", "ptp.mm.update.default.data.set.preferred",
5214 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5215 NULL, HFILL }
5217 { &hf_ptp_mm_update_default_data_set_syncinterval,
5218 { "syncInterval", "ptp.mm.update.default.data.set.syncinterval",
5219 FT_INT8, BASE_DEC, NULL, 0x00,
5220 NULL, HFILL }
5222 { &hf_ptp_mm_update_default_data_set_subdomainname,
5223 { "subdomainName", "ptp.mm.update.default.data.set.subdomainname",
5224 FT_STRING, BASE_NONE, NULL, 0x00,
5225 NULL, HFILL }
5227 /* ptp_mm_current_data_set (parameterlength = 20) */
5228 { &hf_ptp_mm_current_data_set_stepsremoved,
5229 { "stepsRemoved", "ptp.mm.current.data.set.stepsremoved",
5230 FT_UINT16, BASE_DEC, NULL, 0x00,
5231 NULL, HFILL }
5233 { &hf_ptp_mm_current_data_set_offsetfrommaster,
5234 { "offsetFromMaster", "ptp.mm.current.data.set.offsetfrommaster",
5235 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5236 NULL, HFILL }
5238 { &hf_ptp_mm_current_data_set_offsetfrommasterseconds,
5239 { "offsetFromMasterSeconds", "ptp.mm.current.data.set.offsetfrommasterseconds",
5240 FT_UINT32, BASE_DEC, NULL, 0x00,
5241 NULL, HFILL }
5243 { &hf_ptp_mm_current_data_set_offsetfrommasternanoseconds,
5244 { "offsetFromMasterNanoseconds", "ptp.mm.current.data.set.offsetfrommasternanoseconds",
5245 FT_INT32, BASE_DEC, NULL, 0x00,
5246 NULL, HFILL }
5248 { &hf_ptp_mm_current_data_set_onewaydelay,
5249 { "oneWayDelay", "ptp.mm.current.data.set.onewaydelay",
5250 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5251 NULL, HFILL }
5253 { &hf_ptp_mm_current_data_set_onewaydelayseconds,
5254 { "oneWayDelaySeconds", "ptp.mm.current.data.set.onewaydelayseconds",
5255 FT_UINT32, BASE_DEC, NULL, 0x00,
5256 NULL, HFILL }
5258 { &hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
5259 { "oneWayDelayNanoseconds", "ptp.mm.current.data.set.onewaydelaynanoseconds",
5260 FT_INT32, BASE_DEC, NULL, 0x00,
5261 NULL, HFILL }
5263 /* ptp_mm_parent_data_set (parameterlength = 90) */
5264 { &hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
5265 { "parentCommunicationTechnology", "ptp.mm.parent.data.set.parentcommunicationtechnology",
5266 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5267 NULL, HFILL }
5269 { &hf_ptp_mm_parent_data_set_parentuuid,
5270 { "parentUuid", "ptp.mm.parent.data.set.parentuuid",
5271 FT_ETHER, BASE_NONE, NULL, 0x00,
5272 NULL, HFILL }
5274 { &hf_ptp_mm_parent_data_set_parentportid,
5275 { "parentPortId", "ptp.mm.parent.data.set.parentportid",
5276 FT_UINT16, BASE_DEC, NULL, 0x00,
5277 NULL, HFILL }
5279 { &hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
5280 { "parentLastSyncSequenceNumber", "ptp.mm.parent.data.set.parentlastsyncsequencenumber",
5281 FT_UINT16, BASE_DEC, NULL, 0x00,
5282 NULL, HFILL }
5284 { &hf_ptp_mm_parent_data_set_parentfollowupcapable,
5285 { "parentFollowupCapable", "ptp.mm.parent.data.set.parentfollowupcapable",
5286 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5287 NULL, HFILL }
5289 { &hf_ptp_mm_parent_data_set_parentexternaltiming,
5290 { "parentExternalTiming", "ptp.mm.parent.data.set.parentexternaltiming",
5291 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5292 NULL, HFILL }
5294 { &hf_ptp_mm_parent_data_set_parentvariance,
5295 { "parentVariance", "ptp.mm.parent.data.set.parentvariance",
5296 FT_UINT16, BASE_DEC, NULL, 0x00,
5297 NULL, HFILL }
5299 { &hf_ptp_mm_parent_data_set_parentstats,
5300 { "parentStats", "ptp.mm.parent.data.set.parentstats",
5301 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5302 NULL, HFILL }
5304 { &hf_ptp_mm_parent_data_set_observedvariance,
5305 { "observedVariance", "ptp.mm.parent.data.set.observedvariance",
5306 FT_INT16, BASE_DEC, NULL, 0x00,
5307 NULL, HFILL }
5309 { &hf_ptp_mm_parent_data_set_observeddrift,
5310 { "observedDrift", "ptp.mm.parent.data.set.observeddrift",
5311 FT_INT32, BASE_DEC, NULL, 0x00,
5312 NULL, HFILL }
5314 { &hf_ptp_mm_parent_data_set_utcreasonable,
5315 { "utcReasonable", "ptp.mm.parent.data.set.utcreasonable",
5316 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5317 NULL, HFILL }
5319 { &hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
5320 { "grandmasterCommunicationTechnology", "ptp.mm.parent.data.set.grandmastercommunicationtechnology",
5321 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5322 NULL, HFILL }
5324 { &hf_ptp_mm_parent_data_set_grandmasteruuidfield,
5325 { "grandmasterUuidField", "ptp.mm.parent.data.set.grandmasteruuidfield",
5326 FT_ETHER, BASE_NONE, NULL, 0x00,
5327 NULL, HFILL }
5329 { &hf_ptp_mm_parent_data_set_grandmasterportidfield,
5330 { "grandmasterPortIdField", "ptp.mm.parent.data.set.grandmasterportidfield",
5331 FT_UINT16, BASE_DEC, NULL, 0x00,
5332 NULL, HFILL }
5334 { &hf_ptp_mm_parent_data_set_grandmasterstratum,
5335 { "grandmasterStratum", "ptp.mm.parent.data.set.grandmasterstratum",
5336 FT_UINT8, BASE_DEC, NULL, 0x00,
5337 NULL, HFILL }
5339 { &hf_ptp_mm_parent_data_set_grandmasteridentifier,
5340 { "grandmasterIdentifier", "ptp.mm.parent.data.set.grandmasteridentifier",
5341 FT_BYTES, BASE_NONE, NULL, 0x00,
5342 NULL, HFILL }
5344 { &hf_ptp_mm_parent_data_set_grandmastervariance,
5345 { "grandmasterVariance", "ptp.mm.parent.data.set.grandmastervariance",
5346 FT_INT16, BASE_DEC, NULL, 0x00,
5347 NULL, HFILL }
5349 { &hf_ptp_mm_parent_data_set_grandmasterpreferred,
5350 { "grandmasterPreferred", "ptp.mm.parent.data.set.grandmasterpreferred",
5351 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5352 NULL, HFILL }
5354 { &hf_ptp_mm_parent_data_set_grandmasterisboundaryclock,
5355 { "grandmasterIsBoundaryClock", "ptp.mm.parent.data.set.grandmasterisboundaryclock",
5356 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5357 NULL, HFILL }
5359 { &hf_ptp_mm_parent_data_set_grandmastersequencenumber,
5360 { "grandmasterSequenceNumber", "ptp.mm.parent.data.set.grandmastersequencenumber",
5361 FT_UINT16, BASE_DEC, NULL, 0x00,
5362 NULL, HFILL }
5364 /* ptp_mm_port_data_set (parameterlength = 52) */
5365 { &hf_ptp_mm_port_data_set_returnedportnumber,
5366 { "returnedPortNumber", "ptp.mm.port.data.set.returnedportnumber",
5367 FT_UINT16, BASE_DEC, NULL, 0x00,
5368 NULL, HFILL }
5370 { &hf_ptp_mm_port_data_set_portstate,
5371 { "portState", "ptp.mm.port.data.set.portstate",
5372 FT_UINT8, BASE_DEC, NULL, 0x00,
5373 NULL, HFILL }
5375 { &hf_ptp_mm_port_data_set_lastsynceventsequencenumber,
5376 { "lastSyncEventSequenceNumber", "ptp.mm.port.data.set.lastsynceventsequencenumber",
5377 FT_UINT16, BASE_DEC, NULL, 0x00,
5378 NULL, HFILL }
5380 { &hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
5381 { "lastGeneralEventSequenceNumber", "ptp.mm.port.data.set.lastgeneraleventsequencenumber",
5382 FT_UINT16, BASE_DEC, NULL, 0x00,
5383 NULL, HFILL }
5385 { &hf_ptp_mm_port_data_set_portcommunicationtechnology,
5386 { "portCommunicationTechnology", "ptp.mm.port.data.set.portcommunicationtechnology",
5387 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5388 NULL, HFILL }
5390 { &hf_ptp_mm_port_data_set_portuuidfield,
5391 { "portUuidField", "ptp.mm.port.data.set.portuuidfield",
5392 FT_ETHER, BASE_NONE, NULL, 0x00,
5393 NULL, HFILL }
5395 { &hf_ptp_mm_port_data_set_portidfield,
5396 { "portIdField", "ptp.mm.port.data.set.portidfield",
5397 FT_UINT16, BASE_DEC, NULL, 0x00,
5398 NULL, HFILL }
5400 { &hf_ptp_mm_port_data_set_burstenabled,
5401 { "burstEnabled", "ptp.mm.port.data.set.burstenabled",
5402 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5403 NULL, HFILL }
5405 { &hf_ptp_mm_port_data_set_subdomainaddressoctets,
5406 { "subdomainAddressOctets", "ptp.mm.port.data.set.subdomainaddressoctets",
5407 FT_UINT8, BASE_DEC, NULL, 0x00,
5408 NULL, HFILL }
5410 { &hf_ptp_mm_port_data_set_eventportaddressoctets,
5411 { "eventPortAddressOctets", "ptp.mm.port.data.set.eventportaddressoctets",
5412 FT_UINT8, BASE_DEC, NULL, 0x00,
5413 NULL, HFILL }
5415 { &hf_ptp_mm_port_data_set_generalportaddressoctets,
5416 { "generalPortAddressOctets", "ptp.mm.port.data.set.generalportaddressoctets",
5417 FT_UINT8, BASE_DEC, NULL, 0x00,
5418 NULL, HFILL }
5420 { &hf_ptp_mm_port_data_set_subdomainaddress,
5421 { "subdomainAddress", "ptp.mm.port.data.set.subdomainaddress",
5422 FT_BYTES, BASE_NONE, NULL, 0x00,
5423 NULL, HFILL }
5425 { &hf_ptp_mm_port_data_set_eventportaddress,
5426 { "eventPortAddress", "ptp.mm.port.data.set.eventportaddress",
5427 FT_BYTES, BASE_NONE, NULL, 0x00,
5428 NULL, HFILL }
5430 { &hf_ptp_mm_port_data_set_generalportaddress,
5431 { "generalPortAddress", "ptp.mm.port.data.set.generalportaddress",
5432 FT_BYTES, BASE_NONE, NULL, 0x00,
5433 NULL, HFILL }
5435 /* ptp_mm_global_time_data_set (parameterlength = 24) */
5436 { &hf_ptp_mm_global_time_data_set_localtime,
5437 { "localTime", "ptp.mm.global.time.data.set.localtime",
5438 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5439 NULL, HFILL }
5441 { &hf_ptp_mm_global_time_data_set_localtimeseconds,
5442 { "localTimeSeconds", "ptp.mm.global.time.data.set.localtimeseconds",
5443 FT_UINT32, BASE_DEC, NULL, 0x00,
5444 NULL, HFILL }
5446 { &hf_ptp_mm_global_time_data_set_localtimenanoseconds,
5447 { "localTimeNanoseconds", "ptp.mm.global.time.data.set.localtimenanoseconds",
5448 FT_INT32, BASE_DEC, NULL, 0x00,
5449 NULL, HFILL }
5451 { &hf_ptp_mm_global_time_data_set_currentutcoffset,
5452 { "currentUtcOffset", "ptp.mm.global.time.data.set.currentutcoffset",
5453 FT_INT16, BASE_DEC, NULL, 0x00,
5454 NULL, HFILL }
5456 { &hf_ptp_mm_global_time_data_set_leap59,
5457 { "leap59", "ptp.mm.global.time.data.set.leap59",
5458 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5459 NULL, HFILL }
5461 { &hf_ptp_mm_global_time_data_set_leap61,
5462 { "leap61", "ptp.mm.global.time.data.set.leap61",
5463 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5464 NULL, HFILL }
5466 { &hf_ptp_mm_global_time_data_set_epochnumber,
5467 { "epochNumber", "ptp.mm.global.time.data.set.epochnumber",
5468 FT_UINT16, BASE_DEC, NULL, 0x00,
5469 NULL, HFILL }
5471 /* ptp_mm_update_global_time_properties (parameterlength = 16) */
5472 { &hf_ptp_mm_update_global_time_properties_currentutcoffset,
5473 { "currentUtcOffset", "ptp.mm.update.global.time.properties.currentutcoffset",
5474 FT_UINT16, BASE_DEC, NULL, 0x00,
5475 NULL, HFILL }
5477 { &hf_ptp_mm_update_global_time_properties_leap59,
5478 { "leap59", "ptp.mm.update.global.time.properties.leap59",
5479 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5480 NULL, HFILL }
5482 { &hf_ptp_mm_update_global_time_properties_leap61,
5483 { "leap61", "ptp.mm.update.global.time.properties.leap61",
5484 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5485 NULL, HFILL }
5487 #if 0
5488 { &hf_ptp_mm_update_global_time_properties_epochnumber,
5489 { "epochNumber", "ptp.mm.update.global.time.properties.epochnumber",
5490 FT_UINT16, BASE_DEC, NULL, 0x00,
5491 NULL, HFILL }
5493 #endif
5494 /* ptp_mm_get_foreign_data_set (parameterlength = 4) */
5495 { &hf_ptp_mm_get_foreign_data_set_recordkey,
5496 { "recordKey", "ptp.mm.get.foreign.data.set.recordkey",
5497 FT_UINT16, BASE_DEC, NULL, 0x00,
5498 NULL, HFILL }
5500 /* ptp_mm_foreign_data_set (parameterlength = 28) */
5501 { &hf_ptp_mm_foreign_data_set_returnedportnumber,
5502 { "returnedPortNumber", "ptp.mm.foreign.data.set.returnedportnumber",
5503 FT_UINT16, BASE_DEC, NULL, 0x00,
5504 NULL, HFILL }
5506 { &hf_ptp_mm_foreign_data_set_returnedrecordnumber,
5507 { "returnedRecordNumber", "ptp.mm.foreign.data.set.returnedrecordnumber",
5508 FT_UINT16, BASE_DEC, NULL, 0x00,
5509 NULL, HFILL }
5511 { &hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
5512 { "foreignMasterCommunicationTechnology",
5513 "ptp.mm.foreign.data.set.foreignmastercommunicationtechnology",
5514 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5515 NULL, HFILL }
5517 { &hf_ptp_mm_foreign_data_set_foreignmasteruuidfield,
5518 { "foreignMasterUuidField", "ptp.mm.foreign.data.set.foreignmasteruuidfield",
5519 FT_ETHER, BASE_NONE, NULL, 0x00,
5520 NULL, HFILL }
5522 { &hf_ptp_mm_foreign_data_set_foreignmasterportidfield,
5523 { "foreignMasterPortIdField", "ptp.mm.foreign.data.set.foreignmasterportidfield",
5524 FT_UINT16, BASE_DEC, NULL, 0x00,
5525 NULL, HFILL }
5527 { &hf_ptp_mm_foreign_data_set_foreignmastersyncs,
5528 { "foreignMasterSyncs", "ptp.mm.foreign.data.set.foreignmastersyncs",
5529 FT_UINT16, BASE_DEC, NULL, 0x00,
5530 NULL, HFILL }
5532 /* ptp_mm_set_sync_interval (parameterlength = 4) */
5533 { &hf_ptp_mm_set_sync_interval_syncinterval,
5534 { "syncInterval", "ptp.mm.set.sync.interval.syncinterval",
5535 FT_UINT16, BASE_DEC, NULL, 0x00,
5536 NULL, HFILL }
5538 /* ptp_mm_set_time (parameterlength = 8) */
5539 { &hf_ptp_mm_set_time_localtime,
5540 { "localtime", "ptp.mm.set.time.localtime",
5541 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5542 NULL, HFILL }
5544 { &hf_ptp_mm_set_time_localtimeseconds,
5545 { "localtimeSeconds", "ptp.mm.set.time.localtimeseconds",
5546 FT_UINT32, BASE_DEC, NULL, 0x00,
5547 NULL, HFILL }
5549 { &hf_ptp_mm_set_time_localtimenanoseconds,
5550 { "localTimeNanoseconds", "ptp.mm.set.time.localtimenanoseconds",
5551 FT_INT32, BASE_DEC, NULL, 0x0,
5552 NULL, HFILL }
5558 /* PTPv2 fields **********************************************************/
5559 /* Common fields for all frames */
5560 { &hf_ptp_v2_majorsdoid,
5561 { "majorSdoId", "ptp.v2.majorsdoid",
5562 FT_UINT8, BASE_HEX, VALS(ptpv2_majorsdoid_vals), 0xF0,
5563 NULL, HFILL }
5565 { &hf_ptp_v2_messagetype,
5566 { "messageType", "ptp.v2.messagetype",
5567 FT_UINT8, BASE_HEX | BASE_EXT_STRING, & ptp_v2_messagetype_vals_ext, 0x0F,
5568 NULL, HFILL }
5570 { &hf_ptp_v2_minorversionptp,
5571 { "minorVersionPTP", "ptp.v2.minorversionptp",
5572 FT_UINT8, BASE_DEC, NULL, 0xF0,
5573 NULL, HFILL }
5575 { &hf_ptp_v2_versionptp,
5576 { "versionPTP", "ptp.v2.versionptp",
5577 FT_UINT8, BASE_DEC, NULL, 0x0F,
5578 NULL, HFILL }
5580 { &hf_ptp_v2_messagelength,
5581 { "messageLength", "ptp.v2.messagelength",
5582 FT_UINT16, BASE_DEC, NULL, 0x00,
5583 NULL, HFILL }
5585 { &hf_ptp_v2_minorsdoid,
5586 { "minorSdoId", "ptp.v2.minorsdoid",
5587 FT_UINT8, BASE_DEC, NULL, 0x00,
5588 NULL, HFILL }
5590 { &hf_ptp_v2_domainnumber,
5591 { "domainNumber", "ptp.v2.domainnumber",
5592 FT_UINT8, BASE_DEC, NULL, 0x00,
5593 NULL, HFILL }
5595 { &hf_ptp_v2_flags,
5596 { "flags", "ptp.v2.flags",
5597 FT_UINT16, BASE_HEX, NULL, 0x00,
5598 NULL, HFILL }
5600 { &hf_ptp_v2_flags_alternatemaster,
5601 { "PTP_ALTERNATE_MASTER", "ptp.v2.flags.alternatemaster",
5602 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_ALTERNATE_BITMASK,
5603 NULL, HFILL }
5605 { &hf_ptp_v2_flags_twostep,
5606 { "PTP_TWO_STEP", "ptp.v2.flags.twostep",
5607 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TWO_STEP_BITMASK,
5608 NULL, HFILL }
5610 { &hf_ptp_v2_flags_unicast,
5611 { "PTP_UNICAST", "ptp.v2.flags.unicast",
5612 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UNICAST_BITMASK,
5613 NULL, HFILL }
5615 { &hf_ptp_v2_flags_specific1,
5616 { "PTP profile Specific 1", "ptp.v2.flags.specific1",
5617 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC1_BITMASK,
5618 NULL, HFILL }
5620 { &hf_ptp_v2_flags_specific2,
5621 { "PTP profile Specific 2", "ptp.v2.flags.specific2",
5622 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC2_BITMASK,
5623 NULL, HFILL }
5625 { &hf_ptp_v2_flags_security,
5626 { "PTP_SECURITY", "ptp.v2.flags.security",
5627 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SECURITY_BITMASK,
5628 NULL, HFILL }
5630 { &hf_ptp_v2_flags_li61,
5631 { "PTP_LI_61", "ptp.v2.flags.li61",
5632 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI61_BITMASK,
5633 NULL, HFILL }
5635 { &hf_ptp_v2_flags_li59,
5636 { "PTP_LI_59", "ptp.v2.flags.li59",
5637 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI59_BITMASK,
5638 NULL, HFILL }
5640 { &hf_ptp_v2_flags_utcoffsetvalid,
5641 { "PTP_UTC_REASONABLE", "ptp.v2.flags.utcreasonable",
5642 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK,
5643 NULL, HFILL }
5645 { &hf_ptp_v2_flags_ptptimescale,
5646 { "PTP_TIMESCALE", "ptp.v2.flags.timescale",
5647 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK,
5648 NULL, HFILL }
5650 { &hf_ptp_v2_flags_timetraceable,
5651 { "TIME_TRACEABLE", "ptp.v2.flags.timetraceable",
5652 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK,
5653 NULL, HFILL }
5655 { &hf_ptp_v2_flags_frequencytraceable,
5656 { "FREQUENCY_TRACEABLE", "ptp.v2.flags.frequencytraceable",
5657 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK,
5658 NULL, HFILL }
5660 { &hf_ptp_v2_flags_synchronizationUncertain,
5661 { "SYNCHRONIZATION_UNCERTAIN", "ptp.v2.flags.synchronizationUncertain",
5662 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SYNCHRONIZATION_UNCERTAIN_BITMASK,
5663 NULL, HFILL }
5665 { &hf_ptp_v2_messagetypespecific,
5666 { "messageTypeSpecific", "ptp.v2.messagetypespecific",
5667 FT_UINT32, BASE_DEC, NULL, 0x00,
5668 NULL, HFILL }
5670 { &hf_ptp_v2_correction,
5671 { "correctionNs", "ptp.v2.correction.ns",
5672 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
5673 NULL, HFILL }
5675 { &hf_ptp_v2_correctionsubns,
5676 { "correctionSubNs", "ptp.v2.correction.subns",
5677 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
5678 NULL, HFILL }
5680 { &hf_ptp_v2_clockidentity,
5681 { "ClockIdentity", "ptp.v2.clockidentity",
5682 FT_UINT64, BASE_HEX, NULL, 0x00,
5683 NULL, HFILL }
5685 { &hf_ptp_v2_clockidentity_manuf,
5686 { "MAC Vendor", "ptp.v2.clockidentity_manuf",
5687 FT_BYTES, BASE_NONE, NULL, 0x00,
5688 NULL, HFILL }
5690 { &hf_ptp_v2_sourceportid,
5691 { "SourcePortID", "ptp.v2.sourceportid",
5692 FT_UINT16, BASE_DEC, NULL, 0x00,
5693 NULL, HFILL }
5695 { &hf_ptp_v2_sequenceid,
5696 { "sequenceId", "ptp.v2.sequenceid",
5697 FT_UINT16, BASE_DEC, NULL, 0x00,
5698 NULL, HFILL }
5700 { &hf_ptp_v2_controlfield_default,
5701 { "controlField", "ptp.v2.controlfield",
5702 FT_UINT8, BASE_DEC, NULL, 0x00,
5703 NULL, HFILL }
5705 { &hf_ptp_v2_controlfield,
5706 { "controlField", "ptp.v2.controlfield",
5707 FT_UINT8, BASE_DEC, VALS(ptp_controlfield_vals), 0x00,
5708 NULL, HFILL }
5710 { &hf_ptp_v2_logmessageperiod,
5711 { "logMessagePeriod", "ptp.v2.logmessageperiod",
5712 FT_INT8, BASE_DEC, NULL, 0x00,
5713 NULL, HFILL }
5716 /* Fields for PTP_Announce (=an) messages */
5717 { &hf_ptp_v2_an_reserved1,
5718 { "reserved", "ptp.v2.an.reserved1",
5719 FT_BYTES, BASE_NONE, NULL, 0x00,
5720 NULL, HFILL }
5722 { &hf_ptp_v2_an_reserved2,
5723 { "reserved", "ptp.v2.an.reserved2",
5724 FT_BYTES, BASE_NONE, NULL, 0x00,
5725 NULL, HFILL }
5727 #if 0
5728 { &hf_ptp_v2_an_origintimestamp,
5729 { "originTimestamp", "ptp.v2.an.origintimestamp",
5730 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5731 NULL, HFILL }
5733 #endif
5734 { &hf_ptp_v2_an_origintimestamp_seconds,
5735 { "originTimestamp (seconds)", "ptp.v2.an.origintimestamp.seconds",
5736 FT_UINT64, BASE_DEC, NULL, 0x00,
5737 NULL, HFILL }
5739 { &hf_ptp_v2_an_origintimestamp_nanoseconds,
5740 { "originTimestamp (nanoseconds)", "ptp.v2.an.origintimestamp.nanoseconds",
5741 FT_INT32, BASE_DEC, NULL, 0x00,
5742 NULL, HFILL }
5744 { &hf_ptp_v2_an_origincurrentutcoffset,
5745 { "originCurrentUTCOffset", "ptp.v2.an.origincurrentutcoffset",
5746 FT_INT16, BASE_DEC, NULL, 0x00,
5747 NULL, HFILL }
5749 { &hf_ptp_v2_an_timesource,
5750 { "TimeSource", "ptp.v2.timesource",
5751 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_timeSource_vals_ext, 0x00,
5752 NULL, HFILL }
5754 { &hf_ptp_v2_an_localstepsremoved,
5755 { "localStepsRemoved", "ptp.v2.an.localstepsremoved",
5756 FT_UINT16, BASE_DEC, NULL, 0x00,
5757 NULL, HFILL }
5759 { &hf_ptp_v2_an_grandmasterclockidentity,
5760 { "grandmasterClockIdentity", "ptp.v2.an.grandmasterclockidentity",
5761 FT_UINT64, BASE_HEX, NULL, 0x00,
5762 NULL, HFILL }
5764 { &hf_ptp_v2_an_grandmasterclockclass,
5765 { "grandmasterClockClass", "ptp.v2.an.grandmasterclockclass",
5766 FT_UINT8, BASE_DEC, NULL, 0x00,
5767 NULL, HFILL }
5769 { &hf_ptp_v2_an_grandmasterclockaccuracy,
5770 { "grandmasterClockAccuracy", "ptp.v2.an.grandmasterclockaccuracy",
5771 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
5772 NULL, HFILL }
5774 { &hf_ptp_v2_an_grandmasterclockvariance,
5775 { "grandmasterClockVariance", "ptp.v2.an.grandmasterclockvariance",
5776 FT_UINT16, BASE_DEC, NULL, 0x00,
5777 NULL, HFILL }
5779 { &hf_ptp_v2_an_priority1,
5780 { "priority1", "ptp.v2.an.priority1",
5781 FT_UINT8, BASE_DEC, NULL, 0x00,
5782 NULL, HFILL }
5784 { &hf_ptp_v2_an_priority2,
5785 { "priority2", "ptp.v2.an.priority2",
5786 FT_UINT8, BASE_DEC, NULL, 0x00,
5787 NULL, HFILL }
5790 /* Fields for TLVs */
5791 { &hf_ptp_tlv_tlvtype,
5792 { "tlvType", "ptp.v2.tlv.tlvType",
5793 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
5794 NULL, HFILL }
5796 { &hf_ptp_tlv_lengthfield,
5797 { "lengthField", "ptp.v2.tlv.lengthField",
5798 FT_UINT16, BASE_DEC, NULL, 0x00,
5799 NULL, HFILL }
5801 { &hf_ptp_tlv_unparsed_payload,
5802 { "Unparsed Payload", "ptp.v2.tlv.unparsed_payload",
5803 FT_BYTES, BASE_NONE, NULL, 0x00,
5804 NULL, HFILL }
5806 /* Fields for ORGANIZATION_EXTENSION TLV */
5807 { &hf_ptp_tlv_oe_organizationid,
5808 { "organizationId", "ptp.v2.tlv.oe.organizationId",
5809 FT_UINT24, BASE_OUI, NULL, 0x00,
5810 NULL, HFILL }
5812 { &hf_ptp_tlv_oe_organizationsubtype,
5813 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
5814 FT_UINT24, BASE_HEX, NULL, 0x00,
5815 NULL, HFILL }
5817 { &hf_ptp_tlv_oe_organizationsubtype_802_1,
5818 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
5819 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_802_1_subtype_vals), 0x00,
5820 NULL, HFILL }
5822 { &hf_ptp_tlv_oe_organizationsubtype_802_1_no_propagate,
5823 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
5824 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_802_1_no_propagate_subtype_vals), 0x00,
5825 NULL, HFILL }
5827 { &hf_ptp_v2_oe_tlv_ieee_c37_238_2017_organizationsubtype,
5828 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
5829 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_ieee_c37_238_2017_subtype_vals), 0x00,
5830 NULL, HFILL }
5833 { &hf_ptp_v2_oe_tlv_datafield,
5834 { "dataField", "ptp.v2.an.oe.dataField",
5835 FT_BYTES, BASE_NONE, NULL, 0x00,
5836 NULL, HFILL }
5839 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
5840 { &hf_ptp_v2_an_tlv_oe_cern_subtype,
5841 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
5842 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_cern_subtype_vals), 0x00,
5843 NULL, HFILL }
5845 { &hf_ptp_v2_an_tlv_oe_cern_wrMessageID,
5846 { "wrMessageID", "ptp.v2.an.oe.cern.wr.wrMessageID",
5847 FT_UINT16, BASE_HEX, VALS(ptp_v2_org_cern_wrMessageID_vals), 0x00,
5848 NULL, HFILL }
5850 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags,
5851 { "wrFlags", "ptp.v2.an.oe.cern.wr.wrFlags",
5852 FT_UINT16, BASE_HEX, NULL, 0x00,
5853 NULL, HFILL }
5855 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig,
5856 { "wrConfig", "ptp.v2.an.oe.cern.wr.wrFlags.wrConfig",
5857 FT_UINT16, BASE_HEX, VALS(ptp_v2_tlv_oe_cern_wrFlags_wrConfig_vals), PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK,
5858 NULL, HFILL }
5860 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated,
5861 { "calibrated", "ptp.v2.an.oe.cern.wr.wrFlags.calibrated",
5862 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_OE_CERN_WRFLAGS_CALIBRATED_BITMASK,
5863 NULL, HFILL }
5865 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn,
5866 { "wrModeOn", "ptp.v2.an.oe.cern.wr.wrFlags.wrModeOn",
5867 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_OE_CERN_WRFLAGS_WRMODEON_BITMASK,
5868 NULL, HFILL }
5870 /* Fields for IEEE_C37_238 TLV (OE TLV subtype) */
5871 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid,
5872 { "grandmasterID", "ptp.v2.an.oe.grandmasterID",
5873 FT_UINT16, BASE_DEC, NULL, 0x00,
5874 NULL, HFILL }
5876 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy,
5877 { "grandmasterTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.grandmasterTimeInaccuracy",
5878 FT_UINT32, BASE_DEC, NULL, 0x00,
5879 NULL, HFILL }
5881 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy,
5882 { "networkTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.networkTimeInaccuracy",
5883 FT_UINT32, BASE_DEC, NULL, 0x00,
5884 NULL, HFILL }
5886 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved,
5887 { "reserved", "ptp.v2.an.oe.reserved",
5888 FT_UINT16, BASE_HEX, NULL, 0x00,
5889 NULL, HFILL }
5891 /* Additional fields in C37.238-2017 compared to C37.238-2011 */
5892 { &hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved,
5893 { "reserved", "ptp.v2.an.oe.reserved",
5894 FT_UINT32, BASE_HEX, NULL, 0x00,
5895 NULL, HFILL }
5897 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy,
5898 { "totalTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.totalTimeInaccuracy",
5899 FT_UINT32, BASE_DEC, NULL, 0x00,
5900 NULL, HFILL }
5902 /* Fields for ALTERNATE_TIME_OFFSET_INDICATOR TLV */
5903 { &hf_ptp_v2_atoi_tlv_keyfield,
5904 { "keyField", "ptp.v2.an.atoi.keyField",
5905 FT_UINT8, BASE_DEC, NULL, 0x00,
5906 NULL, HFILL }
5908 { &hf_ptp_v2_atoi_tlv_currentoffset,
5909 { "currentOffset", "ptp.v2.an.atoi.currentOffset",
5910 FT_INT32, BASE_DEC, NULL, 0x00,
5911 NULL, HFILL }
5913 { &hf_ptp_v2_atoi_tlv_jumpseconds,
5914 { "jumpSeconds", "ptp.v2.an.atoi.jumpSeconds",
5915 FT_INT32, BASE_DEC, NULL, 0x00,
5916 NULL, HFILL }
5918 { &hf_ptp_v2_atoi_tlv_timeofnextjump,
5919 { "timeOfNextJump", "ptp.v2.an.atoi.timeOfNextJump",
5920 FT_INT48, BASE_DEC, NULL, 0x00,
5921 NULL, HFILL }
5923 { &hf_ptp_v2_atoi_tlv_displayname,
5924 { "displayName", "ptp.v2.an.atoi.displayName",
5925 FT_STRING, BASE_NONE, NULL, 0x00,
5926 NULL, HFILL }
5928 { &hf_ptp_v2_atoi_tlv_displayname_length,
5929 { "length", "ptp.v2.an.atoi.displayName.length",
5930 FT_UINT8, BASE_DEC, NULL, 0x00,
5931 NULL, HFILL }
5933 /* Field for Path Trace TLV */
5934 { &hf_ptp_v2_an_tlv_pathsequence,
5935 { "PathSequence", "ptp.v2.an.pathsequence",
5936 FT_UINT64, BASE_HEX, NULL, 0x00,
5937 NULL, HFILL }
5940 /* Fields for undissected TLV */
5941 { &hf_ptp_v2_an_tlv_data,
5942 { "data", "ptp.v2.an.tlv.data",
5943 FT_BYTES, BASE_NONE, NULL, 0x00,
5944 NULL, HFILL }
5947 /* Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages */
5948 #if 0
5949 { &hf_ptp_v2_sdr_origintimestamp,
5950 { "originTimestamp", "ptp.v2.sdr.origintimestamp",
5951 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5952 NULL, HFILL }
5954 #endif
5955 { &hf_ptp_v2_sdr_origintimestamp_seconds,
5956 { "originTimestamp (seconds)", "ptp.v2.sdr.origintimestamp.seconds",
5957 FT_UINT64, BASE_DEC, NULL, 0x00,
5958 NULL, HFILL }
5960 { &hf_ptp_v2_sdr_origintimestamp_nanoseconds,
5961 { "originTimestamp (nanoseconds)", "ptp.v2.sdr.origintimestamp.nanoseconds",
5962 FT_INT32, BASE_DEC, NULL, 0x00,
5963 NULL, HFILL }
5966 { &hf_ptp_v2_sync_reserved,
5967 { "reserved", "ptp.v2.sync.reserved",
5968 FT_BYTES, BASE_NONE, NULL, 0x00,
5969 NULL, HFILL }
5972 /* Fields for PTP_Follow_Up (=fu) messages */
5973 #if 0
5974 { &hf_ptp_v2_fu_preciseorigintimestamp,
5975 { "preciseOriginTimestamp", "ptp.v2.fu.preciseorigintimestamp",
5976 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5977 NULL, HFILL }
5979 #endif
5980 { &hf_ptp_v2_fu_preciseorigintimestamp_seconds,
5981 { "preciseOriginTimestamp (seconds)", "ptp.v2.fu.preciseorigintimestamp.seconds",
5982 FT_UINT64, BASE_DEC, NULL, 0x00,
5983 NULL, HFILL }
5985 { &hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds,
5986 { "preciseOriginTimestamp (nanoseconds)", "ptp.v2.fu.preciseorigintimestamp.nanoseconds",
5987 FT_UINT32, BASE_DEC, NULL, 0x00,
5988 NULL, HFILL }
5990 { &hf_ptp_v2_fu_preciseorigintimestamp_32bit,
5991 { "preciseOriginTimestamp (32bit)", "ptp.v2.fu.preciseorigintimestamp.32bit",
5992 FT_BYTES, BASE_NONE, NULL, 0x00,
5993 NULL, HFILL }
5995 /* Fields for PTP_Follow_up TLVs */
5996 { &hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset,
5997 { "cumulativeScaledRateOffset", "ptp.as.fu.cumulativeScaledRateOffset",
5998 FT_INT32, BASE_DEC, NULL, 0x00,
5999 NULL, HFILL }
6001 { &hf_ptp_as_fu_tlv_cumulative_rate_ratio,
6002 { "cumulativeRateRatio", "ptp.as.fu.cumulativeRateRatio",
6003 FT_DOUBLE, BASE_NONE, NULL, 0x00,
6004 NULL, HFILL }
6006 { &hf_ptp_as_fu_tlv_gm_base_indicator,
6007 { "gmTimeBaseIndicator", "ptp.as.fu.gmTimeBaseIndicator",
6008 FT_UINT16, BASE_DEC, NULL, 0x00,
6009 NULL, HFILL }
6011 { &hf_ptp_as_fu_tlv_last_gm_phase_change,
6012 { "lastGMPhaseChange", "ptp.as.fu.lastGmPhaseChange",
6013 FT_BYTES, BASE_NONE, NULL, 0x00,
6014 NULL, HFILL }
6016 { &hf_ptp_as_fu_tlv_scaled_last_gm_freq_change,
6017 { "scaledLastGmFreqChange", "ptp.as.fu.scaledLastGmFreqChange",
6018 FT_INT32, BASE_DEC, NULL, 0x00,
6019 NULL, HFILL }
6021 /* Fields for Drift_Tracking TLVs (802.1ASdm) */
6022 { &hf_ptp_as_dt_tlv_sync_egress_timestamp_seconds,
6023 { "syncEgressTimestamp (seconds)", "ptp.as.dt.syncEgressTimestamp.seconds",
6024 FT_UINT48, BASE_DEC, NULL, 0x00,
6025 NULL, HFILL }
6027 { &hf_ptp_as_dt_tlv_sync_egress_timestamp_fractional_nanoseconds,
6028 { "syncEgressTimestamp (nanoseconds)", "ptp.as.dt.syncEgressTimestamp.scaledNanoseconds",
6029 FT_DOUBLE, BASE_NONE, NULL, 0x00,
6030 "fractionalNanoseconds converted into nanoseconds (double)", HFILL }
6032 { &hf_ptp_as_dt_tlv_sync_grandmaster_identity,
6033 { "syncGrandmasterIdentity", "ptp.as.dt.syncGrandmasterIdentity",
6034 FT_EUI64, BASE_NONE, NULL, 0x00,
6035 NULL, HFILL }
6037 { &hf_ptp_as_dt_tlv_sync_steps_removed,
6038 { "syncStepsRemoved", "ptp.as.dt.syncStepsRemoved",
6039 FT_UINT16, BASE_DEC, NULL, 0x00,
6040 NULL, HFILL }
6042 { &hf_ptp_as_dt_tlv_rate_ratio_drift,
6043 { "rateRatioDrift", "ptp.as.dt.rateRatioDrift",
6044 FT_INT32, BASE_DEC, NULL, 0x00,
6045 NULL, HFILL }
6047 { &hf_ptp_as_dt_tlv_rate_ratio_drift_ppm,
6048 { "rateRatioDrift (ppm/s)", "ptp.as.fu.rateRatioDrift.ppm",
6049 FT_DOUBLE, BASE_NONE, NULL, 0x00,
6050 NULL, HFILL }
6053 /* Fields for PTP_DelayResponse (=dr) messages */
6054 #if 0
6055 { &hf_ptp_v2_dr_receivetimestamp,
6056 { "receiveTimestamp", "ptp.v2.dr.receivetimestamp",
6057 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6058 NULL, HFILL }
6060 #endif
6061 { &hf_ptp_v2_dr_receivetimestamp_seconds,
6062 { "receiveTimestamp (seconds)", "ptp.v2.dr.receivetimestamp.seconds",
6063 FT_UINT64, BASE_DEC, NULL, 0x00,
6064 NULL, HFILL }
6066 { &hf_ptp_v2_dr_receivetimestamp_nanoseconds,
6067 { "receiveTimestamp (nanoseconds)", "ptp.v2.dr.receivetimestamp.nanoseconds",
6068 FT_INT32, BASE_DEC, NULL, 0x00,
6069 NULL, HFILL }
6071 { &hf_ptp_v2_dr_requestingportidentity,
6072 { "requestingSourcePortIdentity", "ptp.v2.dr.requestingsourceportidentity",
6073 FT_UINT64, BASE_HEX, NULL, 0x00,
6074 NULL, HFILL }
6076 { &hf_ptp_v2_dr_requestingsourceportid,
6077 { "requestingSourcePortId", "ptp.v2.dr.requestingsourceportid",
6078 FT_UINT16, BASE_DEC, NULL, 0x00,
6079 NULL, HFILL }
6082 /* Fields for PTP_PDelayRequest (=pdrq) messages */
6083 #if 0
6084 { &hf_ptp_v2_pdrq_origintimestamp,
6085 { "originTimestamp", "ptp.v2.pdrq.origintimestamp",
6086 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6087 NULL, HFILL }
6089 #endif
6090 { &hf_ptp_v2_pdrq_origintimestamp_seconds,
6091 { "originTimestamp (seconds)", "ptp.v2.pdrq.origintimestamp.seconds",
6092 FT_UINT64, BASE_DEC, NULL, 0x00,
6093 NULL, HFILL }
6095 { &hf_ptp_v2_pdrq_origintimestamp_nanoseconds,
6096 { "originTimestamp (nanoseconds)", "ptp.v2.pdrq.origintimestamp.nanoseconds",
6097 FT_INT32, BASE_DEC, NULL, 0x00,
6098 NULL, HFILL }
6100 { &hf_ptp_v2_pdrq_reserved,
6101 { "reserved", "ptp.v2.pdrq.reserved",
6102 FT_BYTES, BASE_NONE, NULL, 0x00,
6103 NULL, HFILL }
6106 /* Fields for PTP_PDelayResponse (=pdrs) messages */
6107 #if 0
6108 { &hf_ptp_v2_pdrs_requestreceipttimestamp,
6109 { "requestreceiptTimestamp", "ptp.v2.pdrs.requestreceipttimestamp",
6110 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6111 NULL, HFILL }
6113 #endif
6114 { &hf_ptp_v2_pdrs_requestreceipttimestamp_seconds,
6115 { "requestreceiptTimestamp (seconds)", "ptp.v2.pdrs.requestreceipttimestamp.seconds",
6116 FT_UINT64, BASE_DEC, NULL, 0x00,
6117 NULL, HFILL }
6119 { &hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds,
6120 { "requestreceiptTimestamp (nanoseconds)", "ptp.v2.pdrs.requestreceipttimestamp.nanoseconds",
6121 FT_INT32, BASE_DEC, NULL, 0x00,
6122 NULL, HFILL }
6124 { &hf_ptp_v2_pdrs_requestingportidentity,
6125 { "requestingSourcePortIdentity", "ptp.v2.pdrs.requestingportidentity",
6126 FT_UINT64, BASE_HEX, NULL, 0x00,
6127 NULL, HFILL }
6129 { &hf_ptp_v2_pdrs_requestingsourceportid,
6130 { "requestingSourcePortId", "ptp.v2.pdrs.requestingsourceportid",
6131 FT_UINT16, BASE_DEC, NULL, 0x00,
6132 NULL, HFILL }
6135 /* Fields for PTP_PDelayResponseFollowUp (=pdfu) messages */
6136 #if 0
6137 { &hf_ptp_v2_pdfu_responseorigintimestamp,
6138 { "responseOriginTimestamp", "ptp.v2.pdfu.responseorigintimestamp",
6139 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6140 NULL, HFILL }
6142 #endif
6143 { &hf_ptp_v2_pdfu_responseorigintimestamp_seconds,
6144 { "responseOriginTimestamp (seconds)", "ptp.v2.pdfu.responseorigintimestamp.seconds",
6145 FT_UINT64, BASE_DEC, NULL, 0x00,
6146 NULL, HFILL }
6148 { &hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds,
6149 { "responseOriginTimestamp (nanoseconds)", "ptp.v2.pdfu.responseorigintimestamp.nanoseconds",
6150 FT_INT32, BASE_DEC, NULL, 0x00,
6151 NULL, HFILL }
6153 { &hf_ptp_v2_pdfu_requestingportidentity,
6154 { "requestingSourcePortIdentity", "ptp.v2.pdfu.requestingportidentity",
6155 FT_UINT64, BASE_HEX, NULL, 0x00,
6156 NULL, HFILL }
6158 { &hf_ptp_v2_pdfu_requestingsourceportid,
6159 { "requestingSourcePortId", "ptp.v2.pdfu.requestingsourceportid",
6160 FT_UINT16, BASE_DEC, NULL, 0x00,
6161 NULL, HFILL }
6164 /* Fields for PTP_Signaling (=sig) messages */
6165 { &hf_ptp_v2_sig_targetportidentity,
6166 { "targetPortIdentity", "ptp.v2.sig.targetportidentity",
6167 FT_UINT64, BASE_HEX, NULL, 0x00,
6168 NULL, HFILL }
6170 { &hf_ptp_v2_sig_targetportid,
6171 { "targetPortId", "ptp.v2.sig.targetportid",
6172 FT_UINT16, BASE_DEC, NULL, 0x00,
6173 NULL, HFILL }
6175 { &hf_ptp_v2_sig_tlv_data,
6176 { "data", "ptp.v2.sig.tlv.data",
6177 FT_BYTES, BASE_NONE, NULL, 0x00,
6178 NULL, HFILL }
6180 { &hf_ptp_v2_sig_tlv_messageType,
6181 { "messageType", "ptp.v2.sig.tlv.messageType",
6182 FT_UINT8, BASE_HEX | BASE_EXT_STRING, & ptp_v2_messagetype_vals_ext, 0xF0,
6183 NULL, HFILL }
6185 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod,
6186 { "logInterMessagePeriod", "ptp.v2.sig.tlv.logInterMessagePeriod",
6187 FT_INT8, BASE_DEC, NULL, 0x00,
6188 NULL, HFILL }
6190 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod_period,
6191 { "period", "ptp.v2.sig.tlv.logInterMessagePeriod.period",
6192 FT_INT8, BASE_DEC, NULL, 0x00,
6193 NULL, HFILL }
6195 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate,
6196 { "rate", "ptp.v2.sig.tlv.logInterMessagePeriod.rate",
6197 FT_INT8, BASE_DEC, NULL, 0x00,
6198 NULL, HFILL }
6200 { &hf_ptp_v2_sig_tlv_durationField,
6201 { "durationField", "ptp.v2.sig.tlv.durationField",
6202 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
6203 NULL, HFILL }
6205 { &hf_ptp_v2_sig_tlv_renewalInvited,
6206 { "renewalInvited", "ptp.v2.sig.tlv.renewalInvited",
6207 FT_BOOLEAN, 8, NULL, 0x01,
6208 NULL, HFILL }
6210 { &hf_ptp_v2_sig_tlv_maintainRequest,
6211 { "maintainRequest", "ptp.v2.sig.tlv.maintainRequest",
6212 FT_BOOLEAN, 8, NULL, 0x01,
6213 NULL, HFILL }
6215 { &hf_ptp_v2_sig_tlv_maintainGrant,
6216 { "maintainGrant", "ptp.v2.sig.tlv.maintainGrant",
6217 FT_BOOLEAN, 8, NULL, 0x02,
6218 NULL, HFILL }
6220 { &hf_ptp_v2_sig_tlv_reserved,
6221 { "reserved", "ptp.v2.sig.tlv.reserved",
6222 FT_BYTES, BASE_NONE, NULL, 0x00,
6223 NULL, HFILL }
6225 { &hf_ptp_v2_sig_tlv_flags2,
6226 { "flags", "ptp.v2.sig.tlv.l1sync.flags",
6227 FT_UINT16, BASE_HEX, NULL, 0x00,
6228 NULL, HFILL }
6230 { &hf_ptp_v2_sig_tlv_flags3,
6231 { "flags", "ptp.v2.sig.tlv.l1sync.flags",
6232 FT_UINT24, BASE_HEX, NULL, 0x00,
6233 NULL, HFILL }
6235 { &hf_ptp_v2_sig_tlv_l1sync_flags2_tcr, /* Version with 2 bytes flags field */
6236 { "txCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.tcr",
6237 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK,
6238 NULL, HFILL }
6240 { &hf_ptp_v2_sig_tlv_l1sync_flags3_tcr, /* Version with 3 bytes flags field */
6241 { "txCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.tcr",
6242 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK << 8,
6243 NULL, HFILL }
6245 { &hf_ptp_v2_sig_tlv_l1sync_flags2_rcr, /* Version with 2 bytes flags field */
6246 { "rxCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.rcr",
6247 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK,
6248 NULL, HFILL }
6250 { &hf_ptp_v2_sig_tlv_l1sync_flags3_rcr, /* Version with 3 bytes flags field */
6251 { "rxCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.rcr",
6252 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK << 8,
6253 NULL, HFILL }
6255 { &hf_ptp_v2_sig_tlv_l1sync_flags2_cr, /* Version with 2 bytes flags field */
6256 { "congruentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.cr",
6257 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK,
6258 NULL, HFILL }
6260 { &hf_ptp_v2_sig_tlv_l1sync_flags3_cr, /* Version with 3 bytes flags field */
6261 { "congruentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.cr",
6262 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK << 8,
6263 NULL, HFILL }
6265 { &hf_ptp_v2_sig_tlv_l1sync_flags2_ope, /* Version with 2 bytes flags field */
6266 { "optParamsEnabled", "ptp.v2.sig.tlv.l1sync.flags.ope",
6267 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK,
6268 NULL, HFILL }
6270 { &hf_ptp_v2_sig_tlv_l1sync_flags3_ope, /* Version with 3 bytes flags field */
6271 { "optParamsEnabled", "ptp.v2.sig.tlv.l1sync.flags.ope",
6272 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK << 8,
6273 NULL, HFILL }
6275 { &hf_ptp_v2_sig_tlv_l1sync_flags2_itc, /* Version with 2 bytes flags field */
6276 { "isTxCoherent", "ptp.v2.sig.tlv.l1sync.flags.itc",
6277 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK,
6278 NULL, HFILL }
6280 { &hf_ptp_v2_sig_tlv_l1sync_flags3_itc, /* Version with 3 bytes flags field */
6281 { "isTxCoherent", "ptp.v2.sig.tlv.l1sync.flags.itc",
6282 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK << 8,
6283 NULL, HFILL }
6285 { &hf_ptp_v2_sig_tlv_l1sync_flags2_irc, /* Version with 2 bytes flags field */
6286 { "isRxCoherent", "ptp.v2.sig.tlv.l1sync.flags.irc",
6287 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK,
6288 NULL, HFILL }
6290 { &hf_ptp_v2_sig_tlv_l1sync_flags3_irc, /* Version with 3 bytes flags field */
6291 { "isRxCoherent", "ptp.v2.sig.tlv.l1sync.flags.irc",
6292 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK << 8,
6293 NULL, HFILL }
6295 { &hf_ptp_v2_sig_tlv_l1sync_flags2_ic, /* Version with 2 bytes flags field */
6296 { "isCongruent", "ptp.v2.sig.tlv.l1sync.flags.ic",
6297 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK,
6298 NULL, HFILL }
6300 { &hf_ptp_v2_sig_tlv_l1sync_flags3_ic, /* Version with 3 bytes flags field */
6301 { "isCongruent", "ptp.v2.sig.tlv.l1sync.flags.ic",
6302 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK << 8,
6303 NULL, HFILL }
6305 { &hf_ptp_v2_sig_tlv_l1sync_flags3_fov,
6306 { "frequencyOffsetTxValid", "ptp.v2.sig.tlv.l1sync.flags.fov",
6307 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_FOV_BITMASK,
6308 NULL, HFILL }
6310 { &hf_ptp_v2_sig_tlv_l1sync_flags3_pov,
6311 { "phaseOffsetTxValid", "ptp.v2.sig.tlv.l1sync.flags.pov",
6312 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_POV_BITMASK,
6313 NULL, HFILL }
6315 { &hf_ptp_v2_sig_tlv_l1sync_flags3_tct,
6316 { "timestampsCorrectedTx", "ptp.v2.sig.tlv.l1sync.flags.tct",
6317 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_TCT_BITMASK,
6318 NULL, HFILL }
6320 { &hf_ptp_v2_sig_tlv_l1sync_flags2_reserved,
6321 { "reserved", "ptp.v2.sig.tlv.l1sync.flags.reserved",
6322 FT_UINT16, BASE_HEX, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK,
6323 NULL, HFILL }
6325 { &hf_ptp_v2_sig_tlv_l1sync_flags3_reserved,
6326 { "reserved", "ptp.v2.sig.tlv.l1sync.flags.reserved",
6327 FT_UINT24, BASE_HEX, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_ALL_BITMASK,
6328 NULL, HFILL }
6330 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns,
6331 { "Ns", "ptp.v2.sig.tlv.l1sync.phaseOffsetTx.ns",
6332 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6333 NULL, HFILL }
6335 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns,
6336 { "SubNs", "ptp.v2.sig.tlv.l1sync.phaseOffsetTx.subns",
6337 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6338 NULL, HFILL }
6340 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s,
6341 { "S", "ptp.v2.sig.tlv.l1sync.phaseOffsetTxTimestamp.s",
6342 FT_UINT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
6343 NULL, HFILL }
6345 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns,
6346 { "Ns", "ptp.v2.sig.tlv.l1sync.phaseOffsetTxTimestamp.ns",
6347 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6348 NULL, HFILL }
6350 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns,
6351 { "Ns", "ptp.v2.sig.tlv.l1sync.freqOffsetTx.ns",
6352 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6353 NULL, HFILL }
6355 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns,
6356 { "SubNs", "ptp.v2.sig.tlv.l1sync.freqOffsetTx.subns",
6357 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6358 NULL, HFILL }
6360 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s,
6361 { "S", "ptp.v2.sig.tlv.l1sync.freqOffsetTxTimestamp.s",
6362 FT_UINT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
6363 NULL, HFILL }
6365 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns,
6366 { "Ns", "ptp.v2.sig.tlv.l1sync.freqOffsetTxTimestamp.ns",
6367 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6368 NULL, HFILL }
6370 { &hf_ptp_v2_sig_oe_tlv_cern_subtype,
6371 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
6372 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_cern_subtype_vals), 0x00,
6373 NULL, HFILL }
6375 { &hf_ptp_v2_sig_oe_tlv_itut_subtype,
6376 { "organizationSubType", "ptp.v2.tlv.oe.organizationSubType",
6377 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_itut_subtype_vals), 0x00,
6378 NULL, HFILL }
6380 { &hf_ptp_v2_sig_oe_tlv_cern_wrMessageID,
6381 { "wrMessageID", "ptp.v2.sig.oe.cern.wr.wrMessageID",
6382 FT_UINT16, BASE_HEX, VALS(ptp_v2_org_cern_wrMessageID_vals), 0x00,
6383 NULL, HFILL }
6385 { &hf_ptp_v2_sig_oe_tlv_cern_calSendPattern,
6386 { "calSendPattern", "ptp.v2.sig.oe.cern.wr.calSendPattern",
6387 FT_BOOLEAN, 8, NULL, 0x01,
6388 NULL, HFILL }
6390 { &hf_ptp_v2_sig_oe_tlv_cern_calRety,
6391 { "calRety", "ptp.v2.sig.oe.cern.wr.calRety",
6392 FT_UINT8, BASE_DEC, NULL, 0x00,
6393 NULL, HFILL }
6395 { &hf_ptp_v2_sig_oe_tlv_cern_calPeriod,
6396 { "calPeriod", "ptp.v2.sig.oe.cern.wr.calPeriod",
6397 FT_UINT32, BASE_DEC, NULL, 0x00,
6398 NULL, HFILL }
6400 { &hf_ptp_v2_sig_oe_tlv_cern_deltaTx,
6401 { "deltaTx", "ptp.v2.sig.oe.cern.wr.deltaTx",
6402 FT_DOUBLE, BASE_NONE | BASE_UNIT_STRING, UNS(&units_picoseconds), 0x00,
6403 NULL, HFILL }
6405 { &hf_ptp_v2_sig_oe_tlv_cern_deltaRx,
6406 { "deltaRx", "ptp.v2.sig.oe.cern.wr.deltaRx",
6407 FT_DOUBLE, BASE_NONE | BASE_UNIT_STRING, UNS(&units_picoseconds), 0x00,
6408 NULL, HFILL }
6410 /* Fields for PTP_Signaling (=sig) TLVs */
6411 { &hf_ptp_as_sig_tlv_link_delay_interval,
6412 { "linkDelayInterval", "ptp.as.sig.tlv.linkdelayinterval",
6413 FT_INT8, BASE_DEC, NULL, 0x00,
6414 NULL, HFILL }
6416 { &hf_ptp_as_sig_tlv_time_sync_interval,
6417 { "timeSyncInterval", "ptp.as.sig.tlv.timesyncinterval",
6418 FT_INT8, BASE_DEC, NULL, 0x00,
6419 NULL, HFILL }
6421 { &hf_ptp_as_sig_tlv_announce_interval,
6422 { "announceInterval", "ptp.as.sig.tlv.announceinterval",
6423 FT_INT8, BASE_DEC, NULL, 0x00,
6424 NULL, HFILL }
6426 { &hf_ptp_as_sig_tlv_flags,
6427 { "flags", "ptp.as.sig.tlv.flags",
6428 FT_UINT8, BASE_HEX, NULL, 0x00,
6429 NULL, HFILL }
6431 { &hf_ptp_as_sig_tlv_flags_comp_rate_ratio,
6432 { "computeNeighborRateRatio", "ptp.as.sig.tlv.flags.rateratio",
6433 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_COMP_NEIGHBOR_RATE_RATIO_BITMASK,
6434 NULL, HFILL }
6436 { &hf_ptp_as_sig_tlv_flags_comp_mean_link_delay,
6437 { "computeMeanLinkDelay", "ptp.as.sig.tlv.flags.meanlinkdelay",
6438 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_COMP_MEAN_LINK_DELAY_BITMASK,
6439 NULL, HFILL }
6441 { &hf_ptp_as_sig_tlv_flags_one_step_receive_capable,
6442 { "oneStepReceiveCapable", "ptp.as.sig.tlv.flags.stepreceivecapable",
6443 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_ONE_STEP_RECEIVE_CAPABLE,
6444 NULL, HFILL }
6446 { &hf_ptp_as_sig_tlv_gptp_capable_message_interval,
6447 { "gptpCapableMessageInterval", "ptp.as.sig.tlv.gptpcapablemessageinterval",
6448 FT_INT8, BASE_DEC, NULL, 0x00,
6449 NULL, HFILL }
6451 { &hf_ptp_as_sig_tlv_gptp_capable_reserved,
6452 { "reserved", "ptp.as.sig.tlv.reserved",
6453 FT_BYTES, BASE_NONE, NULL, 0x00,
6454 NULL, HFILL }
6456 { &hf_ptp_as_sig_tlv_reserved,
6457 { "reserved", "ptp.as.sig.tlv.reserved",
6458 FT_BYTES, BASE_NONE, NULL, 0x00,
6459 NULL, HFILL }
6462 { &hf_ptp_as_csn_upstream_tx_time,
6463 { "upstreamTxTime", "ptp.as.tlv.csn.upstream_tx_time",
6464 FT_BYTES, BASE_NONE, NULL, 0x00,
6465 NULL, HFILL }
6467 { &hf_ptp_as_csn_neighbor_rate_ratio,
6468 { "neighborRateRatio", "ptp.as.tlv.csn.neighbor_rate_ratio",
6469 FT_INT32, BASE_DEC, NULL, 0x00,
6470 NULL, HFILL }
6472 { &hf_ptp_as_csn_mean_link_delay,
6473 { "meanLinkDelay", "ptp.as.tlv.csn.mean_link_delay",
6474 FT_BYTES, BASE_NONE, NULL, 0x00,
6475 NULL, HFILL }
6477 { &hf_ptp_as_csn_delay_asymmetry,
6478 { "delayAsymmetry", "ptp.as.tlv.csn.delay_asymmetry",
6479 FT_BYTES, BASE_NONE, NULL, 0x00,
6480 NULL, HFILL }
6482 { &hf_ptp_as_csn_domain_number,
6483 { "domainNumber", "ptp.as.tlv.csn.domain_number",
6484 FT_UINT8, BASE_DEC, NULL, 0x00,
6485 NULL, HFILL }
6488 { &hf_ptp_v2_sig_tlv_interface_bit_period,
6489 { "interfaceBitPeriod", "ptp.as.sig.tlv.interfaceBitPeriod",
6490 FT_UINT64, BASE_DEC | BASE_UNIT_STRING, UNS(&units_attoseconds), 0x00,
6491 NULL, HFILL }
6493 { &hf_ptp_v2_sig_tlv_numberbits_before_timestamp,
6494 { "numberBitsBeforeTimestamp", "ptp.as.sig.tlv.numberBitsBeforeTimestamp",
6495 FT_UINT16, BASE_DEC, NULL, 0x00,
6496 NULL, HFILL }
6498 { &hf_ptp_v2_sig_tlv_numberbits_after_timestamp,
6499 { "numberBitsAfterTimestamp", "ptp.as.sig.tlv.numberBitsAfterTimestamp",
6500 FT_UINT16, BASE_DEC, NULL, 0x00,
6501 NULL, HFILL }
6503 /* Fields for PTP_Management (=mm) messages */
6504 { &hf_ptp_v2_mm_targetportidentity,
6505 { "targetPortIdentity", "ptp.v2.mm.targetportidentity",
6506 FT_UINT64, BASE_HEX, NULL, 0x00,
6507 NULL, HFILL }
6509 { &hf_ptp_v2_mm_targetportid,
6510 { "targetPortId", "ptp.v2.mm.targetportid",
6511 FT_UINT16, BASE_DEC, NULL, 0x00,
6512 NULL, HFILL }
6514 { &hf_ptp_v2_mm_startingboundaryhops,
6515 { "startingBoundaryHops", "ptp.v2.mm.startingboundaryhops",
6516 FT_UINT8, BASE_DEC, NULL, 0x00,
6517 NULL, HFILL }
6519 { &hf_ptp_v2_mm_boundaryhops,
6520 { "boundaryHops", "ptp.v2.mm.boundaryhops",
6521 FT_UINT8, BASE_DEC, NULL, 0x00,
6522 NULL, HFILL }
6524 { &hf_ptp_v2_mm_action,
6525 { "action", "ptp.v2.mm.action",
6526 FT_UINT8, BASE_DEC, VALS(ptp_v2_mm_action_vals), 0x0F,
6527 NULL, HFILL }
6529 { &hf_ptp_v2_mm_reserved1,
6530 { "reserved", "ptp.v2.mm.reserved1",
6531 FT_UINT8, BASE_DEC, NULL, 0xF0,
6532 NULL, HFILL }
6534 { &hf_ptp_v2_mm_reserved2,
6535 { "reserved", "ptp.v2.mm.reserved2",
6536 FT_BYTES, BASE_NONE, NULL, 0x00,
6537 NULL, HFILL }
6539 /* Management TLV */
6540 { &hf_ptp_v2_mm_tlvType,
6541 { "tlvType", "ptp.v2.mm.tlvType",
6542 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
6543 NULL, HFILL }
6545 { &hf_ptp_v2_mm_lengthField,
6546 { "lengthField", "ptp.v2.mm.lengthField",
6547 FT_UINT16, BASE_DEC, NULL, 0x00,
6548 NULL, HFILL }
6550 { &hf_ptp_v2_mm_managementId,
6551 { "managementId", "ptp.v2.mm.managementId",
6552 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_managementID_vals_ext, 0x00,
6553 NULL, HFILL }
6555 { &hf_ptp_v2_mm_data,
6556 { "data", "ptp.v2.mm.data",
6557 FT_BYTES, BASE_NONE, NULL, 0x00,
6558 NULL, HFILL }
6560 /* Management TLV dataField */
6561 /* CLOCK_DESCRIPTION */
6562 { &hf_ptp_v2_mm_clockType,
6563 { "clockType", "ptp.v2.mm.clockType",
6564 FT_UINT16, BASE_HEX, NULL, 0x00,
6565 NULL, HFILL }
6567 { &hf_ptp_v2_mm_clockType_ordinaryClock,
6568 { "The node implements an ordinary clock", "ptp.v2.mm.clockType.OC",
6569 FT_BOOLEAN, 16, NULL, CLOCKTYPE_ORDINARY_CLOCK,
6570 NULL, HFILL }
6572 { &hf_ptp_v2_mm_clockType_boundaryClock,
6573 { "The node implements a boundary clock", "ptp.v2.mm.clockType.BC",
6574 FT_BOOLEAN, 16, NULL, CLOCKTYPE_BOUNDARY_CLOCK,
6575 NULL, HFILL }
6577 { &hf_ptp_v2_mm_clockType_p2p_transparentClock,
6578 { "The node implements a peer-to-peer transparent clock", "ptp.v2.mm.clockType.p2p_TC",
6579 FT_BOOLEAN, 16, NULL, CLOCKTYPE_P2P_TC,
6580 NULL, HFILL }
6582 { &hf_ptp_v2_mm_clockType_e2e_transparentClock,
6583 { "The node implements an end-to-end transparent clock", "ptp.v2.mm.clockType.e2e_TC",
6584 FT_BOOLEAN, 16, NULL, CLOCKTYPE_E2E_TC,
6585 NULL, HFILL }
6587 { &hf_ptp_v2_mm_clockType_managementNode,
6588 { "The node implements a management node", "ptp.v2.mm.clockType.MM",
6589 FT_BOOLEAN, 16, NULL, CLOCKTYPE_MANAGEMENT_NODE,
6590 NULL, HFILL }
6592 { &hf_ptp_v2_mm_clockType_reserved,
6593 { "reserved", "ptp.v2.mm.clockType.reserved",
6594 FT_BOOLEAN, 16, NULL, CLOCKTYPE_RESERVED,
6595 NULL, HFILL }
6597 { &hf_ptp_v2_mm_physicalLayerProtocol,
6598 { "physicalLayerProtocol", "ptp.v2.mm.physicalLayerProtocol",
6599 FT_STRING, BASE_NONE, NULL, 0x00,
6600 NULL, HFILL }
6602 { &hf_ptp_v2_mm_physicalLayerProtocol_length,
6603 { "length", "ptp.v2.mm.physicalLayerProtocol.length",
6604 FT_UINT8, BASE_DEC, NULL, 0x00,
6605 NULL, HFILL }
6607 { &hf_ptp_v2_mm_physicalAddressLength,
6608 { "physical address length", "ptp.v2.mm.physicalAddressLength",
6609 FT_UINT16, BASE_DEC, NULL, 0x00,
6610 NULL, HFILL }
6612 { &hf_ptp_v2_mm_physicalAddress,
6613 { "physical address", "ptp.v2.mm.physicalAddress",
6614 FT_BYTES, BASE_NONE, NULL, 0x00,
6615 NULL, HFILL }
6617 { &hf_ptp_v2_mm_protocolAddress,
6618 { "protocol address", "ptp.v2.mm.protocolAddress",
6619 FT_BYTES, BASE_NONE, NULL, 0x00,
6620 NULL, HFILL }
6622 { &hf_ptp_v2_mm_protocolAddress_networkProtocol,
6623 { "network protocol", "ptp.v2.mm.networkProtocol",
6624 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_networkProtocol_vals_ext, 0x00,
6625 NULL, HFILL }
6627 { &hf_ptp_v2_mm_protocolAddress_length,
6628 { "length", "ptp.v2.mm.protocolAddress.length",
6629 FT_UINT16, BASE_DEC, NULL, 0x00,
6630 NULL, HFILL }
6632 { &hf_ptp_v2_mm_manufacturerIdentity,
6633 { "manufacturer identity", "ptp.v2.mm.manufacturerIdentity",
6634 FT_BYTES, BASE_NONE, NULL, 0x00,
6635 NULL, HFILL }
6637 { &hf_ptp_v2_mm_reserved,
6638 { "reserved", "ptp.v2.mm.reserved",
6639 FT_BYTES, BASE_NONE, NULL, 0x00,
6640 NULL, HFILL }
6642 { &hf_ptp_v2_mm_productDescription,
6643 { "product description", "ptp.v2.mm.productDescription",
6644 FT_STRING, BASE_NONE, NULL, 0x00,
6645 NULL, HFILL }
6647 { &hf_ptp_v2_mm_productDescription_length,
6648 { "length", "ptp.v2.mm.productDescription.length",
6649 FT_UINT8, BASE_DEC, NULL, 0x00,
6650 NULL, HFILL }
6652 { &hf_ptp_v2_mm_revisionData,
6653 { "revision data", "ptp.v2.mm.revisionData",
6654 FT_STRING, BASE_NONE, NULL, 0x00,
6655 NULL, HFILL }
6657 { &hf_ptp_v2_mm_revisionData_length,
6658 { "length", "ptp.v2.mm.revisionData.length",
6659 FT_UINT8, BASE_DEC, NULL, 0x00,
6660 NULL, HFILL }
6662 { &hf_ptp_v2_mm_userDescription,
6663 { "user description", "ptp.v2.mm.userDescription",
6664 FT_STRING, BASE_NONE, NULL, 0x00,
6665 NULL, HFILL }
6667 { &hf_ptp_v2_mm_userDescription_length,
6668 { "length", "ptp.v2.mm.userDescription.length",
6669 FT_UINT8, BASE_DEC, NULL, 0x00,
6670 NULL, HFILL }
6672 { &hf_ptp_v2_mm_profileIdentity,
6673 { "profileIdentity", "ptp.v2.mm.profileIdentity",
6674 FT_BYTES, BASE_NONE, NULL, 0x00,
6675 NULL, HFILL }
6677 { &hf_ptp_v2_mm_pad,
6678 { "Pad", "ptp.v2.mm.pad",
6679 FT_BYTES, BASE_NONE, NULL, 0x0,
6680 NULL, HFILL }
6682 { &hf_ptp_v2_mm_initializationKey,
6683 { "initialization key", "ptp.v2.mm.initializationKey",
6684 FT_UINT16, BASE_DEC, NULL, 0x00,
6685 NULL, HFILL }
6687 { &hf_ptp_v2_mm_numberOfFaultRecords,
6688 { "number of fault records", "ptp.v2.mm.numberOfFaultRecords",
6689 FT_UINT16, BASE_DEC, NULL, 0x00,
6690 NULL, HFILL }
6692 #if 0
6693 { &hf_ptp_v2_mm_faultRecord,
6694 { "fault record", "ptp.v2.mm.faultRecord",
6695 FT_BYTES, BASE_NONE, NULL, 0x00,
6696 NULL, HFILL }
6698 #endif
6699 { &hf_ptp_v2_mm_faultRecordLength,
6700 { "fault record length", "ptp.v2.mm.faultRecordLength",
6701 FT_UINT16, BASE_DEC, NULL, 0x00,
6702 NULL, HFILL }
6704 { &hf_ptp_v2_mm_severityCode,
6705 { "severity code", "ptp.v2.mm.severityCode",
6706 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_v2_severityCode_vals_ext, 0x00,
6707 NULL, HFILL }
6709 { &hf_ptp_v2_mm_faultName,
6710 { "faultName", "ptp.v2.mm.faultName",
6711 FT_STRING, BASE_NONE, NULL, 0x00,
6712 NULL, HFILL }
6714 { &hf_ptp_v2_mm_faultName_length,
6715 { "length", "ptp.v2.mm.faultName.length",
6716 FT_UINT8, BASE_DEC, NULL, 0x00,
6717 NULL, HFILL }
6719 { &hf_ptp_v2_mm_faultValue,
6720 { "faultValue", "ptp.v2.mm.faultValue",
6721 FT_STRING, BASE_NONE, NULL, 0x00,
6722 NULL, HFILL }
6724 { &hf_ptp_v2_mm_faultValue_length,
6725 { "length", "ptp.v2.mm.faultValue.length",
6726 FT_UINT8, BASE_DEC, NULL, 0x00,
6727 NULL, HFILL }
6729 { &hf_ptp_v2_mm_faultDescription,
6730 { "faultDescription", "ptp.v2.mm.faultDescription",
6731 FT_STRING, BASE_NONE, NULL, 0x00,
6732 NULL, HFILL }
6734 { &hf_ptp_v2_mm_faultDescription_length,
6735 { "length", "ptp.v2.mm.faultDescription.length",
6736 FT_UINT8, BASE_DEC, NULL, 0x00,
6737 NULL, HFILL }
6739 #if 0
6740 { &hf_ptp_v2_mm_faultTime,
6741 { "Fault time", "ptp.v2.mm.faultTime",
6742 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6743 NULL, HFILL }
6745 #endif
6746 { &hf_ptp_v2_mm_faultTime_s,
6747 { "Fault time (seconds)", "ptp.v2.mm.faultTime.seconds",
6748 FT_UINT64, BASE_DEC, NULL, 0x00,
6749 NULL, HFILL }
6751 { &hf_ptp_v2_mm_faultTime_ns,
6752 { "Fault time (nanoseconds)", "ptp.v2.mm.faultTime.nanoseconds",
6753 FT_INT32, BASE_DEC, NULL, 0x00,
6754 NULL, HFILL }
6756 { &hf_ptp_v2_mm_currentTime_s,
6757 { "current time (seconds)", "ptp.v2.mm.currentTime.seconds",
6758 FT_UINT64, BASE_DEC, NULL, 0x00,
6759 NULL, HFILL }
6761 { &hf_ptp_v2_mm_currentTime_ns,
6762 { "current time (nanoseconds)", "ptp.v2.mm.currentTime.nanoseconds",
6763 FT_INT32, BASE_DEC, NULL, 0x00,
6764 NULL, HFILL }
6766 { &hf_ptp_v2_mm_clockAccuracy,
6767 { "Clock accuracy", "ptp.v2.mm.clockaccuracy",
6768 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
6769 NULL, HFILL }
6772 { &hf_ptp_v2_mm_priority1,
6773 { "priority1", "ptp.v2.mm.priority1",
6774 FT_UINT8, BASE_DEC, NULL, 0x00,
6775 NULL, HFILL }
6777 { &hf_ptp_v2_mm_priority2,
6778 { "priority2", "ptp.v2.mm.priority2",
6779 FT_UINT8, BASE_DEC, NULL, 0x00,
6780 NULL, HFILL }
6782 { &hf_ptp_v2_mm_dds_SO,
6783 { "Slave only", "ptp.v2.mm.SlaveOnly",
6784 FT_BOOLEAN, 8, NULL, 0x02,
6785 NULL, HFILL }
6787 { &hf_ptp_v2_mm_TSC,
6788 { "Two step", "ptp.v2.mm.twoStep",
6789 FT_BOOLEAN, 8, NULL, 0x01,
6790 NULL, HFILL }
6792 { &hf_ptp_v2_mm_numberPorts,
6793 { "number of ports", "ptp.v2.mm.numberPorts",
6794 FT_UINT16, BASE_DEC, NULL, 0x00,
6795 NULL, HFILL }
6797 { &hf_ptp_v2_mm_clockclass,
6798 { "Clock class", "ptp.v2.mm.clockclass",
6799 FT_UINT8, BASE_DEC, NULL, 0x00,
6800 NULL, HFILL }
6802 { &hf_ptp_v2_mm_clockaccuracy,
6803 { "Clock accuracy", "ptp.v2.mm.clockaccuracy",
6804 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
6805 NULL, HFILL }
6807 { &hf_ptp_v2_mm_clockvariance,
6808 { "Clock variance", "ptp.v2.mm.clockvariance",
6809 FT_UINT16, BASE_DEC, NULL, 0x00,
6810 NULL, HFILL }
6812 { &hf_ptp_v2_mm_clockidentity,
6813 { "Clock identity", "ptp.v2.mm.clockidentity",
6814 FT_UINT64, BASE_HEX, NULL, 0x00,
6815 NULL, HFILL }
6817 { &hf_ptp_v2_mm_domainNumber,
6818 { "domain number", "ptp.v2.mm.domainNumber",
6819 FT_UINT8, BASE_DEC, NULL , 0x00,
6820 NULL, HFILL }
6822 { &hf_ptp_v2_mm_SO,
6823 { "Slave only", "ptp.v2.mm.SlavOnly",
6824 FT_BOOLEAN, 8, NULL, 0x01,
6825 NULL, HFILL }
6827 { &hf_ptp_v2_mm_stepsRemoved,
6828 { "steps removed", "ptp.v2.mm.stepsRemoved",
6829 FT_INT16, BASE_DEC, NULL, 0x00,
6830 NULL, HFILL }
6832 { &hf_ptp_v2_mm_parentIdentity,
6833 { "parent ClockIdentity", "ptp.v2.mm.parentclockidentity",
6834 FT_UINT64, BASE_HEX, NULL, 0x00,
6835 NULL, HFILL }
6837 { &hf_ptp_v2_mm_parentPort,
6838 { "parent SourcePortID", "ptp.v2.mm.parentsourceportid",
6839 FT_UINT16, BASE_DEC, NULL, 0x00,
6840 NULL, HFILL }
6842 { &hf_ptp_v2_mm_parentStats,
6843 { "parent stats", "ptp.v2.mm.parentstats",
6844 FT_BOOLEAN, 8, NULL, 0x01,
6845 NULL, HFILL }
6847 { &hf_ptp_v2_mm_observedParentOffsetScaledLogVariance,
6848 { "observedParentOffsetScaledLogVariance", "ptp.v2.mm.observedParentOffsetScaledLogVariance",
6849 FT_UINT16, BASE_DEC, NULL, 0x00,
6850 NULL, HFILL }
6852 { &hf_ptp_v2_mm_observedParentClockPhaseChangeRate,
6853 { "observedParentClockPhaseChangeRate", "ptp.v2.mm.observedParentClockPhaseChangeRate",
6854 FT_INT32, BASE_DEC, NULL, 0x00,
6855 NULL, HFILL }
6857 { &hf_ptp_v2_mm_grandmasterPriority1,
6858 { "Grandmaster priority1", "ptp.v2.mm.grandmasterPriority1",
6859 FT_UINT8, BASE_DEC, NULL, 0x00,
6860 NULL, HFILL }
6862 { &hf_ptp_v2_mm_grandmasterPriority2,
6863 { "Grandmaster priority2", "ptp.v2.mm.grandmasterPriority2",
6864 FT_UINT8, BASE_DEC, NULL, 0x00,
6865 NULL, HFILL }
6867 { &hf_ptp_v2_mm_grandmasterclockclass,
6868 { "Grandmaster clock class", "ptp.v2.mm.grandmasterclockclass",
6869 FT_UINT8, BASE_DEC, NULL, 0x00,
6870 NULL, HFILL }
6872 { &hf_ptp_v2_mm_grandmasterclockaccuracy,
6873 { "Grandmaster clock accuracy", "ptp.v2.mm.grandmasterclockaccuracy",
6874 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
6875 NULL, HFILL }
6877 { &hf_ptp_v2_mm_grandmasterclockvariance,
6878 { "Grandmaster clock variance", "ptp.v2.mm.grandmasterclockvariance",
6879 FT_UINT16, BASE_DEC, NULL, 0x00,
6880 NULL, HFILL }
6882 { &hf_ptp_v2_mm_grandmasterIdentity,
6883 { "Grandmaster clock identity", "ptp.v2.mm.grandmasterclockidentity",
6884 FT_UINT64, BASE_HEX, NULL, 0x00,
6885 NULL, HFILL }
6887 { &hf_ptp_v2_mm_currentUtcOffset,
6888 { "CurrentUTCOffset", "ptp.v2.mm.currentutcoffset",
6889 FT_INT16, BASE_DEC, NULL, 0x00,
6890 NULL, HFILL }
6892 { &hf_ptp_v2_mm_LI_61,
6893 { "leap 61", "ptp.v2.mm.li61",
6894 FT_BOOLEAN, 8, NULL, 0x01,
6895 NULL, HFILL }
6897 { &hf_ptp_v2_mm_LI_59,
6898 { "leap 59", "ptp.v2.mm.li59",
6899 FT_BOOLEAN, 8, NULL, 0x02,
6900 NULL, HFILL }
6902 { &hf_ptp_v2_mm_UTCV,
6903 { "CurrentUTCOffset valid", "ptp.v2.mm.CurrentUTCOffsetValid",
6904 FT_BOOLEAN, 8, NULL, 0x04,
6905 NULL, HFILL }
6907 { &hf_ptp_v2_mm_PTP,
6908 { "PTP timescale", "ptp.v2.mm.ptptimescale",
6909 FT_BOOLEAN, 8, NULL, 0x08,
6910 NULL, HFILL }
6912 { &hf_ptp_v2_mm_TTRA,
6913 { "Time traceable", "ptp.v2.mm.timeTraceable",
6914 FT_BOOLEAN, 8, NULL, 0x10,
6915 NULL, HFILL }
6917 { &hf_ptp_v2_mm_FTRA,
6918 { "Frequency traceable", "ptp.v2.mm.frequencyTraceable",
6919 FT_BOOLEAN, 8, NULL, 0x20,
6920 NULL, HFILL }
6922 { &hf_ptp_v2_mm_timesource,
6923 { "TimeSource", "ptp.v2.mm.timesource",
6924 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_timeSource_vals_ext, 0x00,
6925 NULL, HFILL }
6927 { &hf_ptp_v2_mm_offset_ns,
6928 { "Ns", "ptp.v2.mm.offset.ns",
6929 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6930 NULL, HFILL }
6932 { &hf_ptp_v2_mm_offset_subns,
6933 { "SubNs", "ptp.v2.mm.offset.subns",
6934 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6935 NULL, HFILL }
6937 { &hf_ptp_v2_mm_pathDelay_ns,
6938 { "Ns", "ptp.v2.mm.pathDelay.ns",
6939 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6940 NULL, HFILL }
6942 { &hf_ptp_v2_mm_pathDelay_subns,
6943 { "SubNs", "ptp.v2.mm.pathDelay.subns",
6944 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6945 NULL, HFILL }
6947 { &hf_ptp_v2_mm_PortNumber,
6948 { "PortNumber", "ptp.v2.mm.PortNumber",
6949 FT_UINT16, BASE_DEC, NULL, 0x00,
6950 NULL, HFILL }
6952 { &hf_ptp_v2_mm_portState,
6953 { "Port state", "ptp.v2.mm.portState",
6954 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_v2_portState_vals_ext, 0x00,
6955 NULL, HFILL }
6957 { &hf_ptp_v2_mm_logMinDelayReqInterval,
6958 { "logMinDelayReqInterval", "ptp.v2.mm.logMinDelayReqInterval",
6959 FT_INT8, BASE_DEC, NULL, 0x00,
6960 NULL, HFILL }
6962 { &hf_ptp_v2_mm_peerMeanPathDelay_ns,
6963 { "Ns", "ptp.v2.mm.peerMeanPathDelay.ns",
6964 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6965 NULL, HFILL }
6967 { &hf_ptp_v2_mm_peerMeanPathDelay_subns,
6968 { "SubNs", "ptp.v2.mm.peerMeanPathDelay.subns",
6969 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6970 NULL, HFILL }
6972 { &hf_ptp_v2_mm_logAnnounceInterval,
6973 { "logAnnounceInterval", "ptp.v2.mm.logAnnounceInterval",
6974 FT_INT8, BASE_DEC, NULL, 0x00,
6975 NULL, HFILL }
6977 { &hf_ptp_v2_mm_announceReceiptTimeout,
6978 { "announceReceiptTimeout", "ptp.v2.mm.announceReceiptTimeout",
6979 FT_UINT8, BASE_DEC, NULL, 0x00,
6980 NULL, HFILL }
6982 { &hf_ptp_v2_mm_logSyncInterval,
6983 { "logSyncInterval", "ptp.v2.mm.logSyncInterval",
6984 FT_INT8, BASE_DEC, NULL, 0x00,
6985 NULL, HFILL }
6987 { &hf_ptp_v2_mm_delayMechanism,
6988 { "Delay mechanism", "ptp.v2.mm.delayMechanism",
6989 FT_UINT8, BASE_DEC, VALS(ptp_v2_delayMechanism_vals), 0x00,
6990 NULL, HFILL }
6992 { &hf_ptp_v2_mm_logMinPdelayReqInterval,
6993 { "logMinPdelayReqInterval", "ptp.v2.mm.logMinPdelayReqInterval",
6994 FT_INT8, BASE_DEC, NULL, 0x00,
6995 NULL, HFILL }
6997 { &hf_ptp_v2_mm_versionNumber,
6998 { "versionNumber", "ptp.v2.mm.versionNumber",
6999 FT_UINT8, BASE_DEC, NULL, 0x0F,
7000 NULL, HFILL }
7002 { &hf_ptp_v2_mm_primaryDomain,
7003 { "Primary domain number", "ptp.v2.mm.primaryDomain",
7004 FT_UINT8, BASE_DEC, NULL, 0x00,
7005 NULL, HFILL }
7007 { &hf_ptp_v2_mm_faultyFlag,
7008 { "Faulty flag", "ptp.v2.mm.faultyFlag",
7009 FT_BOOLEAN, 8, NULL, 0x01,
7010 NULL, HFILL }
7013 { &hf_ptp_v2_mm_managementErrorId,
7014 { "managementErrorId", "ptp.v2.mm.managementErrorId",
7015 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_managementErrorId_vals_ext, 0x00,
7016 NULL, HFILL }
7018 { &hf_ptp_v2_mm_displayData,
7019 { "Display data", "ptp.v2.mm.displayData",
7020 FT_STRING, BASE_NONE, NULL, 0x00,
7021 NULL, HFILL }
7023 { &hf_ptp_v2_mm_displayData_length,
7024 { "length", "ptp.v2.mm.displayData.length",
7025 FT_UINT8, BASE_DEC, NULL, 0x00,
7026 NULL, HFILL }
7028 { &hf_ptp_v2_mm_ucEN,
7029 { "Enable unicast", "ptp.v2.mm.unicastEnable",
7030 FT_BOOLEAN, 8, NULL, 0x01,
7031 NULL, HFILL }
7033 { &hf_ptp_v2_mm_ptEN,
7034 { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
7035 FT_BOOLEAN, 8, NULL, 0x01,
7036 NULL, HFILL }
7038 { &hf_ptp_v2_mm_atEN,
7039 { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
7040 FT_BOOLEAN, 8, NULL, 0x01,
7041 NULL, HFILL }
7043 { &hf_ptp_v2_mm_keyField,
7044 { "Key field", "ptp.v2.mm.keyField",
7045 FT_UINT8, BASE_DEC, NULL, 0x00,
7046 NULL, HFILL }
7048 { &hf_ptp_v2_mm_displayName,
7049 { "Display name", "ptp.v2.mm.displayName",
7050 FT_STRING, BASE_NONE, NULL, 0x00,
7051 NULL, HFILL }
7053 { &hf_ptp_v2_mm_displayName_length,
7054 { "length", "ptp.v2.mm.displayName.length",
7055 FT_UINT8, BASE_DEC, NULL, 0x00,
7056 NULL, HFILL }
7058 { &hf_ptp_v2_mm_maxKey,
7059 { "Max key", "ptp.v2.mm.maxKey",
7060 FT_UINT8, BASE_DEC, NULL, 0x00,
7061 NULL, HFILL }
7063 { &hf_ptp_v2_mm_currentOffset,
7064 { "Current offset", "ptp.v2.mm.currentOffset",
7065 FT_INT32, BASE_DEC, NULL, 0x00,
7066 NULL, HFILL }
7068 { &hf_ptp_v2_mm_jumpSeconds,
7069 { "Jump seconds", "ptp.v2.mm.jumpSeconds",
7070 FT_INT32, BASE_DEC, NULL, 0x00,
7071 NULL, HFILL }
7073 { &hf_ptp_v2_mm_nextjumpSeconds,
7074 { "Time of next jump (seconds)", "ptp.v2.mm.nextjumpSeconds",
7075 FT_UINT64, BASE_DEC, NULL, 0x00,
7076 NULL, HFILL }
7078 { &hf_ptp_v2_mm_numberOfAlternateMasters,
7079 { "Number of alternate masters", "ptp.v2.mm.numberOfAlternateMasters",
7080 FT_UINT8, BASE_DEC, NULL, 0x00,
7081 NULL, HFILL }
7083 { &hf_ptp_v2_mm_logAlternateMulticastSyncInterval,
7084 { "Alternate multicast sync interval", "ptp.v2.mm.AlternateMulticastSyncInterval",
7085 FT_INT8, BASE_DEC, NULL, 0x00,
7086 NULL, HFILL }
7088 { &hf_ptp_v2_mm_transmitAlternateMulticastSync,
7089 { "Transmit alternate multicast sync", "ptp.v2.mm.transmitAlternateMulticastSync",
7090 FT_BOOLEAN, 8, NULL, 0x01,
7091 NULL, HFILL }
7093 { &hf_ptp_v2_oe_tlv_smpte_subtype,
7094 { "SMPTE SubType", "ptp.v2.oe.smpte.SubType",
7095 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_smpte_subtype_vals), 0x00,
7096 NULL, HFILL }
7098 { &hf_ptp_v2_oe_tlv_subtype_smpte_data,
7099 { "SMPTE Data", "ptp.v2.oe.smpte.data",
7100 FT_NONE, BASE_NONE, NULL, 0x00,
7101 NULL, HFILL }
7103 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate,
7104 { "defaultSystemFramerate", "ptp.v2.oe.smpte.defaultsystemframerate",
7105 FT_BYTES, BASE_NONE, NULL, 0x00,
7106 NULL, HFILL }
7108 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator,
7109 { "Numerator", "ptp.v2.oe.smpte.defaultsystemframerate.numerator",
7110 FT_UINT32, BASE_DEC, NULL, 0x00,
7111 NULL, HFILL }
7113 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator,
7114 { "Denominator", "ptp.v2.oe.smpte.defaultsystemframerate.denominator",
7115 FT_UINT32, BASE_DEC, NULL, 0x00,
7116 NULL, HFILL }
7118 { &hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus,
7119 { "masterLockingStatus", "ptp.v2.oe.smpte.masterlockingstatus",
7120 FT_UINT8, BASE_DEC, VALS(ptp_v2_org_smpte_subtype_masterlockingstatus_vals), 0x00,
7121 NULL, HFILL }
7123 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags,
7124 { "timeAddressFlags", "ptp.v2.oe.smpte.timeaddressflags",
7125 FT_UINT8, BASE_HEX, NULL, 0x00,
7126 NULL, HFILL }
7128 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop,
7129 { "Drop frame", "ptp.v2.oe.smpte.timeaddressflags.drop",
7130 FT_BOOLEAN, 8, TFS(&tfs_inuse_not_inuse), PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_DROP,
7131 NULL, HFILL }
7133 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color,
7134 { "Color frame identification", "ptp.v2.oe.smpte.timeaddressflags.color",
7135 FT_BOOLEAN, 8, TFS(&tfs_inuse_not_inuse), PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_COLOR,
7136 NULL, HFILL }
7138 { &hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset,
7139 { "currentLocalOffset", "ptp.v2.oe.smpte.currentlocaloffset",
7140 FT_INT32, BASE_DEC, NULL, 0x00,
7141 "Offset in seconds of Local Time from grandmaster PTP time", HFILL }
7143 { &hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds,
7144 { "jumpSeconds", "ptp.v2.oe.smpte.jumpseconds",
7145 FT_INT32, BASE_DEC, NULL, 0x00,
7146 "Size of next discontinuity, in seconds, of Local Time", HFILL }
7148 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump,
7149 { "timeOfNextJump", "ptp.v2.oe.smpte.timeofnextjump",
7150 FT_UINT48, BASE_DEC, NULL, 0x00,
7151 "Value of the seconds portion at the time that the next discontinuity of the currentLocalOffset will occur", HFILL }
7153 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam,
7154 { "timeOfNextJam", "ptp.v2.oe.smpte.timeofnextjam",
7155 FT_UINT48, BASE_DEC, NULL, 0x00,
7156 "Value of the seconds portion to the next scheduled Daily Jam", HFILL }
7158 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam,
7159 { "timeOfPreviousJam", "ptp.v2.oe.smpte.timeofpreviousjam",
7160 FT_UINT48, BASE_DEC, NULL, 0x00,
7161 "Value of the seconds portion of the previous Daily Jam", HFILL }
7163 { &hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset,
7164 { "previousJamLocalOffset", "ptp.v2.oe.smpte.previousjamlocaloffset",
7165 FT_INT32, BASE_DEC, NULL, 0x00,
7166 "Value of current LocalOffset at the time of the previous Daily Jam", HFILL }
7168 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving,
7169 { "daylightSaving", "ptp.v2.oe.smpte.daylightsaving",
7170 FT_UINT8, BASE_HEX, NULL, 0x00,
7171 NULL, HFILL }
7173 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current,
7174 { "Current", "ptp.v2.oe.smpte.daylightsaving.current",
7175 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_CURRENT,
7176 NULL, HFILL }
7178 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next,
7179 { "Next", "ptp.v2.oe.smpte.daylightsaving.next",
7180 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_NEXT,
7181 NULL, HFILL }
7183 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous,
7184 { "Previous", "ptp.v2.oe.smpte.daylightsaving.previous",
7185 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_PREVIOUS,
7186 NULL, HFILL }
7188 { &hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump,
7189 { "leapSecondJump", "ptp.v2.oe.smpte.leapsecondjump",
7190 FT_UINT8, BASE_HEX, NULL, 0x00,
7191 NULL, HFILL }
7193 { &hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change,
7194 { "Change in number", "ptp.v2.oe.smpte.leapsecondjump.change",
7195 FT_BOOLEAN, 8, TFS(&tfs_set_notset), PTP_V2_FLAGS_OE_SMPTE_LEAP_SECOND_JUMP_CHANGE,
7196 NULL, HFILL }
7198 { &hf_ptp_v2_analysis_followup_to_sync,
7199 { "This is a Follow Up to Sync in Frame", "ptp.v2.analysis.followuptosync",
7200 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7201 "Which message is this a Follow Up for", HFILL }
7203 { &hf_ptp_v2_analysis_sync_to_followup,
7204 { "This is a Sync to Follow Up in Frame", "ptp.v2.analysis.synctofollowup",
7205 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7206 "Which message is this a Sync for", HFILL }
7208 { &hf_ptp_v2_analysis_pdelayreq_to_pdelayres,
7209 { "This is a Peer Delay Request to Response in Frame", "ptp.v2.analysis.pdelayreqtores",
7210 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7211 "Which Peer Delay Response is this a Peer Delay Request for", HFILL }
7213 { &hf_ptp_v2_analysis_pdelayres_to_pdelayreq,
7214 { "This is a Peer Delay Response to Request in Frame", "ptp.v2.analysis.pdelayrestoreq",
7215 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7216 "Which Peer Delay Request is this a Peer Delay Response for", HFILL }
7218 { &hf_ptp_v2_analysis_pdelayres_to_pdelayfup,
7219 { "This is a Peer Delay Response to Follow Up in Frame", "ptp.v2.analysis.pdelayfuptores",
7220 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7221 "Which Peer Delay FollowUp is this a Peer Delay Response for", HFILL }
7223 { &hf_ptp_v2_analysis_pdelayfup_to_pdelayres,
7224 { "This is a Peer Delay Follow Up to Response in Frame", "ptp.v2.analysis.pdelayrestofup",
7225 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7226 "Which Peer Delay Response is this a Peer Delay FollowUp for", HFILL }
7228 { &hf_ptp_v2_analysis_sync_timestamp,
7229 { "calculatedSyncTimestamp", "ptp.v2.analysis.sync.timestamp",
7230 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7231 NULL, HFILL }
7233 { &hf_ptp_v2_analysis_sync_timestamp_seconds,
7234 { "calculatedSyncTimestamp (s)", "ptp.v2.analysis.sync.timestamp_seconds",
7235 FT_UINT64, BASE_DEC, NULL, 0x00,
7236 NULL, HFILL }
7238 { &hf_ptp_v2_analysis_sync_timestamp_nanoseconds,
7239 { "calculatedSyncTimestamp (ns)", "ptp.v2.analysis.sync.timestamp_nanoseconds",
7240 FT_UINT32, BASE_DEC, NULL, 0x00,
7241 NULL, HFILL }
7243 { &hf_ptp_v2_analysis_sync_period,
7244 { "measuredMessagePeriod", "ptp.v2.analysis.sync.measuredMessagePeriod",
7245 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7246 NULL, HFILL }
7248 { &hf_ptp_v2_analysis_sync_rateRatio,
7249 { "calculatedSyncRateRatio", "ptp.v2.analysis.sync.calculatedRateRatio",
7250 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7251 NULL, HFILL }
7253 { &hf_ptp_v2_analysis_sync_rateRatio_ppm,
7254 { "calculatedSyncRateRatio PPM", "ptp.v2.analysis.sync.calculatedRateRatio_ppm",
7255 FT_INT32, BASE_DEC, NULL, 0x00,
7256 NULL, HFILL }
7258 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled,
7259 { "calculatedUnscaledMeanPropagationDelay", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled",
7260 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7261 NULL, HFILL }
7263 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled_seconds,
7264 { "calculatedUnscaledMeanPropagationDelay (s)", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled_seconds",
7265 FT_INT64, BASE_DEC, NULL, 0x00,
7266 NULL, HFILL }
7268 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled_nanoseconds,
7269 { "calculatedUnscaledMeanPropagationDelay (ns)", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled_nanoseconds",
7270 FT_INT32, BASE_DEC, NULL, 0x00,
7271 NULL, HFILL }
7273 { &hf_ptp_v2_analysis_pdelay_mpd_scaled,
7274 { "calculatedScaledMeanPropagationDelay", "ptp.v2.analysis.pdelay.meanpropdelay_scaled",
7275 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7276 NULL, HFILL }
7278 { &hf_ptp_v2_analysis_pdelay_period,
7279 { "measuredMessagePeriod", "ptp.v2.analysis.pdelay.measuredMessagePeriod",
7280 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7281 NULL, HFILL }
7283 { &hf_ptp_v2_analysis_pdelay_neighRateRatio,
7284 { "calculatedNeighborRateRatio", "ptp.v2.analysis.pdelay.calculatedNeighborRateRatio",
7285 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7286 NULL, HFILL }
7288 { &hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm,
7289 { "calculatedNeighborRateRatio PPM", "ptp.v2.analysis.pdelay.calculatedNeighborRateRatio_ppm",
7290 FT_INT32, BASE_DEC, NULL, 0x00,
7291 NULL, HFILL }
7296 /* Setup protocol subtree array */
7297 static int *ett[] = {
7298 &ett_ptp,
7299 &ett_ptp_flags,
7300 &ett_ptp_time,
7301 &ett_ptp_time2,
7302 &ett_ptp_v2,
7303 &ett_ptp_v2_majorsdoid,
7304 &ett_ptp_v2_flags,
7305 &ett_ptp_v2_clockidentity,
7306 &ett_ptp_v2_correction,
7307 &ett_ptp_v2_time,
7308 &ett_ptp_v2_time2,
7309 &ett_ptp_v2_managementData,
7310 &ett_ptp_v2_clockType,
7311 &ett_ptp_v2_physicalLayerProtocol,
7312 &ett_ptp_v2_protocolAddress,
7313 &ett_ptp_v2_ptptext,
7314 &ett_ptp_v2_faultRecord,
7315 &ett_ptp_v2_timeInterval,
7316 &ett_ptp_v2_tlv,
7317 &ett_ptp_v2_tlv_log_period,
7318 &ett_ptp_v2_sig_l1sync_flags,
7319 &ett_ptp_as_sig_tlv_flags,
7320 &ett_ptp_oe_wr_flags,
7321 &ett_ptp_oe_smpte_data,
7322 &ett_ptp_oe_smpte_framerate,
7323 &ett_ptp_oe_smpte_timeaddress,
7324 &ett_ptp_oe_smpte_daylightsaving,
7325 &ett_ptp_oe_smpte_leapsecondjump,
7326 &ett_ptp_analysis_timestamp,
7327 &ett_ptp_analysis_mean_propagation_delay,
7330 static ei_register_info ei[] = {
7331 { &ei_ptp_v2_msg_len_too_large, { "ptp.v2.msg_len_too_large", PI_MALFORMED, PI_ERROR, "Message length goes past the end of the packet", EXPFILL }},
7332 { &ei_ptp_v2_msg_len_too_small, { "ptp.v2.msg_len_too_small", PI_MALFORMED, PI_ERROR, "Message length too short to include the message length field", EXPFILL }},
7333 { &ei_ptp_v2_sync_no_followup, { "ptp.v2.sync_no_fup", PI_PROTOCOL, PI_WARN, "No Follow Up for this Two Step Sync", EXPFILL }},
7334 { &ei_ptp_v2_sync_no_fup_tlv, { "ptp.v2.sync_no_fup_tlv", PI_PROTOCOL, PI_WARN, "No Follow Up Information TLV for this gPTP One Step Sync", EXPFILL }},
7335 { &ei_ptp_v2_sync_with_fup_tlv, { "ptp.v2.sync_with_fup_tlv", PI_PROTOCOL, PI_WARN, "Two Step Sync should not have Follow Up Information TLV", EXPFILL }},
7336 { &ei_ptp_v2_followup_no_sync, { "ptp.v2.fup_without_sync", PI_PROTOCOL, PI_WARN, "No Sync for this Follow Up", EXPFILL }},
7337 { &ei_ptp_v2_followup_no_tlv, { "ptp.v2.fup_without_fup_tlv", PI_PROTOCOL, PI_WARN, "Follow Up without Follow Up TLV", EXPFILL }},
7338 { &ei_ptp_v2_pdreq_no_pdresp, { "ptp.v2.pdelay_req_without_resp", PI_PROTOCOL, PI_WARN, "No Response for this Peer Delay Request", EXPFILL }},
7339 { &ei_ptp_v2_pdresp_no_pdreq, { "ptp.v2.pdelay_resp_without_req", PI_PROTOCOL, PI_WARN, "No Request for this Peer Delay Response", EXPFILL }},
7340 { &ei_ptp_v2_pdresp_no_pdfup, { "ptp.v2.pdelay_resp_without_fup", PI_PROTOCOL, PI_WARN, "No Follow Up for this Peer Delay Response", EXPFILL }},
7341 { &ei_ptp_v2_pdresp_twostep, { "ptp.v2.pdelay_resp_two_step_false", PI_PROTOCOL, PI_WARN, "Peer Delay Response with Two Step Flag set to false but Follow Up received", EXPFILL }},
7342 { &ei_ptp_v2_pdfup_no_pdresp, { "ptp.v2.pdelay_fup_without_resp", PI_PROTOCOL, PI_WARN, "No Response for this Peer Delay Follow Up", EXPFILL }},
7343 { &ei_ptp_v2_period_invalid, { "ptp.v2.period.invalid", PI_PROTOCOL, PI_WARN, "Period invalid", EXPFILL }},
7344 { &ei_ptp_v2_as_tlv_in_non_as, { "ptp.v2.as_tlv_in_non_as", PI_PROTOCOL, PI_WARN, "TLV defined for 802.1AS but this is PTPv2", EXPFILL }},
7347 expert_module_t* expert_ptp;
7349 /* Register the protocol name and description */
7350 proto_ptp = proto_register_protocol("Precision Time Protocol (IEEE1588)", "PTP", "ptp");
7352 /* Required function calls to register the header fields and subtrees used */
7353 proto_register_field_array(proto_ptp, hf, array_length(hf));
7354 proto_register_subtree_array(ett, array_length(ett));
7356 expert_ptp = expert_register_protocol(proto_ptp);
7357 expert_register_field_array(expert_ptp, ei, array_length(ei));
7359 /* Get the decimal point based on locale */
7360 decimal_point = localeconv()->decimal_point;
7362 /* Configuration */
7363 module_t *ptp_module = prefs_register_protocol(proto_ptp, NULL);
7364 prefs_register_bool_preference(ptp_module, "analyze_ptp_messages", "Analyze PTP messages",
7365 "Make the PTP dissector analyze PTP messages. Accurate Capture Timestamps required!",
7366 &ptp_analyze_messages);
7368 prefs_register_bool_preference(ptp_module, "analyze_ptp_strict_minor_version_matching", "Analysis: Only match messages, if minor version matches",
7369 "Take minor version for matching of messages into account!",
7370 &ptp_analyze_messages_with_minor_version);
7372 prefs_register_uint_preference(ptp_module, "analyze_ptp_delta", "Analysis: Max message delta",
7373 "Maximum allowed time between messages of same type when finding "
7374 "consecutive messages for analysis calculations.",
7375 10, &ptp_analysis_max_consecutive_delta);
7377 /* Setup analysis data structures */
7378 ptp_clocks = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_int64_hash, g_int64_equal);
7380 ptpv2_tlv_org_id_subdissector_table = register_dissector_table("ptp.v2.tlv.oe.organizationId", "PTPv2 TLV Organization ID", proto_ptp, FT_UINT24, BASE_HEX);
7384 void
7385 proto_reg_handoff_ptp(void) {
7386 dissector_handle_t ptp_handle;
7387 dissector_handle_t ethertype_ptp_handle;
7389 ptp_handle = register_dissector("ptp", dissect_ptp, proto_ptp);
7390 ethertype_ptp_handle = register_dissector("ptp_over_ethernet", dissect_ptp_oE, proto_ptp);
7392 dissector_add_uint_range_with_preference("udp.port", PTP_PORT_RANGE, ptp_handle);
7393 dissector_add_uint("ethertype", ETHERTYPE_PTP, ethertype_ptp_handle);
7397 * Editor modelines - https://www.wireshark.org/tools/modelines.html
7399 * Local variables:
7400 * c-basic-offset: 4
7401 * tab-width: 8
7402 * indent-tabs-mode: nil
7403 * End:
7405 * vi: set shiftwidth=4 tabstop=8 expandtab:
7406 * :indentSize=4:tabSize=8:noTabs=true: