TODO drsuapi compressed
[wireshark-sm.git] / epan / dissectors / packet-ptp.c
blob77b996edb148091661ad88e64f029a1190376b17
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 Voelker <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>
17 * Revisions:
18 * - Markus Seehofer 09.08.2005 <mseehofe@nt.hirschmann.de>
19 * - Included the "startingBoundaryHops" field in
20 * ptp_management messages.
21 * - Christian Schaer 07.07.2006 <scc@zhwin.ch>
22 * - Added support for PTP version 2
23 * - Markus Renz 2007-06-01
24 * - updated support for PTPv2
25 * - Markus Renz added Management for PTPv2, update to Draft 2.2
26 * - Torrey Atcitty & Dave Olsen 05.14.2010
27 * - Added support for 802.1AS D7.0
28 * - Andreas Bachmann 08.07.2013 <bacr@zhaw.ch>
29 * - allow multiple TLVs
30 * - bugfix in logInterMessagePeriod uint8_t -> int8_t
31 * - Uli Heilmeier 21.03.2016 <uh@heilmeier.eu>
32 * - Added support for SMPTE TLV
33 * - Adam Wujek 17.10.2017 <adam.wujek@cern.ch>
34 * - Added support for White Rabbit TLV
35 * - Prashant Tripathi 19-02-2021 <prashant_tripathi@selinc.com>
36 * - Added support for C37.238-2017
37 * - Dr. Lars Voelker 05-01-2022 <lars.voelker@technica-engineering.de>
38 * - Added analysis support
39 * - Adam Wujek 28.08.2023 <dev_public@wujek.eu>
40 * - Added support for L1Sync
41 * - Patrik Thunström 27.01.2024 <patrik.thunstroem@technica-engineering.de>
42 * - Improvements/corrections for cumulativeScaledRateOffset
43 * - Prashant Tripathi 31-07-2024 <prashant_tripathi@selinc.com>
44 * - Corrections to timeOfNextJump field in ATOI TLV
45 * - Patrik Thunström 24.09.2024 <patrik.thunstroem@technica-engineering.de>
46 * - Fix analysis association (Sync to Follow_Up etc.) in case of sequenceId resets
48 * Wireshark - Network traffic analyzer
49 * By Gerald Combs <gerald@wireshark.org>
50 * Copyright 1998 Gerald Combs
52 * SPDX-License-Identifier: GPL-2.0-or-later
55 #include "config.h"
57 #include <math.h>
58 #include <locale.h>
60 #include <epan/packet.h>
61 #include <epan/tfs.h>
62 #include <epan/unit_strings.h>
63 #include <epan/etypes.h>
64 #include <epan/expert.h>
65 #include <epan/proto_data.h>
66 #include <epan/oui.h>
67 #include <epan/addr_resolv.h>
68 #include "packet-ptp.h"
70 #define NS_PER_S 1000000000
72 /**********************************************************/
73 /* Port definition's for PTP */
74 /**********************************************************/
75 #define PTP_PORT_RANGE "319-320"
77 /* END Port definition's for PTP */
78 void proto_register_ptp(void);
79 void proto_reg_handoff_ptp(void);
81 static int proto_ptp;
82 /* To keep the decimal point based on locale */
83 static char * decimal_point;
85 /***********************************************************************************/
86 /* Definitions and fields for PTPv1 dissection. */
87 /***********************************************************************************/
90 /**********************************************************/
91 /* Offsets of fields within a PTPv1 packet. */
92 /**********************************************************/
94 /* Common offsets for all Messages (Synch, Delay_Req, Follow_Up, Delay_Resp ....) */
95 #define PTP_VERSIONPTP_OFFSET 0
96 #define PTP_VERSIONNETWORK_OFFSET 2
97 #define PTP_SUBDOMAIN_OFFSET 4
98 #define PTP_MESSAGETYPE_OFFSET 20
99 #define PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET 21
100 #define PTP_SOURCEUUID_OFFSET 22
101 #define PTP_SOURCEPORTID_OFFSET 28
102 #define PTP_SEQUENCEID_OFFSET 30
103 #define PTP_CONTROLFIELD_OFFSET 32
104 #define PTP_FLAGS_OFFSET 34
105 #define PTP_FLAGS_LI61_OFFSET 34
106 #define PTP_FLAGS_LI59_OFFSET 34
107 #define PTP_FLAGS_BOUNDARY_CLOCK_OFFSET 34
108 #define PTP_FLAGS_ASSIST_OFFSET 34
109 #define PTP_FLAGS_EXT_SYNC_OFFSET 34
110 #define PTP_FLAGS_PARENT_STATS_OFFSET 34
111 #define PTP_FLAGS_SYNC_BURST_OFFSET 34
113 /* Offsets for PTP_Sync and Delay_Req (=SDR) messages */
114 #define PTP_SDR_ORIGINTIMESTAMP_OFFSET 40
115 #define PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET 40
116 #define PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET 44
117 #define PTP_SDR_EPOCHNUMBER_OFFSET 48
118 #define PTP_SDR_CURRENTUTCOFFSET_OFFSET 50
119 #define PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 53
120 #define PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET 54
121 #define PTP_SDR_GRANDMASTERPORTID_OFFSET 60
122 #define PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET 62
123 #define PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET 67
124 #define PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET 68
125 #define PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET 74
126 #define PTP_SDR_GRANDMASTERPREFERRED_OFFSET 77
127 #define PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET 79
128 #define PTP_SDR_SYNCINTERVAL_OFFSET 83
129 #define PTP_SDR_LOCALCLOCKVARIANCE_OFFSET 86
130 #define PTP_SDR_LOCALSTEPSREMOVED_OFFSET 90
131 #define PTP_SDR_LOCALCLOCKSTRATUM_OFFSET 95
132 #define PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET 96
133 #define PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET 101
134 #define PTP_SDR_PARENTUUID_OFFSET 102
135 #define PTP_SDR_PARENTPORTFIELD_OFFSET 110
136 #define PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET 114
137 #define PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET 116
138 #define PTP_SDR_UTCREASONABLE_OFFSET 123
140 /* Offsets for Follow_Up (=FU) messages */
141 #define PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET 42
142 #define PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET 44
143 #define PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET 44
144 #define PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET 48
146 /* Offsets for Delay_Resp (=DR) messages */
147 #define PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET 40
148 #define PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET 40
149 #define PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET 44
150 #define PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET 49
151 #define PTP_DR_REQUESTINGSOURCEUUID_OFFSET 50
152 #define PTP_DR_REQUESTINGSOURCEPORTID_OFFSET 56
153 #define PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET 58
155 /* Offsets for Management (=MM) messages */
156 #define PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET 41
157 #define PTP_MM_TARGETUUID_OFFSET 42
158 #define PTP_MM_TARGETPORTID_OFFSET 48
159 #define PTP_MM_STARTINGBOUNDARYHOPS_OFFSET 50
160 #define PTP_MM_BOUNDARYHOPS_OFFSET 52
161 #define PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET 55
162 #define PTP_MM_PARAMETERLENGTH_OFFSET 58
164 /* PARAMETERLENGTH > 0 */
165 #define PTP_MM_MESSAGEPARAMETERS_OFFSET 60
167 /* PTP_MM_CLOCK_IDENTITY (PARAMETERLENGTH = 64) */
168 #define PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET 63
169 #define PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET 64
170 #define PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET 74
171 #define PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET 76
173 /* PTP_MM_INITIALIZE_CLOCK (PARAMETERLENGTH = 4) */
174 #define PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET 62
176 /* PTP_MM_SET_SUBDOMAIN (PARAMETERLENGTH = 16) */
177 #define PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET 60
179 /* PTP_MM_DEFAULT_DATA_SET (PARAMETERLENGTH = 76) */
180 #define PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET 63
181 #define PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET 64
182 #define PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET 74
183 #define PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET 79
184 #define PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET 80
185 #define PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET 86
186 #define PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET 89
187 #define PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET 95
188 #define PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET 99
189 #define PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET 103
190 #define PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET 107
191 #define PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET 111
192 #define PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET 112
193 #define PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET 130
194 #define PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET 134
196 /* PTP_MM_UPDATE_DEFAULT_DATA_SET (PARAMETERLENGTH = 36) */
197 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET 63
198 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET 64
199 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET 70
200 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET 75
201 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET 79
202 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET 80
204 /* PTP_MM_CURRENT_DATA_SET (PARAMETERLENGTH = 20) */
205 #define PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET 62
206 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET 64
207 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET 64
208 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET 68
209 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET 72
210 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET 72
211 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET 76
213 /* PTP_MM_PARENT_DATA_SET (PARAMETERLENGTH = 90) */
214 #define PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET 63
215 #define PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET 64
216 #define PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET 74
217 #define PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET 78
218 #define PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET 83
219 #define PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET 87
220 #define PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET 90
221 #define PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET 95
222 #define PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET 98
223 #define PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET 100
224 #define PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET 107
225 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 111
226 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET 112
227 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET 122
228 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET 127
229 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET 128
230 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET 134
231 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET 139
232 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET 143
233 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET 146
235 /* PTP_MM_PORT_DATA_SET (PARAMETERLENGTH = 52) */
236 #define PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET 62
237 #define PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET 67
238 #define PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET 70
239 #define PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET 74
240 #define PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET 79
241 #define PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET 80
242 #define PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET 90
243 #define PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET 95
244 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET 97
245 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET 98
246 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET 99
247 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET 100
248 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET 106
249 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET 110
251 /* PTP_MM_GLOBAL_TIME_DATA_SET (PARAMETERLENGTH = 24) */
252 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET 60
253 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET 60
254 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET 64
255 #define PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET 70
256 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET 75
257 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET 79
258 #define PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET 82
260 /* PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES (PARAMETERLENGTH = 16) */
261 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET 62
262 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET 67
263 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET 71
264 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET 74
266 /* PTP_MM_GET_FOREIGN_DATA_SET (PARAMETERLENGTH = 4) */
267 #define PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET 62
269 /* PTP_MM_FOREIGN_DATA_SET (PARAMETERLENGTH = 28) */
270 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET 62
271 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET 66
272 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET 71
273 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET 72
274 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET 82
275 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET 86
277 /* PTP_MM_SET_SYNC_INTERVAL (PARAMETERLENGTH = 4) */
278 #define PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET 62
280 /* PTP_MM_SET_TIME (PARAMETERLENGTH = 8) */
281 #define PTP_MM_SET_TIME_LOCALTIME_OFFSET 60
282 #define PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET 60
283 #define PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET 64
285 /* Interface Rate Tlv field offsets */
286 #define PTP_SIG_TLV_INTERFACE_BIT_PERIOD 10
287 #define PTP_SIG_TLV_NUMBERBITS_BEFORE_TIMESTAMP 18
288 #define PTP_SIG_TLV_NUMBERBITS_AFTER_TIMESTAMP 20
290 /* END Offsets of fields within a PTP packet. */
292 /**********************************************************/
293 /* flag-field-mask-definitions */
294 /**********************************************************/
295 #define PTP_FLAGS_LI61_BITMASK 0x0001
296 #define PTP_FLAGS_LI59_BITMASK 0x0002
297 #define PTP_FLAGS_BOUNDARY_CLOCK_BITMASK 0x0004
298 #define PTP_FLAGS_ASSIST_BITMASK 0x0008
299 #define PTP_FLAGS_EXT_SYNC_BITMASK 0x0010
300 #define PTP_FLAGS_PARENT_STATS_BITMASK 0x0020
301 #define PTP_FLAGS_SYNC_BURST_BITMASK 0x0040
303 /* END flag-field-mask-definitions */
305 /**********************************************************/
306 /* managementMessage definitions */
307 /**********************************************************/
308 #define PTP_MM_NULL 0
309 #define PTP_MM_OBTAIN_IDENTITY 1
310 #define PTP_MM_CLOCK_IDENTITY 2
311 #define PTP_MM_INITIALIZE_CLOCK 3
312 #define PTP_MM_SET_SUBDOMAIN 4
313 #define PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER 5
314 #define PTP_MM_SET_DESIGNATED_PREFERRED_MASTER 6
315 #define PTP_MM_GET_DEFAULT_DATA_SET 7
316 #define PTP_MM_DEFAULT_DATA_SET 8
317 #define PTP_MM_UPDATE_DEFAULT_DATA_SET 9
318 #define PTP_MM_GET_CURRENT_DATA_SET 10
319 #define PTP_MM_CURRENT_DATA_SET 11
320 #define PTP_MM_GET_PARENT_DATA_SET 12
321 #define PTP_MM_PARENT_DATA_SET 13
322 #define PTP_MM_GET_PORT_DATA_SET 14
323 #define PTP_MM_PORT_DATA_SET 15
324 #define PTP_MM_GET_GLOBAL_TIME_DATA_SET 16
325 #define PTP_MM_GLOBAL_TIME_DATA_SET 17
326 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES 18
327 #define PTP_MM_GOTO_FAULTY_STATE 19
328 #define PTP_MM_GET_FOREIGN_DATA_SET 20
329 #define PTP_MM_FOREIGN_DATA_SET 21
330 #define PTP_MM_SET_SYNC_INTERVAL 22
331 #define PTP_MM_DISABLE_PORT 23
332 #define PTP_MM_ENABLE_PORT 24
333 #define PTP_MM_DISABLE_BURST 25
334 #define PTP_MM_ENABLE_BURST 26
335 #define PTP_MM_SET_TIME 27
337 static const value_string ptp_managementMessageKey_vals[] = {
338 {PTP_MM_NULL , "PTP_MM_NULL"},
339 {PTP_MM_OBTAIN_IDENTITY , "PTP_MM_OBTAIN_IDENTITY"},
340 {PTP_MM_CLOCK_IDENTITY , "PTP_MM_CLOCK_IDENTITY"},
341 {PTP_MM_INITIALIZE_CLOCK , "PTP_MM_INITIALIZE_CLOCK"},
342 {PTP_MM_SET_SUBDOMAIN , "PTP_MM_SET_SUBDOMAIN"},
343 {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER , "PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER"},
344 {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER , "PTP_MM_SET_DESIGNATED_PREFERRED_MASTER"},
345 {PTP_MM_GET_DEFAULT_DATA_SET , "PTP_MM_GET_DEFAULT_DATA_SET"},
346 {PTP_MM_DEFAULT_DATA_SET , "PTP_MM_DEFAULT_DATA_SET"},
347 {PTP_MM_UPDATE_DEFAULT_DATA_SET , "PTP_MM_UPDATE_DEFAULT_DATA_SET"},
348 {PTP_MM_GET_CURRENT_DATA_SET , "PTP_MM_GET_CURRENT_DATA_SET"},
349 {PTP_MM_CURRENT_DATA_SET , "PTP_MM_CURRENT_DATA_SET"},
350 {PTP_MM_GET_PARENT_DATA_SET , "PTP_MM_GET_PARENT_DATA_SET"},
351 {PTP_MM_PARENT_DATA_SET , "PTP_MM_PARENT_DATA_SET"},
352 {PTP_MM_GET_PORT_DATA_SET , "PTP_MM_GET_PORT_DATA_SET"},
353 {PTP_MM_PORT_DATA_SET , "PTP_MM_PORT_DATA_SET"},
354 {PTP_MM_GET_GLOBAL_TIME_DATA_SET , "PTP_MM_GET_GLOBAL_TIME_DATA_SET"},
355 {PTP_MM_GLOBAL_TIME_DATA_SET , "PTP_MM_GLOBAL_TIME_DATA_SET"},
356 {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES , "PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES"},
357 {PTP_MM_GOTO_FAULTY_STATE , "PTP_MM_GOTO_FAULTY_STATE"},
358 {PTP_MM_GET_FOREIGN_DATA_SET , "PTP_MM_GET_FOREIGN_DATA_SET"},
359 {PTP_MM_FOREIGN_DATA_SET , "PTP_MM_FOREIGN_DATA_SET"},
360 {PTP_MM_SET_SYNC_INTERVAL , "PTP_MM_SET_SYNC_INTERVAL"},
361 {PTP_MM_DISABLE_PORT , "PTP_MM_DISABLE_PORT"},
362 {PTP_MM_ENABLE_PORT , "PTP_MM_ENABLE_PORT"},
363 {PTP_MM_DISABLE_BURST , "PTP_MM_DISABLE_BURST"},
364 {PTP_MM_ENABLE_BURST , "PTP_MM_ENABLE_BURST"},
365 {PTP_MM_SET_TIME , "PTP_MM_SET_TIME"},
366 {0, NULL }
368 static value_string_ext ptp_managementMessageKey_vals_ext =
369 VALUE_STRING_EXT_INIT(ptp_managementMessageKey_vals);
371 /* same again but better readable text for info column */
372 static const value_string ptp_managementMessageKey_infocolumn_vals[] = {
373 {PTP_MM_NULL , "Null"},
374 {PTP_MM_OBTAIN_IDENTITY , "Obtain Identity"},
375 {PTP_MM_CLOCK_IDENTITY , "Clock Identity"},
376 {PTP_MM_INITIALIZE_CLOCK , "Initialize Clock"},
377 {PTP_MM_SET_SUBDOMAIN , "Set Subdomain"},
378 {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER , "Clear Designated Preferred Master"},
379 {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER , "Set Designated Preferred Master"},
380 {PTP_MM_GET_DEFAULT_DATA_SET , "Get Default Data Set"},
381 {PTP_MM_DEFAULT_DATA_SET , "Default Data Set"},
382 {PTP_MM_UPDATE_DEFAULT_DATA_SET , "Update Default Data Set"},
383 {PTP_MM_GET_CURRENT_DATA_SET , "Get Current Data Set"},
384 {PTP_MM_CURRENT_DATA_SET , "Current Data Set"},
385 {PTP_MM_GET_PARENT_DATA_SET , "Get Parent Data Set"},
386 {PTP_MM_PARENT_DATA_SET , "Parent Data Set"},
387 {PTP_MM_GET_PORT_DATA_SET , "Get Port Data Set"},
388 {PTP_MM_PORT_DATA_SET , "Port Data Set"},
389 {PTP_MM_GET_GLOBAL_TIME_DATA_SET , "Get Global Time Data Set"},
390 {PTP_MM_GLOBAL_TIME_DATA_SET , "Global Time Data Set"},
391 {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES , "Update Global Time Properties"},
392 {PTP_MM_GOTO_FAULTY_STATE , "Goto Faulty State"},
393 {PTP_MM_GET_FOREIGN_DATA_SET , "Get Foreign Data Set"},
394 {PTP_MM_FOREIGN_DATA_SET , "Foreign Data Set"},
395 {PTP_MM_SET_SYNC_INTERVAL , "Set Sync Interval"},
396 {PTP_MM_DISABLE_PORT , "Disable Port"},
397 {PTP_MM_ENABLE_PORT , "Enable Port"},
398 {PTP_MM_DISABLE_BURST , "Disable Burst"},
399 {PTP_MM_ENABLE_BURST , "Enable Burst"},
400 {PTP_MM_SET_TIME , "Set Time"},
401 {0, NULL }
403 static value_string_ext ptp_managementMessageKey_infocolumn_vals_ext =
404 VALUE_STRING_EXT_INIT(ptp_managementMessageKey_infocolumn_vals);
406 /* END managementMessage definitions */
408 /**********************************************************/
409 /* CommunicationId definitions */
410 /**********************************************************/
411 #define PTP_CLOSED 0
412 #define PTP_ETHER 1
413 #define PTP_FFBUS 4
414 #define PTP_PROFIBUS 5
415 #define PTP_LON 6
416 #define PTP_DNET 7
417 #define PTP_SDS 8
418 #define PTP_CONTROLNET 9
419 #define PTP_CANOPEN 10
420 #define PTP_IEEE1394 243
421 #define PTP_IEEE802_11A 244
422 #define PTP_IEEE_WIRELESS 245
423 #define PTP_INFINIBAND 246
424 #define PTP_BLUETOOTH 247
425 #define PTP_IEEE802_15_1 248
426 #define PTP_IEEE1451_3 249
427 #define PTP_IEEE1451_5 250
428 #define PTP_USB 251
429 #define PTP_ISA 252
430 #define PTP_PCI 253
431 #define PTP_VXI 254
432 #define PTP_DEFAULT 255
434 static const value_string ptp_communicationid_vals[] = {
435 {PTP_CLOSED , "Closed system outside the scope of this standard."},
436 {PTP_ETHER , "IEEE 802.3 (Ethernet)"},
437 {PTP_FFBUS , "FOUNDATION Fieldbus"},
438 {PTP_PROFIBUS , "PROFIBUS"},
439 {PTP_LON , "LonTalk"},
440 {PTP_DNET , "DeviceNet"},
441 {PTP_SDS , "SmartDistributedSystem"},
442 {PTP_CONTROLNET , "ControlNet"},
443 {PTP_CANOPEN , "CANopen"},
444 {PTP_IEEE1394 , "IEEE 1394"},
445 {PTP_IEEE802_11A , "IEEE 802.11a"},
446 {PTP_IEEE_WIRELESS , "IEEE 802.11b"},
447 {PTP_INFINIBAND , "InfiniBand"},
448 {PTP_BLUETOOTH , "Bluetooth wireless"},
449 {PTP_IEEE802_15_1 , "IEEE 802.15.1"},
450 {PTP_IEEE1451_3 , "IEEE 1451.3"},
451 {PTP_IEEE1451_5 , "IEEE 1451.5"},
452 {PTP_USB , "USB bus"},
453 {PTP_ISA , "ISA bus"},
454 {PTP_PCI , "PCI bus"},
455 {PTP_VXI , "VXI bus"},
456 {PTP_DEFAULT , "Default value"},
457 {0, NULL }
459 static value_string_ext ptp_communicationid_vals_ext =
460 VALUE_STRING_EXT_INIT(ptp_communicationid_vals);
462 /* END CommunicationId definitions */
464 /**********************************************************/
465 /* PTP message types (PTP_CONTROL field) */
466 /**********************************************************/
467 #define PTP_SYNC_MESSAGE 0x00
468 #define PTP_DELAY_REQ_MESSAGE 0x01
469 #define PTP_FOLLOWUP_MESSAGE 0x02
470 #define PTP_DELAY_RESP_MESSAGE 0x03
471 #define PTP_MANAGEMENT_MESSAGE 0x04
472 #define PTP_OTHER_MESSAGE 0x05
474 static const value_string ptp_controlfield_vals[] = {
475 {PTP_SYNC_MESSAGE , "Sync Message"},
476 {PTP_DELAY_REQ_MESSAGE , "Delay_Req Message"},
477 {PTP_FOLLOWUP_MESSAGE , "Follow_Up Message"},
478 {PTP_DELAY_RESP_MESSAGE , "Delay_Resp Message"},
479 {PTP_MANAGEMENT_MESSAGE , "Management Message"},
480 {PTP_OTHER_MESSAGE , "Other Message"},
481 {0, NULL }
484 /* END PTP message types */
486 /**********************************************************/
487 /* Channel values for the PTP_MESSAGETYPE field */
488 /**********************************************************/
489 #define PTP_MESSAGETYPE_EVENT 0x01
490 #define PTP_MESSAGETYPE_GENERAL 0x02
492 static const value_string ptp_messagetype_vals[] = {
493 {PTP_MESSAGETYPE_EVENT , "Event Message"},
494 {PTP_MESSAGETYPE_GENERAL , "General Message"},
495 {0, NULL }
498 /* END channel values for the PTP_MESSAGETYPE field */
500 /**********************************************************/
501 /* Initialize the protocol and registered fields */
502 /**********************************************************/
504 static int hf_ptp_versionptp;
505 static int hf_ptp_versionnetwork;
506 static int hf_ptp_subdomain;
507 static int hf_ptp_messagetype;
508 static int hf_ptp_sourcecommunicationtechnology;
509 static int hf_ptp_sourceuuid;
510 static int hf_ptp_sourceportid;
511 static int hf_ptp_sequenceid;
512 static int hf_ptp_controlfield;
513 static int hf_ptp_flags;
514 static int hf_ptp_flags_li61;
515 static int hf_ptp_flags_li59;
516 static int hf_ptp_flags_boundary_clock;
517 static int hf_ptp_flags_assist;
518 static int hf_ptp_flags_ext_sync;
519 static int hf_ptp_flags_parent;
520 static int hf_ptp_flags_sync_burst;
522 /* Fields for ptp_sync and delay_req (=sdr) messages */
523 static int hf_ptp_sdr_origintimestamp; /* Field for seconds & nanoseconds */
524 static int hf_ptp_sdr_origintimestamp_seconds;
525 static int hf_ptp_sdr_origintimestamp_nanoseconds;
526 static int hf_ptp_sdr_epochnumber;
527 static int hf_ptp_sdr_currentutcoffset;
528 static int hf_ptp_sdr_grandmastercommunicationtechnology;
529 static int hf_ptp_sdr_grandmasterclockuuid;
530 static int hf_ptp_sdr_grandmasterportid;
531 static int hf_ptp_sdr_grandmastersequenceid;
532 static int hf_ptp_sdr_grandmasterclockstratum;
533 static int hf_ptp_sdr_grandmasterclockidentifier;
534 static int hf_ptp_sdr_grandmasterclockvariance;
535 static int hf_ptp_sdr_grandmasterpreferred;
536 static int hf_ptp_sdr_grandmasterisboundaryclock;
537 static int hf_ptp_sdr_syncinterval;
538 static int hf_ptp_sdr_localclockvariance;
539 static int hf_ptp_sdr_localstepsremoved;
540 static int hf_ptp_sdr_localclockstratum;
541 static int hf_ptp_sdr_localclockidentifier;
542 static int hf_ptp_sdr_parentcommunicationtechnology;
543 static int hf_ptp_sdr_parentuuid;
544 static int hf_ptp_sdr_parentportfield;
545 static int hf_ptp_sdr_estimatedmastervariance;
546 static int hf_ptp_sdr_estimatedmasterdrift;
547 static int hf_ptp_sdr_utcreasonable;
549 /* Fields for follow_up (=fu) messages */
550 static int hf_ptp_fu_associatedsequenceid;
551 static int hf_ptp_fu_preciseorigintimestamp;
552 static int hf_ptp_fu_preciseorigintimestamp_seconds;
553 static int hf_ptp_fu_preciseorigintimestamp_nanoseconds;
555 /* Fields for delay_resp (=dr) messages */
556 static int hf_ptp_dr_delayreceipttimestamp;
557 static int hf_ptp_dr_delayreceipttimestamp_seconds;
558 static int hf_ptp_dr_delayreceipttimestamp_nanoseconds;
559 static int hf_ptp_dr_requestingsourcecommunicationtechnology;
560 static int hf_ptp_dr_requestingsourceuuid;
561 static int hf_ptp_dr_requestingsourceportid;
562 static int hf_ptp_dr_requestingsourcesequenceid;
564 /* Fields for management (=mm) messages */
565 static int hf_ptp_mm_targetcommunicationtechnology;
566 static int hf_ptp_mm_targetuuid;
567 static int hf_ptp_mm_targetportid;
568 static int hf_ptp_mm_startingboundaryhops;
569 static int hf_ptp_mm_boundaryhops;
570 static int hf_ptp_mm_managementmessagekey;
571 static int hf_ptp_mm_parameterlength;
572 /* parameterlength > 0 */
573 /* static int hf_ptp_mm_messageparameters; */
574 /* ptp_mm_clock_identity (parameterlength = 64) */
575 static int hf_ptp_mm_clock_identity_clockcommunicationtechnology;
576 static int hf_ptp_mm_clock_identity_clockuuidfield;
577 static int hf_ptp_mm_clock_identity_clockportfield;
578 static int hf_ptp_mm_clock_identity_manufactureridentity;
580 /* ptp_mm_initialize_clock (parameterlength = 4) */
581 static int hf_ptp_mm_initialize_clock_initialisationkey;
583 /* ptp_mm_set_subdomain (parameterlength = 16) */
584 static int hf_ptp_mm_set_subdomain_subdomainname;
586 /* ptp_mm_default_data_set (parameterlength = 76) */
587 static int hf_ptp_mm_default_data_set_clockcommunicationtechnology;
588 static int hf_ptp_mm_default_data_set_clockuuidfield;
589 static int hf_ptp_mm_default_data_set_clockportfield;
590 static int hf_ptp_mm_default_data_set_clockstratum;
591 static int hf_ptp_mm_default_data_set_clockidentifier;
592 static int hf_ptp_mm_default_data_set_clockvariance;
593 static int hf_ptp_mm_default_data_set_clockfollowupcapable;
594 static int hf_ptp_mm_default_data_set_preferred;
595 static int hf_ptp_mm_default_data_set_initializable;
596 static int hf_ptp_mm_default_data_set_externaltiming;
597 static int hf_ptp_mm_default_data_set_isboundaryclock;
598 static int hf_ptp_mm_default_data_set_syncinterval;
599 static int hf_ptp_mm_default_data_set_subdomainname;
600 static int hf_ptp_mm_default_data_set_numberports;
601 static int hf_ptp_mm_default_data_set_numberforeignrecords;
603 /* ptp_mm_update_default_data_set (parameterlength = 36) */
604 static int hf_ptp_mm_update_default_data_set_clockstratum;
605 static int hf_ptp_mm_update_default_data_set_clockidentifier;
606 static int hf_ptp_mm_update_default_data_set_clockvariance;
607 static int hf_ptp_mm_update_default_data_set_preferred;
608 static int hf_ptp_mm_update_default_data_set_syncinterval;
609 static int hf_ptp_mm_update_default_data_set_subdomainname;
611 /* ptp_mm_current_data_set (parameterlength = 20) */
612 static int hf_ptp_mm_current_data_set_stepsremoved;
613 static int hf_ptp_mm_current_data_set_offsetfrommaster;
614 static int hf_ptp_mm_current_data_set_offsetfrommasterseconds;
615 static int hf_ptp_mm_current_data_set_offsetfrommasternanoseconds;
616 static int hf_ptp_mm_current_data_set_onewaydelay;
617 static int hf_ptp_mm_current_data_set_onewaydelayseconds;
618 static int hf_ptp_mm_current_data_set_onewaydelaynanoseconds;
620 /* ptp_mm_parent_data_set (parameterlength = 90) */
621 static int hf_ptp_mm_parent_data_set_parentcommunicationtechnology;
622 static int hf_ptp_mm_parent_data_set_parentuuid;
623 static int hf_ptp_mm_parent_data_set_parentportid;
624 static int hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber;
625 static int hf_ptp_mm_parent_data_set_parentfollowupcapable;
626 static int hf_ptp_mm_parent_data_set_parentexternaltiming;
627 static int hf_ptp_mm_parent_data_set_parentvariance;
628 static int hf_ptp_mm_parent_data_set_parentstats;
629 static int hf_ptp_mm_parent_data_set_observedvariance;
630 static int hf_ptp_mm_parent_data_set_observeddrift;
631 static int hf_ptp_mm_parent_data_set_utcreasonable;
632 static int hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology;
633 static int hf_ptp_mm_parent_data_set_grandmasteruuidfield;
634 static int hf_ptp_mm_parent_data_set_grandmasterportidfield;
635 static int hf_ptp_mm_parent_data_set_grandmasterstratum;
636 static int hf_ptp_mm_parent_data_set_grandmasteridentifier;
637 static int hf_ptp_mm_parent_data_set_grandmastervariance;
638 static int hf_ptp_mm_parent_data_set_grandmasterpreferred;
639 static int hf_ptp_mm_parent_data_set_grandmasterisboundaryclock;
640 static int hf_ptp_mm_parent_data_set_grandmastersequencenumber;
642 /* ptp_mm_port_data_set (parameterlength = 52) */
643 static int hf_ptp_mm_port_data_set_returnedportnumber;
644 static int hf_ptp_mm_port_data_set_portstate;
645 static int hf_ptp_mm_port_data_set_lastsynceventsequencenumber;
646 static int hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber;
647 static int hf_ptp_mm_port_data_set_portcommunicationtechnology;
648 static int hf_ptp_mm_port_data_set_portuuidfield;
649 static int hf_ptp_mm_port_data_set_portidfield;
650 static int hf_ptp_mm_port_data_set_burstenabled;
651 static int hf_ptp_mm_port_data_set_subdomainaddressoctets;
652 static int hf_ptp_mm_port_data_set_eventportaddressoctets;
653 static int hf_ptp_mm_port_data_set_generalportaddressoctets;
654 static int hf_ptp_mm_port_data_set_subdomainaddress;
655 static int hf_ptp_mm_port_data_set_eventportaddress;
656 static int hf_ptp_mm_port_data_set_generalportaddress;
658 /* ptp_mm_global_time_data_set (parameterlength = 24) */
659 static int hf_ptp_mm_global_time_data_set_localtime;
660 static int hf_ptp_mm_global_time_data_set_localtimeseconds;
661 static int hf_ptp_mm_global_time_data_set_localtimenanoseconds;
662 static int hf_ptp_mm_global_time_data_set_currentutcoffset;
663 static int hf_ptp_mm_global_time_data_set_leap59;
664 static int hf_ptp_mm_global_time_data_set_leap61;
665 static int hf_ptp_mm_global_time_data_set_epochnumber;
667 /* ptp_mm_update_global_time_properties (parameterlength = 16) */
668 static int hf_ptp_mm_update_global_time_properties_currentutcoffset;
669 static int hf_ptp_mm_update_global_time_properties_leap59;
670 static int hf_ptp_mm_update_global_time_properties_leap61;
671 /* static int hf_ptp_mm_update_global_time_properties_epochnumber; */
673 /* ptp_mm_get_foreign_data_set (parameterlength = 4) */
674 static int hf_ptp_mm_get_foreign_data_set_recordkey;
676 /* ptp_mm_foreign_data_set (parameterlength = 28) */
677 static int hf_ptp_mm_foreign_data_set_returnedportnumber;
678 static int hf_ptp_mm_foreign_data_set_returnedrecordnumber;
679 static int hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology;
680 static int hf_ptp_mm_foreign_data_set_foreignmasteruuidfield;
681 static int hf_ptp_mm_foreign_data_set_foreignmasterportidfield;
682 static int hf_ptp_mm_foreign_data_set_foreignmastersyncs;
684 /* ptp_mm_set_sync_interval (parameterlength = 4) */
685 static int hf_ptp_mm_set_sync_interval_syncinterval;
687 /* ptp_mm_set_time (parameterlength = 8) */
688 static int hf_ptp_mm_set_time_localtime;
689 static int hf_ptp_mm_set_time_localtimeseconds;
690 static int hf_ptp_mm_set_time_localtimenanoseconds;
692 /* END Initialize the protocol and registered fields */
694 /* Initialize the subtree pointers */
695 static int ett_ptp;
696 static int ett_ptp_flags;
697 static int ett_ptp_time;
698 static int ett_ptp_time2;
700 /* END Definitions and fields for PTPv1 dissection. */
706 /***********************************************************************************/
707 /* Definitions and fields for PTPv2 dissection. */
708 /***********************************************************************************/
711 /**********************************************************/
712 /* Offsets of fields within a PTPv2 packet. */
713 /**********************************************************/
715 /* Common offsets for all Messages (Sync, Delay_Req, Follow_Up, Delay_Resp ....) */
716 #define PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET 0
717 #define PTP_V2_VERSIONPTP_OFFSET 1
718 #define PTP_V2_MINORVERSIONPTP_OFFSET PTP_V2_VERSIONPTP_OFFSET
719 #define PTP_V2_MESSAGE_LENGTH_OFFSET 2
720 #define PTP_V2_DOMAIN_NUMBER_OFFSET 4
721 #define PTP_V2_MINORSDOID_OFFSET 5
722 #define PTP_V2_FLAGS_OFFSET 6
723 #define PTP_V2_CORRECTION_OFFSET 8
724 #define PTP_V2_CORRECTIONNS_OFFSET 8
725 #define PTP_V2_CORRECTIONSUBNS_OFFSET 14
726 #define PTP_V2_MESSAGE_TYPE_SPECIFIC_OFFSET 16
727 #define PTP_V2_CLOCKIDENTITY_OFFSET 20
728 #define PTP_V2_SOURCEPORTID_OFFSET 28
729 #define PTP_V2_SEQUENCEID_OFFSET 30
730 #define PTP_V2_CONTROLFIELD_OFFSET 32
731 #define PTP_V2_LOGMESSAGEPERIOD_OFFSET 33
734 /* Offsets for PTP_Announce (=AN) messages */
735 #define PTP_V2_AN_ORIGINTIMESTAMP_OFFSET 34
736 #define PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET 34
737 #define PTP_V2_AN_ORIGINTIMESTAMPNANOSECONDS_OFFSET 40
738 #define PTP_V2_AN_ORIGINCURRENTUTCOFFSET_OFFSET 44
739 #define PTP_V2_AN_PRIORITY_1_OFFSET 47
740 #define PTP_V2_AN_GRANDMASTERCLOCKCLASS_OFFSET 48
741 #define PTP_V2_AN_GRANDMASTERCLOCKACCURACY_OFFSET 49
742 #define PTP_V2_AN_GRANDMASTERCLOCKVARIANCE_OFFSET 50
743 #define PTP_V2_AN_PRIORITY_2_OFFSET 52
744 #define PTP_V2_AN_GRANDMASTERCLOCKIDENTITY_OFFSET 53
745 #define PTP_V2_AN_LOCALSTEPSREMOVED_OFFSET 61
746 #define PTP_V2_AN_TIMESOURCE_OFFSET 63
747 #define PTP_V2_AN_TLV_OFFSET 64 /* TLV only used if message length is > 64 bytes */
749 /* Announce TLV field offsets */
750 #define PTP_V2_AN_TLV_TYPE_OFFSET 0
751 #define PTP_V2_AN_TLV_LENGTHFIELD_OFFSET 2
753 /* PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION field offsets */
754 #define PTP_V2_AN_TLV_OE_ORGANIZATIONID_OFFSET 4
755 #define PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET 7
756 #define PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET 10
758 /* PTPv2 White Rabbit TLV (organization extension subtype) field offsets */
759 #define PTP_V2_AN_TLV_OE_WRTLV_MESSAGEID_OFFSET 10
760 #define PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET 12
762 /* PTPv2 IEEE_C37_238 TLV (organization extension subtype) field offsets */
763 #define PTP_V2_AN_TLV_OE_IEEEC37238TLV_GMID_OFFSET 10
764 #define PTP_V2_AN_TLV_OE_IEEEC37238TLV_GMINACCURACY_OFFSET 12
765 #define PTP_V2_AN_TLV_OE_IEEEC37238TLV_NWINACCURACY_OFFSET 16
766 #define PTP_V2_AN_TLV_OE_IEEEC37238TLV_RESERVED_OFFSET 20
768 /* PTPv2 IEEE_C37_238-2017 TLV additional field offsets */
769 #define PTP_V2_AN_TLV_OE_IEEEC372382017TLV_RESERVED_OFFSET 12
770 #define PTP_V2_AN_TLV_OE_IEEEC37238TLV_TOTALINACCURACY_OFFSET 16
772 /* PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR field offsets */
773 #define PTP_V2_AN_TLV_ATOI_KEYFIELD_OFFSET 4
774 #define PTP_V2_AN_TLV_ATOI_CURRENTOFFSET_OFFSET 5
775 #define PTP_V2_AN_TLV_ATOI_JUMPSECONDS_OFFSET 9
776 #define PTP_V2_AN_TLV_ATOI_TIMEOFNEXTJUMP_OFFSET 13
777 #define PTP_V2_AN_TLV_ATOI_DISPLAYNAME_OFFSET 19
779 /* Undissected TLV field offset */
780 #define PTP_V2_AN_TLV_DATA_OFFSET 4
782 /* 802.1AS Path Sequence Offset */
783 #define PTP_AS_AN_TLV_PATH_TRACE_OFFSET 4
785 /* Offsets for PTP_Sync AND PTP_DelayRequest (=SDR) messages */
786 #define PTP_V2_SDR_ORIGINTIMESTAMP_OFFSET 34
787 #define PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET 34
788 #define PTP_V2_SDR_ORIGINTIMESTAMPNANOSECONDS_OFFSET 40
790 /* Offsets for PTP_Follow_Up (=FU) messages */
791 #define PTP_V2_FU_PRECISEORIGINTIMESTAMP_OFFSET 34
792 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET 34
793 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET 40
795 /* 802.1AS Follow_Up information TLV */
796 #define PTP_AS_FU_TLV_INFORMATION_OFFSET 44
798 /* 802.1AS Follow_Up TLV field offsets */
799 #define PTP_AS_FU_TLV_TYPE_OFFSET 0
800 #define PTP_AS_FU_TLV_LENGTHFIELD_OFFSET 2
801 #define PTP_AS_FU_TLV_ORGANIZATIONID_OFFSET 4
802 #define PTP_AS_FU_TLV_ORGANIZATIONSUBTYPE_OFFSET 7
803 #define PTP_AS_FU_TLV_CUMULATIVESCALEDRATEOFFSET_OFFSET 10
804 #define PTP_AS_FU_TLV_GMTIMEBASEINDICATOR_OFFSET 14
805 #define PTP_AS_FU_TLV_LASTGMPHASECHANGE_OFFSET 16
806 #define PTP_AS_FU_TLV_SCALEDLASTGMFREQCHANGE_OFFSET 28
808 /* Offsets for PTP_DelayResponse (=DR) messages */
809 #define PTP_V2_DR_RECEIVETIMESTAMP_OFFSET 34
810 #define PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET 34
811 #define PTP_V2_DR_RECEIVETIMESTAMPNANOSECONDS_OFFSET 40
812 #define PTP_V2_DR_REQUESTINGPORTIDENTITY_OFFSET 44
813 #define PTP_V2_DR_REQUESTINGSOURCEPORTID_OFFSET 52
815 /* Offsets for PTP_PDelayRequest (=PDRQ) messages */
816 #define PTP_V2_PDRQ_ORIGINTIMESTAMP_OFFSET 34
817 #define PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET 34
818 #define PTP_V2_PDRQ_ORIGINTIMESTAMPNANOSECONDS_OFFSET 40
819 #define PTP_V2_PDRQ_RESERVED_OFFSET 44
821 /* Offsets for PTP_PDelayResponse (=PDRS) messages */
822 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMP_OFFSET 34
823 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET 34
824 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET 40
825 #define PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET 44 /* ++ */
826 #define PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET 52 /* ++ */
829 /* Offsets for PTP_PDelayResponseFollowUp (=PDFU) messages */
830 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMP_OFFSET 34
831 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET 34
832 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET 40
833 #define PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET 44 /* ++ */
834 #define PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET 52
837 /* Offsets for PTP_Signalling (=SIG) messages */
838 #define PTP_V2_SIG_TARGETPORTIDENTITY_OFFSET 34
839 #define PTP_V2_SIG_TARGETPORTID_OFFSET 42
840 #define PTP_V2_SIG_TLV_START 44
842 /* Offset for PTP Signaling messages (relative to tlvOffset!) */
843 #define PTP_V2_SIG_TLV_TYPE_OFFSET 0
844 #define PTP_V2_SIG_TLV_LENGTH_OFFSET 2
845 #define PTP_V2_SIG_TLV_VALUE_OFFSET 4
846 #define PTP_V2_SIG_TLV_MESSAGE_TYPE_OFFSET 4
847 #define PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET 5
848 #define PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET 6
849 #define PTP_V2_SIG_TLV_RENEWAL_INVITED_OFFSET 11
851 #define PTP_V2_SIG_TLV_TYPE_LEN 2
852 #define PTP_V2_SIG_TLV_LENGTH_LEN 2
853 #define PTP_V2_SIG_TLV_MESSAGE_TYPE_LEN 1
854 #define PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN 1
855 #define PTP_V2_SIG_TLV_DURATION_FIELD_LEN 4
856 #define PTP_V2_SIG_TLV_RENEWAL_INVITED_LEN 1
858 /* PTPv2.1 L1 SYNC flags field length */
859 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS_BASIC_FORMAT 2
860 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS_EXT_FORMAT 3
862 /* PTPv2.1 L1 SYNC field offsets */
863 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET 4
864 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS1_OFFSET 4
865 #define PTP_V2_SIG_TLV_L1SYNC_FLAGS2_OFFSET 5
866 #define PTP_V2_SIG_TLV_L1SYNCEXT_FLAGS3_OFFSET 6
867 #define PTP_V2_SIG_TLV_L1SYNCEXT_PHASE_OFFSET_TX_OFFSET 7
868 #define PTP_V2_SIG_TLV_L1SYNCEXT_PHASE_OFFSET_TX_TIMESTAMP_OFFSET 15
869 #define PTP_V2_SIG_TLV_L1SYNCEXT_FREQ_OFFSET_TX_OFFSET 25
870 #define PTP_V2_SIG_TLV_L1SYNCEXT_FREQ_OFFSET_TX_TIMESTAMP_OFFSET 33
872 /* PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION field offsets */
873 #define PTP_V2_SIG_TLV_ORGANIZATIONID_OFFSET 4
874 #define PTP_V2_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET 7
875 #define PTP_V2_SIG_TLV_DATAFIELD_OFFSET 10
877 /* PTPv2 White Rabbit (WR) TLV (organization extension subtype) field offsets */
878 #define PTP_V2_SIG_TLV_WRTLV_MESSAGEID_OFFSET 10
880 #define PTP_V2_SIG_TLV_WRTLV_CALSENDPATTERN_OFFSET 12
881 #define PTP_V2_SIG_TLV_WRTLV_CALRETRY_OFFSET 13
882 #define PTP_V2_SIG_TLV_WRTLV_CALPERIOD_OFFSET 14
884 #define PTP_V2_SIG_TLV_WRTLV_DELTATX_OFFSET 12
885 #define PTP_V2_SIG_TLV_WRTLV_DELTARX_OFFSET 20
887 /* 802.1AS Signalling Message Interval Request TLV */
888 #define PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET 44
890 /* 802.1AS Signalling TLV field offsets */
891 #define PTP_AS_SIG_TLV_TYPE_OFFSET 0
892 #define PTP_AS_SIG_TLV_LENGTHFIELD_OFFSET 2
893 #define PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET 4
894 #define PTP_AS_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET 7
896 #define PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_LINKDELAYINTERVAL_OFFSET 10
897 #define PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_TIMESYNCINTERVAL_OFFSET 11
898 #define PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_ANNOUNCEINTERVAL_OFFSET 12
899 #define PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_FLAGS_OFFSET 13
901 #define PTP_AS_SIG_TLV_GPTPCAPABLE_MESSAGEINTERVAL_OFFSET 10
902 #define PTP_AS_SIG_TLV_GPTPCAPABLE_FLAGS_OFFSET 11
904 #define PTP_AS_SIG_TLV_TYPE_MESSAGEINTERVALREQUEST 0x0003
905 #define PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE 0x8000
907 /*Defined in 10.6.4.4.5*/
908 #define PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_ORG_SUB_TYPE 4
909 /*Defined in 10.6.4.5.5*/
910 #define PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_MESSSAGEINTERVAL_ORG_SUB_TYPE 5
912 /**********************************************************/
913 /* Message Interval Request flag-field-mask-definitions */
914 /**********************************************************/
915 #define PTP_AS_FLAGS_COMP_NEIGHBOR_RATE_RATIO_BITMASK 0x02
916 #define PTP_AS_FLAGS_COMP_MEAN_LINK_DELAY_BITMASK 0x04
917 #define PTP_AS_FLAGS_ONE_STEP_RECEIVE_CAPABLE 0x08
919 /* Offsets for PTP_V2_Management (=MM) messages */
920 #define PTP_V2_MM_TARGETPORTIDENTITY_OFFSET 34
921 #define PTP_V2_MM_TARGETPORTID_OFFSET 42
922 #define PTP_V2_MM_STARTINGBOUNDARYHOPS_OFFSET 44
923 #define PTP_V2_MM_BOUNDARYHOPS_OFFSET 45
924 #define PTP_V2_MM_ACTION_OFFSET 46
925 #define PTP_V2_MM_RESERVED_OFFSET 47
927 #define PTP_V2_MM_MANAGEMENTTLV_OFFSET 48
928 /* Management TLV */
929 #define PTP_V2_MM_TLV_TYPE_OFFSET 48
930 #define PTP_V2_MM_TLV_LENGTHFIELD_OFFSET 50
931 #define PTP_V2_MM_TLV_MANAGEMENTID_OFFSET 52
932 #define PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET 52
933 #define PTP_V2_MM_TLV_DATAFIELD_OFFSET 54
935 /* TLV Types */
936 #define PTP_V2_TLV_TYPE_RESERVED 0x0000
937 #define PTP_V2_TLV_TYPE_MANAGEMENT 0x0001
938 #define PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS 0x0002
939 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION 0x0003
940 #define PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION 0x0004
941 #define PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION 0x0005
942 #define PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION 0x0006
943 #define PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION 0x0007
944 #define PTP_V2_TLV_TYPE_PATH_TRACE 0x0008
945 #define PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR 0x0009
946 #define PTP_V2_TLV_TYPE_AUTHENTICATION 0x2000
947 #define PTP_V2_TLV_TYPE_AUTHENTICATION_CHALLENGE 0x2001
948 #define PTP_V2_TLV_TYPE_SECURITY_ASSOCIATION_UPDATE 0x2002
949 #define PTP_V2_TLV_TYPE_CUM_FREQ_SCALE_FACTOR_OFFSET 0x2003
950 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_PROPAGATE 0x4000
951 #define PTP_V2_TLV_TYPE_ENHANCED_ACCURACY_METRICS 0x4001
952 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE 0x8000
953 #define PTP_V2_TLV_TYPE_L1_SYNC 0x8001
954 #define PTP_V2_TLV_TYPE_PORT_COMMUNICATION_AVAILABILITY 0x8002
955 #define PTP_V2_TLV_TYPE_PROTOCOL_ADDRESS 0x8003
956 #define PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_TIMING_DATA 0x8004
957 #define PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_COMPUTED_DATA 0x8005
958 #define PTP_V2_TLV_TYPE_SLAVE_TX_EVENT_TIMESTAMPS 0x8006
959 #define PTP_V2_TLV_TYPE_CUMULATIVE_RATE_RATIO 0x8007
960 #define PTP_V2_TLV_TYPE_PAD 0x8008
961 #define PTP_V2_TLV_TYPE_AUTHENTICATION2 0x8009
963 /* Signalling TLV Object IDs */
964 #define PTP_AS_TLV_OID_TYPE_802 0x0080C2
966 /* PTPv2 Management clockType Boolean[16] Bits mask */
967 #define CLOCKTYPE_ORDINARY_CLOCK 0x8000
968 #define CLOCKTYPE_BOUNDARY_CLOCK 0x4000
969 #define CLOCKTYPE_P2P_TC 0x2000
970 #define CLOCKTYPE_E2E_TC 0x1000
971 #define CLOCKTYPE_MANAGEMENT_NODE 0x0800
972 #define CLOCKTYPE_RESERVED 0x07FF
974 /* PTPv2 Management IDs */
975 #define PTP_V2_MM_ID_NULL_MANAGEMENT 0x0000
976 #define PTP_V2_MM_ID_CLOCK_DESCRIPTION 0x0001
977 #define PTP_V2_MM_ID_USER_DESCRIPTION 0x0002
978 #define PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE 0x0003
979 #define PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE 0x0004
980 #define PTP_V2_MM_ID_INITIALIZE 0x0005
981 #define PTP_V2_MM_ID_FAULT_LOG 0x0006
982 #define PTP_V2_MM_ID_FAULT_LOG_RESET 0x0007
983 #define PTP_V2_MM_ID_DEFAULT_DATA_SET 0x2000
984 #define PTP_V2_MM_ID_CURRENT_DATA_SET 0x2001
985 #define PTP_V2_MM_ID_PARENT_DATA_SET 0x2002
986 #define PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET 0x2003
987 #define PTP_V2_MM_ID_PORT_DATA_SET 0x2004
988 #define PTP_V2_MM_ID_PRIORITY1 0x2005
989 #define PTP_V2_MM_ID_PRIORITY2 0x2006
990 #define PTP_V2_MM_ID_DOMAIN 0x2007
991 #define PTP_V2_MM_ID_SLAVE_ONLY 0x2008
992 #define PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL 0x2009
993 #define PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT 0x200A
994 #define PTP_V2_MM_ID_LOG_SYNC_INTERVAL 0x200B
995 #define PTP_V2_MM_ID_VERSION_NUMBER 0x200C
996 #define PTP_V2_MM_ID_ENABLE_PORT 0x200D
997 #define PTP_V2_MM_ID_DISABLE_PORT 0x200E
998 #define PTP_V2_MM_ID_TIME 0x200F
999 #define PTP_V2_MM_ID_CLOCK_ACCURACY 0x2010
1000 #define PTP_V2_MM_ID_UTC_PROPERTIES 0x2011
1001 #define PTP_V2_MM_ID_TRACEABILITY_PROPERTIES 0x2012
1002 #define PTP_V2_MM_ID_TIMESCALE_PROPERTIES 0x2013
1003 #define PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE 0x2014
1004 #define PTP_V2_MM_ID_PATH_TRACE_LIST 0x2015
1005 #define PTP_V2_MM_ID_PATH_TRACE_ENABLE 0x2016
1006 #define PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE 0x2017
1007 #define PTP_V2_MM_ID_UNICAST_MASTER_TABLE 0x2018
1008 #define PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE 0x2019
1009 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE 0x201A
1010 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED 0x201B
1011 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE 0x201C
1012 #define PTP_V2_MM_ID_ALTERNATE_MASTER 0x201D
1013 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE 0x201E
1014 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME 0x201F
1015 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY 0x2020
1016 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES 0x2021
1017 #define PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED 0x3001
1018 #define PTP_V2_MM_ID_MASTER_ONLY 0x3002
1019 #define PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE 0x3003
1020 #define PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET 0x3004
1021 #define PTP_V2_MM_ID_TC_DEFAULT_DATA_SET 0x4000
1022 #define PTP_V2_MM_ID_TC_PORT_DATA_SET 0x4001
1023 #define PTP_V2_MM_ID_PRIMARY_DOMAIN 0x4002
1024 #define PTP_V2_MM_ID_DELAY_MECHANISM 0x6000
1025 #define PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
1027 /* Management DataField for DefaultDS */
1028 #define PTP_V2_MM_RESERVED1 PTP_V2_MM_TLV_DATAFIELD_OFFSET + 1
1029 #define PTP_V2_MM_NUMBERPORTS PTP_V2_MM_TLV_DATAFIELD_OFFSET + 2
1030 #define PTP_V2_MM_PRIORITY1 PTP_V2_MM_TLV_DATAFIELD_OFFSET + 4
1031 #define PTP_V2_MM_CLOCKQUALITY PTP_V2_MM_TLV_DATAFIELD_OFFSET + 5
1032 #define PTP_V2_MM_PRIORITY2 PTP_V2_MM_TLV_DATAFIELD_OFFSET + 9
1033 #define PTP_V2_MM_CLOCKIDENTITY PTP_V2_MM_TLV_DATAFIELD_OFFSET + 10
1034 #define PTP_V2_MM_DOMAINNUMBER PTP_V2_MM_TLV_DATAFIELD_OFFSET + 18
1035 #define PTP_V2_MM_RESERVED2 PTP_V2_MM_TLV_DATAFIELD_OFFSET + 19
1037 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNC_FLAGS1_OFFSET */
1038 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK 0x1 << 8
1039 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK 0x2 << 8
1040 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK 0x4 << 8
1041 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK 0x8 << 8
1042 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RESERVED_BITMASK 0xF0 << 8
1044 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNC_FLAGS2_OFFSET */
1045 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK 0x1
1046 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK 0x2
1047 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK 0x4
1048 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_BITMASK 0xF8
1050 /* Bitmasks for PTP_V2_SIG_TLV_L1SYNCEXT_FLAGS3_OFFSET */
1051 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_TCT_BITMASK 0x1
1052 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_POV_BITMASK 0x2
1053 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_FOV_BITMASK 0x4
1054 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_BITMASK 0xF8
1056 /* Bitmasks for reserved values for standard and extended versions of L1_SYNC frames */
1057 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK \
1058 (PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RESERVED_BITMASK \
1059 | PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_BITMASK)
1060 #define PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_ALL_BITMASK \
1061 (PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK << 8 \
1062 | PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_BITMASK)
1065 /* Subtypes for the OUI_IEEE_C37_238 organization ID */
1066 #define PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C37238TLV 1 /* Defined in IEEE Std C37.238-2011 */
1067 #define PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV 2 /* Defined in IEEE Std C37.238-2017 */
1069 /* Subtypes for the PTP_V2_OE_ORG_ID_SMPTE organization ID */
1070 #define PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV 1
1072 /* Subtypes for the OUI_CERN organization ID */
1073 #define PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV 0xdead01
1075 /* Subtypes for ITU-T organization ID */
1076 #define PTP_V2_INTERFACE_RATE_TLV 0x000002
1078 /* MESSAGE ID for the PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV */
1079 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_NULL_WR_TLV 0x0000
1080 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_SLAVE_PRESENT 0x1000
1081 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCK 0x1001
1082 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCKED 0x1002
1083 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE 0x1003
1084 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED 0x1004
1085 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_WR_MODE_ON 0x1005
1086 #define PTP_V2_OE_ORG_CERN_WRMESSAGEID_ANN_SUFIX 0x2000
1088 /* Bitmasks for PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET */
1089 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK 0x3
1090 #define PTP_V2_TLV_OE_CERN_WRFLAGS_CALIBRATED_BITMASK 0x4
1091 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRMODEON_BITMASK 0x8
1093 /* Values for PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK */
1094 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_NON_WR 0
1095 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_ONLY 1
1096 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_S_ONLY 2
1097 #define PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_AND_S 3
1099 #define PTP_V2_MAJORSDOID_ASPACKET_BITMASK 0x10
1102 /**********************************************************/
1103 /* flag-field-mask-definitions */
1104 /**********************************************************/
1105 #define PTP_V2_FLAGS_LI61_BITMASK 0x0001
1106 #define PTP_V2_FLAGS_LI59_BITMASK 0x0002
1107 #define PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK 0x0004
1108 #define PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK 0x0008
1109 #define PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK 0x0010
1110 #define PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK 0x0020
1111 #define PTP_V2_FLAGS_SYNCHRONIZATION_UNCERTAIN_BITMASK 0x0040
1112 #define PTP_V2_FLAGS_ALTERNATE_BITMASK 0x0100
1113 #define PTP_V2_FLAGS_TWO_STEP_BITMASK 0x0200
1114 #define PTP_V2_FLAGS_UNICAST_BITMASK 0x0400
1115 #define PTP_V2_FLAGS_SPECIFIC1_BITMASK 0x2000
1116 #define PTP_V2_FLAGS_SPECIFIC2_BITMASK 0x4000
1117 #define PTP_V2_FLAGS_SECURITY_BITMASK 0x8000
1119 #define PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_DROP 0x01
1120 #define PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_COLOR 0x02
1122 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_CURRENT 0x01
1123 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_NEXT 0x02
1124 #define PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_PREVIOUS 0x04
1126 #define PTP_V2_FLAGS_OE_SMPTE_LEAP_SECOND_JUMP_CHANGE 0x01
1128 /**********************************************************/
1129 /* PTP v2 message ids (ptp messageid field) */
1130 /**********************************************************/
1131 #define PTP_V2_SYNC_MESSAGE 0x00
1132 #define PTP_V2_DELAY_REQ_MESSAGE 0x01
1133 #define PTP_V2_PEER_DELAY_REQ_MESSAGE 0x02
1134 #define PTP_V2_PEER_DELAY_RESP_MESSAGE 0x03
1135 #define PTP_V2_FOLLOWUP_MESSAGE 0x08
1136 #define PTP_V2_DELAY_RESP_MESSAGE 0x09
1137 #define PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE 0x0A
1138 #define PTP_V2_ANNOUNCE_MESSAGE 0x0B
1139 #define PTP_V2_SIGNALLING_MESSAGE 0x0C
1140 #define PTP_V2_MANAGEMENT_MESSAGE 0x0D
1144 static const value_string ptp_v2_managementID_vals[] = {
1145 {PTP_V2_MM_ID_NULL_MANAGEMENT ,"NULL_MANAGEMENT"},
1146 {PTP_V2_MM_ID_CLOCK_DESCRIPTION ,"CLOCK_DESCRIPTION"},
1147 {PTP_V2_MM_ID_USER_DESCRIPTION ,"USER_DESCRIPTION"},
1148 {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE ,"SAVE_IN_NON_VOLATILE_STORAGE"},
1149 {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE ,"RESET_NON_VOLATILE_STORAGE"},
1150 {PTP_V2_MM_ID_INITIALIZE ,"INITIALIZE"},
1151 {PTP_V2_MM_ID_FAULT_LOG ,"FAULT_LOG"},
1152 {PTP_V2_MM_ID_FAULT_LOG_RESET ,"FAULT_LOG_RESET"},
1153 {PTP_V2_MM_ID_DEFAULT_DATA_SET ,"DEFAULT_DATA_SET"},
1154 {PTP_V2_MM_ID_CURRENT_DATA_SET ,"CURRENT_DATA_SET"},
1155 {PTP_V2_MM_ID_PARENT_DATA_SET ,"PARENT_DATA_SET"},
1156 {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET ,"TIME_PROPERTIES_DATA_SET"},
1157 {PTP_V2_MM_ID_PORT_DATA_SET ,"PORT_DATA_SET"},
1158 {PTP_V2_MM_ID_PRIORITY1 ,"PRIORITY1"},
1159 {PTP_V2_MM_ID_PRIORITY2 ,"PRIORITY2"},
1160 {PTP_V2_MM_ID_DOMAIN ,"DOMAIN"},
1161 {PTP_V2_MM_ID_SLAVE_ONLY ,"SLAVE_ONLY"},
1162 {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL ,"LOG_ANNOUNCE_INTERVAL"},
1163 {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT ,"ANNOUNCE_RECEIPT_TIMEOUT"},
1164 {PTP_V2_MM_ID_LOG_SYNC_INTERVAL ,"LOG_SYNC_INTERVAL"},
1165 {PTP_V2_MM_ID_VERSION_NUMBER ,"VERSION_NUMBER"},
1166 {PTP_V2_MM_ID_ENABLE_PORT ,"ENABLE_PORT"},
1167 {PTP_V2_MM_ID_DISABLE_PORT ,"DISABLE_PORT"},
1168 {PTP_V2_MM_ID_TIME ,"TIME"},
1169 {PTP_V2_MM_ID_CLOCK_ACCURACY ,"CLOCK_ACCURACY"},
1170 {PTP_V2_MM_ID_UTC_PROPERTIES ,"UTC_PROPERTIES"},
1171 {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES ,"TRACEABILITY_PROPERTIES"},
1172 {PTP_V2_MM_ID_TIMESCALE_PROPERTIES ,"TIMESCALE_PROPERTIES"},
1173 {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE ,"UNICAST_NEGOTIATION_ENABLE"},
1174 {PTP_V2_MM_ID_PATH_TRACE_LIST ,"PATH_TRACE_LIST"},
1175 {PTP_V2_MM_ID_PATH_TRACE_ENABLE ,"PATH_TRACE_ENABLE"},
1176 {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE ,"GRANDMASTER_CLUSTER_TABLE"},
1177 {PTP_V2_MM_ID_UNICAST_MASTER_TABLE ,"UNICAST_MASTER_TABLE"},
1178 {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE ,"UNICAST_MASTER_MAX_TABLE_SIZE"},
1179 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE ,"ACCEPTABLE_MASTER_TABLE"},
1180 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED ,"ACCEPTABLE_MASTER_TABLE_ENABLED"},
1181 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE ,"ACCEPTABLE_MASTER_MAX_TABLE_SIZE"},
1182 {PTP_V2_MM_ID_ALTERNATE_MASTER ,"ALTERNATE_MASTER"},
1183 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE ,"ALTERNATE_TIME_OFFSET_ENABLE"},
1184 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME ,"ALTERNATE_TIME_OFFSET_NAME"},
1185 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY ,"ALTERNATE_TIME_OFFSET_MAX_KEY"},
1186 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES ,"ALTERNATE_TIME_OFFSET_PROPERTIES"},
1187 {PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED,"EXTERNAL_PORT_CONFIGURATION_ENABLED"},
1188 {PTP_V2_MM_ID_MASTER_ONLY ,"MASTER_ONLY"},
1189 {PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE ,"HOLDOVER_UPGRADE_ENABLE"},
1190 {PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET ,"EXT_PORT_CONFIG_PORT_DATA_SET"},
1191 {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET ,"TC_DEFAULT_DATA_SET"},
1192 {PTP_V2_MM_ID_TC_PORT_DATA_SET ,"TC_PORT_DATA_SET"},
1193 {PTP_V2_MM_ID_PRIMARY_DOMAIN ,"PRIMARY_DOMAIN"},
1194 {PTP_V2_MM_ID_DELAY_MECHANISM ,"DELAY_MECHANISM"},
1195 {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL ,"LOG_MIN_PDELAY_REQ_INTERVAL"},
1196 {0 ,NULL}
1198 static value_string_ext ptp_v2_managementID_vals_ext =
1199 VALUE_STRING_EXT_INIT(ptp_v2_managementID_vals);
1201 /* same again but better readable text for info column */
1202 static const value_string ptp_v2_managementID_infocolumn_vals[] = {
1203 {PTP_V2_MM_ID_NULL_MANAGEMENT ,"Null management"},
1204 {PTP_V2_MM_ID_CLOCK_DESCRIPTION ,"Clock description"},
1205 {PTP_V2_MM_ID_USER_DESCRIPTION ,"User description"},
1206 {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE ,"Save in non volatile storage"},
1207 {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE ,"Reset non volatile storage"},
1208 {PTP_V2_MM_ID_INITIALIZE ,"Initialize"},
1209 {PTP_V2_MM_ID_FAULT_LOG ,"Fault log"},
1210 {PTP_V2_MM_ID_FAULT_LOG_RESET ,"Fault log reset"},
1211 {PTP_V2_MM_ID_DEFAULT_DATA_SET ,"Default dataset"},
1212 {PTP_V2_MM_ID_CURRENT_DATA_SET ,"Current dataset"},
1213 {PTP_V2_MM_ID_PARENT_DATA_SET ,"Parent dataset"},
1214 {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET ,"Time properties dataset"},
1215 {PTP_V2_MM_ID_PORT_DATA_SET ,"Port dataset"},
1216 {PTP_V2_MM_ID_PRIORITY1 ,"Priority 1"},
1217 {PTP_V2_MM_ID_PRIORITY2 ,"Priority 2"},
1218 {PTP_V2_MM_ID_DOMAIN ,"Domain"},
1219 {PTP_V2_MM_ID_SLAVE_ONLY ,"Slave only"},
1220 {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL ,"Log announce interval"},
1221 {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT ,"Announce receipt timeout"},
1222 {PTP_V2_MM_ID_LOG_SYNC_INTERVAL ,"Log sync interval"},
1223 {PTP_V2_MM_ID_VERSION_NUMBER ,"Version number"},
1224 {PTP_V2_MM_ID_ENABLE_PORT ,"Enable port"},
1225 {PTP_V2_MM_ID_DISABLE_PORT ,"Disable port"},
1226 {PTP_V2_MM_ID_TIME ,"Time"},
1227 {PTP_V2_MM_ID_CLOCK_ACCURACY ,"Clock accuracy"},
1228 {PTP_V2_MM_ID_UTC_PROPERTIES ,"UTC properties"},
1229 {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES ,"Traceability properties"},
1230 {PTP_V2_MM_ID_TIMESCALE_PROPERTIES ,"Timescale properties"},
1231 {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE ,"Unicast negotiation enable"},
1232 {PTP_V2_MM_ID_PATH_TRACE_LIST ,"Path trace list"},
1233 {PTP_V2_MM_ID_PATH_TRACE_ENABLE ,"Path trace enable"},
1234 {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE ,"Grandmaster cluster table"},
1235 {PTP_V2_MM_ID_UNICAST_MASTER_TABLE ,"Unicast master table"},
1236 {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE ,"Unicast master max table size"},
1237 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE ,"Acceptable master table"},
1238 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED ,"Acceptable master table enabled"},
1239 {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE ,"Acceptable master max table size"},
1240 {PTP_V2_MM_ID_ALTERNATE_MASTER ,"Alternate master"},
1241 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE ,"Alternate time offset enable"},
1242 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME ,"Alternate time offset name"},
1243 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY ,"Alternate time offset max key"},
1244 {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES ,"Alternate time offset properties"},
1245 {PTP_V2_MM_ID_EXTERNAL_PORT_CONFIGURATION_ENABLED,"External port configuration enabled"},
1246 {PTP_V2_MM_ID_MASTER_ONLY ,"Master only"},
1247 {PTP_V2_MM_ID_HOLDOVER_UPGRADE_ENABLE ,"Holdover upgrade enable"},
1248 {PTP_V2_MM_ID_EXT_PORT_CONFIG_PORT_DATA_SET ,"External port config port data set"},
1249 {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET ,"Transparent clock default dataset"},
1250 {PTP_V2_MM_ID_TC_PORT_DATA_SET ,"Transparent clock port dataset"},
1251 {PTP_V2_MM_ID_PRIMARY_DOMAIN ,"Primary domain"},
1252 {PTP_V2_MM_ID_DELAY_MECHANISM ,"Delay mechanism"},
1253 {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL ,"Log min pdelay req. interval"},
1254 {0 , NULL}
1256 static value_string_ext ptp_v2_managementID_infocolumn_vals_ext =
1257 VALUE_STRING_EXT_INIT(ptp_v2_managementID_infocolumn_vals);
1259 static const value_string ptp_v2_TLV_type_vals[] = {
1260 {PTP_V2_TLV_TYPE_RESERVED ,"Reserved"},
1261 {PTP_V2_TLV_TYPE_MANAGEMENT ,"Management"},
1262 {PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS ,"Management error status"},
1263 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION ,"Organization extension"},
1264 {PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION ,"Request unicast transmission"},
1265 {PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION ,"Grant unicast transmission"},
1266 {PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION ,"Cancel unicast transmission"},
1267 {PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION ,"Acknowledge cancel unicast transmission"},
1268 {PTP_V2_TLV_TYPE_PATH_TRACE ,"Path trace"},
1269 {PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR,"Alternate time offset indicator"},
1270 {PTP_V2_TLV_TYPE_AUTHENTICATION ,"Authentication"},
1271 {PTP_V2_TLV_TYPE_AUTHENTICATION_CHALLENGE ,"Authentication challenge"},
1272 {PTP_V2_TLV_TYPE_SECURITY_ASSOCIATION_UPDATE ,"Security association update"},
1273 {PTP_V2_TLV_TYPE_CUM_FREQ_SCALE_FACTOR_OFFSET ,"Cum. freq. scale factor offset"},
1274 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_PROPAGATE,"Organization extension propagate"},
1275 {PTP_V2_TLV_TYPE_ENHANCED_ACCURACY_METRICS ,"Enhanced accuracy metrics"},
1276 {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION_DO_NOT_PROPAGATE, "Organization extension do not propagate"},
1277 {PTP_V2_TLV_TYPE_L1_SYNC ,"L1 sync"},
1278 {PTP_V2_TLV_TYPE_PORT_COMMUNICATION_AVAILABILITY,"Port communication availability"},
1279 {PTP_V2_TLV_TYPE_PROTOCOL_ADDRESS ,"Protocol address"},
1280 {PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_TIMING_DATA ,"Slave rx sync timing data"},
1281 {PTP_V2_TLV_TYPE_SLAVE_RX_SYNC_COMPUTED_DATA ,"Slave rx sync computed data"},
1282 {PTP_V2_TLV_TYPE_SLAVE_TX_EVENT_TIMESTAMPS ,"Slave tx event timestamps"},
1283 {PTP_V2_TLV_TYPE_CUMULATIVE_RATE_RATIO ,"Cumulative rate ratio"},
1284 {PTP_V2_TLV_TYPE_PAD ,"Pad"},
1285 {PTP_V2_TLV_TYPE_AUTHENTICATION2 ,"Authentication"},
1286 {0 , NULL}
1288 static value_string_ext ptp_v2_TLV_type_vals_ext =
1289 VALUE_STRING_EXT_INIT(ptp_v2_TLV_type_vals);
1291 static const value_string ptp_as_TLV_oid_vals[] = {
1292 {PTP_AS_TLV_OID_TYPE_802 ,"IEEE 802"},
1293 {0 , NULL}
1296 static const value_string ptp_v2_networkProtocol_vals[] = {
1297 {0x0000, "Reserved"},
1298 {0x0001, "UDP/IPv4"},
1299 {0x0002, "UDP/IPv6"},
1300 {0x0003, "IEEE 802.3"},
1301 {0x0004, "DeviceNet"},
1302 {0x0005, "ControlNet"},
1303 {0x0006, "PROFINET"},
1304 {0x0007, "Reserved"},
1305 {0xFFFE, "Unknown Protocol"},
1306 {0xFFFF, "Reserved"},
1307 {0, NULL }
1309 static value_string_ext ptp_v2_networkProtocol_vals_ext =
1310 VALUE_STRING_EXT_INIT(ptp_v2_networkProtocol_vals);
1313 static const value_string ptp_v2_messagetype_vals[] = {
1314 {PTP_V2_SYNC_MESSAGE, "Sync Message"},
1315 {PTP_V2_DELAY_REQ_MESSAGE, "Delay_Req Message"},
1316 {PTP_V2_PEER_DELAY_REQ_MESSAGE, "Peer_Delay_Req Message"},
1317 {PTP_V2_PEER_DELAY_RESP_MESSAGE, "Peer_Delay_Resp Message"},
1318 {PTP_V2_FOLLOWUP_MESSAGE, "Follow_Up Message"},
1319 {PTP_V2_DELAY_RESP_MESSAGE, "Delay_Resp Message"},
1320 {PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE,"Peer_Delay_Resp_Follow_Up Message"},
1321 {PTP_V2_ANNOUNCE_MESSAGE, "Announce Message"},
1322 {PTP_V2_SIGNALLING_MESSAGE, "Signalling Message"},
1323 {PTP_V2_MANAGEMENT_MESSAGE, "Management Message"},
1324 {0, NULL }
1326 static value_string_ext ptp_v2_messagetype_vals_ext =
1327 VALUE_STRING_EXT_INIT(ptp_v2_messagetype_vals);
1329 static const value_string ptp_v2_clockAccuracy_vals[] = {
1330 {0x17, "The time is accurate to within 1 ps"},
1331 {0x18, "The time is accurate to within 2,5 ps"},
1332 {0x19, "The time is accurate to within 10 ps"},
1333 {0x1A, "The time is accurate to within 25 ps"},
1334 {0x1B, "The time is accurate to within 100 ps"},
1335 {0x1C, "The time is accurate to within 250 ps"},
1336 {0x1D, "The time is accurate to within 1 ns"},
1337 {0x1E, "The time is accurate to within 2,5 ns"},
1338 {0x1F, "The time is accurate to within 10 ns"},
1339 {0x20, "The time is accurate to within 25 ns"},
1340 {0x21, "The time is accurate to within 100 ns"},
1341 {0x22, "The time is accurate to within 250 ns"},
1342 {0x23, "The time is accurate to within 1 us"},
1343 {0x24, "The time is accurate to within 2,5 us"},
1344 {0x25, "The time is accurate to within 10 us"},
1345 {0x26, "The time is accurate to within 25 us"},
1346 {0x27, "The time is accurate to within 100 us"},
1347 {0x28, "The time is accurate to within 250 us"},
1348 {0x29, "The time is accurate to within 1 ms"},
1349 {0x2A, "The time is accurate to within 2,5 ms"},
1350 {0x2B, "The time is accurate to within 10 ms"},
1351 {0x2C, "The time is accurate to within 25 ms"},
1352 {0x2D, "The time is accurate to within 100 ms"},
1353 {0x2E, "The time is accurate to within 250 ms"},
1354 {0x2F, "The time is accurate to within 1 s"},
1355 {0x30, "The time is accurate to within 10 s"},
1356 {0x31, "The time is accurate to >10 s"},
1357 {0x32, "reserved"},
1358 {0x80, "For use by alternate PTP profiles"},
1359 {0xFE, "Accuracy Unknown"},
1360 {0xFF, "reserved"},
1361 {0, NULL }
1363 /* Exposed in packet-ptp.h */
1364 value_string_ext ptp_v2_clockAccuracy_vals_ext =
1365 VALUE_STRING_EXT_INIT(ptp_v2_clockAccuracy_vals);
1367 static const value_string ptp_v2_timeSource_vals[] = {
1368 {0x10, "ATOMIC_CLOCK"},
1369 {0x20, "GPS"},
1370 {0x30, "TERRESTRIAL_RADIO"},
1371 {0x39, "SERIAL_TIME_CODE"},
1372 {0x40, "PTP"},
1373 {0x50, "NTP"},
1374 {0x60, "HAND_SET"},
1375 {0x90, "OTHER"},
1376 {0xA0, "INTERNAL_OSCILLATOR"},
1377 {0xFF, "reserved"},
1378 {0, NULL }
1380 /* Exposed in packet-ptp.h */
1381 value_string_ext ptp_v2_timeSource_vals_ext =
1382 VALUE_STRING_EXT_INIT(ptp_v2_timeSource_vals);
1384 static const value_string ptp_v2_mm_action_vals[] = {
1385 {0x0, "GET"},
1386 {0x1, "SET"},
1387 {0x2, "RESPONSE"},
1388 {0x3, "COMMAND"},
1389 {0x4, "ACKNOWLEDGE"},
1390 {0, NULL }
1393 static const value_string ptp_v2_severityCode_vals[] = {
1394 {0x00, "Emergency: system is unusable"},
1395 {0x01, "Alert: immediate action needed"},
1396 {0x02, "Critical: critical conditions"},
1397 {0x03, "Error: error conditions"},
1398 {0x04, "Warning: warning conditions"},
1399 {0x05, "Notice: normal but significant condition"},
1400 {0x06, "Informational: informational messages"},
1401 {0x07, "Debug: debug-level messages"},
1402 {0x08, "Reserved"},
1403 {0xFF, "Reserved"},
1404 {0, NULL}
1406 static value_string_ext ptp_v2_severityCode_vals_ext =
1407 VALUE_STRING_EXT_INIT(ptp_v2_severityCode_vals);
1409 static const value_string ptp_v2_portState_vals[] = {
1410 {0x01, "INITIALIZING"},
1411 {0x02, "FAULTY"},
1412 {0x03, "DISABLED"},
1413 {0x04, "LISTENING"},
1414 {0x05, "PRE_MASTER"},
1415 {0x06, "MASTER"},
1416 {0x07, "PASSIVE"},
1417 {0x08, "UNCALIBRATED"},
1418 {0x09, "SLAVE"},
1419 {0, NULL}
1421 /* Exposed in packet-ptp.h */
1422 value_string_ext ptp_v2_portState_vals_ext =
1423 VALUE_STRING_EXT_INIT(ptp_v2_portState_vals);
1425 /* Exposed in packet-ptp.h */
1426 const value_string ptp_v2_delayMechanism_vals[] = {
1427 {0x01, "E2E"},
1428 {0x02, "P2P"},
1429 {0x03, "COMMON_P2P"},
1430 {0x04, "SPECIAL"},
1431 {0xFE, "NO_MECHANISM"},
1432 {0, NULL}
1435 static const value_string ptp_v2_managementErrorId_vals[] = {
1436 {0x0000, "Reserved"},
1437 {0x0001, "RESPONSE_TOO_BIG"},
1438 {0x0002, "NO_SUCH_ID"},
1439 {0x0003, "WRONG_LENGTH"},
1440 {0x0004, "WRONG_VALUE"},
1441 {0x0005, "NOT_SETABLE"},
1442 {0x0006, "NOT_SUPPORTED"},
1443 {0x0007, "Reserved"},
1444 {0xFFFE, "GENERAL_ERROR"},
1445 {0xFFFF, "Reserved"},
1446 {0, NULL}
1448 static value_string_ext ptp_v2_managementErrorId_vals_ext =
1449 VALUE_STRING_EXT_INIT(ptp_v2_managementErrorId_vals);
1451 static const value_string ptp_v2_org_iee_c37_238_subtype_vals[] = {
1452 {PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C37238TLV, "IEEE_C37_238 TLV"},
1453 {0, NULL}
1456 static const value_string ptp_v2_org_iee_c37_238_2017_subtype_vals[] = {
1457 {PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV, "IEEE_C37_238_2017 TLV"},
1458 {0, NULL}
1461 static const value_string ptp_v2_org_smpte_subtype_vals[] = {
1462 {PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV, "Version"},
1463 {0, NULL}
1466 static const value_string ptp_v2_org_cern_subtype_vals[] = {
1467 {PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV, "White Rabbit"},
1468 {0, NULL}
1471 static const value_string ptp_v2_org_itut_subtype_vals[] = {
1472 {PTP_V2_INTERFACE_RATE_TLV, "Interface Rate TLV"},
1473 {0, NULL}
1476 static const value_string ptp_v2_org_cern_wrMessageID_vals[] = {
1477 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_NULL_WR_TLV, "NULL_WR_TLV"},
1478 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_SLAVE_PRESENT,"SLAVE_PRESENT"},
1479 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCK, "LOCK"},
1480 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_LOCKED, "LOCKED"},
1481 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE, "CALIBRATE"},
1482 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED, "CALIBRATED"},
1483 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_WR_MODE_ON, "WR_MODE_ON"},
1484 {PTP_V2_OE_ORG_CERN_WRMESSAGEID_ANN_SUFIX, "ANN_SUFIX"},
1485 {0, NULL}
1488 static const value_string ptp_v2_tlv_oe_cern_wrFlags_wrConfig_vals[] = {
1489 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_NON_WR, "NON WR"},
1490 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_ONLY, "WR_M_ONLY"},
1491 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_S_ONLY, "WR_S_ONLY"},
1492 {PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_WR_M_AND_S, "WR_M_AND_S"},
1493 {0, NULL}
1496 static const value_string ptp_v2_org_smpte_subtype_masterlockingstatus_vals[] = {
1497 {0, "Not in use"},
1498 {1, "Free Run"},
1499 {2, "Cold Locking"},
1500 {3, "Warm Locking"},
1501 {4, "Locked"},
1502 {0, NULL}
1505 /**********************************************************/
1506 /* MajorSdoId values for the PTPv2 */
1507 /**********************************************************/
1508 // 802.1AS 10.6.2.2.1 majorSdoId
1509 static const value_string ptpv2_majorsdoid_vals[] = {
1510 {0x1, "gPTP Domain"},
1511 {0x2, "CMLDS"},
1512 {0, NULL}
1515 /* END PTPv2 MajorSdoId values */
1517 /**********************************************************/
1518 /* Initialize the protocol and registered fields */
1519 /**********************************************************/
1521 static int hf_ptp_v2_majorsdoid;
1522 static int hf_ptp_v2_messagetype;
1523 static int hf_ptp_v2_minorversionptp;
1524 static int hf_ptp_v2_versionptp;
1525 static int hf_ptp_v2_messagelength;
1526 static int hf_ptp_v2_minorsdoid;
1527 static int hf_ptp_v2_domainnumber;
1528 static int hf_ptp_v2_flags;
1529 static int hf_ptp_v2_flags_alternatemaster;
1530 static int hf_ptp_v2_flags_twostep;
1531 static int hf_ptp_v2_flags_unicast;
1532 static int hf_ptp_v2_flags_specific1;
1533 static int hf_ptp_v2_flags_specific2;
1534 static int hf_ptp_v2_flags_security;
1535 static int hf_ptp_v2_flags_li61;
1536 static int hf_ptp_v2_flags_li59;
1537 static int hf_ptp_v2_flags_utcoffsetvalid;
1538 static int hf_ptp_v2_flags_ptptimescale;
1539 static int hf_ptp_v2_flags_timetraceable;
1540 static int hf_ptp_v2_flags_frequencytraceable;
1541 static int hf_ptp_v2_correction;
1542 static int hf_ptp_v2_correctionsubns;
1543 static int hf_ptp_v2_messagetypespecific;
1544 static int hf_ptp_v2_clockidentity;
1545 static int hf_ptp_v2_clockidentity_manuf;
1546 static int hf_ptp_v2_sourceportid;
1547 static int hf_ptp_v2_sequenceid;
1548 static int hf_ptp_v2_controlfield;
1549 static int hf_ptp_v2_controlfield_default;
1550 static int hf_ptp_v2_logmessageperiod;
1551 static int hf_ptp_v2_flags_synchronizationUncertain;
1554 /* Fields for PTP_Announce (=an) messages */
1555 /* static int hf_ptp_v2_an_origintimestamp; */ /* Field for seconds & nanoseconds */
1556 static int hf_ptp_v2_an_origintimestamp_seconds;
1557 static int hf_ptp_v2_an_origintimestamp_nanoseconds;
1558 static int hf_ptp_v2_an_origincurrentutcoffset;
1559 static int hf_ptp_v2_an_timesource;
1560 static int hf_ptp_v2_an_localstepsremoved;
1561 static int hf_ptp_v2_an_grandmasterclockidentity;
1562 static int hf_ptp_v2_an_grandmasterclockclass;
1563 static int hf_ptp_v2_an_grandmasterclockaccuracy;
1564 static int hf_ptp_v2_an_grandmasterclockvariance;
1565 static int hf_ptp_v2_an_priority1;
1566 static int hf_ptp_v2_an_priority2;
1568 /* Fields for PTP_Announce TLVs */
1569 static int hf_ptp_v2_an_tlv_tlvtype;
1570 static int hf_ptp_v2_an_tlv_lengthfield;
1571 /* Fields for the ORGANIZATION_EXTENSION TLV */
1572 static int hf_ptp_v2_oe_tlv_organizationid;
1573 static int hf_ptp_v2_oe_tlv_organizationsubtype;
1574 static int hf_ptp_v2_oe_tlv_2017_organizationsubtype;
1575 static int hf_ptp_v2_oe_tlv_datafield;
1577 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
1578 static int hf_ptp_v2_an_tlv_oe_cern_subtype;
1579 static int hf_ptp_v2_an_tlv_oe_cern_wrMessageID;
1580 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags;
1581 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig;
1582 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated;
1583 static int hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn;
1585 /* Fields for IEEE_C37_238 TLV (OE TLV subtype) */
1586 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid;
1587 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy;
1588 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy;
1589 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved;
1591 /* Additional Fields for IEEE_C37_238-2017 TLV (OE TLV subtype) */
1592 static int hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved;
1593 static int hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy;
1595 /* Fields for SMPTE TLV (OE TLV subtype) */
1596 static int hf_ptp_v2_oe_tlv_smpte_subtype;
1597 static int hf_ptp_v2_oe_tlv_subtype_smpte_data;
1598 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate;
1599 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator;
1600 static int hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator;
1601 static int hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus;
1602 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags;
1603 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop;
1604 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color;
1605 static int hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset;
1606 static int hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds;
1607 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump;
1608 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam;
1609 static int hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam;
1610 static int hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset;
1611 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving;
1612 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current;
1613 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next;
1614 static int hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous;
1615 static int hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump;
1616 static int hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change;
1617 /* Fields for the ALTERNATE_TIME_OFFSET_INDICATOR TLV */
1618 static int hf_ptp_v2_atoi_tlv_keyfield;
1619 static int hf_ptp_v2_atoi_tlv_currentoffset;
1620 static int hf_ptp_v2_atoi_tlv_jumpseconds;
1621 static int hf_ptp_v2_atoi_tlv_timeofnextjump;
1622 static int hf_ptp_v2_atoi_tlv_displayname;
1623 static int hf_ptp_v2_atoi_tlv_displayname_length;
1624 /* Field for the PATH TRACE TLV */
1625 static int hf_ptp_v2_an_tlv_pathsequence;
1627 /* Fields for an undissected TLV */
1628 static int hf_ptp_v2_an_tlv_data;
1630 /* Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages */
1631 /* static int hf_ptp_v2_sdr_origintimestamp; */ /* Field for seconds & nanoseconds */
1632 static int hf_ptp_v2_sdr_origintimestamp_seconds;
1633 static int hf_ptp_v2_sdr_origintimestamp_nanoseconds;
1634 static int hf_ptp_v2_sync_reserved;
1637 /* Fields for PTP_Follow_Up (=fu) messages */
1638 /* static int hf_ptp_v2_fu_preciseorigintimestamp; */ /* Field for seconds & nanoseconds */
1639 static int hf_ptp_v2_fu_preciseorigintimestamp_seconds;
1640 static int hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds;
1641 static int hf_ptp_v2_fu_preciseorigintimestamp_32bit;
1642 /* Fields for the Follow_Up Information TLV */
1643 static int hf_ptp_as_fu_tlv_tlvtype;
1644 static int hf_ptp_as_fu_tlv_lengthfield;
1645 static int hf_ptp_as_fu_tlv_organization_id;
1646 static int hf_ptp_as_fu_tlv_organization_subtype;
1647 static int hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset;
1648 static int hf_ptp_as_fu_tlv_cumulative_rate_ratio; /* Remove scale and offset from above */
1649 static int hf_ptp_as_fu_tlv_gm_base_indicator;
1650 static int hf_ptp_as_fu_tlv_last_gm_phase_change;
1651 static int hf_ptp_as_fu_tlv_scaled_last_gm_freq_change;
1653 /* Fields for PTP_DelayResponse (=dr) messages */
1654 /* static int hf_ptp_v2_dr_receivetimestamp; */ /* Field for seconds & nanoseconds */
1655 static int hf_ptp_v2_dr_receivetimestamp_seconds;
1656 static int hf_ptp_v2_dr_receivetimestamp_nanoseconds;
1657 static int hf_ptp_v2_dr_requestingportidentity;
1658 static int hf_ptp_v2_dr_requestingsourceportid;
1661 /* Fields for PTP_PDelayRequest (=pdrq) messages */
1662 /* static int hf_ptp_v2_pdrq_origintimestamp; */ /* Field for seconds & nanoseconds */
1663 static int hf_ptp_v2_pdrq_origintimestamp_seconds;
1664 static int hf_ptp_v2_pdrq_origintimestamp_nanoseconds;
1667 /* Fields for PTP_PDelayResponse (=pdrs) messages */
1668 /* static int hf_ptp_v2_pdrs_requestreceipttimestamp; */ /* Field for seconds & nanoseconds */
1669 static int hf_ptp_v2_pdrs_requestreceipttimestamp_seconds;
1670 static int hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds;
1671 static int hf_ptp_v2_pdrs_requestingportidentity;
1672 static int hf_ptp_v2_pdrs_requestingsourceportid;
1675 /* Fields for PTP_PDelayResponseFollowUp (=pdfu) messages */
1676 /* static int hf_ptp_v2_pdfu_responseorigintimestamp; */ /* Field for seconds & nanoseconds */
1677 static int hf_ptp_v2_pdfu_responseorigintimestamp_seconds;
1678 static int hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds;
1679 static int hf_ptp_v2_pdfu_requestingportidentity;
1680 static int hf_ptp_v2_pdfu_requestingsourceportid;
1683 /* Fields for PTP_Signalling (=sig) messages */
1684 static int hf_ptp_v2_sig_targetportidentity;
1685 static int hf_ptp_v2_sig_targetportid;
1686 static int hf_ptp_v2_sig_tlv_tlvType;
1687 static int hf_ptp_v2_sig_tlv_lengthField;
1688 static int hf_ptp_v2_sig_tlv_data;
1689 static int hf_ptp_v2_sig_tlv_messageType;
1690 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod;
1691 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod_period;
1692 static int hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate;
1693 static int hf_ptp_v2_sig_tlv_durationField;
1694 static int hf_ptp_v2_sig_tlv_renewalInvited;
1696 /* Fields for the Message Interval Request TLV */
1697 static int hf_ptp_as_sig_tlv_tlvtype;
1698 static int hf_ptp_as_sig_tlv_lengthfield;
1699 static int hf_ptp_as_sig_tlv_organization_id;
1700 static int hf_ptp_as_sig_tlv_organization_subtype;
1701 static int hf_ptp_as_sig_tlv_link_delay_interval;
1702 static int hf_ptp_as_sig_tlv_time_sync_interval;
1703 static int hf_ptp_as_sig_tlv_announce_interval;
1704 static int hf_ptp_as_sig_tlv_flags;
1705 static int hf_ptp_as_sig_tlv_flags_comp_rate_ratio;
1706 static int hf_ptp_as_sig_tlv_flags_comp_mean_link_delay;
1707 static int hf_ptp_as_sig_tlv_flags_one_step_receive_capable;
1708 static int hf_ptp_as_sig_tlv_gptp_capable_message_interval;
1710 /* Fields for L1SYNC TLV */
1711 static int hf_ptp_v2_sig_tlv_flags2;
1712 static int hf_ptp_v2_sig_tlv_flags3;
1713 static int hf_ptp_v2_sig_tlv_l1sync_flags2_reserved;
1714 static int hf_ptp_v2_sig_tlv_l1sync_flags3_reserved;
1715 static int hf_ptp_v2_sig_tlv_l1sync_flags2_tcr;
1716 static int hf_ptp_v2_sig_tlv_l1sync_flags3_tcr;
1717 static int hf_ptp_v2_sig_tlv_l1sync_flags2_rcr;
1718 static int hf_ptp_v2_sig_tlv_l1sync_flags3_rcr;
1719 static int hf_ptp_v2_sig_tlv_l1sync_flags2_cr;
1720 static int hf_ptp_v2_sig_tlv_l1sync_flags3_cr;
1721 static int hf_ptp_v2_sig_tlv_l1sync_flags2_ope;
1722 static int hf_ptp_v2_sig_tlv_l1sync_flags3_ope;
1723 static int hf_ptp_v2_sig_tlv_l1sync_flags2_itc;
1724 static int hf_ptp_v2_sig_tlv_l1sync_flags3_itc;
1725 static int hf_ptp_v2_sig_tlv_l1sync_flags2_irc;
1726 static int hf_ptp_v2_sig_tlv_l1sync_flags3_irc;
1727 static int hf_ptp_v2_sig_tlv_l1sync_flags2_ic;
1728 static int hf_ptp_v2_sig_tlv_l1sync_flags3_ic;
1729 static int hf_ptp_v2_sig_tlv_l1sync_flags3_tct;
1730 static int hf_ptp_v2_sig_tlv_l1sync_flags3_pov;
1731 static int hf_ptp_v2_sig_tlv_l1sync_flags3_fov;
1732 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns;
1733 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns;
1734 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s;
1735 static int hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns;
1736 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns;
1737 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns;
1738 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s;
1739 static int hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns;
1741 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
1742 static int hf_ptp_v2_sig_oe_tlv_cern_subtype;
1743 static int hf_ptp_v2_sig_oe_tlv_cern_wrMessageID;
1745 static int hf_ptp_v2_sig_oe_tlv_cern_calSendPattern;
1746 static int hf_ptp_v2_sig_oe_tlv_cern_calRety;
1747 static int hf_ptp_v2_sig_oe_tlv_cern_calPeriod;
1748 static int hf_ptp_v2_sig_oe_tlv_cern_deltaTx;
1749 static int hf_ptp_v2_sig_oe_tlv_cern_deltaRx;
1751 static int hf_ptp_v2_sig_oe_tlv_itut_subtype;
1752 static int hf_ptp_v2_sig_tlv_interface_bit_period;
1753 static int hf_ptp_v2_sig_tlv_numberbits_before_timestamp;
1754 static int hf_ptp_v2_sig_tlv_numberbits_after_timestamp;
1756 /* Fields for PTP_Management (=mm) messages */
1757 static int hf_ptp_v2_mm_targetportidentity;
1758 static int hf_ptp_v2_mm_targetportid;
1759 static int hf_ptp_v2_mm_startingboundaryhops;
1760 static int hf_ptp_v2_mm_boundaryhops;
1761 static int hf_ptp_v2_mm_action;
1763 /* management TLV */
1764 static int hf_ptp_v2_mm_tlvType;
1765 static int hf_ptp_v2_mm_lengthField;
1766 static int hf_ptp_v2_mm_managementId;
1767 static int hf_ptp_v2_mm_data;
1768 /* Management dataField */
1770 static int hf_ptp_v2_mm_clockType;
1771 static int hf_ptp_v2_mm_clockType_ordinaryClock;
1772 static int hf_ptp_v2_mm_clockType_boundaryClock;
1773 static int hf_ptp_v2_mm_clockType_p2p_transparentClock;
1774 static int hf_ptp_v2_mm_clockType_e2e_transparentClock;
1775 static int hf_ptp_v2_mm_clockType_managementNode;
1776 static int hf_ptp_v2_mm_clockType_reserved;
1777 static int hf_ptp_v2_mm_physicalLayerProtocol;
1778 static int hf_ptp_v2_mm_physicalLayerProtocol_length;
1779 static int hf_ptp_v2_mm_physicalAddressLength;
1780 static int hf_ptp_v2_mm_physicalAddress;
1781 static int hf_ptp_v2_mm_protocolAddress;
1782 static int hf_ptp_v2_mm_protocolAddress_networkProtocol;
1783 static int hf_ptp_v2_mm_protocolAddress_length;
1784 static int hf_ptp_v2_mm_manufacturerIdentity;
1786 static int hf_ptp_v2_mm_reserved;
1787 static int hf_ptp_v2_mm_productDescription;
1788 static int hf_ptp_v2_mm_productDescription_length;
1789 static int hf_ptp_v2_mm_revisionData;
1790 static int hf_ptp_v2_mm_revisionData_length;
1791 static int hf_ptp_v2_mm_userDescription;
1792 static int hf_ptp_v2_mm_userDescription_length;
1793 static int hf_ptp_v2_mm_profileIdentity;
1794 static int hf_ptp_v2_mm_pad;
1796 static int hf_ptp_v2_mm_numberOfFaultRecords;
1797 /* static int hf_ptp_v2_mm_faultRecord; */
1799 static int hf_ptp_v2_mm_initializationKey;
1800 static int hf_ptp_v2_mm_severityCode;
1801 static int hf_ptp_v2_mm_faultRecordLength;
1802 /* static int hf_ptp_v2_mm_faultTime; */
1803 static int hf_ptp_v2_mm_faultTime_s;
1804 static int hf_ptp_v2_mm_faultTime_ns;
1805 static int hf_ptp_v2_mm_faultValue;
1806 static int hf_ptp_v2_mm_faultName;
1807 static int hf_ptp_v2_mm_faultName_length;
1808 static int hf_ptp_v2_mm_faultValue_length;
1809 static int hf_ptp_v2_mm_faultDescription;
1810 static int hf_ptp_v2_mm_faultDescription_length;
1811 static int hf_ptp_v2_mm_currentTime_s;
1812 static int hf_ptp_v2_mm_currentTime_ns;
1813 static int hf_ptp_v2_mm_clockAccuracy;
1814 static int hf_ptp_v2_mm_priority1;
1815 static int hf_ptp_v2_mm_priority2;
1816 static int hf_ptp_v2_mm_dds_SO;
1817 static int hf_ptp_v2_mm_TSC;
1818 static int hf_ptp_v2_mm_numberPorts;
1819 static int hf_ptp_v2_mm_clockclass;
1820 static int hf_ptp_v2_mm_clockaccuracy;
1821 static int hf_ptp_v2_mm_clockvariance;
1822 static int hf_ptp_v2_mm_clockidentity;
1823 static int hf_ptp_v2_mm_domainNumber;
1824 static int hf_ptp_v2_mm_SO;
1825 static int hf_ptp_v2_mm_stepsRemoved;
1826 static int hf_ptp_v2_mm_parentIdentity;
1827 static int hf_ptp_v2_mm_parentPort;
1828 static int hf_ptp_v2_mm_parentStats;
1829 static int hf_ptp_v2_mm_observedParentOffsetScaledLogVariance;
1830 static int hf_ptp_v2_mm_observedParentClockPhaseChangeRate;
1831 static int hf_ptp_v2_mm_grandmasterPriority1;
1832 static int hf_ptp_v2_mm_grandmasterPriority2;
1833 static int hf_ptp_v2_mm_grandmasterclockclass;
1834 static int hf_ptp_v2_mm_grandmasterclockaccuracy;
1835 static int hf_ptp_v2_mm_grandmasterclockvariance;
1836 static int hf_ptp_v2_mm_grandmasterIdentity;
1837 static int hf_ptp_v2_mm_currentUtcOffset;
1838 static int hf_ptp_v2_mm_LI_61;
1839 static int hf_ptp_v2_mm_LI_59;
1840 static int hf_ptp_v2_mm_UTCV;
1841 static int hf_ptp_v2_mm_PTP;
1842 static int hf_ptp_v2_mm_TTRA;
1843 static int hf_ptp_v2_mm_FTRA;
1844 static int hf_ptp_v2_mm_timesource;
1845 static int hf_ptp_v2_mm_offset_ns;
1846 static int hf_ptp_v2_mm_pathDelay_ns;
1847 static int hf_ptp_v2_mm_offset_subns;
1848 static int hf_ptp_v2_mm_pathDelay_subns;
1849 static int hf_ptp_v2_mm_PortNumber;
1850 static int hf_ptp_v2_mm_portState;
1851 static int hf_ptp_v2_mm_logMinDelayReqInterval;
1852 static int hf_ptp_v2_mm_peerMeanPathDelay_ns;
1853 static int hf_ptp_v2_mm_peerMeanPathDelay_subns;
1854 static int hf_ptp_v2_mm_logAnnounceInterval;
1855 static int hf_ptp_v2_mm_announceReceiptTimeout;
1856 static int hf_ptp_v2_mm_logSyncInterval;
1857 static int hf_ptp_v2_mm_delayMechanism;
1858 static int hf_ptp_v2_mm_logMinPdelayReqInterval;
1859 static int hf_ptp_v2_mm_versionNumber;
1860 static int hf_ptp_v2_mm_primaryDomain;
1861 static int hf_ptp_v2_mm_faultyFlag;
1862 static int hf_ptp_v2_mm_managementErrorId;
1863 static int hf_ptp_v2_mm_displayData;
1864 static int hf_ptp_v2_mm_displayData_length;
1865 static int hf_ptp_v2_mm_ucEN;
1866 static int hf_ptp_v2_mm_ptEN;
1867 static int hf_ptp_v2_mm_atEN;
1868 static int hf_ptp_v2_mm_keyField;
1869 static int hf_ptp_v2_mm_displayName;
1870 static int hf_ptp_v2_mm_displayName_length;
1871 static int hf_ptp_v2_mm_maxKey;
1872 static int hf_ptp_v2_mm_currentOffset;
1873 static int hf_ptp_v2_mm_jumpSeconds;
1874 static int hf_ptp_v2_mm_nextjumpSeconds;
1875 static int hf_ptp_v2_mm_logAlternateMulticastSyncInterval;
1876 static int hf_ptp_v2_mm_numberOfAlternateMasters;
1877 static int hf_ptp_v2_mm_transmitAlternateMulticastSync;
1879 /* Fields for analysis code*/
1880 static int hf_ptp_v2_analysis_sync_to_followup;
1881 static int hf_ptp_v2_analysis_followup_to_sync;
1882 static int hf_ptp_v2_analysis_pdelayreq_to_pdelayres;
1883 static int hf_ptp_v2_analysis_pdelayres_to_pdelayreq;
1884 static int hf_ptp_v2_analysis_pdelayres_to_pdelayfup;
1885 static int hf_ptp_v2_analysis_pdelayfup_to_pdelayres;
1886 static int hf_ptp_v2_analysis_sync_timestamp;
1887 static int hf_ptp_v2_analysis_sync_timestamp_seconds;
1888 static int hf_ptp_v2_analysis_sync_timestamp_nanoseconds;
1889 static int hf_ptp_v2_analysis_sync_period;
1890 static int hf_ptp_v2_analysis_sync_rateRatio;
1891 static int hf_ptp_v2_analysis_sync_rateRatio_ppm;
1892 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled;
1893 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled_seconds;
1894 static int hf_ptp_v2_analysis_pdelay_mpd_unscaled_nanoseconds;
1895 static int hf_ptp_v2_analysis_pdelay_mpd_scaled;
1896 static int hf_ptp_v2_analysis_pdelay_period;
1897 static int hf_ptp_v2_analysis_pdelay_neighRateRatio;
1898 static int hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm;
1900 /* Initialize the subtree pointers */
1901 static int ett_ptp_v2;
1902 static int ett_ptp_v2_flags;
1903 static int ett_ptp_v2_clockidentity;
1904 static int ett_ptp_v2_correction;
1905 static int ett_ptp_v2_time;
1906 static int ett_ptp_v2_time2;
1907 static int ett_ptp_v2_managementData;
1908 static int ett_ptp_v2_clockType;
1909 static int ett_ptp_v2_physicalLayerProtocol;
1910 static int ett_ptp_v2_protocolAddress;
1911 static int ett_ptp_v2_faultRecord;
1912 static int ett_ptp_v2_ptptext;
1913 static int ett_ptp_v2_timeInterval;
1914 static int ett_ptp_v2_tlv;
1915 static int ett_ptp_v2_tlv_log_period;
1916 static int ett_ptp_v2_sig_l1sync_flags;
1917 static int ett_ptp_as_sig_tlv_flags;
1918 static int ett_ptp_oe_wr_flags;
1919 static int ett_ptp_oe_smpte_data;
1920 static int ett_ptp_oe_smpte_framerate;
1921 static int ett_ptp_oe_smpte_timeaddress;
1922 static int ett_ptp_oe_smpte_daylightsaving;
1923 static int ett_ptp_oe_smpte_leapsecondjump;
1924 static int ett_ptp_analysis_timestamp;
1925 static int ett_ptp_analysis_mean_propagation_delay;
1927 /* static int ett_ptp_v2_timesource;
1928 static int ett_ptp_v2_priority; */
1929 static int ett_ptp_v2_majorsdoid;
1931 static expert_field ei_ptp_v2_msg_len_too_large;
1932 static expert_field ei_ptp_v2_msg_len_too_small;
1933 static expert_field ei_ptp_v2_sync_no_followup;
1934 static expert_field ei_ptp_v2_sync_no_fup_tlv;
1935 static expert_field ei_ptp_v2_followup_no_sync;
1936 static expert_field ei_ptp_v2_pdreq_no_pdresp;
1937 static expert_field ei_ptp_v2_pdresp_no_pdreq;
1938 static expert_field ei_ptp_v2_pdresp_no_pdfup;
1939 static expert_field ei_ptp_v2_pdresp_twostep;
1940 static expert_field ei_ptp_v2_pdfup_no_pdresp;
1941 static expert_field ei_ptp_v2_period_invalid;
1943 /* END Definitions and fields for PTPv2 dissection. */
1946 * Analysis
1948 * The analysis code cannot access the internal data of the PTP participants and
1949 * therefore the values calculated are based on the capture timestamps.
1953 /* Config for Analysis features */
1954 static bool ptp_analyze_messages = true;
1955 static unsigned ptp_analysis_max_consecutive_delta = 10;
1957 /* Definitions for Analysis features */
1959 /* 1588 defines related messages (with matching seqIds) should be sent "as soon as possible".
1960 * 802.1AS formalizes a requirement of max 10ms for the same in "Annex B - Performance requirements".
1961 * A 1 second threshold gives good margin, while not causing analysis issues in case of resets.
1962 * In case of rapid sequence number resets <1s apart, incorrect message associations can still happen.
1964 #define PTP_ANALYSIS_MAX_ALLOWED_DELTA_SECS 1.0
1966 typedef struct ptp_frame_info_sync {
1967 uint32_t sync_frame_num;
1968 uint32_t fup_frame_num;
1969 bool sync_two_step;
1971 nstime_t sync_ts;
1973 uint64_t timestamp_s;
1974 uint32_t timestamp_ns;
1975 int64_t correction_ns;
1976 uint16_t correction_subns;
1978 bool calculated_timestamp_valid;
1979 nstime_t calculated_timestamp;
1981 bool syncInterval_valid;
1982 double syncInterval;
1984 bool syncRateRatio_valid;
1985 double syncRateRatio;
1986 int32_t syncRateRatio_ppm;
1987 } ptp_frame_info_sync_t;
1989 typedef struct ptp_frame_info_pdelay {
1990 uint32_t pdelay_req_frame_num;
1991 uint32_t pdelay_res_frame_num;
1992 uint32_t pdelay_fup_frame_num;
1993 bool pdelay_res_two_step;
1995 nstime_t pdelay_req_ts;
1997 uint64_t pdelay_req_recv_ts_s;
1998 uint32_t pdelay_req_recv_ts_ns;
2000 uint64_t pdelay_res_send_ts_s;
2001 uint32_t pdelay_res_send_ts_ns;
2003 nstime_t pdelay_res_ts;
2005 nstime_t mean_propagation_delay_unscaled;
2006 double mean_propagation_delay_scaled;
2008 bool pdelayInterval_valid;
2009 double pdelayInterval;
2011 bool neighborRateRatio_valid;
2012 double neighborRateRatio;
2013 int32_t neighborRateRatio_ppm;
2014 } ptp_frame_info_pdelay_t;
2016 typedef struct ptp_frame_info {
2017 uint8_t messagetype;
2018 union {
2019 ptp_frame_info_sync_t sync;
2020 ptp_frame_info_pdelay_t pdelay;
2023 struct ptp_frame_info *prev;
2024 nstime_t ref_time;
2025 } ptp_frame_info_t;
2027 #define PTP_FRAME_INFO_SYNC_SEEN(fi) ((fi) != NULL && (fi)->messagetype == PTP_V2_SYNC_MESSAGE && (fi)->sync.sync_frame_num != 0)
2028 #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)
2029 #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)
2030 #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)
2032 typedef struct ptp_clock_info {
2033 wmem_map_t *frames;
2034 } ptp_clock_info_t;
2036 static wmem_map_t *ptp_clocks;
2039 * PTP major ver 4 bit
2040 * PTP min ver 4 bit (shift!)
2041 * MajorSdoId 4 bit
2042 * MessageType 4 bit (shift!)
2043 * MinorSdoId 1 Byte
2044 * Domain 1 Byte
2045 * PortID 2 Byte
2046 * SeqID 2 Byte
2048 static uint64_t
2049 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)
2051 DISSECTOR_ASSERT(ptp_minor % 16 == 0);
2052 DISSECTOR_ASSERT(ptp_major <= 15);
2053 DISSECTOR_ASSERT(majorsdoid % 16 == 0);
2054 DISSECTOR_ASSERT(messagetype <= 15);
2056 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 |
2057 (uint64_t)portid << 16 | (uint64_t)seqid;
2058 return ret;
2061 static ptp_frame_info_t *
2062 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)
2064 DISSECTOR_ASSERT(ptp_clocks != NULL);
2066 ptp_clock_info_t *clock_info = (ptp_clock_info_t *)wmem_map_lookup(ptp_clocks, GUINT_TO_POINTER(clockidentity));
2068 if (clock_info == NULL)
2070 clock_info = wmem_new0(wmem_file_scope(), ptp_clock_info_t);
2071 clock_info->frames = NULL;
2072 wmem_map_insert(ptp_clocks, GUINT_TO_POINTER(clockidentity), clock_info);
2075 if (clock_info->frames == NULL)
2077 clock_info->frames = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
2080 uint64_t key2 = calculate_frame_key(ptp_major, ptp_minor, majorsdoid, minorsdoid, messagetype, domain, portid, seqid);
2081 ptp_frame_info_t *tmp = (ptp_frame_info_t *)wmem_map_lookup(clock_info->frames, GUINT_TO_POINTER(key2));
2083 if (tmp != NULL)
2085 /* Is this a real match or did have wrapped the ptp seqid? */
2086 /* This check also handles sequenceIds resets due to restarts. */
2087 nstime_t delta_time;
2088 nstime_delta(&delta_time, &(pinfo->abs_ts), &(tmp->ref_time));
2089 double delta_secs = nstime_to_sec(&delta_time);
2091 if (fabs(delta_secs) > delta_cutoff)
2093 /* Not our match! */
2094 tmp = NULL;
2098 if (tmp == NULL && create_missing)
2100 tmp = wmem_new0(wmem_file_scope(), ptp_frame_info_t);
2101 tmp->prev = NULL;
2102 if (messagetype == PTP_V2_PEER_DELAY_REQ_MESSAGE) {
2103 tmp->pdelay.neighborRateRatio_valid = false;
2105 wmem_map_insert(clock_info->frames, GUINT_TO_POINTER(key2), tmp);
2107 nstime_copy(&(tmp->ref_time), &(pinfo->abs_ts));
2110 return tmp;
2113 static ptp_frame_info_t *
2114 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)
2116 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);
2118 uint16_t seqid_prev = seqid == 0 ? UINT16_MAX : seqid - 1;
2119 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);
2121 return ret;
2125 /* forward declaration of local functions for v1 and v2 */
2127 static bool
2128 is_ptp_v1(tvbuff_t *tvb);
2130 static void
2131 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
2133 static bool
2134 is_ptp_v2(tvbuff_t *tvb);
2136 static void
2137 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool ptpv2_oE);
2139 /**********************************************************/
2140 /* Implementation of the functions */
2141 /**********************************************************/
2144 /* Code to dissect the packet */
2146 static int
2147 dissect_ptp_oE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2149 /* PTP over Ethernet only available with PTPv2 */
2150 dissect_ptp_v2(tvb, pinfo, tree, true);
2151 return tvb_captured_length(tvb);
2154 static int
2155 dissect_ptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2157 if(is_ptp_v1(tvb))
2158 dissect_ptp_v1(tvb, pinfo, tree);
2159 else if(is_ptp_v2(tvb))
2160 dissect_ptp_v2(tvb, pinfo, tree, false);
2162 return tvb_captured_length(tvb);
2166 /* Code to check if packet is PTPv1 */
2168 static bool
2169 is_ptp_v1(tvbuff_t *tvb)
2171 uint16_t version_ptp;
2173 version_ptp = tvb_get_ntohs(tvb, PTP_VERSIONPTP_OFFSET);
2175 if( version_ptp == 1) return true;
2176 else return false;
2180 /* Code to check if packet is PTPv2 */
2182 static bool
2183 is_ptp_v2(tvbuff_t *tvb)
2185 uint8_t version_ptp;
2187 version_ptp = 0x0F & tvb_get_uint8(tvb, PTP_V2_VERSIONPTP_OFFSET);
2189 if( version_ptp == 2) return true;
2190 else return false;
2194 /* Code to actually dissect the PTPv1 packets */
2196 static void
2197 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2199 uint8_t ptp_control_field, ptp_mm_messagekey = 0;
2200 nstime_t ts; /* time structure with seconds and nanoseconds */
2202 /* Set up structures needed to add the protocol subtree and manage it */
2203 proto_item *ti, *flags_ti, *time_ti, *time2_ti;
2204 proto_tree *ptp_tree = NULL, *ptp_flags_tree, *ptp_time_tree, *ptp_time2_tree;
2206 /* Make entries in Protocol column and Info column on summary display */
2207 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv1");
2210 /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
2212 ptp_control_field = tvb_get_uint8 (tvb, PTP_CONTROLFIELD_OFFSET);
2213 /* MGMT packet? */
2214 if (ptp_control_field == PTP_MANAGEMENT_MESSAGE ){
2215 /* Get the managementMessageKey */
2216 ptp_mm_messagekey = tvb_get_uint8(tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET);
2219 /* Create and set the string for "Info" column */
2220 switch(ptp_control_field){
2221 case PTP_SYNC_MESSAGE:{
2222 col_set_str(pinfo->cinfo, COL_INFO, "Sync Message");
2223 break;
2225 case PTP_DELAY_REQ_MESSAGE:{
2226 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Request Message");
2227 break;
2229 case PTP_FOLLOWUP_MESSAGE:{
2230 col_set_str(pinfo->cinfo, COL_INFO, "Follow_Up Message");
2231 break;
2233 case PTP_DELAY_RESP_MESSAGE:{
2234 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Response Message");
2235 break;
2237 case PTP_MANAGEMENT_MESSAGE:{
2238 col_add_fstr(pinfo->cinfo, COL_INFO, "Management Message (%s)",
2239 val_to_str_ext(ptp_mm_messagekey,
2240 &ptp_managementMessageKey_infocolumn_vals_ext,
2241 "Unknown message key %u"));
2242 break;
2244 default:{
2245 col_set_str(pinfo->cinfo, COL_INFO, "Unknown Message");
2246 break;
2250 if (tree) {
2252 /* create display subtree for the protocol */
2253 ti = proto_tree_add_item(tree, proto_ptp, tvb, 0, -1, ENC_NA);
2255 ptp_tree = proto_item_add_subtree(ti, ett_ptp);
2257 proto_tree_add_item(ptp_tree,
2258 hf_ptp_versionptp, tvb, PTP_VERSIONPTP_OFFSET, 2, ENC_BIG_ENDIAN);
2260 proto_tree_add_item(ptp_tree,
2261 hf_ptp_versionnetwork, tvb, PTP_VERSIONNETWORK_OFFSET, 2, ENC_BIG_ENDIAN);
2263 proto_tree_add_item(ptp_tree,
2264 hf_ptp_subdomain, tvb, PTP_SUBDOMAIN_OFFSET, 16, ENC_ASCII);
2266 proto_tree_add_item(ptp_tree,
2267 hf_ptp_messagetype, tvb, PTP_MESSAGETYPE_OFFSET, 1, ENC_BIG_ENDIAN);
2269 proto_tree_add_item(ptp_tree,
2270 hf_ptp_sourcecommunicationtechnology, tvb, PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2272 proto_tree_add_item(ptp_tree,
2273 hf_ptp_sourceuuid, tvb, PTP_SOURCEUUID_OFFSET, 6, ENC_NA);
2275 proto_tree_add_item(ptp_tree,
2276 hf_ptp_sourceportid, tvb, PTP_SOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2278 proto_tree_add_item(ptp_tree,
2279 hf_ptp_sequenceid, tvb, PTP_SEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2281 proto_tree_add_item(ptp_tree,
2282 hf_ptp_controlfield, tvb, PTP_CONTROLFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
2284 /* Subtree for the flag-field */
2285 /* TODO: use proto_tree_add_bitmask_list() ? */
2286 flags_ti = proto_tree_add_item(ptp_tree,
2287 hf_ptp_flags, tvb, PTP_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
2289 ptp_flags_tree = proto_item_add_subtree(flags_ti, ett_ptp_flags);
2291 proto_tree_add_item(ptp_flags_tree,
2292 hf_ptp_flags_li61, tvb, PTP_FLAGS_LI61_OFFSET, 2, ENC_BIG_ENDIAN);
2294 proto_tree_add_item(ptp_flags_tree,
2295 hf_ptp_flags_li59, tvb, PTP_FLAGS_LI59_OFFSET, 2, ENC_BIG_ENDIAN);
2297 proto_tree_add_item(ptp_flags_tree,
2298 hf_ptp_flags_boundary_clock, tvb, PTP_FLAGS_BOUNDARY_CLOCK_OFFSET, 2, ENC_BIG_ENDIAN);
2300 proto_tree_add_item(ptp_flags_tree,
2301 hf_ptp_flags_assist, tvb, PTP_FLAGS_ASSIST_OFFSET, 2, ENC_BIG_ENDIAN);
2303 proto_tree_add_item(ptp_flags_tree,
2304 hf_ptp_flags_ext_sync, tvb, PTP_FLAGS_EXT_SYNC_OFFSET, 2, ENC_BIG_ENDIAN);
2306 proto_tree_add_item(ptp_flags_tree,
2307 hf_ptp_flags_parent, tvb, PTP_FLAGS_PARENT_STATS_OFFSET, 2, ENC_BIG_ENDIAN);
2309 proto_tree_add_item(ptp_flags_tree,
2310 hf_ptp_flags_sync_burst, tvb, PTP_FLAGS_SYNC_BURST_OFFSET, 2, ENC_BIG_ENDIAN);
2312 /* The rest of the ptp-dissector depends on the control-field */
2314 switch(ptp_control_field){
2315 case PTP_SYNC_MESSAGE:
2316 case PTP_DELAY_REQ_MESSAGE:{
2318 /* Subtree for the timestamp-field */
2319 ts.secs = tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET);
2320 ts.nsecs = tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET);
2321 if(tree){
2322 time_ti = proto_tree_add_time(ptp_tree,
2323 hf_ptp_sdr_origintimestamp, tvb, PTP_SDR_ORIGINTIMESTAMP_OFFSET, 8, &ts);
2325 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2327 proto_tree_add_item(ptp_time_tree,
2328 hf_ptp_sdr_origintimestamp_seconds, tvb,
2329 PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2331 proto_tree_add_item(ptp_time_tree, hf_ptp_sdr_origintimestamp_nanoseconds, tvb,
2332 PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2335 proto_tree_add_item(ptp_tree,
2336 hf_ptp_sdr_epochnumber, tvb, PTP_SDR_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2338 proto_tree_add_item(ptp_tree,
2339 hf_ptp_sdr_currentutcoffset, tvb, PTP_SDR_CURRENTUTCOFFSET_OFFSET, 2, ENC_BIG_ENDIAN);
2341 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmastercommunicationtechnology, tvb,
2342 PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2344 proto_tree_add_item(ptp_tree,
2345 hf_ptp_sdr_grandmasterclockuuid, tvb, PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET, 6, ENC_NA);
2347 proto_tree_add_item(ptp_tree,
2348 hf_ptp_sdr_grandmasterportid, tvb, PTP_SDR_GRANDMASTERPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2350 proto_tree_add_item(ptp_tree,
2351 hf_ptp_sdr_grandmastersequenceid, tvb, PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2353 proto_tree_add_item(ptp_tree,
2354 hf_ptp_sdr_grandmasterclockstratum, tvb,
2355 PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2357 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterclockidentifier, tvb,
2358 PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET, 4, ENC_ASCII);
2360 proto_tree_add_item(ptp_tree,
2361 hf_ptp_sdr_grandmasterclockvariance, tvb,
2362 PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2364 proto_tree_add_item(ptp_tree,
2365 hf_ptp_sdr_grandmasterpreferred, tvb, PTP_SDR_GRANDMASTERPREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2367 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterisboundaryclock, tvb,
2368 PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2370 proto_tree_add_item(ptp_tree,
2371 hf_ptp_sdr_syncinterval, tvb, PTP_SDR_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2373 proto_tree_add_item(ptp_tree,
2374 hf_ptp_sdr_localclockvariance, tvb, PTP_SDR_LOCALCLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2376 proto_tree_add_item(ptp_tree,
2377 hf_ptp_sdr_localstepsremoved, tvb, PTP_SDR_LOCALSTEPSREMOVED_OFFSET, 2, ENC_BIG_ENDIAN);
2379 proto_tree_add_item(ptp_tree,
2380 hf_ptp_sdr_localclockstratum, tvb, PTP_SDR_LOCALCLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2382 proto_tree_add_item(ptp_tree,
2383 hf_ptp_sdr_localclockidentifier, tvb, PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET, 4, ENC_ASCII);
2385 proto_tree_add_item(ptp_tree, hf_ptp_sdr_parentcommunicationtechnology, tvb,
2386 PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2388 proto_tree_add_item(ptp_tree,
2389 hf_ptp_sdr_parentuuid, tvb, PTP_SDR_PARENTUUID_OFFSET, 6, ENC_NA);
2391 proto_tree_add_item(ptp_tree,
2392 hf_ptp_sdr_parentportfield, tvb, PTP_SDR_PARENTPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2394 proto_tree_add_item(ptp_tree,
2395 hf_ptp_sdr_estimatedmastervariance, tvb,
2396 PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2398 proto_tree_add_item(ptp_tree,
2399 hf_ptp_sdr_estimatedmasterdrift, tvb, PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET, 4, ENC_BIG_ENDIAN);
2401 proto_tree_add_item(ptp_tree,
2402 hf_ptp_sdr_utcreasonable, tvb, PTP_SDR_UTCREASONABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2403 break;
2405 case PTP_FOLLOWUP_MESSAGE:{
2406 proto_tree_add_item(ptp_tree,
2407 hf_ptp_fu_associatedsequenceid, tvb, PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2409 /* Subtree for the timestamp-field */
2410 ts.secs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET);
2411 ts.nsecs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET);
2412 if(tree){
2413 time_ti = proto_tree_add_time(ptp_tree,
2414 hf_ptp_fu_preciseorigintimestamp, tvb,
2415 PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET, 8, &ts);
2417 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2419 proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_seconds, tvb,
2420 PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2422 proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_nanoseconds, tvb,
2423 PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2425 break;
2427 case PTP_DELAY_RESP_MESSAGE:{
2428 /* Subtree for the timestamp-field */
2429 ts.secs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET);
2430 ts.nsecs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET);
2431 if(tree){
2432 time_ti = proto_tree_add_time(ptp_tree,
2433 hf_ptp_dr_delayreceipttimestamp, tvb,
2434 PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET, 8, &ts);
2436 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2438 proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_seconds, tvb,
2439 PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2441 proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_nanoseconds, tvb,
2442 PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2445 proto_tree_add_item(ptp_tree, hf_ptp_dr_requestingsourcecommunicationtechnology, tvb,
2446 PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2448 proto_tree_add_item(ptp_tree,
2449 hf_ptp_dr_requestingsourceuuid, tvb, PTP_DR_REQUESTINGSOURCEUUID_OFFSET, 6, ENC_NA);
2451 proto_tree_add_item(ptp_tree,
2452 hf_ptp_dr_requestingsourceportid, tvb, PTP_DR_REQUESTINGSOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2454 proto_tree_add_item(ptp_tree,
2455 hf_ptp_dr_requestingsourcesequenceid, tvb,
2456 PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
2457 break;
2459 case PTP_MANAGEMENT_MESSAGE:{
2460 proto_tree_add_item(ptp_tree, hf_ptp_mm_targetcommunicationtechnology, tvb,
2461 PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2463 proto_tree_add_item(ptp_tree,
2464 hf_ptp_mm_targetuuid, tvb, PTP_MM_TARGETUUID_OFFSET, 6, ENC_NA);
2466 proto_tree_add_item(ptp_tree,
2467 hf_ptp_mm_targetportid, tvb, PTP_MM_TARGETPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2469 proto_tree_add_item(ptp_tree,
2470 hf_ptp_mm_startingboundaryhops, tvb, PTP_MM_STARTINGBOUNDARYHOPS_OFFSET, 2, ENC_BIG_ENDIAN);
2472 proto_tree_add_item(ptp_tree,
2473 hf_ptp_mm_boundaryhops, tvb, PTP_MM_BOUNDARYHOPS_OFFSET, 2, ENC_BIG_ENDIAN);
2476 proto_tree_add_item(ptp_tree,
2477 hf_ptp_mm_managementmessagekey, tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET, 1, ENC_BIG_ENDIAN);
2479 proto_tree_add_item(ptp_tree,
2480 hf_ptp_mm_parameterlength, tvb, PTP_MM_PARAMETERLENGTH_OFFSET, 2, ENC_BIG_ENDIAN);
2482 switch(ptp_mm_messagekey){
2483 case PTP_MM_CLOCK_IDENTITY:{
2484 proto_tree_add_item(ptp_tree,
2485 hf_ptp_mm_clock_identity_clockcommunicationtechnology, tvb,
2486 PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2488 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockuuidfield, tvb,
2489 PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET, 6, ENC_NA);
2491 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockportfield, tvb,
2492 PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2494 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_manufactureridentity, tvb,
2495 PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET, 48, ENC_NA);
2496 break;
2498 case PTP_MM_INITIALIZE_CLOCK:{
2499 proto_tree_add_item(ptp_tree, hf_ptp_mm_initialize_clock_initialisationkey, tvb,
2500 PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET, 2, ENC_BIG_ENDIAN);
2501 break;
2503 case PTP_MM_SET_SUBDOMAIN:{
2504 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_subdomain_subdomainname, tvb,
2505 PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2506 break;
2508 case PTP_MM_DEFAULT_DATA_SET:{
2509 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockcommunicationtechnology,
2510 tvb, PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET,
2511 1, ENC_BIG_ENDIAN);
2513 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockuuidfield, tvb,
2514 PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET, 6, ENC_NA);
2516 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockportfield, tvb,
2517 PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2519 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockstratum, tvb,
2520 PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2522 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockidentifier, tvb,
2523 PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, ENC_NA);
2525 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockvariance, tvb,
2526 PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2528 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockfollowupcapable, tvb,
2529 PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2531 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_preferred, tvb,
2532 PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2534 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_initializable, tvb,
2535 PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2537 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_externaltiming, tvb,
2538 PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET, 1, ENC_BIG_ENDIAN);
2540 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_isboundaryclock, tvb,
2541 PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2543 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_syncinterval, tvb,
2544 PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2546 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_subdomainname, tvb,
2547 PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2549 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberports, tvb,
2550 PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET, 2, ENC_BIG_ENDIAN);
2552 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberforeignrecords, tvb,
2553 PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET, 2, ENC_BIG_ENDIAN);
2554 break;
2556 case PTP_MM_UPDATE_DEFAULT_DATA_SET:{
2557 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockstratum, tvb,
2558 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2560 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockidentifier, tvb,
2561 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, ENC_NA);
2563 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockvariance, tvb,
2564 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2566 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_preferred, tvb,
2567 PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2569 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_syncinterval, tvb,
2570 PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, ENC_BIG_ENDIAN);
2572 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_subdomainname, tvb,
2573 PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, ENC_ASCII);
2574 break;
2576 case PTP_MM_CURRENT_DATA_SET:{
2577 proto_tree_add_item(ptp_tree, hf_ptp_mm_current_data_set_stepsremoved, tvb,
2578 PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET, 2, ENC_BIG_ENDIAN);
2580 /* Subtree for offset from master */
2581 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET);
2583 ts.nsecs = tvb_get_ntohl(tvb,
2584 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET);
2586 if (ts.nsecs & 0x80000000) ts.nsecs = ts.nsecs & 0x7FFFFFFF;
2588 if(tree){
2589 time_ti = proto_tree_add_time(ptp_tree,
2590 hf_ptp_mm_current_data_set_offsetfrommaster, tvb,
2591 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET, 8, &ts);
2593 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2595 proto_tree_add_item(ptp_time_tree,
2596 hf_ptp_mm_current_data_set_offsetfrommasterseconds, tvb,
2597 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2599 proto_tree_add_item(ptp_time_tree,
2600 hf_ptp_mm_current_data_set_offsetfrommasternanoseconds, tvb,
2601 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2604 /* Subtree for offset from master */
2605 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET);
2607 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET);
2609 if(tree){
2610 time2_ti = proto_tree_add_time(ptp_tree,
2611 hf_ptp_mm_current_data_set_onewaydelay, tvb,
2612 PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET, 8, &ts);
2614 ptp_time2_tree = proto_item_add_subtree(time2_ti, ett_ptp_time2);
2616 proto_tree_add_item(ptp_time2_tree, hf_ptp_mm_current_data_set_onewaydelayseconds,
2617 tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2619 proto_tree_add_item(ptp_time2_tree,
2620 hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
2621 tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2623 break;
2625 case PTP_MM_PARENT_DATA_SET:{
2626 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
2627 tvb, PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET,
2628 1, ENC_BIG_ENDIAN);
2630 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentuuid, tvb,
2631 PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET, 6, ENC_NA);
2633 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentportid, tvb,
2634 PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
2636 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
2637 tvb, PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET,
2638 2, ENC_BIG_ENDIAN);
2640 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentfollowupcapable, tvb,
2641 PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2643 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentexternaltiming, tvb,
2644 PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET, 1, ENC_BIG_ENDIAN);
2646 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentvariance, tvb,
2647 PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2649 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentstats, tvb,
2650 PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET, 1, ENC_BIG_ENDIAN);
2652 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observedvariance, tvb,
2653 PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2655 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observeddrift, tvb,
2656 PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET, 4, ENC_BIG_ENDIAN);
2658 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_utcreasonable, tvb,
2659 PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET, 1, ENC_BIG_ENDIAN);
2661 proto_tree_add_item(ptp_tree,
2662 hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
2663 tvb, PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
2664 ENC_BIG_ENDIAN);
2666 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteruuidfield, tvb,
2667 PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET, 6, ENC_NA);
2669 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterportidfield, tvb,
2670 PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2672 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterstratum, tvb,
2673 PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET, 1, ENC_BIG_ENDIAN);
2675 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteridentifier, tvb,
2676 PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET, 4, ENC_NA);
2678 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastervariance, tvb,
2679 PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
2681 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterpreferred, tvb,
2682 PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET, 1, ENC_BIG_ENDIAN);
2684 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterisboundaryclock, tvb,
2685 PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, ENC_BIG_ENDIAN);
2687 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastersequencenumber, tvb,
2688 PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2689 break;
2691 case PTP_MM_PORT_DATA_SET:{
2692 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_returnedportnumber, tvb,
2693 PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2695 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portstate, tvb,
2696 PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET, 1, ENC_BIG_ENDIAN);
2698 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastsynceventsequencenumber, tvb,
2699 PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2701 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
2702 tvb, PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET,
2703 2, ENC_BIG_ENDIAN);
2705 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portcommunicationtechnology, tvb,
2706 PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, ENC_BIG_ENDIAN);
2708 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portuuidfield, tvb,
2709 PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET, 6, ENC_NA);
2711 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portidfield, tvb,
2712 PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2714 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_burstenabled, tvb,
2715 PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET, 1, ENC_BIG_ENDIAN);
2717 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddressoctets, tvb,
2718 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2720 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddressoctets, tvb,
2721 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2723 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddressoctets, tvb,
2724 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET, 1, ENC_BIG_ENDIAN);
2726 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddress, tvb,
2727 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET, 4, ENC_NA);
2729 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddress, tvb,
2730 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET, 2, ENC_NA);
2732 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddress, tvb,
2733 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET, 2, ENC_NA);
2734 break;
2736 case PTP_MM_GLOBAL_TIME_DATA_SET:{
2737 /* Subtree for local time */
2738 ts.secs = tvb_get_ntohl(tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET);
2740 ts.nsecs = tvb_get_ntohl(tvb,
2741 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET);
2743 if(tree){
2744 time_ti = proto_tree_add_time(ptp_tree,
2745 hf_ptp_mm_global_time_data_set_localtime, tvb,
2746 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET, 8, &ts);
2748 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2750 proto_tree_add_item(ptp_time_tree,
2751 hf_ptp_mm_global_time_data_set_localtimeseconds, tvb,
2752 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2754 proto_tree_add_item(ptp_time_tree,
2755 hf_ptp_mm_global_time_data_set_localtimenanoseconds,
2756 tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2759 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_currentutcoffset, tvb,
2760 PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET, 2, ENC_BIG_ENDIAN);
2762 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap59, tvb,
2763 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET, 1, ENC_BIG_ENDIAN);
2765 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap61, tvb,
2766 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET, 1, ENC_BIG_ENDIAN);
2768 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_epochnumber, tvb,
2769 PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2770 break;
2772 case PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES:{
2773 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_currentutcoffset,
2774 tvb, PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET,
2775 2, ENC_BIG_ENDIAN);
2777 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap59, tvb,
2778 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET, 1, ENC_BIG_ENDIAN);
2780 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap61, tvb,
2781 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET, 1, ENC_BIG_ENDIAN);
2783 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2784 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2785 break;
2787 case PTP_MM_GET_FOREIGN_DATA_SET:{
2788 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2789 PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET, 2, ENC_BIG_ENDIAN);
2790 break;
2792 case PTP_MM_FOREIGN_DATA_SET:{
2793 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedportnumber, tvb,
2794 PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2796 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedrecordnumber, tvb,
2797 PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET, 2, ENC_BIG_ENDIAN);
2799 proto_tree_add_item(ptp_tree,
2800 hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
2801 tvb, PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
2802 ENC_BIG_ENDIAN);
2804 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasteruuidfield, tvb,
2805 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET, 6, ENC_NA);
2807 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasterportidfield, tvb,
2808 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2810 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmastersyncs, tvb,
2811 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET, 2, ENC_BIG_ENDIAN);
2812 break;
2814 case PTP_MM_SET_SYNC_INTERVAL:{
2815 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_sync_interval_syncinterval, tvb,
2816 PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET, 2, ENC_BIG_ENDIAN);
2817 break;
2819 case PTP_MM_SET_TIME:{
2820 /* Subtree for local time */
2821 ts.secs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET);
2823 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET);
2825 if(tree){
2826 time_ti = proto_tree_add_time(ptp_tree, hf_ptp_mm_set_time_localtime, tvb,
2827 PTP_MM_SET_TIME_LOCALTIME_OFFSET, 8, &ts);
2829 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2831 proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimeseconds, tvb,
2832 PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2834 proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimenanoseconds,
2835 tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
2837 break;
2839 default :{
2840 /* - don't dissect any further. */
2841 break;
2844 break;
2846 default :{
2847 /* Not a valid MessageType - can't dissect. */
2848 break;
2855 /* Code to dissect PTPText */
2856 static void
2857 dissect_ptp_v2_text(tvbuff_t *tvb, uint16_t *cur_offset, proto_tree *tree, int hf_ptp_v2_mm_ptptext, int hf_ptp_v2_mm_ptptext_length)
2859 uint8_t length = 0;
2860 proto_item *ptptext_ti;
2861 proto_tree *ptptext_subtree;
2863 length = tvb_get_uint8 (tvb, *cur_offset);
2865 if (tree)
2867 ptptext_ti = proto_tree_add_item(tree, hf_ptp_v2_mm_ptptext, tvb,
2868 *cur_offset+1, length, ENC_BIG_ENDIAN);
2870 ptptext_subtree = proto_item_add_subtree(ptptext_ti, ett_ptp_v2_ptptext);
2871 /* subtree */
2872 proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext_length, tvb,
2873 *cur_offset, 1, ENC_BIG_ENDIAN);
2874 proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext, tvb,
2875 *cur_offset+1, length, ENC_ASCII|ENC_NA);
2877 *cur_offset = *cur_offset + length + 1;
2881 static void
2882 dissect_ptp_v2_timeInterval(tvbuff_t *tvb, uint16_t *cur_offset, proto_tree *tree, const char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns)
2885 double time_double;
2886 int64_t time_ns;
2887 uint16_t time_subns;
2888 proto_tree *ptptimeInterval_subtree;
2890 time_ns = tvb_get_ntoh64(tvb, *cur_offset);
2891 time_double = (1.0*time_ns) / 65536.0;
2892 time_ns = time_ns >> 16;
2893 time_subns = tvb_get_ntohs(tvb, *cur_offset+6);
2895 ptptimeInterval_subtree = proto_tree_add_subtree_format(tree, tvb, *cur_offset, 8,
2896 ett_ptp_v2_timeInterval, NULL, "%s: %f nanoseconds", name, time_double);
2898 proto_tree_add_int64(ptptimeInterval_subtree,
2899 hf_ptp_v2_timeInterval_ns, tvb, *cur_offset, 6, time_ns);
2901 proto_tree_add_double(ptptimeInterval_subtree,
2902 hf_ptp_v2_timeInterval_subns, tvb, *cur_offset+6, 2, (time_subns/65536.0));
2904 *cur_offset = *cur_offset + 8;
2907 static void
2908 dissect_ptp_v2_timetstamp(tvbuff_t *tvb, uint16_t *cur_offset, proto_tree *tree,
2909 const char* name, int hf_ptp_v2_timestamp_s,
2910 int hf_ptp_v2_timestamp_ns)
2912 int64_t time_s;
2913 uint32_t time_ns;
2914 proto_tree *ptptimestamp_subtree;
2916 time_s = tvb_get_ntoh48(tvb, *cur_offset);
2917 time_ns = tvb_get_ntohl(tvb, *cur_offset + 6);
2919 ptptimestamp_subtree = proto_tree_add_subtree_format(tree,
2920 tvb,
2921 *cur_offset,
2923 ett_ptp_v2_timeInterval,
2924 NULL,
2925 "%s: %" PRIu64 "%s%09" PRId32 " nanoseconds",
2926 name, time_s, decimal_point, time_ns);
2928 proto_tree_add_uint64(ptptimestamp_subtree,
2929 hf_ptp_v2_timestamp_s,
2930 tvb,
2931 *cur_offset,
2933 time_s);
2935 proto_tree_add_int(ptptimestamp_subtree,
2936 hf_ptp_v2_timestamp_ns,
2937 tvb,
2938 *cur_offset + 6,
2940 time_ns);
2942 *cur_offset = *cur_offset + 10;
2945 /* Code to actually dissect the PTPv2 packets */
2947 static void
2948 dissect_follow_up_tlv(tvbuff_t *tvb, proto_tree *ptp_tree)
2950 proto_item *ti = NULL;
2951 int32_t scaled_rate = 0;
2952 /* There are TLV's to be processed */
2953 uint16_t tlv_length = tvb_get_ntohs(tvb, PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_LENGTHFIELD_OFFSET);
2955 proto_tree *ptp_tlv_tree = proto_tree_add_subtree(ptp_tree, tvb, PTP_AS_FU_TLV_INFORMATION_OFFSET,
2956 tlv_length + PTP_AS_FU_TLV_ORGANIZATIONID_OFFSET,
2957 ett_ptp_v2_tlv, NULL, "Follow Up information TLV");
2959 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_tlvtype, tvb,
2960 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_TYPE_OFFSET, 2, ENC_BIG_ENDIAN);
2962 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_lengthfield, tvb,
2963 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_LENGTHFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
2965 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_organization_id, tvb,
2966 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_ORGANIZATIONID_OFFSET, 3, ENC_BIG_ENDIAN);
2968 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_organization_subtype, tvb,
2969 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_ORGANIZATIONSUBTYPE_OFFSET, 3, ENC_BIG_ENDIAN);
2971 proto_tree_add_item_ret_int(ptp_tlv_tree, hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset, tvb,
2972 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_CUMULATIVESCALEDRATEOFFSET_OFFSET, 4, ENC_BIG_ENDIAN, &scaled_rate);
2974 // The cumulative scaled rate offset is (rateRatio - 1.0) * 2^41
2975 ti = proto_tree_add_double(ptp_tlv_tree, hf_ptp_as_fu_tlv_cumulative_rate_ratio, tvb,
2976 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_CUMULATIVESCALEDRATEOFFSET_OFFSET, 4, 1.0 + ((double) scaled_rate / (UINT64_C(1) << 41)));
2977 proto_item_set_generated(ti);
2979 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_gm_base_indicator, tvb,
2980 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_GMTIMEBASEINDICATOR_OFFSET, 2, ENC_BIG_ENDIAN);
2982 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_last_gm_phase_change, tvb,
2983 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_LASTGMPHASECHANGE_OFFSET, 12, ENC_NA);
2985 proto_tree_add_item(ptp_tlv_tree, hf_ptp_as_fu_tlv_scaled_last_gm_freq_change, tvb,
2986 PTP_AS_FU_TLV_INFORMATION_OFFSET + PTP_AS_FU_TLV_SCALEDLASTGMFREQCHANGE_OFFSET, 4, ENC_BIG_ENDIAN);
2989 static void
2990 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool ptpv2_oE)
2992 uint8_t ptp_v2_majorsdoid;
2993 uint8_t ptp_v2_messageid;
2994 uint8_t ptp_v2_ver = 0;
2995 uint8_t ptp_v2_minorver = 0;
2996 uint8_t ptp_v2_domain = 0;
2997 uint8_t ptp_v2_minorsdoid = 0;
2998 uint64_t ptp_v2_correction = 0;
2999 uint64_t ptp_v2_clockid = 0;
3000 uint16_t ptp_v2_sourceportid = 0;
3001 uint16_t ptp_v2_seqid = 0;
3002 uint64_t ptp_v2_clockidref = 0;
3003 uint16_t ptp_v2_sourceportidref = 0;
3005 uint64_t timeStamp;
3006 uint16_t msg_len;
3007 uint16_t ptp_v2_flags;
3008 uint16_t temp;
3009 const char *manuf_name;
3011 /* Set up structures needed to add the protocol subtree and manage it */
3012 proto_item *ti = NULL, *msg_len_item = NULL, *flags_ti, *clockidentity_ti,
3013 *managementData_ti, *clockType_ti, *protocolAddress_ti, *ti_root = NULL;
3014 proto_tree *ptp_tree = NULL, *ptp_flags_tree, *ptp_clockidentity_tree,
3015 *ptp_managementData_tree, *ptp_clockType_tree, *ptp_protocolAddress_tree;
3017 /* Make entries in Protocol column and Info column on summary display */
3018 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv2");
3020 /* Get majorSdoId bit to determine whether this is an AS packet or not */
3021 ptp_v2_majorsdoid = 0xF0 & tvb_get_uint8 (tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET);
3023 // 802.1as is indicated by Ethernet and a certain transport specific bit.
3024 bool is_802_1as = (ptp_v2_majorsdoid & PTP_V2_MAJORSDOID_ASPACKET_BITMASK) && (ptpv2_oE == true);
3026 /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
3027 ptp_v2_messageid = 0x0F & tvb_get_uint8 (tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET);
3029 msg_len = tvb_get_ntohs(tvb, PTP_V2_MESSAGE_LENGTH_OFFSET);
3031 ptp_v2_flags = tvb_get_uint16(tvb, PTP_V2_FLAGS_OFFSET, ENC_BIG_ENDIAN);
3033 if (ptp_analyze_messages)
3035 ptp_v2_ver = 0x0F & tvb_get_uint8(tvb, PTP_V2_VERSIONPTP_OFFSET);
3036 ptp_v2_minorver = 0xF0 & tvb_get_uint8(tvb, PTP_V2_MINORVERSIONPTP_OFFSET);
3037 ptp_v2_domain = tvb_get_uint8(tvb, PTP_V2_DOMAIN_NUMBER_OFFSET);
3038 ptp_v2_minorsdoid = tvb_get_uint8(tvb, PTP_V2_MINORSDOID_OFFSET);
3039 ptp_v2_clockid = tvb_get_uint64(tvb, PTP_V2_CLOCKIDENTITY_OFFSET, ENC_BIG_ENDIAN);
3040 ptp_v2_sourceportid = tvb_get_uint16(tvb, PTP_V2_SOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
3041 ptp_v2_seqid = tvb_get_uint16(tvb, PTP_V2_SEQUENCEID_OFFSET, ENC_BIG_ENDIAN);
3042 ptp_v2_correction = tvb_get_uint64(tvb, PTP_V2_CORRECTION_OFFSET, ENC_BIG_ENDIAN);
3044 switch (ptp_v2_messageid)
3046 case PTP_V2_PEER_DELAY_RESP_MESSAGE:
3047 ptp_v2_clockidref = tvb_get_uint64(tvb, PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET, ENC_BIG_ENDIAN);
3048 ptp_v2_sourceportidref = tvb_get_uint16(tvb, PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
3049 break;
3050 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:
3051 ptp_v2_clockidref = tvb_get_uint64(tvb, PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET, ENC_BIG_ENDIAN);
3052 ptp_v2_sourceportidref = tvb_get_uint16(tvb, PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET, ENC_BIG_ENDIAN);
3053 break;
3056 if (!(pinfo->fd->visited))
3058 ptp_frame_info_t *frame_info = NULL;
3059 switch (ptp_v2_messageid)
3061 case PTP_V2_SYNC_MESSAGE:
3062 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);
3063 frame_info->messagetype = PTP_V2_SYNC_MESSAGE;
3064 frame_info->sync.sync_two_step = (ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK;
3065 frame_info->sync.sync_ts = pinfo->abs_ts;
3066 /* Rapid sequence number resets can be detected here checking for non-zero frame_info->sync.sync_frame_num */
3067 frame_info->sync.sync_frame_num = pinfo->num;
3069 if (!frame_info->sync.sync_two_step) {
3070 /* In 1-step mode, the sync carries the followup information, so we set fup to sync */
3071 frame_info->sync.fup_frame_num = pinfo->num;
3072 frame_info->sync.timestamp_s = tvb_get_uint48(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
3073 frame_info->sync.timestamp_ns = tvb_get_uint32(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
3074 frame_info->sync.correction_ns = ptp_v2_correction >> 16;
3075 frame_info->sync.correction_subns = ptp_v2_correction % 16;
3077 break;
3078 case PTP_V2_FOLLOWUP_MESSAGE:
3079 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);
3080 frame_info->messagetype = PTP_V2_SYNC_MESSAGE;
3081 frame_info->sync.fup_frame_num = pinfo->num;
3082 frame_info->sync.timestamp_s = tvb_get_uint48(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
3083 frame_info->sync.timestamp_ns = tvb_get_uint32(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
3084 frame_info->sync.correction_ns = ptp_v2_correction >> 16;
3085 frame_info->sync.correction_subns = ptp_v2_correction % 16;
3086 break;
3087 case PTP_V2_PEER_DELAY_REQ_MESSAGE:
3088 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);
3089 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
3090 frame_info->pdelay.pdelay_req_frame_num = pinfo->num;
3091 frame_info->pdelay.pdelay_req_ts = pinfo->abs_ts;
3092 break;
3093 case PTP_V2_PEER_DELAY_RESP_MESSAGE:
3094 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);
3095 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
3096 frame_info->pdelay.pdelay_res_frame_num = pinfo->num;
3097 frame_info->pdelay.pdelay_res_two_step = (ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK;
3098 frame_info->pdelay.pdelay_res_ts = pinfo->abs_ts;
3099 frame_info->pdelay.pdelay_req_recv_ts_s = tvb_get_uint48(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
3100 frame_info->pdelay.pdelay_req_recv_ts_ns = tvb_get_uint32(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
3101 break;
3102 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:
3103 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);
3104 frame_info->messagetype = PTP_V2_PEER_DELAY_REQ_MESSAGE;
3105 frame_info->pdelay.pdelay_fup_frame_num = pinfo->num;
3106 frame_info->pdelay.pdelay_res_send_ts_s = tvb_get_uint48(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET, ENC_BIG_ENDIAN);
3107 frame_info->pdelay.pdelay_res_send_ts_ns = tvb_get_uint32(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET, ENC_BIG_ENDIAN);
3108 break;
3111 if (frame_info != NULL) {
3112 p_add_proto_data(wmem_file_scope(), pinfo, proto_ptp, 0, frame_info);
3115 if PTP_FRAME_INFO_SYNC_SEEN(frame_info) {
3117 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info) && !frame_info->sync.calculated_timestamp_valid) {
3118 /* calculate two step sync timestamp */
3120 nstime_t ts = NSTIME_INIT_SECS_NSECS(frame_info->sync.timestamp_s, frame_info->sync.timestamp_ns);
3122 /* we are ignoring subns */
3123 int64_t corr_s = frame_info->sync.correction_ns / NS_PER_S;
3124 int32_t corr_ns = frame_info->sync.correction_ns % NS_PER_S;
3125 nstime_t corr = NSTIME_INIT_SECS_NSECS(corr_s, corr_ns);
3127 nstime_sum(&(frame_info->sync.calculated_timestamp), &(ts), &(corr));
3128 frame_info->sync.calculated_timestamp_valid = true;
3131 if PTP_FRAME_INFO_SYNC_SEEN(frame_info->prev) {
3132 nstime_t delta_capture_ts;
3133 nstime_delta(&delta_capture_ts, &(frame_info->sync.sync_ts), &(frame_info->prev->sync.sync_ts));
3135 frame_info->sync.syncInterval = nstime_to_sec(&delta_capture_ts);
3136 if (frame_info->sync.syncInterval > 0)
3137 frame_info->sync.syncInterval_valid = true;
3139 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info->prev) && frame_info->sync.calculated_timestamp_valid && frame_info->prev->sync.calculated_timestamp_valid) {
3140 nstime_t delta_sync_ts;
3141 nstime_delta(&delta_sync_ts, &(frame_info->sync.calculated_timestamp), &(frame_info->prev->sync.calculated_timestamp));
3143 if (frame_info->sync.syncInterval_valid) {
3144 frame_info->sync.syncRateRatio = nstime_to_sec(&delta_sync_ts) / nstime_to_sec(&delta_capture_ts);
3145 frame_info->sync.syncRateRatio_valid = true;
3146 frame_info->sync.syncRateRatio_ppm =
3147 (int32_t)((1.0 - frame_info->sync.syncRateRatio) * 1000 * 1000);
3153 if (PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info) && PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info->prev)) {
3154 nstime_t t4_delta;
3155 nstime_delta(&t4_delta, &frame_info->pdelay.pdelay_res_ts, &frame_info->prev->pdelay.pdelay_res_ts);
3157 frame_info->pdelay.pdelayInterval = nstime_to_sec(&t4_delta);
3158 if (frame_info->pdelay.pdelayInterval > 0)
3159 frame_info->pdelay.pdelayInterval_valid = true;
3161 if (PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) && PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info->prev)) {
3162 /* lets calculate rate t3_delta / t4_delta */
3163 nstime_t t3_delta;
3164 nstime_t t3_curr = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_res_send_ts_s, frame_info->pdelay.pdelay_res_send_ts_ns);
3165 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);
3166 nstime_delta(&t3_delta, &t3_curr, &t3_prev);
3168 if (frame_info->pdelay.pdelayInterval_valid) {
3169 frame_info->pdelay.neighborRateRatio = nstime_to_sec(&t3_delta) / nstime_to_sec(&t4_delta);
3170 frame_info->pdelay.neighborRateRatio_valid = true;
3171 frame_info->pdelay.neighborRateRatio_ppm =
3172 (int32_t)((1.0 - frame_info->pdelay.neighborRateRatio) * 1000 * 1000);
3177 if PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) {
3178 /* lets calculate peer delay: T4 - T1 - (t3 - t2) */
3179 nstime_t t2 = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_req_recv_ts_s, frame_info->pdelay.pdelay_req_recv_ts_ns);
3180 nstime_t t3 = NSTIME_INIT_SECS_NSECS(frame_info->pdelay.pdelay_res_send_ts_s, frame_info->pdelay.pdelay_res_send_ts_ns);
3181 nstime_t peer_delta_t3_t2;
3182 nstime_delta(&peer_delta_t3_t2, &t3, &t2);
3184 nstime_delta(&frame_info->pdelay.mean_propagation_delay_unscaled, &(frame_info->pdelay.pdelay_res_ts), &(frame_info->pdelay.pdelay_req_ts));
3185 double delta_t4_t1 = nstime_to_sec(&(frame_info->pdelay.mean_propagation_delay_unscaled));
3186 nstime_subtract(&frame_info->pdelay.mean_propagation_delay_unscaled, &peer_delta_t3_t2);
3188 /* now take only 1/2 of it */
3189 frame_info->pdelay.mean_propagation_delay_unscaled.nsecs /= 2;
3190 if ((frame_info->pdelay.mean_propagation_delay_unscaled.secs % 2) == 1) {
3191 frame_info->pdelay.mean_propagation_delay_unscaled.secs -= 1;
3192 frame_info->pdelay.mean_propagation_delay_unscaled.nsecs += NS_PER_S / 2;
3194 frame_info->pdelay.mean_propagation_delay_unscaled.secs /= 2;
3196 /* lets scale by neighborRateRatio. converted to the capture timestamp timescale. */
3197 if (frame_info->pdelay.neighborRateRatio_valid) {
3198 double delta_t3_t2 = nstime_to_sec(&peer_delta_t3_t2);
3199 frame_info->pdelay.mean_propagation_delay_scaled = 0.5 * (delta_t4_t1 - frame_info->pdelay.neighborRateRatio * delta_t3_t2);
3205 /* Extend Info column with managementId */
3206 /* Create and set the string for "Info" column */
3207 if ( ptp_v2_messageid == PTP_V2_MANAGEMENT_MESSAGE )
3209 uint16_t tlv_type;
3210 /* Get TLV Type */
3211 tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
3212 /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */
3213 switch(tlv_type)
3215 case PTP_V2_TLV_TYPE_MANAGEMENT:
3217 uint16_t ptp_v2_mm_managementId;
3218 uint8_t ptp_v2_management_action;
3219 /* Get the managementId */
3220 ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET);
3221 ptp_v2_management_action = 0x0F & tvb_get_uint8(tvb, PTP_V2_MM_ACTION_OFFSET);
3222 col_add_fstr(pinfo->cinfo, COL_INFO, "Management (%s) %s",
3223 val_to_str_ext(ptp_v2_mm_managementId, &ptp_v2_managementID_infocolumn_vals_ext, "Unknown management Id %u"),
3224 val_to_str(ptp_v2_management_action, ptp_v2_mm_action_vals, "Unknown Action %u"));
3225 break;
3227 case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS:
3229 uint16_t ptp_v2_mm_managementId;
3230 /* Get the managementErrorId */
3231 ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET);
3232 col_add_fstr(pinfo->cinfo, COL_INFO, "Management Error Message (%s)",
3233 val_to_str_ext(ptp_v2_mm_managementId, &ptp_v2_managementErrorId_vals_ext, "Unknown Error Id %u"));
3234 break;
3236 default:
3237 col_add_str(pinfo->cinfo, COL_INFO,
3238 val_to_str_ext(ptp_v2_messageid, &ptp_v2_messagetype_vals_ext, "Unknown PTP Message (%u)"));
3239 break;
3242 else
3244 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext(ptp_v2_messageid, &ptp_v2_messagetype_vals_ext, "Unknown PTP Message (%u)"));
3245 if (ptp_v2_messageid == PTP_V2_SIGNALLING_MESSAGE)
3247 uint32_t tlv_offset;
3248 uint16_t tlv_type;
3249 uint32_t org_id;
3250 uint32_t subtype;
3251 uint16_t tlv_length;
3252 uint16_t wr_messageId;
3254 tlv_offset = PTP_V2_SIG_TLV_START;
3256 while (tlv_offset + PTP_V2_SIG_TLV_LENGTH_LEN + PTP_V2_SIG_TLV_TYPE_LEN <= msg_len)
3258 tlv_length = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_LENGTH_OFFSET);
3259 tlv_type = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_TYPE_OFFSET);
3261 if (tlv_type == PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION)
3263 org_id = tvb_get_ntoh24(tvb, tlv_offset + PTP_V2_SIG_TLV_ORGANIZATIONID_OFFSET);
3264 subtype = tvb_get_ntoh24(tvb, tlv_offset + PTP_V2_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET);
3266 if (org_id == OUI_CERN && subtype == PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV)
3268 col_append_str(pinfo->cinfo, COL_INFO, " WR ");
3269 wr_messageId = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_WRTLV_MESSAGEID_OFFSET);
3270 col_append_str(pinfo->cinfo,
3271 COL_INFO,
3272 val_to_str(wr_messageId,
3273 ptp_v2_org_cern_wrMessageID_vals,
3274 "Unknown PTP WR Message (%u)"
3279 if (tlv_type == PTP_V2_TLV_TYPE_L1_SYNC) {
3280 uint16_t l1sync_flags;
3282 col_append_str(pinfo->cinfo, COL_INFO, " PTP L1 SYNC");
3283 l1sync_flags = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET);
3285 if (l1sync_flags & PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK) {
3286 col_append_str(pinfo->cinfo, COL_INFO, " ext");
3289 tlv_offset += PTP_V2_SIG_TLV_TYPE_LEN +
3290 PTP_V2_SIG_TLV_LENGTH_LEN +
3291 tlv_length;
3296 if (tree) {
3298 ti_root = proto_tree_add_item(tree, proto_ptp, tvb, 0, -1, ENC_NA);
3300 ptp_tree = proto_item_add_subtree(ti_root, ett_ptp_v2);
3302 proto_tree_add_item(ptp_tree,
3303 hf_ptp_v2_majorsdoid, tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET, 1, ENC_BIG_ENDIAN);
3305 proto_tree_add_item(ptp_tree,
3306 hf_ptp_v2_messagetype, tvb, PTP_V2_MAJORSDOID_MESSAGE_TYPE_OFFSET, 1, ENC_BIG_ENDIAN);
3308 proto_tree_add_item(ptp_tree,
3309 hf_ptp_v2_minorversionptp, tvb, PTP_V2_MINORVERSIONPTP_OFFSET, 1, ENC_BIG_ENDIAN);
3311 proto_tree_add_item(ptp_tree,
3312 hf_ptp_v2_versionptp, tvb, PTP_V2_VERSIONPTP_OFFSET, 1, ENC_BIG_ENDIAN);
3314 msg_len_item = proto_tree_add_item(ptp_tree,
3315 hf_ptp_v2_messagelength, tvb, PTP_V2_MESSAGE_LENGTH_OFFSET, 2, ENC_BIG_ENDIAN);
3319 * Sanity-check the message length.
3321 if (msg_len > tvb_reported_length(tvb)) {
3322 /* Bogus message length - runs past the end of the packet */
3323 expert_add_info(pinfo, msg_len_item, &ei_ptp_v2_msg_len_too_large);
3324 msg_len = tvb_reported_length(tvb);
3325 } else if (msg_len < PTP_V2_MESSAGE_LENGTH_OFFSET + 2) {
3326 /* Bogus message length - not long enough to include the message length field */
3327 expert_add_info(pinfo, msg_len_item, &ei_ptp_v2_msg_len_too_small);
3328 return;
3329 } else {
3331 * Set the length of this tvbuff to the message length, chopping
3332 * off extra data.
3334 set_actual_length(tvb, msg_len);
3335 proto_item_set_len(ti_root, msg_len);
3338 if (tree) {
3339 ptp_frame_info_t *frame_info = (ptp_frame_info_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_ptp, 0);
3341 proto_tree_add_item(ptp_tree,
3342 hf_ptp_v2_domainnumber, tvb, PTP_V2_DOMAIN_NUMBER_OFFSET, 1, ENC_BIG_ENDIAN);
3344 proto_tree_add_item(ptp_tree,
3345 hf_ptp_v2_minorsdoid, tvb, PTP_V2_MINORSDOID_OFFSET, 1, ENC_BIG_ENDIAN);
3347 flags_ti = proto_tree_add_item(ptp_tree,
3348 hf_ptp_v2_flags, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3350 ptp_flags_tree = proto_item_add_subtree(flags_ti, ett_ptp_v2_flags);
3352 proto_tree_add_item(ptp_flags_tree,
3353 hf_ptp_v2_flags_security, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3355 proto_tree_add_item(ptp_flags_tree,
3356 hf_ptp_v2_flags_specific2, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3358 proto_tree_add_item(ptp_flags_tree,
3359 hf_ptp_v2_flags_specific1, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3361 proto_tree_add_item(ptp_flags_tree,
3362 hf_ptp_v2_flags_unicast, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3364 proto_tree_add_item(ptp_flags_tree,
3365 hf_ptp_v2_flags_twostep, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3367 proto_tree_add_item(ptp_flags_tree,
3368 hf_ptp_v2_flags_alternatemaster, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3370 proto_tree_add_item(ptp_flags_tree,
3371 hf_ptp_v2_flags_synchronizationUncertain, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3373 proto_tree_add_item(ptp_flags_tree,
3374 hf_ptp_v2_flags_frequencytraceable, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3376 proto_tree_add_item(ptp_flags_tree,
3377 hf_ptp_v2_flags_timetraceable, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3379 proto_tree_add_item(ptp_flags_tree,
3380 hf_ptp_v2_flags_ptptimescale, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3382 proto_tree_add_item(ptp_flags_tree,
3383 hf_ptp_v2_flags_utcoffsetvalid, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3385 proto_tree_add_item(ptp_flags_tree,
3386 hf_ptp_v2_flags_li59, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3388 proto_tree_add_item(ptp_flags_tree,
3389 hf_ptp_v2_flags_li61, tvb, PTP_V2_FLAGS_OFFSET, 2, ENC_BIG_ENDIAN);
3391 temp = PTP_V2_CORRECTIONNS_OFFSET;
3393 dissect_ptp_v2_timeInterval(tvb, &temp, ptp_tree, "correctionField", hf_ptp_v2_correction, hf_ptp_v2_correctionsubns);
3395 proto_tree_add_item(ptp_tree,
3396 hf_ptp_v2_messagetypespecific, tvb, PTP_V2_MESSAGE_TYPE_SPECIFIC_OFFSET, 4, ENC_BIG_ENDIAN);
3398 clockidentity_ti = proto_tree_add_item(ptp_tree,
3399 hf_ptp_v2_clockidentity, tvb, PTP_V2_CLOCKIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
3401 /* EUI-64: vendor ID | 0xFF - 0xFE | card ID */
3402 if (tvb_get_ntohs(tvb, PTP_V2_CLOCKIDENTITY_OFFSET + 3) == 0xFFFE) {
3403 ptp_clockidentity_tree = proto_item_add_subtree(clockidentity_ti, ett_ptp_v2_clockidentity);
3405 manuf_name = tvb_get_manuf_name(tvb, PTP_V2_CLOCKIDENTITY_OFFSET);
3406 proto_tree_add_bytes_format_value(ptp_clockidentity_tree, hf_ptp_v2_clockidentity_manuf,
3407 tvb, PTP_V2_CLOCKIDENTITY_OFFSET, 3, NULL, "%s", manuf_name);
3410 proto_tree_add_item(ptp_tree,
3411 hf_ptp_v2_sourceportid, tvb, PTP_V2_SOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
3413 proto_tree_add_item(ptp_tree,
3414 hf_ptp_v2_sequenceid, tvb, PTP_V2_SEQUENCEID_OFFSET, 2, ENC_BIG_ENDIAN);
3416 //The controlField in the IEEE 802.1AS is 0 for all messages(they have minorVersionPTP set to 1)
3417 if (tvb_get_ntohs(tvb, PTP_V2_MINORVERSIONPTP_OFFSET) == 1) {
3418 proto_tree_add_item(ptp_tree,
3419 hf_ptp_v2_controlfield_default, tvb, PTP_V2_CONTROLFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
3421 else {
3422 proto_tree_add_item(ptp_tree,
3423 hf_ptp_v2_controlfield, tvb, PTP_V2_CONTROLFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
3426 int logmsgperiod;
3427 ti = proto_tree_add_item_ret_int(ptp_tree,
3428 hf_ptp_v2_logmessageperiod, tvb, PTP_V2_LOGMESSAGEPERIOD_OFFSET, 1, ENC_BIG_ENDIAN, &logmsgperiod);
3430 /* 127 is special */
3431 if (ptp_analyze_messages && logmsgperiod != 127) {
3432 proto_item_append_text(ti, " (%.6f s)", pow(2.0, (double)logmsgperiod));
3435 switch(ptp_v2_messageid){
3436 case PTP_V2_ANNOUNCE_MESSAGE:{
3437 uint16_t Offset;
3438 uint16_t tlv_type;
3439 uint16_t tlv_length;
3440 uint16_t tlv_total_length;
3441 proto_tree *ptp_tlv_tree;
3442 proto_tree *ptp_tlv_wr_flags_tree;
3444 /* In 802.1AS there is no origin timestamp in an Announce Message */
3445 if(!is_802_1as){
3447 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_seconds, tvb,
3448 PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3450 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_nanoseconds, tvb,
3451 PTP_V2_AN_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3454 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origincurrentutcoffset, tvb,
3455 PTP_V2_AN_ORIGINCURRENTUTCOFFSET_OFFSET, 2, ENC_BIG_ENDIAN);
3457 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority1, tvb,
3458 PTP_V2_AN_PRIORITY_1_OFFSET, 1, ENC_BIG_ENDIAN);
3460 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockclass, tvb,
3461 PTP_V2_AN_GRANDMASTERCLOCKCLASS_OFFSET, 1, ENC_BIG_ENDIAN);
3463 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockaccuracy, tvb,
3464 PTP_V2_AN_GRANDMASTERCLOCKACCURACY_OFFSET, 1, ENC_BIG_ENDIAN);
3466 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockvariance, tvb,
3467 PTP_V2_AN_GRANDMASTERCLOCKVARIANCE_OFFSET, 2, ENC_BIG_ENDIAN);
3469 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority2, tvb,
3470 PTP_V2_AN_PRIORITY_2_OFFSET, 1, ENC_BIG_ENDIAN);
3472 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockidentity, tvb,
3473 PTP_V2_AN_GRANDMASTERCLOCKIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
3475 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_localstepsremoved, tvb,
3476 PTP_V2_AN_LOCALSTEPSREMOVED_OFFSET, 2, ENC_BIG_ENDIAN);
3478 proto_tree_add_item(ptp_tree,
3479 hf_ptp_v2_an_timesource, tvb, PTP_V2_AN_TIMESOURCE_OFFSET, 1, ENC_BIG_ENDIAN);
3481 if (msg_len > 64)
3483 tlv_total_length = 0;
3484 /* XXX It seems like at least 4 bytes must reamain to have a tlv_type and tlv_length */
3485 while (tvb_reported_length_remaining(tvb, PTP_V2_AN_TLV_OFFSET + tlv_total_length) >= 4)
3487 /* There are TLV's to be processed */
3488 tlv_type = tvb_get_ntohs (tvb, PTP_V2_AN_TLV_OFFSET+tlv_total_length+PTP_V2_AN_TLV_TYPE_OFFSET);
3489 tlv_length = tvb_get_ntohs (tvb, PTP_V2_AN_TLV_OFFSET+tlv_total_length+PTP_V2_AN_TLV_LENGTHFIELD_OFFSET);
3491 ptp_tlv_tree = proto_tree_add_subtree_format(
3492 ptp_tree,
3493 tvb,
3494 PTP_V2_AN_TLV_OFFSET + tlv_total_length,
3495 tlv_length + PTP_V2_AN_TLV_DATA_OFFSET,
3496 ett_ptp_v2_tlv, NULL, "%s TLV",
3497 val_to_str_ext(tlv_type,
3498 &ptp_v2_TLV_type_vals_ext,
3499 "Unknown (%u)"));
3501 proto_tree_add_item(ptp_tlv_tree,
3502 hf_ptp_v2_an_tlv_tlvtype,
3503 tvb,
3504 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_TYPE_OFFSET,
3506 ENC_BIG_ENDIAN);
3508 proto_tree_add_item(ptp_tlv_tree,
3509 hf_ptp_v2_an_tlv_lengthfield,
3510 tvb,
3511 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_LENGTHFIELD_OFFSET,
3513 ENC_BIG_ENDIAN);
3515 switch (tlv_type)
3517 case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION:
3519 uint32_t org_id;
3520 uint32_t subtype;
3522 proto_tree_add_item(ptp_tlv_tree,
3523 hf_ptp_v2_oe_tlv_organizationid,
3524 tvb,
3525 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONID_OFFSET,
3527 ENC_BIG_ENDIAN);
3529 org_id = tvb_get_ntoh24(tvb, PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONID_OFFSET);
3530 subtype = tvb_get_ntoh24(tvb, PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET);
3532 switch (org_id)
3534 case OUI_IEEE_C37_238:
3537 switch (subtype)
3539 case PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C37238TLV:
3541 proto_tree_add_item(ptp_tlv_tree,
3542 hf_ptp_v2_oe_tlv_organizationsubtype,
3543 tvb,
3544 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
3546 ENC_BIG_ENDIAN);
3547 proto_tree_add_item(ptp_tlv_tree,
3548 hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid,
3549 tvb,
3550 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_GMID_OFFSET,
3552 ENC_BIG_ENDIAN);
3553 proto_tree_add_item(ptp_tlv_tree,
3554 hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy,
3555 tvb,
3556 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_GMINACCURACY_OFFSET,
3558 ENC_BIG_ENDIAN);
3559 proto_tree_add_item(ptp_tlv_tree,
3560 hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy,
3561 tvb,
3562 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_NWINACCURACY_OFFSET,
3564 ENC_BIG_ENDIAN);
3565 proto_tree_add_item(ptp_tlv_tree,
3566 hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved,
3567 tvb,
3568 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_RESERVED_OFFSET,
3570 ENC_BIG_ENDIAN);
3571 break;
3573 case PTP_V2_OE_ORG_IEEE_C37_238_SUBTYPE_C372382017TLV:
3575 proto_tree_add_item(ptp_tlv_tree,
3576 hf_ptp_v2_oe_tlv_2017_organizationsubtype,
3577 tvb,
3578 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
3580 ENC_BIG_ENDIAN);
3581 proto_tree_add_item(ptp_tlv_tree,
3582 hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid,
3583 tvb,
3584 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_GMID_OFFSET,
3586 ENC_BIG_ENDIAN);
3587 proto_tree_add_item(ptp_tlv_tree,
3588 hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved,
3589 tvb,
3590 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC372382017TLV_RESERVED_OFFSET,
3592 ENC_BIG_ENDIAN);
3593 proto_tree_add_item(ptp_tlv_tree,
3594 hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy,
3595 tvb,
3596 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_TOTALINACCURACY_OFFSET,
3598 ENC_BIG_ENDIAN);
3599 proto_tree_add_item(ptp_tlv_tree,
3600 hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved,
3601 tvb,
3602 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_IEEEC37238TLV_RESERVED_OFFSET,
3604 ENC_BIG_ENDIAN);
3605 break;
3610 default:
3612 proto_tree_add_item(ptp_tlv_tree,
3613 hf_ptp_v2_oe_tlv_organizationsubtype,
3614 tvb,
3615 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
3617 ENC_BIG_ENDIAN);
3618 proto_tree_add_item(ptp_tlv_tree,
3619 hf_ptp_v2_oe_tlv_datafield,
3620 tvb,
3621 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET,
3622 tlv_length - 6,
3623 ENC_NA);
3624 break;
3627 break;
3629 case OUI_CERN:
3631 proto_tree_add_item(ptp_tlv_tree,
3632 hf_ptp_v2_an_tlv_oe_cern_subtype,
3633 tvb,
3634 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
3636 ENC_BIG_ENDIAN);
3637 switch (subtype)
3639 case PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV:
3641 proto_item *wrFlags_ti;
3642 proto_tree_add_item(ptp_tlv_tree,
3643 hf_ptp_v2_an_tlv_oe_cern_wrMessageID,
3644 tvb,
3645 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_WRTLV_MESSAGEID_OFFSET,
3647 ENC_BIG_ENDIAN);
3648 wrFlags_ti = proto_tree_add_item(ptp_tlv_tree,
3649 hf_ptp_v2_an_tlv_oe_cern_wrFlags,
3650 tvb,
3651 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET,
3653 ENC_BIG_ENDIAN);
3655 ptp_tlv_wr_flags_tree = proto_item_add_subtree(wrFlags_ti, ett_ptp_oe_wr_flags);
3657 proto_tree_add_item(ptp_tlv_wr_flags_tree,
3658 hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn,
3659 tvb,
3660 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET,
3662 ENC_BIG_ENDIAN);
3664 proto_tree_add_item(ptp_tlv_wr_flags_tree,
3665 hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated,
3666 tvb,
3667 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET,
3669 ENC_BIG_ENDIAN);
3671 proto_tree_add_item(ptp_tlv_wr_flags_tree,
3672 hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig,
3673 tvb,
3674 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_WRTLV_FLAGS_OFFSET,
3676 ENC_BIG_ENDIAN);
3677 break;
3679 default:
3681 proto_tree_add_item(ptp_tlv_tree,
3682 hf_ptp_v2_oe_tlv_datafield,
3683 tvb,
3684 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET,
3685 tlv_length - 6,
3686 ENC_NA);
3687 break;
3690 break;
3694 default:
3696 proto_tree_add_item(ptp_tlv_tree,
3697 hf_ptp_v2_oe_tlv_organizationsubtype,
3698 tvb,
3699 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
3701 ENC_BIG_ENDIAN);
3703 proto_tree_add_item(ptp_tlv_tree,
3704 hf_ptp_v2_oe_tlv_datafield,
3705 tvb,
3706 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET,
3707 tlv_length - 6,
3708 ENC_NA);
3709 break;
3712 break;
3714 case PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR:
3716 proto_tree_add_item(ptp_tlv_tree,
3717 hf_ptp_v2_atoi_tlv_keyfield,
3718 tvb,
3719 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_KEYFIELD_OFFSET,
3721 ENC_BIG_ENDIAN);
3723 proto_tree_add_item(ptp_tlv_tree,
3724 hf_ptp_v2_atoi_tlv_currentoffset,
3725 tvb,
3726 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_CURRENTOFFSET_OFFSET,
3728 ENC_BIG_ENDIAN);
3730 proto_tree_add_item(ptp_tlv_tree,
3731 hf_ptp_v2_atoi_tlv_jumpseconds,
3732 tvb,
3733 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_JUMPSECONDS_OFFSET,
3735 ENC_BIG_ENDIAN);
3737 proto_tree_add_item(ptp_tlv_tree,
3738 hf_ptp_v2_atoi_tlv_timeofnextjump,
3739 tvb,
3740 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_TIMEOFNEXTJUMP_OFFSET,
3742 ENC_NA);
3744 Offset = PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_DISPLAYNAME_OFFSET;
3745 dissect_ptp_v2_text(tvb,
3746 &Offset,
3747 ptp_tlv_tree,
3748 hf_ptp_v2_atoi_tlv_displayname,
3749 hf_ptp_v2_atoi_tlv_displayname_length);
3751 break;
3753 case PTP_V2_TLV_TYPE_PATH_TRACE:
3755 uint16_t path_seq_total_length;
3757 for(path_seq_total_length = 0; path_seq_total_length < tlv_length; path_seq_total_length+=8)
3759 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_an_tlv_pathsequence, tvb,
3760 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_AS_AN_TLV_PATH_TRACE_OFFSET + path_seq_total_length,
3761 8, ENC_BIG_ENDIAN);
3764 break;
3766 default:
3768 proto_tree_add_item(ptp_tlv_tree,
3769 hf_ptp_v2_an_tlv_data,
3770 tvb,
3771 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_DATA_OFFSET,
3772 tlv_length,
3773 ENC_NA);
3774 break;
3778 tlv_total_length += (tlv_length + PTP_V2_AN_TLV_DATA_OFFSET);
3782 break;
3785 case PTP_V2_SYNC_MESSAGE:
3786 if (is_802_1as && ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK)) {
3787 /* IEEE 802.1AS 2-step does not have Origin Timestamp in Sync! See 11.4.3 */
3788 proto_tree_add_item(ptp_tree, hf_ptp_v2_sync_reserved, tvb,
3789 PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET, 10, ENC_NA);
3790 } else {
3791 /* regular PTP or 802.1AS 1-step */
3792 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_seconds, tvb,
3793 PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3795 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_nanoseconds, tvb,
3796 PTP_V2_SDR_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3799 if (is_802_1as && ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) != PTP_V2_FLAGS_TWO_STEP_BITMASK)) {
3800 /* IEEE 802.1AS-2020 11.4.3 */
3801 if (msg_len >= 76) {
3802 dissect_follow_up_tlv(tvb, ptp_tree);
3803 } else {
3804 expert_add_info(pinfo, ti_root, &ei_ptp_v2_sync_no_fup_tlv);
3808 if (ptp_analyze_messages) {
3809 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info)) {
3810 if (frame_info->sync.syncInterval_valid) {
3811 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_period, tvb, 0, 0, frame_info->sync.syncInterval);
3812 proto_item_append_text(ti, " %s", "s");
3813 proto_item_set_generated(ti);
3816 if ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK) {
3817 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_sync_to_followup, tvb, 0, 0, frame_info->sync.fup_frame_num);
3818 proto_item_set_generated(ti);
3819 } else {
3820 if (frame_info->sync.calculated_timestamp_valid) {
3821 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_timestamp, tvb, 0, 0, nstime_to_sec(&(frame_info->sync.calculated_timestamp)));
3822 proto_item_set_generated(ti);
3823 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_timestamp);
3824 ti = proto_tree_add_uint64(ts_tree, hf_ptp_v2_analysis_sync_timestamp_seconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.secs);
3825 proto_item_set_generated(ti);
3826 ti = proto_tree_add_uint(ts_tree, hf_ptp_v2_analysis_sync_timestamp_nanoseconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.nsecs);
3827 proto_item_set_generated(ti);
3830 if (frame_info->sync.syncRateRatio_valid) {
3831 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio, tvb, 0, 0, frame_info->sync.syncRateRatio);
3832 proto_item_set_generated(ti);
3833 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio_ppm, tvb, 0, 0, frame_info->sync.syncRateRatio_ppm);
3834 proto_item_set_generated(ti);
3837 } else if ((ptp_v2_flags & PTP_V2_FLAGS_TWO_STEP_BITMASK) == PTP_V2_FLAGS_TWO_STEP_BITMASK) {
3838 /* No FollowUp found! */
3839 expert_add_info(pinfo, ti_root, &ei_ptp_v2_sync_no_followup);
3843 break;
3845 case PTP_V2_DELAY_REQ_MESSAGE:{
3846 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_seconds, tvb,
3847 PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3849 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_nanoseconds, tvb,
3850 PTP_V2_SDR_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3852 break;
3855 case PTP_V2_FOLLOWUP_MESSAGE:{
3856 proto_item *ti_tstamp;
3857 uint64_t ts_sec;
3858 uint32_t ts_ns;
3860 proto_tree_add_item_ret_uint64(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_seconds, tvb,
3861 PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN, &ts_sec);
3863 proto_tree_add_item_ret_uint(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds, tvb,
3864 PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN, &ts_ns);
3866 ti_tstamp = proto_tree_add_bytes_format_value(ptp_tree,
3867 hf_ptp_v2_fu_preciseorigintimestamp_32bit,
3868 tvb,
3869 PTP_V2_FU_PRECISEORIGINTIMESTAMP_OFFSET,
3871 NULL,
3872 "%"PRIu64, (ts_sec * NS_PER_S + ts_ns) % UINT64_C(0x100000000));
3874 proto_item_set_hidden(ti_tstamp);
3875 proto_item_set_generated(ti_tstamp);
3877 /* In 802.1AS there is a Follow_UP information TLV in the Follow Up Message */
3878 if(is_802_1as){
3879 dissect_follow_up_tlv(tvb, ptp_tree);
3882 if (ptp_analyze_messages) {
3883 if (frame_info != NULL) {
3884 if (PTP_FRAME_INFO_SYNC_COMPLETE(frame_info) && frame_info->sync.sync_two_step) {
3885 if (frame_info->sync.calculated_timestamp_valid) {
3886 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_timestamp, tvb, 0, 0, nstime_to_sec(&(frame_info->sync.calculated_timestamp)));
3887 proto_item_set_generated(ti);
3888 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_timestamp);
3889 ti = proto_tree_add_uint64(ts_tree, hf_ptp_v2_analysis_sync_timestamp_seconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.secs);
3890 proto_item_set_generated(ti);
3891 ti = proto_tree_add_uint(ts_tree, hf_ptp_v2_analysis_sync_timestamp_nanoseconds, tvb, 0, 0, frame_info->sync.calculated_timestamp.nsecs);
3892 proto_item_set_generated(ti);
3895 if (frame_info->sync.syncRateRatio_valid) {
3896 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio, tvb, 0, 0, frame_info->sync.syncRateRatio);
3897 proto_item_set_generated(ti);
3898 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_sync_rateRatio_ppm, tvb, 0, 0, frame_info->sync.syncRateRatio_ppm);
3899 proto_item_set_generated(ti);
3902 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_followup_to_sync, tvb, 0, 0, frame_info->sync.sync_frame_num);
3903 proto_item_set_generated(ti);
3904 } else {
3905 /* No 2-step Sync found! */
3906 expert_add_info(pinfo, ti_root, &ei_ptp_v2_followup_no_sync);
3911 break;
3914 case PTP_V2_DELAY_RESP_MESSAGE:{
3916 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_seconds, tvb,
3917 PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3919 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_nanoseconds, tvb,
3920 PTP_V2_DR_RECEIVETIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3922 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingportidentity, tvb,
3923 PTP_V2_DR_REQUESTINGPORTIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
3925 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingsourceportid, tvb,
3926 PTP_V2_DR_REQUESTINGSOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
3928 break;
3931 case PTP_V2_PEER_DELAY_REQ_MESSAGE:{
3932 /* In 802.1AS there is no origin timestamp in a Pdelay_Req Message */
3933 if(!is_802_1as){
3935 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_seconds, tvb,
3936 PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3938 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_nanoseconds, tvb,
3939 PTP_V2_PDRQ_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3942 if (ptp_analyze_messages) {
3943 if (frame_info != NULL) {
3944 if PTP_FRAME_INFO_PDELAY_REQ_SEEN(frame_info) {
3945 if (frame_info->pdelay.pdelayInterval_valid) {
3946 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_period, tvb, 0, 0, frame_info->pdelay.pdelayInterval);
3947 proto_item_append_text(ti, " %s", "s");
3948 proto_item_set_generated(ti);
3952 if (frame_info->pdelay.pdelay_res_frame_num != 0) {
3953 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayreq_to_pdelayres, tvb, 0, 0, frame_info->pdelay.pdelay_res_frame_num);
3954 proto_item_set_generated(ti);
3955 } else {
3956 /* No Response found! */
3957 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdreq_no_pdresp);
3961 break;
3964 case PTP_V2_PEER_DELAY_RESP_MESSAGE:{
3966 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_seconds, tvb,
3967 PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
3969 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds, tvb,
3970 PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
3972 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingportidentity, tvb,
3973 PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
3975 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingsourceportid, tvb,
3976 PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
3978 if (ptp_analyze_messages) {
3979 if (frame_info != NULL) {
3980 if (frame_info->pdelay.pdelay_req_frame_num != 0) {
3981 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayres_to_pdelayreq, tvb, 0, 0, frame_info->pdelay.pdelay_req_frame_num);
3982 proto_item_set_generated(ti);
3983 } else {
3984 /* No Request found! */
3985 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_no_pdreq);
3987 if (frame_info->pdelay.pdelay_fup_frame_num != 0) {
3988 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayres_to_pdelayfup, tvb, 0, 0, frame_info->pdelay.pdelay_fup_frame_num);
3989 proto_item_set_generated(ti);
3990 } else {
3991 /* No Follow Up found! */
3992 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_no_pdfup);
3994 if (PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) && frame_info->pdelay.pdelay_res_two_step == false) {
3995 /* Two step false but follow up received! */
3996 /* According to 802.1AS-2011/2022 2-step must be true on pDelay Req */
3997 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdresp_twostep);
4001 break;
4004 case PTP_V2_PEER_DELAY_FOLLOWUP_MESSAGE:{
4006 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_seconds, tvb,
4007 PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET, 6, ENC_BIG_ENDIAN);
4009 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds, tvb,
4010 PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, ENC_BIG_ENDIAN);
4013 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingportidentity, tvb,
4014 PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
4016 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingsourceportid, tvb,
4017 PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
4019 if (ptp_analyze_messages) {
4020 if (frame_info != NULL) {
4021 if PTP_FRAME_INFO_PDELAY_COMPLETE(frame_info) {
4022 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));
4023 proto_item_set_generated(ti);
4024 proto_tree *ts_tree = proto_item_add_subtree(ti, ett_ptp_analysis_mean_propagation_delay);
4025 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);
4026 proto_item_set_generated(ti);
4027 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);
4028 proto_item_set_generated(ti);
4030 if (frame_info->pdelay.neighborRateRatio_valid) {
4031 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_mpd_scaled, tvb, 0, 0, frame_info->pdelay.mean_propagation_delay_scaled);
4032 proto_item_set_generated(ti);
4033 ti = proto_tree_add_double(ptp_tree, hf_ptp_v2_analysis_pdelay_neighRateRatio, tvb, 0, 0, frame_info->pdelay.neighborRateRatio);
4034 proto_item_set_generated(ti);
4035 ti = proto_tree_add_int(ptp_tree, hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm, tvb, 0, 0, frame_info->pdelay.neighborRateRatio_ppm);
4036 proto_item_set_generated(ti);
4040 if (frame_info->pdelay.pdelay_res_frame_num != 0) {
4041 ti = proto_tree_add_uint(ptp_tree, hf_ptp_v2_analysis_pdelayfup_to_pdelayres, tvb, 0, 0, frame_info->pdelay.pdelay_res_frame_num);
4042 proto_item_set_generated(ti);
4043 } else {
4044 /* No Response found! */
4045 expert_add_info(pinfo, ti_root, &ei_ptp_v2_pdfup_no_pdresp);
4049 break;
4052 case PTP_V2_SIGNALLING_MESSAGE:{
4053 uint16_t tlv_length;
4054 uint16_t tlv_type;
4055 proto_item *tlv_ti, *sig_tlv_flags_ti;
4056 proto_tree *ptp_tlv_tree, *sig_tlv_flags_tree;
4058 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportidentity, tvb,
4059 PTP_V2_SIG_TARGETPORTIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
4061 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportid, tvb,
4062 PTP_V2_SIG_TARGETPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
4064 /* In 802.1AS there is a Message Interval Request TLV in the Signalling Message */
4065 if(is_802_1as){
4067 /* There are TLV's to be processed */
4068 tlv_length = tvb_get_ntohs (tvb, PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_LENGTHFIELD_OFFSET);
4069 tlv_type = tvb_get_ntohs(tvb, PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_V2_SIG_TLV_TYPE_OFFSET);
4071 switch (tlv_type)
4073 case PTP_AS_SIG_TLV_TYPE_MESSAGEINTERVALREQUEST:{
4075 ptp_tlv_tree = proto_tree_add_subtree(
4076 ptp_tree,
4077 tvb,
4078 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET,
4079 tlv_length + PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET,
4080 ett_ptp_v2_tlv, NULL, "Message Interval Request TLV");
4082 proto_tree_add_item(ptp_tlv_tree,
4083 hf_ptp_as_sig_tlv_tlvtype,
4084 tvb,
4085 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_TYPE_OFFSET,
4087 ENC_BIG_ENDIAN);
4089 proto_tree_add_item(ptp_tlv_tree,
4090 hf_ptp_as_sig_tlv_lengthfield,
4091 tvb,
4092 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_LENGTHFIELD_OFFSET,
4094 ENC_BIG_ENDIAN);
4096 proto_tree_add_item(ptp_tlv_tree,
4097 hf_ptp_as_sig_tlv_organization_id,
4098 tvb,
4099 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET,
4101 ENC_BIG_ENDIAN);
4103 proto_tree_add_item(ptp_tlv_tree,
4104 hf_ptp_as_sig_tlv_organization_subtype,
4105 tvb,
4106 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET,
4108 ENC_BIG_ENDIAN);
4110 proto_tree_add_item(ptp_tlv_tree,
4111 hf_ptp_as_sig_tlv_link_delay_interval,
4112 tvb,
4113 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_LINKDELAYINTERVAL_OFFSET,
4115 ENC_BIG_ENDIAN);
4117 proto_tree_add_item(ptp_tlv_tree,
4118 hf_ptp_as_sig_tlv_time_sync_interval,
4119 tvb,
4120 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_TIMESYNCINTERVAL_OFFSET,
4122 ENC_BIG_ENDIAN);
4124 proto_tree_add_item(ptp_tlv_tree,
4125 hf_ptp_as_sig_tlv_announce_interval,
4126 tvb,
4127 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_ANNOUNCEINTERVAL_OFFSET,
4129 ENC_BIG_ENDIAN);
4131 sig_tlv_flags_ti = proto_tree_add_item(ptp_tlv_tree,
4132 hf_ptp_as_sig_tlv_flags,
4133 tvb,
4134 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_FLAGS_OFFSET,
4136 ENC_BIG_ENDIAN);
4138 sig_tlv_flags_tree = proto_item_add_subtree(sig_tlv_flags_ti, ett_ptp_as_sig_tlv_flags);
4140 proto_tree_add_item(sig_tlv_flags_tree,
4141 hf_ptp_as_sig_tlv_flags_comp_rate_ratio,
4142 tvb,
4143 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_FLAGS_OFFSET,
4145 ENC_BIG_ENDIAN);
4147 proto_tree_add_item(sig_tlv_flags_tree,
4148 hf_ptp_as_sig_tlv_flags_comp_mean_link_delay,
4149 tvb,
4150 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_FLAGS_OFFSET,
4152 ENC_BIG_ENDIAN);
4154 proto_tree_add_item(sig_tlv_flags_tree,
4155 hf_ptp_as_sig_tlv_flags_one_step_receive_capable,
4156 tvb,
4157 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_MESSAGEINTERVALREQ_FLAGS_OFFSET,
4159 ENC_BIG_ENDIAN);
4160 break;
4163 case PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE:{
4165 uint16_t organization_subtype;
4167 organization_subtype = tvb_get_ntohs(tvb, PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET);
4169 if (organization_subtype == PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_MESSSAGEINTERVAL_ORG_SUB_TYPE){
4170 ptp_tlv_tree = proto_tree_add_subtree(
4171 ptp_tree,
4172 tvb,
4173 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET,
4174 tlv_length + PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET,
4175 ett_ptp_v2_tlv, NULL, "gPTP-capable message interval request TLV");
4177 else{
4179 ptp_tlv_tree = proto_tree_add_subtree(
4180 ptp_tree,
4181 tvb,
4182 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET,
4183 tlv_length + PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET,
4184 ett_ptp_v2_tlv, NULL, "gPTP-capable TLV");
4187 proto_tree_add_item(ptp_tlv_tree,
4188 hf_ptp_as_sig_tlv_tlvtype,
4189 tvb,
4190 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_TYPE_OFFSET,
4192 ENC_BIG_ENDIAN);
4194 proto_tree_add_item(ptp_tlv_tree,
4195 hf_ptp_as_sig_tlv_lengthfield,
4196 tvb,
4197 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_LENGTHFIELD_OFFSET,
4199 ENC_BIG_ENDIAN);
4201 proto_tree_add_item(ptp_tlv_tree,
4202 hf_ptp_as_sig_tlv_organization_id,
4203 tvb,
4204 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_ORGANIZATIONID_OFFSET,
4206 ENC_BIG_ENDIAN);
4208 proto_tree_add_item(ptp_tlv_tree,
4209 hf_ptp_as_sig_tlv_organization_subtype,
4210 tvb,
4211 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET,
4213 ENC_BIG_ENDIAN);
4215 proto_tree_add_item(ptp_tlv_tree,
4216 hf_ptp_as_sig_tlv_gptp_capable_message_interval,
4217 tvb,
4218 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_GPTPCAPABLE_MESSAGEINTERVAL_OFFSET,
4220 ENC_BIG_ENDIAN);
4222 if (organization_subtype == PTP_AS_SIG_TLV_TYPE_GPTPCAPABLE_ORG_SUB_TYPE){
4223 proto_tree_add_item(ptp_tlv_tree,
4224 hf_ptp_as_sig_tlv_flags,
4225 tvb,
4226 PTP_AS_SIG_TLV_MESSAGEINTERVALREQUEST_OFFSET + PTP_AS_SIG_TLV_GPTPCAPABLE_FLAGS_OFFSET,
4228 ENC_BIG_ENDIAN);
4230 break;
4234 } else {
4235 unsigned proto_len;
4236 uint32_t tlv_offset;
4237 int8_t log_inter_message_period;
4238 double period = 0.0f;
4239 double rate = 0.0f;
4241 proto_item *ptp_tlv_period;
4242 proto_tree *ptp_tlv_period_tree;
4244 proto_len = tvb_reported_length(tvb);
4245 tlv_offset = PTP_V2_SIG_TLV_START;
4247 while (tlv_offset < proto_len) {
4249 /* 14.1.1 tlvType */
4250 tlv_type = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_TYPE_OFFSET);
4251 tlv_ti = proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_tlv_tlvType, tvb,
4252 tlv_offset + PTP_V2_SIG_TLV_TYPE_OFFSET, PTP_V2_SIG_TLV_TYPE_LEN, ENC_BIG_ENDIAN);
4254 ptp_tlv_tree = proto_item_add_subtree(tlv_ti, ett_ptp_v2_tlv);
4256 /* 14.1.2 lengthField */
4257 tlv_length = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_LENGTH_OFFSET);
4258 proto_tree_add_uint(ptp_tlv_tree, hf_ptp_v2_sig_tlv_lengthField, tvb,
4259 tlv_offset + PTP_V2_SIG_TLV_LENGTH_OFFSET, PTP_V2_SIG_TLV_LENGTH_LEN, tlv_length);
4261 switch (tlv_type) {
4263 /* Request Unicast Transmission */
4264 case PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION:
4266 /* 16.1.4.1.3 messageType */
4267 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb,
4268 tlv_offset + PTP_V2_SIG_TLV_MESSAGE_TYPE_OFFSET, PTP_V2_SIG_TLV_MESSAGE_TYPE_LEN, ENC_BIG_ENDIAN);
4270 /* 16.1.4.1.4 logInterMessagePeriod */
4271 log_inter_message_period = tvb_get_uint8(tvb, tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET);
4272 period = pow(2, log_inter_message_period);
4274 ptp_tlv_period = proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod, tvb,
4275 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, ENC_BIG_ENDIAN);
4277 ptp_tlv_period_tree = proto_item_add_subtree(ptp_tlv_period, ett_ptp_v2_tlv_log_period);
4279 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_period, tvb,
4280 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "every %lg seconds", period);
4282 if (period > 0) {
4283 rate = 1 / period;
4284 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate, tvb,
4285 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "%lg packets/sec", rate);
4286 } else {
4287 proto_tree_add_expert_format(ptp_tlv_period_tree, pinfo, &ei_ptp_v2_period_invalid,
4288 tvb, tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET,
4289 PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN,
4290 "Invalid InterMessagePeriod: %lg", period);
4293 /* 16.1.4.1.5 durationField */
4294 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb,
4295 tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, ENC_BIG_ENDIAN);
4297 break;
4299 /* Grant Unicast Transmission */
4300 case PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION:
4302 /* 16.1.4.2.3 messageType */
4303 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb,
4304 tlv_offset + PTP_V2_SIG_TLV_MESSAGE_TYPE_OFFSET, PTP_V2_SIG_TLV_MESSAGE_TYPE_LEN, ENC_BIG_ENDIAN);
4306 /* 16.1.4.2.4 logInterMessagePeriod */
4307 log_inter_message_period = tvb_get_uint8(tvb, tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET);
4308 period = pow(2, log_inter_message_period);
4310 ptp_tlv_period = proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod, tvb,
4311 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, ENC_BIG_ENDIAN);
4313 ptp_tlv_period_tree = proto_item_add_subtree(ptp_tlv_period, ett_ptp_v2_tlv_log_period);
4315 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_period, tvb,
4316 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "every %lg seconds", period);
4318 if (period > 0) {
4319 rate = 1 / period;
4320 proto_tree_add_int_format_value(ptp_tlv_period_tree, hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate, tvb,
4321 tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "%lg packets/sec", rate);
4322 } else {
4323 proto_tree_add_expert_format(ptp_tlv_period_tree, pinfo, &ei_ptp_v2_period_invalid,
4324 tvb, tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET,
4325 PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN,
4326 "Invalid InterMessagePeriod: %lg", period);
4329 /* 16.1.4.2.5 durationField */
4330 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb,
4331 tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, ENC_BIG_ENDIAN);
4333 /* 16.1.4.2.6 renewalInvited */
4334 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_renewalInvited, tvb,
4335 tlv_offset + PTP_V2_SIG_TLV_RENEWAL_INVITED_OFFSET, PTP_V2_SIG_TLV_RENEWAL_INVITED_LEN, ENC_BIG_ENDIAN);
4337 break;
4339 /* Cancel Unicast Transmission */
4340 case PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION:
4342 /* 16.1.4.3.3 messageType */
4343 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb,
4344 tlv_offset + PTP_V2_SIG_TLV_MESSAGE_TYPE_OFFSET, PTP_V2_SIG_TLV_MESSAGE_TYPE_LEN, ENC_BIG_ENDIAN);
4346 break;
4348 /* Acknowledge Cancel Unicast Transmission */
4349 case PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION:
4351 /* 16.1.4.4.3 messageType */
4352 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_messageType, tvb,
4353 tlv_offset + PTP_V2_SIG_TLV_MESSAGE_TYPE_OFFSET, PTP_V2_SIG_TLV_MESSAGE_TYPE_LEN, ENC_BIG_ENDIAN);
4355 break;
4357 case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION:
4359 uint32_t org_id;
4360 uint32_t subtype;
4361 uint16_t tlv_total_length = tlv_offset;
4362 proto_tree_add_item(ptp_tlv_tree,
4363 hf_ptp_v2_oe_tlv_organizationid,
4364 tvb,
4365 tlv_total_length + PTP_V2_SIG_TLV_ORGANIZATIONID_OFFSET,
4367 ENC_BIG_ENDIAN);
4369 org_id = tvb_get_ntoh24(tvb, tlv_total_length + PTP_V2_SIG_TLV_ORGANIZATIONID_OFFSET);
4370 subtype = tvb_get_ntoh24(tvb, tlv_total_length + PTP_V2_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET);
4372 switch (org_id)
4374 case OUI_CERN:
4376 proto_tree_add_item(ptp_tlv_tree,
4377 hf_ptp_v2_sig_oe_tlv_cern_subtype,
4378 tvb,
4379 tlv_total_length + PTP_V2_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET,
4381 ENC_BIG_ENDIAN);
4382 switch (subtype)
4384 case PTP_V2_OE_ORG_CERN_SUBTYPE_WR_TLV:
4386 uint16_t wr_messageId;
4387 proto_tree_add_item(ptp_tlv_tree,
4388 hf_ptp_v2_sig_oe_tlv_cern_wrMessageID,
4389 tvb,
4390 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_MESSAGEID_OFFSET,
4392 ENC_BIG_ENDIAN);
4393 wr_messageId = tvb_get_ntohs(tvb, tlv_total_length + PTP_V2_SIG_TLV_WRTLV_MESSAGEID_OFFSET);
4394 switch (wr_messageId)
4396 case PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATE:
4397 proto_tree_add_item(ptp_tlv_tree,
4398 hf_ptp_v2_sig_oe_tlv_cern_calSendPattern,
4399 tvb,
4400 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_CALSENDPATTERN_OFFSET,
4402 ENC_BIG_ENDIAN);
4403 proto_tree_add_item(ptp_tlv_tree,
4404 hf_ptp_v2_sig_oe_tlv_cern_calRety,
4405 tvb,
4406 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_CALRETRY_OFFSET,
4408 ENC_BIG_ENDIAN);
4409 proto_tree_add_item(ptp_tlv_tree,
4410 hf_ptp_v2_sig_oe_tlv_cern_calPeriod,
4411 tvb,
4412 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_CALPERIOD_OFFSET,
4414 ENC_BIG_ENDIAN);
4416 break;
4417 case PTP_V2_OE_ORG_CERN_WRMESSAGEID_CALIBRATED:
4419 uint64_t deltaTx;
4420 uint64_t deltaRx;
4421 deltaTx = tvb_get_ntoh64(tvb, tlv_total_length + PTP_V2_SIG_TLV_WRTLV_DELTATX_OFFSET);
4422 deltaRx = tvb_get_ntoh64(tvb, tlv_total_length + PTP_V2_SIG_TLV_WRTLV_DELTARX_OFFSET);
4423 proto_tree_add_bytes_format_value(ptp_tlv_tree,
4424 hf_ptp_v2_sig_oe_tlv_cern_deltaTx,
4425 tvb,
4426 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_DELTATX_OFFSET,
4428 NULL,
4429 "%lf ps", (double) deltaTx/(1 << 16));
4430 proto_tree_add_bytes_format_value(ptp_tlv_tree,
4431 hf_ptp_v2_sig_oe_tlv_cern_deltaRx,
4432 tvb,
4433 tlv_total_length + PTP_V2_SIG_TLV_WRTLV_DELTARX_OFFSET,
4435 NULL,
4436 "%lf ps", (double) deltaRx/(1 << 16));
4437 break;
4439 default:
4440 break;
4442 break;
4444 default:
4446 proto_tree_add_item(ptp_tlv_tree,
4447 hf_ptp_v2_oe_tlv_datafield,
4448 tvb,
4449 tlv_total_length + PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET,
4450 tlv_length - 6,
4451 ENC_NA);
4452 break;
4455 break;
4458 case OUI_ITU_T:
4460 proto_tree_add_item(ptp_tlv_tree,
4461 hf_ptp_v2_sig_oe_tlv_itut_subtype,
4462 tvb,
4463 tlv_total_length + PTP_V2_SIG_TLV_ORGANIZATIONSUBTYPE_OFFSET,
4465 ENC_BIG_ENDIAN);
4466 switch (subtype)
4468 case PTP_V2_INTERFACE_RATE_TLV:
4470 proto_tree_add_item(ptp_tlv_tree,
4471 hf_ptp_v2_sig_tlv_interface_bit_period,
4472 tvb,
4473 tlv_total_length + PTP_SIG_TLV_INTERFACE_BIT_PERIOD,
4475 ENC_BIG_ENDIAN);
4476 proto_tree_add_item(ptp_tlv_tree,
4477 hf_ptp_v2_sig_tlv_numberbits_before_timestamp,
4478 tvb,
4479 tlv_total_length + PTP_SIG_TLV_NUMBERBITS_BEFORE_TIMESTAMP,
4481 ENC_BIG_ENDIAN);
4482 proto_tree_add_item(ptp_tlv_tree,
4483 hf_ptp_v2_sig_tlv_numberbits_after_timestamp,
4484 tvb,
4485 tlv_total_length + PTP_SIG_TLV_NUMBERBITS_AFTER_TIMESTAMP,
4487 ENC_BIG_ENDIAN);
4488 break;
4490 default:
4492 proto_tree_add_item(ptp_tlv_tree,
4493 hf_ptp_v2_oe_tlv_datafield,
4494 tvb,
4495 tlv_total_length + PTP_V2_AN_TLV_OE_DATAFIELD_OFFSET,
4496 tlv_length - 6,
4497 ENC_NA);
4498 break;
4501 break;
4503 default:
4505 proto_tree_add_item(ptp_tlv_tree,
4506 hf_ptp_v2_oe_tlv_organizationsubtype,
4507 tvb,
4508 tlv_total_length + PTP_V2_AN_TLV_OE_ORGANIZATIONSUBTYPE_OFFSET,
4510 ENC_BIG_ENDIAN);
4511 break;
4514 break;
4517 case PTP_V2_TLV_TYPE_L1_SYNC:
4519 uint16_t l1sync_flags;
4520 proto_item *l1Flags_ti;
4521 proto_tree *ptp_tlv_l1sync_flags_tree;
4522 /* In the basic format of the L1_SYNC flags field is 2 bytes */
4523 uint8_t flags_len = PTP_V2_SIG_TLV_L1SYNC_FLAGS_BASIC_FORMAT;
4525 /* Version with 2 bytes flags field */
4526 static int * const data_mode_flags2[] = {
4527 &hf_ptp_v2_sig_tlv_l1sync_flags2_ope,
4528 &hf_ptp_v2_sig_tlv_l1sync_flags2_cr,
4529 &hf_ptp_v2_sig_tlv_l1sync_flags2_rcr,
4530 &hf_ptp_v2_sig_tlv_l1sync_flags2_tcr,
4531 &hf_ptp_v2_sig_tlv_l1sync_flags2_ic,
4532 &hf_ptp_v2_sig_tlv_l1sync_flags2_irc,
4533 &hf_ptp_v2_sig_tlv_l1sync_flags2_itc,
4534 &hf_ptp_v2_sig_tlv_l1sync_flags2_reserved,
4535 NULL
4538 /* Version with 3 bytes flags field */
4539 static int * const data_mode_flags3[] = {
4540 &hf_ptp_v2_sig_tlv_l1sync_flags3_ope,
4541 &hf_ptp_v2_sig_tlv_l1sync_flags3_cr,
4542 &hf_ptp_v2_sig_tlv_l1sync_flags3_rcr,
4543 &hf_ptp_v2_sig_tlv_l1sync_flags3_tcr,
4544 &hf_ptp_v2_sig_tlv_l1sync_flags3_ic,
4545 &hf_ptp_v2_sig_tlv_l1sync_flags3_irc,
4546 &hf_ptp_v2_sig_tlv_l1sync_flags3_itc,
4547 &hf_ptp_v2_sig_tlv_l1sync_flags3_fov,
4548 &hf_ptp_v2_sig_tlv_l1sync_flags3_pov,
4549 &hf_ptp_v2_sig_tlv_l1sync_flags3_tct,
4550 &hf_ptp_v2_sig_tlv_l1sync_flags3_reserved,
4551 NULL
4554 /* Get the value of flags */
4555 l1sync_flags = tvb_get_ntohs(tvb, tlv_offset + PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET);
4557 /* Check if the frame has extended format of L1_SYNC flags field */
4558 if (l1sync_flags & PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK) {
4559 flags_len = PTP_V2_SIG_TLV_L1SYNC_FLAGS_EXT_FORMAT;
4562 l1Flags_ti = proto_tree_add_item(ptp_tlv_tree,
4563 flags_len == PTP_V2_SIG_TLV_L1SYNC_FLAGS_BASIC_FORMAT ? hf_ptp_v2_sig_tlv_flags2 : hf_ptp_v2_sig_tlv_flags3,
4564 tvb,
4565 tlv_offset + PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET,
4566 flags_len,
4567 ENC_BIG_ENDIAN);
4569 ptp_tlv_l1sync_flags_tree = proto_item_add_subtree(l1Flags_ti, ett_ptp_v2_sig_l1sync_flags);
4571 /* Check if the frame has extended format */
4572 if (!(l1sync_flags & PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK)) {
4573 proto_tree_add_bitmask_list(ptp_tlv_l1sync_flags_tree,
4574 tvb,
4575 tlv_offset + PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET,
4576 flags_len,
4577 data_mode_flags2,
4578 ENC_BIG_ENDIAN);
4579 } else {
4580 uint16_t value_offset;
4582 proto_tree_add_bitmask_list(ptp_tlv_l1sync_flags_tree,
4583 tvb,
4584 tlv_offset + PTP_V2_SIG_TLV_L1SYNC_FLAGS_OFFSET,
4585 flags_len,
4586 data_mode_flags3,
4587 ENC_BIG_ENDIAN);
4589 value_offset = tlv_offset + PTP_V2_SIG_TLV_L1SYNCEXT_PHASE_OFFSET_TX_OFFSET;
4590 dissect_ptp_v2_timeInterval(tvb,
4591 &value_offset,
4592 ptp_tlv_tree,
4593 "phaseOffsetTx",
4594 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns,
4595 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns);
4597 value_offset = tlv_offset + PTP_V2_SIG_TLV_L1SYNCEXT_PHASE_OFFSET_TX_TIMESTAMP_OFFSET;
4598 dissect_ptp_v2_timetstamp(tvb,
4599 &value_offset,
4600 ptp_tlv_tree,
4601 "phaseOffsetTxTimestamp",
4602 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s,
4603 hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns);
4605 value_offset = tlv_offset + PTP_V2_SIG_TLV_L1SYNCEXT_FREQ_OFFSET_TX_OFFSET;
4606 dissect_ptp_v2_timeInterval(tvb,
4607 &value_offset,
4608 ptp_tlv_tree,
4609 "freqOffsetTx",
4610 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns,
4611 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns);
4613 value_offset = tlv_offset + PTP_V2_SIG_TLV_L1SYNCEXT_FREQ_OFFSET_TX_TIMESTAMP_OFFSET;
4614 dissect_ptp_v2_timetstamp(tvb,
4615 &value_offset,
4616 ptp_tlv_tree,
4617 "freqOffsetTxTimestamp",
4618 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s,
4619 hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns);
4622 break;
4625 default:
4626 /* TODO: Add dissector for other TLVs */
4627 proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_data, tvb,
4628 tlv_offset + PTP_V2_SIG_TLV_VALUE_OFFSET, tlv_length, ENC_NA);
4631 tlv_offset += PTP_V2_SIG_TLV_TYPE_LEN +
4632 PTP_V2_SIG_TLV_LENGTH_LEN +
4633 tlv_length;
4636 break;
4639 case PTP_V2_MANAGEMENT_MESSAGE:
4641 uint16_t tlv_type, tlv_length;
4643 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportidentity, tvb,
4644 PTP_V2_MM_TARGETPORTIDENTITY_OFFSET, 8, ENC_BIG_ENDIAN);
4646 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportid, tvb,
4647 PTP_V2_MM_TARGETPORTID_OFFSET, 2, ENC_BIG_ENDIAN);
4649 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_startingboundaryhops, tvb,
4650 PTP_V2_MM_STARTINGBOUNDARYHOPS_OFFSET, 1, ENC_BIG_ENDIAN);
4652 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_boundaryhops, tvb,
4653 PTP_V2_MM_BOUNDARYHOPS_OFFSET, 1, ENC_BIG_ENDIAN);
4655 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_action, tvb,
4656 PTP_V2_MM_ACTION_OFFSET, 1, ENC_BIG_ENDIAN);
4658 /* management TLV */
4659 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_tlvType, tvb,
4660 PTP_V2_MM_TLV_TYPE_OFFSET, 2, ENC_BIG_ENDIAN);
4662 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_lengthField, tvb,
4663 PTP_V2_MM_TLV_LENGTHFIELD_OFFSET, 2, ENC_BIG_ENDIAN);
4665 tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
4666 tlv_length = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_LENGTHFIELD_OFFSET);
4668 /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */
4669 switch(tlv_type) {
4670 case PTP_V2_TLV_TYPE_MANAGEMENT:
4672 uint16_t ptp_v2_managementId;
4673 uint16_t Offset = PTP_V2_MM_TLV_DATAFIELD_OFFSET;
4675 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementId, tvb,
4676 PTP_V2_MM_TLV_MANAGEMENTID_OFFSET, 2, ENC_BIG_ENDIAN);
4678 ptp_v2_managementId = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET);
4680 if (tlv_length <= 2)
4682 /* no data */
4683 break;
4686 managementData_ti = proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_data, tvb, Offset, tlv_length - 2, ENC_NA);
4688 /* data field of the management message (subtree) */
4689 ptp_managementData_tree = proto_item_add_subtree(managementData_ti, ett_ptp_v2_managementData);
4691 switch(ptp_v2_managementId) {
4692 case PTP_V2_MM_ID_NULL_MANAGEMENT:
4694 /* no data in NULL management */
4695 break;
4697 case PTP_V2_MM_ID_CLOCK_DESCRIPTION:
4699 uint16_t N = 0, S = 0;
4700 clockType_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockType, tvb,
4701 Offset, 2, ENC_BIG_ENDIAN);
4703 ptp_clockType_tree = proto_item_add_subtree(clockType_ti, ett_ptp_v2_clockType);
4704 /* ClockType Subtree */
4705 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_ordinaryClock, tvb,
4706 Offset, 2, ENC_BIG_ENDIAN);
4708 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_boundaryClock, tvb,
4709 Offset, 2, ENC_BIG_ENDIAN);
4711 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_p2p_transparentClock, tvb,
4712 Offset, 2, ENC_BIG_ENDIAN);
4714 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_e2e_transparentClock, tvb,
4715 Offset, 2, ENC_BIG_ENDIAN);
4717 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_managementNode, tvb,
4718 Offset, 2, ENC_BIG_ENDIAN);
4720 proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_reserved, tvb,
4721 Offset, 2, ENC_BIG_ENDIAN);
4722 Offset +=2;
4724 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
4725 hf_ptp_v2_mm_physicalLayerProtocol, hf_ptp_v2_mm_physicalLayerProtocol_length);
4727 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddressLength, tvb,
4728 Offset, 2, ENC_BIG_ENDIAN);
4730 S = tvb_get_ntohs (tvb, Offset);
4731 Offset +=2;
4733 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddress, tvb,
4734 Offset, S, ENC_NA);
4735 Offset += S;
4737 N = tvb_get_ntohs (tvb, Offset+2);
4739 protocolAddress_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_protocolAddress, tvb,
4740 Offset+4, N, ENC_NA);
4742 ptp_protocolAddress_tree = proto_item_add_subtree(protocolAddress_ti, ett_ptp_v2_protocolAddress);
4743 /* physicalLayerProtocol subtree */
4744 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_networkProtocol, tvb,
4745 Offset, 2, ENC_BIG_ENDIAN);
4747 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_length, tvb,
4748 Offset+2, 2, ENC_BIG_ENDIAN);
4750 proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress, tvb,
4751 Offset+4, N, ENC_NA);
4752 N = N + 4;
4753 Offset += N;
4755 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_manufacturerIdentity, tvb,
4756 Offset, 3, ENC_NA);
4758 Offset += 3;
4760 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
4761 Offset, 1, ENC_NA);
4762 Offset += 1;
4764 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
4765 hf_ptp_v2_mm_productDescription, hf_ptp_v2_mm_productDescription_length);
4766 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
4767 hf_ptp_v2_mm_revisionData, hf_ptp_v2_mm_revisionData_length);
4768 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
4769 hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
4771 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_profileIdentity, tvb,
4772 Offset, 6, ENC_NA);
4773 Offset += 6;
4775 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
4776 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
4778 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
4779 Offset, 1, ENC_NA);
4781 break;
4783 case PTP_V2_MM_ID_USER_DESCRIPTION:
4786 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
4787 hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
4789 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
4790 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
4792 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
4793 Offset, 1, ENC_NA);
4795 break;
4797 case PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE:
4799 /* no data */
4800 break;
4802 case PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE:
4804 /* no data */
4805 break;
4807 case PTP_V2_MM_ID_INITIALIZE:
4809 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_initializationKey, tvb,
4810 Offset, 2, ENC_BIG_ENDIAN);
4811 break;
4813 case PTP_V2_MM_ID_FAULT_LOG:
4815 uint16_t ii, num = 0;
4816 proto_tree *ptpError_subtree;
4818 num = tvb_get_ntohs (tvb, Offset);
4820 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfFaultRecords, tvb,
4821 Offset, 2, ENC_BIG_ENDIAN);
4822 Offset +=2;
4824 for (ii = 0; ii < num; ii++)
4826 ptpError_subtree = proto_tree_add_subtree(ptp_managementData_tree, tvb, Offset, tvb_get_ntohs (tvb, Offset),
4827 ett_ptp_v2_faultRecord, NULL, "Fault record");
4829 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultRecordLength, tvb,
4830 Offset, 2, ENC_BIG_ENDIAN);
4831 Offset +=2;
4833 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_s, tvb,
4834 Offset, 6, ENC_BIG_ENDIAN);
4836 Offset +=6;
4837 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_ns, tvb,
4838 Offset, 4, ENC_BIG_ENDIAN);
4839 Offset +=4;
4840 proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_severityCode, tvb,
4841 Offset, 1, ENC_BIG_ENDIAN);
4842 Offset +=1;
4844 dissect_ptp_v2_text (tvb, &Offset, ptpError_subtree,
4845 hf_ptp_v2_mm_faultName, hf_ptp_v2_mm_faultName_length);
4847 dissect_ptp_v2_text (tvb, &Offset, ptpError_subtree,
4848 hf_ptp_v2_mm_faultValue, hf_ptp_v2_mm_faultValue_length);
4850 dissect_ptp_v2_text (tvb, &Offset, ptpError_subtree,
4851 hf_ptp_v2_mm_faultDescription, hf_ptp_v2_mm_faultDescription_length);
4854 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
4855 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
4857 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
4858 Offset, 1, ENC_NA);
4860 break;
4862 case PTP_V2_MM_ID_FAULT_LOG_RESET:
4864 /* no data */
4865 break;
4867 case PTP_V2_MM_ID_DEFAULT_DATA_SET:
4869 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TSC, tvb,
4870 PTP_V2_MM_TLV_DATAFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
4872 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_dds_SO, tvb,
4873 PTP_V2_MM_TLV_DATAFIELD_OFFSET, 1, ENC_BIG_ENDIAN);
4875 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
4876 PTP_V2_MM_RESERVED1, 1, ENC_NA);
4878 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb,
4879 PTP_V2_MM_NUMBERPORTS, 2, ENC_BIG_ENDIAN);
4881 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb,
4882 PTP_V2_MM_PRIORITY1, 1, ENC_BIG_ENDIAN);
4884 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockclass, tvb,
4885 PTP_V2_MM_CLOCKQUALITY, 1, ENC_BIG_ENDIAN);
4887 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockaccuracy, tvb,
4888 PTP_V2_MM_CLOCKQUALITY+1, 1, ENC_BIG_ENDIAN);
4890 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockvariance, tvb,
4891 PTP_V2_MM_CLOCKQUALITY+2, 2, ENC_BIG_ENDIAN);
4893 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb,
4894 PTP_V2_MM_PRIORITY2, 1, ENC_BIG_ENDIAN);
4896 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
4897 PTP_V2_MM_CLOCKIDENTITY, 8, ENC_BIG_ENDIAN);
4899 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb,
4900 PTP_V2_MM_DOMAINNUMBER, 1, ENC_BIG_ENDIAN);
4902 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
4903 PTP_V2_MM_RESERVED2, 1, ENC_NA);
4904 break;
4906 case PTP_V2_MM_ID_CURRENT_DATA_SET:
4908 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_stepsRemoved, tvb,
4909 Offset, 2, ENC_BIG_ENDIAN);
4910 Offset +=2;
4912 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
4913 "Offset from Master", hf_ptp_v2_mm_offset_ns, hf_ptp_v2_mm_offset_subns);
4914 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
4915 "Mean path delay", hf_ptp_v2_mm_pathDelay_ns, hf_ptp_v2_mm_pathDelay_subns);
4916 break;
4918 case PTP_V2_MM_ID_PARENT_DATA_SET:
4920 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentIdentity, tvb,
4921 Offset, 8, ENC_BIG_ENDIAN);
4923 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentPort, tvb,
4924 Offset+8, 2, ENC_BIG_ENDIAN);
4925 Offset +=10;
4927 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentStats, tvb,
4928 Offset, 1, ENC_BIG_ENDIAN);
4929 Offset +=1;
4931 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
4932 Offset, 1, ENC_NA);
4933 Offset +=1;
4935 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentOffsetScaledLogVariance, tvb,
4936 Offset, 2, ENC_BIG_ENDIAN);
4937 Offset +=2;
4939 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentClockPhaseChangeRate, tvb,
4940 Offset, 4, ENC_BIG_ENDIAN);
4941 Offset +=4;
4943 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority1, tvb,
4944 Offset, 1, ENC_BIG_ENDIAN);
4945 Offset +=1;
4947 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockclass, tvb,
4948 Offset, 1, ENC_BIG_ENDIAN);
4950 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockaccuracy, tvb,
4951 Offset+1, 1, ENC_BIG_ENDIAN);
4953 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockvariance, tvb,
4954 Offset+2, 2, ENC_BIG_ENDIAN);
4955 Offset += 4;
4957 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority2, tvb,
4958 Offset, 1, ENC_BIG_ENDIAN);
4959 Offset +=1;
4961 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterIdentity, tvb,
4962 Offset, 8, ENC_BIG_ENDIAN);
4964 break;
4966 case PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET:
4968 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb,
4969 Offset, 2, ENC_BIG_ENDIAN);
4970 Offset +=2;
4972 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb,
4973 Offset, 1, ENC_BIG_ENDIAN);
4974 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb,
4975 Offset, 1, ENC_BIG_ENDIAN);
4976 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb,
4977 Offset, 1, ENC_BIG_ENDIAN);
4978 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb,
4979 Offset, 1, ENC_BIG_ENDIAN);
4980 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb,
4981 Offset, 1, ENC_BIG_ENDIAN);
4982 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb,
4983 Offset, 1, ENC_BIG_ENDIAN);
4984 Offset +=1;
4986 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb,
4987 Offset, 1, ENC_BIG_ENDIAN);
4989 break;
4991 case PTP_V2_MM_ID_PORT_DATA_SET:
4993 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
4994 Offset, 8, ENC_BIG_ENDIAN);
4995 Offset +=8;
4997 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb,
4998 Offset, 2, ENC_BIG_ENDIAN);
4999 Offset +=2;
5001 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_portState, tvb,
5002 Offset, 1, ENC_BIG_ENDIAN);
5003 Offset +=1;
5005 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinDelayReqInterval, tvb,
5006 Offset, 1, ENC_BIG_ENDIAN);
5007 Offset +=1;
5009 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
5010 "Peer mean path delay", hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns);
5012 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb,
5013 Offset, 1, ENC_BIG_ENDIAN);
5014 Offset +=1;
5016 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb,
5017 Offset, 1, ENC_BIG_ENDIAN);
5018 Offset +=1;
5020 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb,
5021 Offset, 1, ENC_BIG_ENDIAN);
5022 Offset +=1;
5024 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
5025 Offset, 1, ENC_BIG_ENDIAN);
5026 Offset +=1;
5028 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
5029 Offset, 1, ENC_BIG_ENDIAN);
5030 Offset +=1;
5032 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb,
5033 Offset, 1, ENC_BIG_ENDIAN);
5034 Offset +=1;
5036 break;
5038 case PTP_V2_MM_ID_PRIORITY1:
5040 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb,
5041 Offset, 1, ENC_BIG_ENDIAN);
5042 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5043 Offset+1, 1, ENC_NA);
5044 break;
5046 case PTP_V2_MM_ID_PRIORITY2:
5048 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb,
5049 Offset, 1, ENC_BIG_ENDIAN);
5050 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5051 Offset+1, 1, ENC_NA);
5052 break;
5054 case PTP_V2_MM_ID_DOMAIN:
5056 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb,
5057 Offset, 1, ENC_BIG_ENDIAN);
5058 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5059 Offset+1, 1, ENC_NA);
5060 break;
5062 case PTP_V2_MM_ID_SLAVE_ONLY:
5064 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_SO, tvb,
5065 Offset, 1, ENC_BIG_ENDIAN);
5066 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5067 Offset+1, 1, ENC_NA);
5068 break;
5070 case PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL:
5072 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb,
5073 Offset, 1, ENC_BIG_ENDIAN);
5075 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5076 Offset+1, 1, ENC_NA);
5077 break;
5079 case PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT:
5081 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb,
5082 Offset, 1, ENC_BIG_ENDIAN);
5084 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5085 Offset+1, 1, ENC_NA);
5086 break;
5088 case PTP_V2_MM_ID_LOG_SYNC_INTERVAL:
5090 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb,
5091 Offset, 1, ENC_BIG_ENDIAN);
5093 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5094 Offset+1, 1, ENC_NA);
5095 break;
5097 case PTP_V2_MM_ID_VERSION_NUMBER:
5099 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb,
5100 Offset, 1, ENC_BIG_ENDIAN);
5102 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5103 Offset+1, 1, ENC_NA);
5104 break;
5106 case PTP_V2_MM_ID_ENABLE_PORT:
5108 /* no data */
5109 break;
5111 case PTP_V2_MM_ID_DISABLE_PORT:
5113 /* no data */
5114 break;
5116 case PTP_V2_MM_ID_TIME:
5119 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_s, tvb,
5120 Offset, 6, ENC_BIG_ENDIAN);
5122 Offset +=6;
5123 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_ns, tvb,
5124 Offset, 4, ENC_BIG_ENDIAN);
5125 break;
5127 case PTP_V2_MM_ID_CLOCK_ACCURACY:
5129 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockAccuracy, tvb,
5130 Offset, 1, ENC_BIG_ENDIAN);
5131 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5132 Offset+1, 1, ENC_NA);
5133 break;
5135 case PTP_V2_MM_ID_UTC_PROPERTIES:
5137 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb,
5138 Offset, 2, ENC_BIG_ENDIAN);
5139 Offset +=2;
5141 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb,
5142 Offset, 1, ENC_BIG_ENDIAN);
5143 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb,
5144 Offset, 1, ENC_BIG_ENDIAN);
5145 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb,
5146 Offset, 1, ENC_BIG_ENDIAN);
5147 Offset +=1;
5149 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5150 Offset, 1, ENC_NA);
5151 break;
5153 case PTP_V2_MM_ID_TRACEABILITY_PROPERTIES:
5155 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb,
5156 Offset, 1, ENC_BIG_ENDIAN);
5157 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb,
5158 Offset, 1, ENC_BIG_ENDIAN);
5159 Offset +=1;
5161 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5162 Offset, 1, ENC_NA);
5164 break;
5166 case PTP_V2_MM_ID_TIMESCALE_PROPERTIES:
5168 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb,
5169 Offset, 1, ENC_BIG_ENDIAN);
5170 Offset +=1;
5172 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb,
5173 Offset, 1, ENC_BIG_ENDIAN);
5175 break;
5177 case PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE:
5179 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ucEN, tvb,
5180 Offset, 1, ENC_BIG_ENDIAN);
5181 Offset +=1;
5183 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5184 Offset, 1, ENC_NA);
5185 break;
5187 case PTP_V2_MM_ID_PATH_TRACE_LIST:
5189 uint16_t i = 0;
5190 /* one or more ClockIdentity */
5191 for (i = 0; i < (tlv_length / 8); i++)
5193 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
5194 Offset, 8, ENC_BIG_ENDIAN);
5197 break;
5199 case PTP_V2_MM_ID_PATH_TRACE_ENABLE:
5201 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ptEN, tvb,
5202 Offset, 1, ENC_BIG_ENDIAN);
5203 Offset +=1;
5205 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5206 Offset, 1, ENC_NA);
5208 break;
5210 case PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE:
5212 /* ToDo */
5213 break;
5215 case PTP_V2_MM_ID_UNICAST_MASTER_TABLE:
5217 /* ToDo */
5218 break;
5220 case PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE:
5222 /* ToDo */
5223 break;
5225 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE:
5227 /* ToDo */
5228 break;
5230 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED:
5232 /* ToDo */
5233 break;
5235 case PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE:
5237 /* ToDo */
5238 break;
5240 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE:
5242 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
5243 Offset, 1, ENC_BIG_ENDIAN);
5244 Offset +=1;
5246 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_atEN, tvb,
5247 Offset, 1, ENC_BIG_ENDIAN);
5248 Offset +=1;
5250 break;
5252 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME:
5254 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
5255 Offset, 1, ENC_BIG_ENDIAN);
5256 Offset +=1;
5258 dissect_ptp_v2_text (tvb, &Offset, ptp_managementData_tree,
5259 hf_ptp_v2_mm_displayName, hf_ptp_v2_mm_displayName_length);
5261 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
5262 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
5264 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
5265 Offset, 1, ENC_NA);
5267 break;
5269 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY:
5271 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_maxKey, tvb,
5272 Offset, 1, ENC_BIG_ENDIAN);
5273 Offset +=1;
5275 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5276 Offset, 1, ENC_NA);
5278 break;
5280 case PTP_V2_MM_ID_ALTERNATE_MASTER:
5282 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_transmitAlternateMulticastSync, tvb,
5283 Offset, 1, ENC_BIG_ENDIAN);
5284 Offset +=1;
5286 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfAlternateMasters, tvb,
5287 Offset, 1, ENC_BIG_ENDIAN);
5288 Offset +=1;
5290 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAlternateMulticastSyncInterval, tvb,
5291 Offset, 1, ENC_BIG_ENDIAN);
5292 Offset +=1;
5294 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5295 Offset, 1, ENC_NA);
5296 break;
5298 case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES:
5300 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
5301 Offset, 1, ENC_BIG_ENDIAN);
5302 Offset +=1;
5304 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentOffset, tvb,
5305 Offset, 4, ENC_BIG_ENDIAN);
5306 Offset +=4;
5308 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_jumpSeconds, tvb,
5309 Offset, 4, ENC_BIG_ENDIAN);
5310 Offset +=4;
5312 timeStamp = tvb_get_ntohl(tvb, Offset);
5313 timeStamp = timeStamp << 16;
5314 timeStamp = timeStamp | tvb_get_ntohs(tvb, Offset+4);
5316 proto_tree_add_uint64(ptp_managementData_tree, hf_ptp_v2_mm_nextjumpSeconds, tvb,
5317 Offset, 6, timeStamp);
5318 Offset +=6;
5320 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5321 Offset, 1, ENC_NA);
5322 break;
5324 case PTP_V2_MM_ID_TC_DEFAULT_DATA_SET:
5326 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
5327 Offset, 8, ENC_BIG_ENDIAN);
5328 Offset +=8;
5330 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb,
5331 Offset, 2, ENC_BIG_ENDIAN);
5332 Offset +=2;
5334 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
5335 Offset, 1, ENC_BIG_ENDIAN);
5336 Offset +=1;
5338 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb,
5339 Offset, 1, ENC_BIG_ENDIAN);
5341 break;
5343 case PTP_V2_MM_ID_TC_PORT_DATA_SET:
5345 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
5346 Offset, 8, ENC_BIG_ENDIAN);
5347 Offset +=8;
5349 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb,
5350 Offset, 2, ENC_BIG_ENDIAN);
5351 Offset +=2;
5353 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_faultyFlag, tvb,
5354 Offset, 1, ENC_BIG_ENDIAN);
5355 Offset +=1;
5357 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
5358 Offset, 1, ENC_BIG_ENDIAN);
5359 Offset +=1;
5361 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
5362 "Peer mean path delay", hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns);
5363 break;
5365 case PTP_V2_MM_ID_PRIMARY_DOMAIN:
5367 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb,
5368 Offset, 1, ENC_BIG_ENDIAN);
5370 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5371 Offset+1, 1, ENC_NA);
5372 break;
5374 case PTP_V2_MM_ID_DELAY_MECHANISM:
5376 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
5377 Offset, 1, ENC_BIG_ENDIAN);
5379 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5380 Offset+1, 1, ENC_NA);
5381 break;
5383 case PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL:
5385 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
5386 Offset, 1, ENC_BIG_ENDIAN);
5388 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
5389 Offset+1, 1, ENC_NA);
5390 break;
5392 default:
5394 /* no data */
5395 break;
5397 } /* switch(ptp_v2_managementId) */
5398 break;
5400 case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS:
5402 /* there is only one error TLV */
5403 uint16_t Offset = PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET;
5405 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementErrorId, tvb,
5406 Offset, 2, ENC_BIG_ENDIAN);
5407 Offset +=2;
5409 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementId, tvb,
5410 Offset, 2, ENC_BIG_ENDIAN);
5411 Offset +=2;
5413 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_reserved, tvb,
5414 Offset, 4, ENC_NA);
5415 Offset +=4;
5417 /* optional Field! */
5418 if (Offset - PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET + 2 < tlv_length)
5420 dissect_ptp_v2_text (tvb, &Offset, ptp_tree,
5421 hf_ptp_v2_mm_displayData, hf_ptp_v2_mm_displayData_length);
5424 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
5425 if ( (Offset - PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET) % 2 )
5427 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_pad, tvb,
5428 Offset, 1, ENC_NA);
5430 break;
5432 case PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION:
5434 uint32_t org_id;
5435 uint32_t subtype;
5436 proto_item *smptedata_ti, *systemframerate_ti, *timeaddressflags_ti, *daylightsavingflags_ti, *leapsecondjumpflags_ti;
5437 proto_tree *ptp_smptedata_tree, *ptp_framerate_tree, *ptp_timeaddress_tree, *ptp_daylightsaving_tree, *ptp_leapsecondjump_tree;
5438 uint16_t Offset = PTP_V2_MM_TLV_LENGTHFIELD_OFFSET + 2;
5440 proto_tree_add_item(ptp_tree, hf_ptp_v2_oe_tlv_organizationid,
5441 tvb, Offset, 3, ENC_BIG_ENDIAN);
5443 org_id = tvb_get_ntoh24(tvb, Offset);
5444 Offset += 3;
5446 switch (org_id)
5448 case OUI_SMPTE:
5450 proto_tree_add_item(ptp_tree, hf_ptp_v2_oe_tlv_smpte_subtype,
5451 tvb, Offset, 3, ENC_BIG_ENDIAN);
5452 subtype = tvb_get_ntoh24(tvb, Offset);
5453 Offset += 3;
5455 switch (subtype)
5457 case PTP_V2_OE_ORG_SMPTE_SUBTYPE_VERSION_TLV:
5459 smptedata_ti = proto_tree_add_item(ptp_tree,
5460 hf_ptp_v2_oe_tlv_subtype_smpte_data, tvb, Offset, 42, ENC_NA);
5461 ptp_smptedata_tree = proto_item_add_subtree(smptedata_ti, ett_ptp_oe_smpte_data);
5462 systemframerate_ti = proto_tree_add_item(ptp_smptedata_tree,
5463 hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate, tvb, Offset, 8, ENC_NA);
5464 ptp_framerate_tree = proto_item_add_subtree(systemframerate_ti, ett_ptp_oe_smpte_framerate);
5465 proto_tree_add_item(ptp_framerate_tree,
5466 hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator, tvb, Offset, 4, ENC_BIG_ENDIAN);
5467 proto_tree_add_item(ptp_framerate_tree,
5468 hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator, tvb, Offset+4, 4, ENC_BIG_ENDIAN);
5469 Offset += 8;
5471 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus,
5472 tvb, Offset, 1, ENC_BIG_ENDIAN);
5473 Offset += 1;
5475 timeaddressflags_ti = proto_tree_add_item(ptp_smptedata_tree,
5476 hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags, tvb, Offset, 1, ENC_NA);
5477 ptp_timeaddress_tree = proto_item_add_subtree(timeaddressflags_ti, ett_ptp_oe_smpte_timeaddress);
5478 proto_tree_add_item(ptp_timeaddress_tree,
5479 hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop, tvb, Offset, 1, ENC_BIG_ENDIAN);
5480 proto_tree_add_item(ptp_timeaddress_tree,
5481 hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color, tvb, Offset, 1, ENC_BIG_ENDIAN);
5482 Offset += 1;
5484 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset,
5485 tvb, Offset, 4, ENC_BIG_ENDIAN);
5486 Offset += 4;
5488 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds,
5489 tvb, Offset, 4, ENC_BIG_ENDIAN);
5490 Offset += 4;
5492 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump,
5493 tvb, Offset, 6, ENC_BIG_ENDIAN);
5494 Offset += 6;
5496 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam,
5497 tvb, Offset, 6, ENC_BIG_ENDIAN);
5498 Offset += 6;
5500 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam,
5501 tvb, Offset, 6, ENC_BIG_ENDIAN);
5502 Offset += 6;
5504 proto_tree_add_item(ptp_smptedata_tree, hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset,
5505 tvb, Offset, 4, ENC_BIG_ENDIAN);
5506 Offset += 4;
5508 daylightsavingflags_ti = proto_tree_add_item(ptp_smptedata_tree,
5509 hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving, tvb, Offset, 1, ENC_NA);
5510 ptp_daylightsaving_tree = proto_item_add_subtree(daylightsavingflags_ti, ett_ptp_oe_smpte_daylightsaving);
5511 proto_tree_add_item(ptp_daylightsaving_tree,
5512 hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current, tvb, Offset, 1, ENC_BIG_ENDIAN);
5513 proto_tree_add_item(ptp_daylightsaving_tree,
5514 hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next, tvb, Offset, 1, ENC_BIG_ENDIAN);
5515 proto_tree_add_item(ptp_daylightsaving_tree,
5516 hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous, tvb, Offset, 1, ENC_BIG_ENDIAN);
5517 Offset += 1;
5519 leapsecondjumpflags_ti = proto_tree_add_item(ptp_smptedata_tree,
5520 hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump, tvb, Offset, 1, ENC_NA);
5521 ptp_leapsecondjump_tree = proto_item_add_subtree(leapsecondjumpflags_ti, ett_ptp_oe_smpte_leapsecondjump);
5522 proto_tree_add_item(ptp_leapsecondjump_tree,
5523 hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change, tvb, Offset, 1, ENC_BIG_ENDIAN);
5524 break;
5527 break;
5531 default:
5533 break;
5535 } /* switch TLV Type */
5536 } /* case Management Message */
5537 } /* switch message ID */
5538 } /* tree */
5542 /* Register the protocol with Wireshark */
5544 void
5545 proto_register_ptp(void)
5547 static hf_register_info hf[] = {
5548 /* PTPv1 fields **********************************************************/
5549 /* Common fields for all frames */
5550 { &hf_ptp_versionptp,
5551 { "versionPTP", "ptp.versionptp",
5552 FT_UINT16, BASE_DEC, NULL, 0x00,
5553 NULL, HFILL }
5555 { &hf_ptp_versionnetwork,
5556 { "versionNetwork", "ptp.versionnetwork",
5557 FT_UINT16, BASE_DEC, NULL, 0x00,
5558 NULL, HFILL }
5560 { &hf_ptp_subdomain,
5561 { "subdomain", "ptp.subdomain",
5562 FT_STRING, BASE_NONE, NULL, 0x00,
5563 NULL, HFILL }
5565 { &hf_ptp_messagetype,
5566 { "messageType", "ptp.messagetype",
5567 FT_UINT8, BASE_DEC, VALS(ptp_messagetype_vals), 0x00,
5568 NULL, HFILL }
5570 { &hf_ptp_sourcecommunicationtechnology,
5571 { "sourceCommunicationTechnology", "ptp.sourcecommunicationtechnology",
5572 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5573 NULL, HFILL }
5575 { &hf_ptp_sourceuuid,
5576 { "sourceUuid", "ptp.sourceuuid",
5577 FT_ETHER, BASE_NONE, NULL, 0x00,
5578 NULL, HFILL }
5580 { &hf_ptp_sourceportid,
5581 { "sourcePortId", "ptp.sourceportid",
5582 FT_UINT16, BASE_DEC, NULL, 0x00,
5583 NULL, HFILL }
5585 { &hf_ptp_sequenceid,
5586 { "sequenceId", "ptp.sequenceid",
5587 FT_UINT16, BASE_DEC, NULL, 0x00,
5588 NULL, HFILL }
5590 { &hf_ptp_controlfield,
5591 { "controlField", "ptp.controlfield",
5592 FT_UINT8, BASE_DEC, VALS(ptp_controlfield_vals), 0x00,
5593 NULL, HFILL }
5595 /* THE FLAGS-FIELD */
5596 { &hf_ptp_flags,
5597 { "flags", "ptp.flags",
5598 FT_UINT16, BASE_HEX, NULL, 0x00,
5599 NULL, HFILL }
5601 { &hf_ptp_flags_li61,
5602 { "PTP_LI61", "ptp.flags.li61",
5603 FT_BOOLEAN, 16, NULL, PTP_FLAGS_LI61_BITMASK,
5604 NULL, HFILL }
5606 { &hf_ptp_flags_li59,
5607 { "PTP_LI59", "ptp.flags.li59",
5608 FT_BOOLEAN, 16, NULL, PTP_FLAGS_LI59_BITMASK,
5609 NULL, HFILL }
5611 { &hf_ptp_flags_boundary_clock,
5612 { "PTP_BOUNDARY_CLOCK", "ptp.flags.boundary_clock",
5613 FT_BOOLEAN, 16, NULL, PTP_FLAGS_BOUNDARY_CLOCK_BITMASK,
5614 NULL, HFILL }
5616 { &hf_ptp_flags_assist,
5617 { "PTP_ASSIST", "ptp.flags.assist",
5618 FT_BOOLEAN, 16, NULL, PTP_FLAGS_ASSIST_BITMASK,
5619 NULL, HFILL }
5621 { &hf_ptp_flags_ext_sync,
5622 { "PTP_EXT_SYNC", "ptp.flags.ext_sync",
5623 FT_BOOLEAN, 16, NULL, PTP_FLAGS_EXT_SYNC_BITMASK,
5624 NULL, HFILL }
5626 { &hf_ptp_flags_parent,
5627 { "PTP_PARENT_STATS", "ptp.flags.parent_stats",
5628 FT_BOOLEAN, 16, NULL, PTP_FLAGS_PARENT_STATS_BITMASK,
5629 NULL, HFILL }
5631 { &hf_ptp_flags_sync_burst,
5632 { "PTP_SYNC_BURST", "ptp.flags.sync_burst",
5633 FT_BOOLEAN, 16, NULL, PTP_FLAGS_SYNC_BURST_BITMASK,
5634 NULL, HFILL }
5636 /* END OF THE FLAG-FIELD */
5638 /* offsets for ptp_sync and delay_req (=sdr) messages */
5639 { &hf_ptp_sdr_origintimestamp,
5640 { "originTimestamp", "ptp.sdr.origintimestamp",
5641 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5642 NULL, HFILL }
5644 { &hf_ptp_sdr_origintimestamp_seconds,
5645 { "originTimestamp (seconds)", "ptp.sdr.origintimestamp_seconds",
5646 FT_UINT32, BASE_DEC, NULL, 0x00,
5647 NULL, HFILL }
5649 { &hf_ptp_sdr_origintimestamp_nanoseconds,
5650 { "originTimestamp (nanoseconds)", "ptp.sdr.origintimestamp_nanoseconds",
5651 FT_INT32, BASE_DEC, NULL, 0x00,
5652 NULL, HFILL }
5654 { &hf_ptp_sdr_epochnumber,
5655 { "epochNumber", "ptp.sdr.epochnumber",
5656 FT_UINT16, BASE_DEC, NULL, 0x00,
5657 NULL, HFILL }
5659 { &hf_ptp_sdr_currentutcoffset,
5660 { "currentUTCOffset", "ptp.sdr.currentutcoffset",
5661 FT_INT16, BASE_DEC, NULL, 0x00,
5662 NULL, HFILL }
5664 { &hf_ptp_sdr_grandmastercommunicationtechnology,
5665 { "grandmasterCommunicationTechnology", "ptp.sdr.grandmastercommunicationtechnology",
5666 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5667 NULL, HFILL }
5669 { &hf_ptp_sdr_grandmasterclockuuid,
5670 { "grandMasterClockUuid", "ptp.sdr.grandmasterclockuuid",
5671 FT_ETHER, BASE_NONE, NULL, 0x00,
5672 NULL, HFILL }
5674 { &hf_ptp_sdr_grandmasterportid,
5675 { "grandmasterPortId", "ptp.sdr.grandmasterportid",
5676 FT_UINT16, BASE_DEC, NULL, 0x00,
5677 NULL, HFILL }
5679 { &hf_ptp_sdr_grandmastersequenceid,
5680 { "grandmasterSequenceId", "ptp.sdr.grandmastersequenceid",
5681 FT_UINT16, BASE_DEC, NULL, 0x00,
5682 NULL, HFILL }
5684 { &hf_ptp_sdr_grandmasterclockstratum,
5685 { "grandmasterClockStratum", "ptp.sdr.grandmasterclockstratum",
5686 FT_UINT8, BASE_DEC, NULL, 0x00,
5687 NULL, HFILL }
5689 { &hf_ptp_sdr_grandmasterclockidentifier,
5690 { "grandmasterClockIdentifier", "ptp.sdr.grandmasterclockidentifier",
5691 FT_STRING, BASE_NONE, NULL, 0x00,
5692 NULL, HFILL }
5694 { &hf_ptp_sdr_grandmasterclockvariance,
5695 { "grandmasterClockVariance", "ptp.sdr.grandmasterclockvariance",
5696 FT_INT16, BASE_DEC, NULL, 0x00,
5697 NULL, HFILL }
5699 { &hf_ptp_sdr_grandmasterpreferred,
5700 { "grandmasterPreferred", "ptp.sdr.grandmasterpreferred",
5701 FT_UINT8, BASE_DEC, NULL, 0x00,
5702 NULL, HFILL }
5704 { &hf_ptp_sdr_grandmasterisboundaryclock,
5705 { "grandmasterIsBoundaryClock", "ptp.sdr.grandmasterisboundaryclock",
5706 FT_UINT8, BASE_DEC, NULL, 0x00,
5707 NULL, HFILL }
5709 { &hf_ptp_sdr_syncinterval,
5710 { "syncInterval", "ptp.sdr.syncinterval",
5711 FT_INT8, BASE_DEC, NULL, 0x00,
5712 NULL, HFILL }
5714 { &hf_ptp_sdr_localclockvariance,
5715 { "localClockVariance", "ptp.sdr.localclockvariance",
5716 FT_INT16, BASE_DEC, NULL, 0x00,
5717 NULL, HFILL }
5719 { &hf_ptp_sdr_localstepsremoved,
5720 { "localStepsRemoved", "ptp.sdr.localstepsremoved",
5721 FT_UINT16, BASE_DEC, NULL, 0x00,
5722 NULL, HFILL }
5724 { &hf_ptp_sdr_localclockstratum,
5725 { "localClockStratum", "ptp.sdr.localclockstratum",
5726 FT_UINT8, BASE_DEC, NULL, 0x00,
5727 NULL, HFILL }
5729 { &hf_ptp_sdr_localclockidentifier,
5730 { "localClockIdentifier", "ptp.sdr.localclockidentifier",
5731 FT_STRING, BASE_NONE, NULL, 0x00,
5732 NULL, HFILL }
5734 { &hf_ptp_sdr_parentcommunicationtechnology,
5735 { "parentCommunicationTechnology", "ptp.sdr.parentcommunicationtechnology",
5736 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5737 NULL, HFILL }
5739 { &hf_ptp_sdr_parentuuid,
5740 { "parentUuid", "ptp.sdr.parentuuid",
5741 FT_ETHER, BASE_NONE, NULL, 0x00,
5742 NULL, HFILL }
5744 { &hf_ptp_sdr_parentportfield,
5745 { "parentPortField", "ptp.sdr.parentportfield",
5746 FT_UINT16, BASE_DEC, NULL, 0x00,
5747 NULL, HFILL }
5749 { &hf_ptp_sdr_estimatedmastervariance,
5750 { "estimatedMasterVariance", "ptp.sdr.estimatedmastervariance",
5751 FT_INT16, BASE_DEC, NULL, 0x00,
5752 NULL, HFILL }
5754 { &hf_ptp_sdr_estimatedmasterdrift,
5755 { "estimatedMasterDrift", "ptp.sdr.estimatedmasterdrift",
5756 FT_INT32, BASE_DEC, NULL, 0x00,
5757 NULL, HFILL }
5759 { &hf_ptp_sdr_utcreasonable,
5760 { "utcReasonable", "ptp.sdr.utcreasonable",
5761 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5762 NULL, HFILL }
5764 /* offsets for follow_up (=fu) messages */
5765 { &hf_ptp_fu_associatedsequenceid,
5766 { "associatedSequenceId", "ptp.fu.associatedsequenceid",
5767 FT_UINT16, BASE_DEC, NULL, 0x00,
5768 NULL, HFILL }
5770 { &hf_ptp_fu_preciseorigintimestamp,
5771 { "preciseOriginTimestamp", "ptp.fu.preciseorigintimestamp",
5772 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5773 NULL, HFILL }
5775 { &hf_ptp_fu_preciseorigintimestamp_seconds,
5776 { "preciseOriginTimestamp (seconds)", "ptp.fu.preciseorigintimestamp_seconds",
5777 FT_UINT32, BASE_DEC, NULL, 0x00,
5778 NULL, HFILL }
5780 { &hf_ptp_fu_preciseorigintimestamp_nanoseconds,
5781 { "preciseOriginTimestamp (nanoseconds)", "ptp.fu.preciseorigintimestamp_nanoseconds",
5782 FT_INT32, BASE_DEC, NULL, 0x00,
5783 NULL, HFILL }
5785 /* offsets for delay_resp (=dr) messages */
5786 { &hf_ptp_dr_delayreceipttimestamp,
5787 { "delayReceiptTimestamp", "ptp.dr.delayreceipttimestamp",
5788 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
5789 NULL, HFILL }
5791 { &hf_ptp_dr_delayreceipttimestamp_seconds,
5792 { "delayReceiptTimestamp (Seconds)", "ptp.dr.delayreceipttimestamp_seconds",
5793 FT_UINT32, BASE_DEC, NULL, 0x00,
5794 NULL, HFILL }
5796 { &hf_ptp_dr_delayreceipttimestamp_nanoseconds,
5797 { "delayReceiptTimestamp (nanoseconds)", "ptp.dr.delayreceipttimestamp_nanoseconds",
5798 FT_INT32, BASE_DEC, NULL, 0x00,
5799 NULL, HFILL }
5801 { &hf_ptp_dr_requestingsourcecommunicationtechnology,
5802 { "requestingSourceCommunicationTechnology", "ptp.dr.requestingsourcecommunicationtechnology",
5803 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5804 NULL, HFILL }
5806 { &hf_ptp_dr_requestingsourceuuid,
5807 { "requestingSourceUuid", "ptp.dr.requestingsourceuuid",
5808 FT_ETHER, BASE_NONE, NULL, 0x00,
5809 NULL, HFILL }
5811 { &hf_ptp_dr_requestingsourceportid,
5812 { "requestingSourcePortId", "ptp.dr.requestingsourceportid",
5813 FT_UINT16, BASE_DEC, NULL, 0x00,
5814 NULL, HFILL }
5816 { &hf_ptp_dr_requestingsourcesequenceid,
5817 { "requestingSourceSequenceId", "ptp.dr.requestingsourcesequenceid",
5818 FT_UINT16, BASE_DEC, NULL, 0x00,
5819 NULL, HFILL }
5821 /* offsets for management (=mm) messages */
5822 { &hf_ptp_mm_targetcommunicationtechnology,
5823 { "targetCommunicationTechnology", "ptp.mm.targetcommunicationtechnology",
5824 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5825 NULL, HFILL }
5827 { &hf_ptp_mm_targetuuid,
5828 { "targetUuid", "ptp.mm.targetuuid",
5829 FT_ETHER, BASE_NONE, NULL, 0x00,
5830 NULL, HFILL }
5832 { &hf_ptp_mm_targetportid,
5833 { "targetPortId", "ptp.mm.targetportid",
5834 FT_UINT16, BASE_DEC, NULL, 0x00,
5835 NULL, HFILL }
5837 { &hf_ptp_mm_startingboundaryhops,
5838 { "startingBoundaryHops", "ptp.mm.startingboundaryhops",
5839 FT_INT16, BASE_DEC, NULL, 0x00,
5840 NULL, HFILL }
5842 { &hf_ptp_mm_boundaryhops,
5843 { "boundaryHops", "ptp.mm.boundaryhops",
5844 FT_INT16, BASE_DEC, NULL, 0x00,
5845 NULL, HFILL }
5847 { &hf_ptp_mm_managementmessagekey,
5848 { "managementMessageKey", "ptp.mm.managementmessagekey",
5849 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_managementMessageKey_vals_ext, 0x00,
5850 NULL, HFILL }
5852 { &hf_ptp_mm_parameterlength,
5853 { "parameterLength", "ptp.mm.parameterlength",
5854 FT_UINT16, BASE_DEC, NULL, 0x00,
5855 NULL, HFILL }
5857 /* parameterlength > 0 */
5858 #if 0
5859 { &hf_ptp_mm_messageparameters,
5860 { "messageParameters", "ptp.mm.messageparameters",
5861 FT_BYTES, BASE_NONE, NULL, 0x00,
5862 NULL, HFILL }
5864 #endif
5865 /* ptp_mm_clock_identity (parameterlength = 64) */
5866 { &hf_ptp_mm_clock_identity_clockcommunicationtechnology,
5867 { "clockCommunicationTechnology", "ptp.mm.clock.identity.clockcommunicationtechnology",
5868 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5869 NULL, HFILL }
5871 { &hf_ptp_mm_clock_identity_clockuuidfield,
5872 { "clockUuidField", "ptp.mm.clock.identity.clockuuidfield",
5873 FT_ETHER, BASE_NONE, NULL, 0x00,
5874 NULL, HFILL }
5876 { &hf_ptp_mm_clock_identity_clockportfield,
5877 { "clockPortField", "ptp.mm.clock.identity.clockportfield",
5878 FT_UINT16, BASE_DEC, NULL, 0x00,
5879 NULL, HFILL }
5881 { &hf_ptp_mm_clock_identity_manufactureridentity,
5882 { "manufacturerIdentity", "ptp.mm.clock.identity.manufactureridentity",
5883 FT_BYTES, BASE_NONE, NULL, 0x00,
5884 NULL, HFILL }
5887 /* ptp_mm_initialize_clock (parameterlength = 4) */
5888 { &hf_ptp_mm_initialize_clock_initialisationkey,
5889 { "initialisationKey", "ptp.mm.initialize.clock.initialisationkey",
5890 FT_UINT16, BASE_DEC, NULL, 0x00,
5891 NULL, HFILL }
5893 /* ptp_mm_set_subdomain (parameterlength = 16) */
5894 { &hf_ptp_mm_set_subdomain_subdomainname,
5895 { "subdomainName", "ptp.mm.set.subdomain.subdomainname",
5896 FT_STRING, BASE_NONE, NULL, 0x00,
5897 NULL, HFILL }
5899 /* ptp_mm_default_data_set (parameterlength = 76) */
5900 { &hf_ptp_mm_default_data_set_clockcommunicationtechnology,
5901 { "clockCommunicationTechnology", "ptp.mm.default.data.set.clockcommunicationtechnology",
5902 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
5903 NULL, HFILL }
5905 { &hf_ptp_mm_default_data_set_clockuuidfield,
5906 { "clockUuidField", "ptp.mm.default.data.set.clockuuidfield",
5907 FT_ETHER, BASE_NONE, NULL, 0x00,
5908 NULL, HFILL }
5910 { &hf_ptp_mm_default_data_set_clockportfield,
5911 { "clockPortField", "ptp.mm.default.data.set.clockportfield",
5912 FT_UINT16, BASE_DEC, NULL, 0x00,
5913 NULL, HFILL }
5915 { &hf_ptp_mm_default_data_set_clockstratum,
5916 { "clockStratum", "ptp.mm.default.data.set.clockstratum",
5917 FT_UINT8, BASE_DEC, NULL, 0x00,
5918 NULL, HFILL }
5920 { &hf_ptp_mm_default_data_set_clockidentifier,
5921 { "clockIdentifier", "ptp.mm.default.data.set.clockidentifier",
5922 FT_BYTES, BASE_NONE, NULL, 0x00,
5923 NULL, HFILL }
5925 { &hf_ptp_mm_default_data_set_clockvariance,
5926 { "clockVariance", "ptp.mm.default.data.set.clockvariance",
5927 FT_UINT16, BASE_DEC, NULL, 0x00,
5928 NULL, HFILL }
5930 { &hf_ptp_mm_default_data_set_clockfollowupcapable,
5931 { "clockFollowupCapable", "ptp.mm.default.data.set.clockfollowupcapable",
5932 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5933 NULL, HFILL }
5935 { &hf_ptp_mm_default_data_set_preferred,
5936 { "preferred", "ptp.mm.default.data.set.preferred",
5937 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5938 NULL, HFILL }
5940 { &hf_ptp_mm_default_data_set_initializable,
5941 { "initializable", "ptp.mm.default.data.set.initializable",
5942 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5943 NULL, HFILL }
5945 { &hf_ptp_mm_default_data_set_externaltiming,
5946 { "externalTiming", "ptp.mm.default.data.set.externaltiming",
5947 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5948 NULL, HFILL }
5950 { &hf_ptp_mm_default_data_set_isboundaryclock,
5951 { "isBoundaryClock", "ptp.mm.default.data.set.isboundaryclock",
5952 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5953 NULL, HFILL }
5955 { &hf_ptp_mm_default_data_set_syncinterval,
5956 { "syncInterval", "ptp.mm.default.data.set.syncinterval",
5957 FT_INT8, BASE_DEC, NULL, 0x00,
5958 NULL, HFILL }
5960 { &hf_ptp_mm_default_data_set_subdomainname,
5961 { "subDomainName", "ptp.mm.default.data.set.subdomainname",
5962 FT_STRING, BASE_NONE, NULL, 0x00,
5963 NULL, HFILL }
5965 { &hf_ptp_mm_default_data_set_numberports,
5966 { "numberPorts", "ptp.mm.default.data.set.numberports",
5967 FT_UINT16, BASE_DEC, NULL, 0x00,
5968 NULL, HFILL }
5970 { &hf_ptp_mm_default_data_set_numberforeignrecords,
5971 { "numberForeignRecords", "ptp.mm.default.data.set.numberforeignrecords",
5972 FT_UINT16, BASE_DEC, NULL, 0x00,
5973 NULL, HFILL }
5975 /* ptp_mm_update_default_data_set (parameterlength = 36) */
5976 { &hf_ptp_mm_update_default_data_set_clockstratum,
5977 { "clockStratum", "ptp.mm.update.default.data.set.clockstratum",
5978 FT_UINT8, BASE_DEC, NULL, 0x00,
5979 NULL, HFILL }
5981 { &hf_ptp_mm_update_default_data_set_clockidentifier,
5982 { "clockIdentifier", "ptp.mm.update.default.data.set.clockidentifier",
5983 FT_BYTES, BASE_NONE, NULL, 0x00,
5984 NULL, HFILL }
5986 { &hf_ptp_mm_update_default_data_set_clockvariance,
5987 { "clockVariance", "ptp.mm.update.default.data.set.clockvariance",
5988 FT_UINT16, BASE_DEC, NULL, 0x00,
5989 NULL, HFILL }
5991 { &hf_ptp_mm_update_default_data_set_preferred,
5992 { "preferred", "ptp.mm.update.default.data.set.preferred",
5993 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5994 NULL, HFILL }
5996 { &hf_ptp_mm_update_default_data_set_syncinterval,
5997 { "syncInterval", "ptp.mm.update.default.data.set.syncinterval",
5998 FT_INT8, BASE_DEC, NULL, 0x00,
5999 NULL, HFILL }
6001 { &hf_ptp_mm_update_default_data_set_subdomainname,
6002 { "subdomainName", "ptp.mm.update.default.data.set.subdomainname",
6003 FT_STRING, BASE_NONE, NULL, 0x00,
6004 NULL, HFILL }
6006 /* ptp_mm_current_data_set (parameterlength = 20) */
6007 { &hf_ptp_mm_current_data_set_stepsremoved,
6008 { "stepsRemoved", "ptp.mm.current.data.set.stepsremoved",
6009 FT_UINT16, BASE_DEC, NULL, 0x00,
6010 NULL, HFILL }
6012 { &hf_ptp_mm_current_data_set_offsetfrommaster,
6013 { "offsetFromMaster", "ptp.mm.current.data.set.offsetfrommaster",
6014 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6015 NULL, HFILL }
6017 { &hf_ptp_mm_current_data_set_offsetfrommasterseconds,
6018 { "offsetFromMasterSeconds", "ptp.mm.current.data.set.offsetfrommasterseconds",
6019 FT_UINT32, BASE_DEC, NULL, 0x00,
6020 NULL, HFILL }
6022 { &hf_ptp_mm_current_data_set_offsetfrommasternanoseconds,
6023 { "offsetFromMasterNanoseconds", "ptp.mm.current.data.set.offsetfrommasternanoseconds",
6024 FT_INT32, BASE_DEC, NULL, 0x00,
6025 NULL, HFILL }
6027 { &hf_ptp_mm_current_data_set_onewaydelay,
6028 { "oneWayDelay", "ptp.mm.current.data.set.onewaydelay",
6029 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6030 NULL, HFILL }
6032 { &hf_ptp_mm_current_data_set_onewaydelayseconds,
6033 { "oneWayDelaySeconds", "ptp.mm.current.data.set.onewaydelayseconds",
6034 FT_UINT32, BASE_DEC, NULL, 0x00,
6035 NULL, HFILL }
6037 { &hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
6038 { "oneWayDelayNanoseconds", "ptp.mm.current.data.set.onewaydelaynanoseconds",
6039 FT_INT32, BASE_DEC, NULL, 0x00,
6040 NULL, HFILL }
6042 /* ptp_mm_parent_data_set (parameterlength = 90) */
6043 { &hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
6044 { "parentCommunicationTechnology", "ptp.mm.parent.data.set.parentcommunicationtechnology",
6045 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
6046 NULL, HFILL }
6048 { &hf_ptp_mm_parent_data_set_parentuuid,
6049 { "parentUuid", "ptp.mm.parent.data.set.parentuuid",
6050 FT_ETHER, BASE_NONE, NULL, 0x00,
6051 NULL, HFILL }
6053 { &hf_ptp_mm_parent_data_set_parentportid,
6054 { "parentPortId", "ptp.mm.parent.data.set.parentportid",
6055 FT_UINT16, BASE_DEC, NULL, 0x00,
6056 NULL, HFILL }
6058 { &hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
6059 { "parentLastSyncSequenceNumber", "ptp.mm.parent.data.set.parentlastsyncsequencenumber",
6060 FT_UINT16, BASE_DEC, NULL, 0x00,
6061 NULL, HFILL }
6063 { &hf_ptp_mm_parent_data_set_parentfollowupcapable,
6064 { "parentFollowupCapable", "ptp.mm.parent.data.set.parentfollowupcapable",
6065 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6066 NULL, HFILL }
6068 { &hf_ptp_mm_parent_data_set_parentexternaltiming,
6069 { "parentExternalTiming", "ptp.mm.parent.data.set.parentexternaltiming",
6070 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6071 NULL, HFILL }
6073 { &hf_ptp_mm_parent_data_set_parentvariance,
6074 { "parentVariance", "ptp.mm.parent.data.set.parentvariance",
6075 FT_UINT16, BASE_DEC, NULL, 0x00,
6076 NULL, HFILL }
6078 { &hf_ptp_mm_parent_data_set_parentstats,
6079 { "parentStats", "ptp.mm.parent.data.set.parentstats",
6080 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6081 NULL, HFILL }
6083 { &hf_ptp_mm_parent_data_set_observedvariance,
6084 { "observedVariance", "ptp.mm.parent.data.set.observedvariance",
6085 FT_INT16, BASE_DEC, NULL, 0x00,
6086 NULL, HFILL }
6088 { &hf_ptp_mm_parent_data_set_observeddrift,
6089 { "observedDrift", "ptp.mm.parent.data.set.observeddrift",
6090 FT_INT32, BASE_DEC, NULL, 0x00,
6091 NULL, HFILL }
6093 { &hf_ptp_mm_parent_data_set_utcreasonable,
6094 { "utcReasonable", "ptp.mm.parent.data.set.utcreasonable",
6095 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6096 NULL, HFILL }
6098 { &hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
6099 { "grandmasterCommunicationTechnology", "ptp.mm.parent.data.set.grandmastercommunicationtechnology",
6100 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
6101 NULL, HFILL }
6103 { &hf_ptp_mm_parent_data_set_grandmasteruuidfield,
6104 { "grandmasterUuidField", "ptp.mm.parent.data.set.grandmasteruuidfield",
6105 FT_ETHER, BASE_NONE, NULL, 0x00,
6106 NULL, HFILL }
6108 { &hf_ptp_mm_parent_data_set_grandmasterportidfield,
6109 { "grandmasterPortIdField", "ptp.mm.parent.data.set.grandmasterportidfield",
6110 FT_UINT16, BASE_DEC, NULL, 0x00,
6111 NULL, HFILL }
6113 { &hf_ptp_mm_parent_data_set_grandmasterstratum,
6114 { "grandmasterStratum", "ptp.mm.parent.data.set.grandmasterstratum",
6115 FT_UINT8, BASE_DEC, NULL, 0x00,
6116 NULL, HFILL }
6118 { &hf_ptp_mm_parent_data_set_grandmasteridentifier,
6119 { "grandmasterIdentifier", "ptp.mm.parent.data.set.grandmasteridentifier",
6120 FT_BYTES, BASE_NONE, NULL, 0x00,
6121 NULL, HFILL }
6123 { &hf_ptp_mm_parent_data_set_grandmastervariance,
6124 { "grandmasterVariance", "ptp.mm.parent.data.set.grandmastervariance",
6125 FT_INT16, BASE_DEC, NULL, 0x00,
6126 NULL, HFILL }
6128 { &hf_ptp_mm_parent_data_set_grandmasterpreferred,
6129 { "grandmasterPreferred", "ptp.mm.parent.data.set.grandmasterpreferred",
6130 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6131 NULL, HFILL }
6133 { &hf_ptp_mm_parent_data_set_grandmasterisboundaryclock,
6134 { "grandmasterIsBoundaryClock", "ptp.mm.parent.data.set.grandmasterisboundaryclock",
6135 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6136 NULL, HFILL }
6138 { &hf_ptp_mm_parent_data_set_grandmastersequencenumber,
6139 { "grandmasterSequenceNumber", "ptp.mm.parent.data.set.grandmastersequencenumber",
6140 FT_UINT16, BASE_DEC, NULL, 0x00,
6141 NULL, HFILL }
6143 /* ptp_mm_port_data_set (parameterlength = 52) */
6144 { &hf_ptp_mm_port_data_set_returnedportnumber,
6145 { "returnedPortNumber", "ptp.mm.port.data.set.returnedportnumber",
6146 FT_UINT16, BASE_DEC, NULL, 0x00,
6147 NULL, HFILL }
6149 { &hf_ptp_mm_port_data_set_portstate,
6150 { "portState", "ptp.mm.port.data.set.portstate",
6151 FT_UINT8, BASE_DEC, NULL, 0x00,
6152 NULL, HFILL }
6154 { &hf_ptp_mm_port_data_set_lastsynceventsequencenumber,
6155 { "lastSyncEventSequenceNumber", "ptp.mm.port.data.set.lastsynceventsequencenumber",
6156 FT_UINT16, BASE_DEC, NULL, 0x00,
6157 NULL, HFILL }
6159 { &hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
6160 { "lastGeneralEventSequenceNumber", "ptp.mm.port.data.set.lastgeneraleventsequencenumber",
6161 FT_UINT16, BASE_DEC, NULL, 0x00,
6162 NULL, HFILL }
6164 { &hf_ptp_mm_port_data_set_portcommunicationtechnology,
6165 { "portCommunicationTechnology", "ptp.mm.port.data.set.portcommunicationtechnology",
6166 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
6167 NULL, HFILL }
6169 { &hf_ptp_mm_port_data_set_portuuidfield,
6170 { "portUuidField", "ptp.mm.port.data.set.portuuidfield",
6171 FT_ETHER, BASE_NONE, NULL, 0x00,
6172 NULL, HFILL }
6174 { &hf_ptp_mm_port_data_set_portidfield,
6175 { "portIdField", "ptp.mm.port.data.set.portidfield",
6176 FT_UINT16, BASE_DEC, NULL, 0x00,
6177 NULL, HFILL }
6179 { &hf_ptp_mm_port_data_set_burstenabled,
6180 { "burstEnabled", "ptp.mm.port.data.set.burstenabled",
6181 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6182 NULL, HFILL }
6184 { &hf_ptp_mm_port_data_set_subdomainaddressoctets,
6185 { "subdomainAddressOctets", "ptp.mm.port.data.set.subdomainaddressoctets",
6186 FT_UINT8, BASE_DEC, NULL, 0x00,
6187 NULL, HFILL }
6189 { &hf_ptp_mm_port_data_set_eventportaddressoctets,
6190 { "eventPortAddressOctets", "ptp.mm.port.data.set.eventportaddressoctets",
6191 FT_UINT8, BASE_DEC, NULL, 0x00,
6192 NULL, HFILL }
6194 { &hf_ptp_mm_port_data_set_generalportaddressoctets,
6195 { "generalPortAddressOctets", "ptp.mm.port.data.set.generalportaddressoctets",
6196 FT_UINT8, BASE_DEC, NULL, 0x00,
6197 NULL, HFILL }
6199 { &hf_ptp_mm_port_data_set_subdomainaddress,
6200 { "subdomainAddress", "ptp.mm.port.data.set.subdomainaddress",
6201 FT_BYTES, BASE_NONE, NULL, 0x00,
6202 NULL, HFILL }
6204 { &hf_ptp_mm_port_data_set_eventportaddress,
6205 { "eventPortAddress", "ptp.mm.port.data.set.eventportaddress",
6206 FT_BYTES, BASE_NONE, NULL, 0x00,
6207 NULL, HFILL }
6209 { &hf_ptp_mm_port_data_set_generalportaddress,
6210 { "generalPortAddress", "ptp.mm.port.data.set.generalportaddress",
6211 FT_BYTES, BASE_NONE, NULL, 0x00,
6212 NULL, HFILL }
6214 /* ptp_mm_global_time_data_set (parameterlength = 24) */
6215 { &hf_ptp_mm_global_time_data_set_localtime,
6216 { "localTime", "ptp.mm.global.time.data.set.localtime",
6217 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6218 NULL, HFILL }
6220 { &hf_ptp_mm_global_time_data_set_localtimeseconds,
6221 { "localTimeSeconds", "ptp.mm.global.time.data.set.localtimeseconds",
6222 FT_UINT32, BASE_DEC, NULL, 0x00,
6223 NULL, HFILL }
6225 { &hf_ptp_mm_global_time_data_set_localtimenanoseconds,
6226 { "localTimeNanoseconds", "ptp.mm.global.time.data.set.localtimenanoseconds",
6227 FT_INT32, BASE_DEC, NULL, 0x00,
6228 NULL, HFILL }
6230 { &hf_ptp_mm_global_time_data_set_currentutcoffset,
6231 { "currentUtcOffset", "ptp.mm.global.time.data.set.currentutcoffset",
6232 FT_INT16, BASE_DEC, NULL, 0x00,
6233 NULL, HFILL }
6235 { &hf_ptp_mm_global_time_data_set_leap59,
6236 { "leap59", "ptp.mm.global.time.data.set.leap59",
6237 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6238 NULL, HFILL }
6240 { &hf_ptp_mm_global_time_data_set_leap61,
6241 { "leap61", "ptp.mm.global.time.data.set.leap61",
6242 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6243 NULL, HFILL }
6245 { &hf_ptp_mm_global_time_data_set_epochnumber,
6246 { "epochNumber", "ptp.mm.global.time.data.set.epochnumber",
6247 FT_UINT16, BASE_DEC, NULL, 0x00,
6248 NULL, HFILL }
6250 /* ptp_mm_update_global_time_properties (parameterlength = 16) */
6251 { &hf_ptp_mm_update_global_time_properties_currentutcoffset,
6252 { "currentUtcOffset", "ptp.mm.update.global.time.properties.currentutcoffset",
6253 FT_UINT16, BASE_DEC, NULL, 0x00,
6254 NULL, HFILL }
6256 { &hf_ptp_mm_update_global_time_properties_leap59,
6257 { "leap59", "ptp.mm.update.global.time.properties.leap59",
6258 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6259 NULL, HFILL }
6261 { &hf_ptp_mm_update_global_time_properties_leap61,
6262 { "leap61", "ptp.mm.update.global.time.properties.leap61",
6263 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6264 NULL, HFILL }
6266 #if 0
6267 { &hf_ptp_mm_update_global_time_properties_epochnumber,
6268 { "epochNumber", "ptp.mm.update.global.time.properties.epochnumber",
6269 FT_UINT16, BASE_DEC, NULL, 0x00,
6270 NULL, HFILL }
6272 #endif
6273 /* ptp_mm_get_foreign_data_set (parameterlength = 4) */
6274 { &hf_ptp_mm_get_foreign_data_set_recordkey,
6275 { "recordKey", "ptp.mm.get.foreign.data.set.recordkey",
6276 FT_UINT16, BASE_DEC, NULL, 0x00,
6277 NULL, HFILL }
6279 /* ptp_mm_foreign_data_set (parameterlength = 28) */
6280 { &hf_ptp_mm_foreign_data_set_returnedportnumber,
6281 { "returnedPortNumber", "ptp.mm.foreign.data.set.returnedportnumber",
6282 FT_UINT16, BASE_DEC, NULL, 0x00,
6283 NULL, HFILL }
6285 { &hf_ptp_mm_foreign_data_set_returnedrecordnumber,
6286 { "returnedRecordNumber", "ptp.mm.foreign.data.set.returnedrecordnumber",
6287 FT_UINT16, BASE_DEC, NULL, 0x00,
6288 NULL, HFILL }
6290 { &hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
6291 { "foreignMasterCommunicationTechnology",
6292 "ptp.mm.foreign.data.set.foreignmastercommunicationtechnology",
6293 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_communicationid_vals_ext, 0x00,
6294 NULL, HFILL }
6296 { &hf_ptp_mm_foreign_data_set_foreignmasteruuidfield,
6297 { "foreignMasterUuidField", "ptp.mm.foreign.data.set.foreignmasteruuidfield",
6298 FT_ETHER, BASE_NONE, NULL, 0x00,
6299 NULL, HFILL }
6301 { &hf_ptp_mm_foreign_data_set_foreignmasterportidfield,
6302 { "foreignMasterPortIdField", "ptp.mm.foreign.data.set.foreignmasterportidfield",
6303 FT_UINT16, BASE_DEC, NULL, 0x00,
6304 NULL, HFILL }
6306 { &hf_ptp_mm_foreign_data_set_foreignmastersyncs,
6307 { "foreignMasterSyncs", "ptp.mm.foreign.data.set.foreignmastersyncs",
6308 FT_UINT16, BASE_DEC, NULL, 0x00,
6309 NULL, HFILL }
6311 /* ptp_mm_set_sync_interval (parameterlength = 4) */
6312 { &hf_ptp_mm_set_sync_interval_syncinterval,
6313 { "syncInterval", "ptp.mm.set.sync.interval.syncinterval",
6314 FT_UINT16, BASE_DEC, NULL, 0x00,
6315 NULL, HFILL }
6317 /* ptp_mm_set_time (parameterlength = 8) */
6318 { &hf_ptp_mm_set_time_localtime,
6319 { "localtime", "ptp.mm.set.time.localtime",
6320 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6321 NULL, HFILL }
6323 { &hf_ptp_mm_set_time_localtimeseconds,
6324 { "localtimeSeconds", "ptp.mm.set.time.localtimeseconds",
6325 FT_UINT32, BASE_DEC, NULL, 0x00,
6326 NULL, HFILL }
6328 { &hf_ptp_mm_set_time_localtimenanoseconds,
6329 { "localTimeNanoseconds", "ptp.mm.set.time.localtimenanoseconds",
6330 FT_INT32, BASE_DEC, NULL, 0x0,
6331 NULL, HFILL }
6337 /* PTPv2 fields **********************************************************/
6338 /* Common fields for all frames */
6339 { &hf_ptp_v2_majorsdoid,
6340 { "majorSdoId", "ptp.v2.majorsdoid",
6341 FT_UINT8, BASE_HEX, VALS(ptpv2_majorsdoid_vals), 0xF0,
6342 NULL, HFILL }
6344 { &hf_ptp_v2_messagetype,
6345 { "messageType", "ptp.v2.messagetype",
6346 FT_UINT8, BASE_HEX | BASE_EXT_STRING, & ptp_v2_messagetype_vals_ext, 0x0F,
6347 NULL, HFILL }
6349 { &hf_ptp_v2_minorversionptp,
6350 { "minorVersionPTP", "ptp.v2.minorversionptp",
6351 FT_UINT8, BASE_DEC, NULL, 0xF0,
6352 NULL, HFILL }
6354 { &hf_ptp_v2_versionptp,
6355 { "versionPTP", "ptp.v2.versionptp",
6356 FT_UINT8, BASE_DEC, NULL, 0x0F,
6357 NULL, HFILL }
6359 { &hf_ptp_v2_messagelength,
6360 { "messageLength", "ptp.v2.messagelength",
6361 FT_UINT16, BASE_DEC, NULL, 0x00,
6362 NULL, HFILL }
6364 { &hf_ptp_v2_minorsdoid,
6365 { "minorSdoId", "ptp.v2.minorsdoid",
6366 FT_UINT8, BASE_DEC, NULL, 0x00,
6367 NULL, HFILL }
6369 { &hf_ptp_v2_domainnumber,
6370 { "domainNumber", "ptp.v2.domainnumber",
6371 FT_UINT8, BASE_DEC, NULL, 0x00,
6372 NULL, HFILL }
6374 { &hf_ptp_v2_flags,
6375 { "flags", "ptp.v2.flags",
6376 FT_UINT16, BASE_HEX, NULL, 0x00,
6377 NULL, HFILL }
6379 { &hf_ptp_v2_flags_alternatemaster,
6380 { "PTP_ALTERNATE_MASTER", "ptp.v2.flags.alternatemaster",
6381 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_ALTERNATE_BITMASK,
6382 NULL, HFILL }
6384 { &hf_ptp_v2_flags_twostep,
6385 { "PTP_TWO_STEP", "ptp.v2.flags.twostep",
6386 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TWO_STEP_BITMASK,
6387 NULL, HFILL }
6389 { &hf_ptp_v2_flags_unicast,
6390 { "PTP_UNICAST", "ptp.v2.flags.unicast",
6391 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UNICAST_BITMASK,
6392 NULL, HFILL }
6394 { &hf_ptp_v2_flags_specific1,
6395 { "PTP profile Specific 1", "ptp.v2.flags.specific1",
6396 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC1_BITMASK,
6397 NULL, HFILL }
6399 { &hf_ptp_v2_flags_specific2,
6400 { "PTP profile Specific 2", "ptp.v2.flags.specific2",
6401 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC2_BITMASK,
6402 NULL, HFILL }
6404 { &hf_ptp_v2_flags_security,
6405 { "PTP_SECURITY", "ptp.v2.flags.security",
6406 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SECURITY_BITMASK,
6407 NULL, HFILL }
6409 { &hf_ptp_v2_flags_li61,
6410 { "PTP_LI_61", "ptp.v2.flags.li61",
6411 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI61_BITMASK,
6412 NULL, HFILL }
6414 { &hf_ptp_v2_flags_li59,
6415 { "PTP_LI_59", "ptp.v2.flags.li59",
6416 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI59_BITMASK,
6417 NULL, HFILL }
6419 { &hf_ptp_v2_flags_utcoffsetvalid,
6420 { "PTP_UTC_REASONABLE", "ptp.v2.flags.utcreasonable",
6421 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK,
6422 NULL, HFILL }
6424 { &hf_ptp_v2_flags_ptptimescale,
6425 { "PTP_TIMESCALE", "ptp.v2.flags.timescale",
6426 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK,
6427 NULL, HFILL }
6429 { &hf_ptp_v2_flags_timetraceable,
6430 { "TIME_TRACEABLE", "ptp.v2.flags.timetraceable",
6431 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK,
6432 NULL, HFILL }
6434 { &hf_ptp_v2_flags_frequencytraceable,
6435 { "FREQUENCY_TRACEABLE", "ptp.v2.flags.frequencytraceable",
6436 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK,
6437 NULL, HFILL }
6439 { &hf_ptp_v2_flags_synchronizationUncertain,
6440 { "SYNCHRONIZATION_UNCERTAIN", "ptp.v2.flags.synchronizationUncertain",
6441 FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SYNCHRONIZATION_UNCERTAIN_BITMASK,
6442 NULL, HFILL }
6444 { &hf_ptp_v2_messagetypespecific,
6445 { "messageTypeSpecific", "ptp.v2.messagetypespecific",
6446 FT_UINT32, BASE_DEC, NULL, 0x00,
6447 NULL, HFILL }
6449 { &hf_ptp_v2_correction,
6450 { "correctionNs", "ptp.v2.correction.ns",
6451 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6452 NULL, HFILL }
6454 { &hf_ptp_v2_correctionsubns,
6455 { "correctionSubNs", "ptp.v2.correction.subns",
6456 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
6457 NULL, HFILL }
6459 { &hf_ptp_v2_clockidentity,
6460 { "ClockIdentity", "ptp.v2.clockidentity",
6461 FT_UINT64, BASE_HEX, NULL, 0x00,
6462 NULL, HFILL }
6464 { &hf_ptp_v2_clockidentity_manuf,
6465 { "MAC Vendor", "ptp.v2.clockidentity_manuf",
6466 FT_BYTES, BASE_NONE, NULL, 0x00,
6467 NULL, HFILL }
6469 { &hf_ptp_v2_sourceportid,
6470 { "SourcePortID", "ptp.v2.sourceportid",
6471 FT_UINT16, BASE_DEC, NULL, 0x00,
6472 NULL, HFILL }
6474 { &hf_ptp_v2_sequenceid,
6475 { "sequenceId", "ptp.v2.sequenceid",
6476 FT_UINT16, BASE_DEC, NULL, 0x00,
6477 NULL, HFILL }
6479 { &hf_ptp_v2_controlfield_default,
6480 { "controlField", "ptp.v2.controlfield",
6481 FT_UINT8, BASE_DEC, NULL, 0x00,
6482 NULL, HFILL }
6484 { &hf_ptp_v2_controlfield,
6485 { "controlField", "ptp.v2.controlfield",
6486 FT_UINT8, BASE_DEC, VALS(ptp_controlfield_vals), 0x00,
6487 NULL, HFILL }
6489 { &hf_ptp_v2_logmessageperiod,
6490 { "logMessagePeriod", "ptp.v2.logmessageperiod",
6491 FT_INT8, BASE_DEC, NULL, 0x00,
6492 NULL, HFILL }
6495 /* Fields for PTP_Announce (=an) messages */
6496 #if 0
6497 { &hf_ptp_v2_an_origintimestamp,
6498 { "originTimestamp", "ptp.v2.an.origintimestamp",
6499 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6500 NULL, HFILL }
6502 #endif
6503 { &hf_ptp_v2_an_origintimestamp_seconds,
6504 { "originTimestamp (seconds)", "ptp.v2.an.origintimestamp.seconds",
6505 FT_UINT64, BASE_DEC, NULL, 0x00,
6506 NULL, HFILL }
6508 { &hf_ptp_v2_an_origintimestamp_nanoseconds,
6509 { "originTimestamp (nanoseconds)", "ptp.v2.an.origintimestamp.nanoseconds",
6510 FT_INT32, BASE_DEC, NULL, 0x00,
6511 NULL, HFILL }
6513 { &hf_ptp_v2_an_origincurrentutcoffset,
6514 { "originCurrentUTCOffset", "ptp.v2.an.origincurrentutcoffset",
6515 FT_INT16, BASE_DEC, NULL, 0x00,
6516 NULL, HFILL }
6518 { &hf_ptp_v2_an_timesource,
6519 { "TimeSource", "ptp.v2.timesource",
6520 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_timeSource_vals_ext, 0x00,
6521 NULL, HFILL }
6523 { &hf_ptp_v2_an_localstepsremoved,
6524 { "localStepsRemoved", "ptp.v2.an.localstepsremoved",
6525 FT_UINT16, BASE_DEC, NULL, 0x00,
6526 NULL, HFILL }
6528 { &hf_ptp_v2_an_grandmasterclockidentity,
6529 { "grandmasterClockIdentity", "ptp.v2.an.grandmasterclockidentity",
6530 FT_UINT64, BASE_HEX, NULL, 0x00,
6531 NULL, HFILL }
6533 { &hf_ptp_v2_an_grandmasterclockclass,
6534 { "grandmasterClockClass", "ptp.v2.an.grandmasterclockclass",
6535 FT_UINT8, BASE_DEC, NULL, 0x00,
6536 NULL, HFILL }
6538 { &hf_ptp_v2_an_grandmasterclockaccuracy,
6539 { "grandmasterClockAccuracy", "ptp.v2.an.grandmasterclockaccuracy",
6540 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
6541 NULL, HFILL }
6543 { &hf_ptp_v2_an_grandmasterclockvariance,
6544 { "grandmasterClockVariance", "ptp.v2.an.grandmasterclockvariance",
6545 FT_UINT16, BASE_DEC, NULL, 0x00,
6546 NULL, HFILL }
6548 { &hf_ptp_v2_an_priority1,
6549 { "priority1", "ptp.v2.an.priority1",
6550 FT_UINT8, BASE_DEC, NULL, 0x00,
6551 NULL, HFILL }
6553 { &hf_ptp_v2_an_priority2,
6554 { "priority2", "ptp.v2.an.priority2",
6555 FT_UINT8, BASE_DEC, NULL, 0x00,
6556 NULL, HFILL }
6559 /* Fields for PTP_Announce TLVs */
6560 { &hf_ptp_v2_an_tlv_tlvtype,
6561 { "tlvType", "ptp.v2.an.tlvType",
6562 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
6563 NULL, HFILL }
6565 { &hf_ptp_v2_an_tlv_lengthfield,
6566 { "lengthField", "ptp.v2.an.lengthField",
6567 FT_UINT16, BASE_DEC, NULL, 0x00,
6568 NULL, HFILL }
6570 /* Fields for ORGANIZATION_EXTENSION TLV */
6571 { &hf_ptp_v2_oe_tlv_organizationid,
6572 { "organizationId", "ptp.v2.an.oe.organizationId",
6573 FT_UINT24, BASE_OUI, NULL, 0x00,
6574 NULL, HFILL }
6576 { &hf_ptp_v2_oe_tlv_organizationsubtype,
6577 { "organizationSubType", "ptp.v2.an.oe.organizationSubType",
6578 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_iee_c37_238_subtype_vals), 0x00,
6579 NULL, HFILL }
6581 { &hf_ptp_v2_oe_tlv_2017_organizationsubtype,
6582 { "organizationSubType", "ptp.v2.an.oe.organizationSubType",
6583 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_iee_c37_238_2017_subtype_vals), 0x00,
6584 NULL, HFILL }
6586 { &hf_ptp_v2_oe_tlv_datafield,
6587 { "dataField", "ptp.v2.an.oe.dataField",
6588 FT_BYTES, BASE_NONE, NULL, 0x00,
6589 NULL, HFILL }
6591 /* Fields for CERN White Rabbit TLV (OE TLV subtype) */
6592 { &hf_ptp_v2_an_tlv_oe_cern_subtype,
6593 { "organizationSubType", "ptp.v2.an.oe.organizationSubType",
6594 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_cern_subtype_vals), 0x00,
6595 NULL, HFILL }
6597 { &hf_ptp_v2_an_tlv_oe_cern_wrMessageID,
6598 { "wrMessageID", "ptp.v2.an.oe.cern.wr.wrMessageID",
6599 FT_UINT16, BASE_HEX, VALS(ptp_v2_org_cern_wrMessageID_vals), 0x00,
6600 NULL, HFILL }
6602 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags,
6603 { "wrFlags", "ptp.v2.an.oe.cern.wr.wrFlags",
6604 FT_UINT16, BASE_HEX, NULL, 0x00,
6605 NULL, HFILL }
6607 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrConfig,
6608 { "wrConfig", "ptp.v2.an.oe.cern.wr.wrFlags.wrConfig",
6609 FT_UINT16, BASE_HEX, VALS(ptp_v2_tlv_oe_cern_wrFlags_wrConfig_vals), PTP_V2_TLV_OE_CERN_WRFLAGS_WRCONFIG_BITMASK,
6610 NULL, HFILL }
6612 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_calibrated,
6613 { "calibrated", "ptp.v2.an.oe.cern.wr.wrFlags.calibrated",
6614 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_OE_CERN_WRFLAGS_CALIBRATED_BITMASK,
6615 NULL, HFILL }
6617 { &hf_ptp_v2_an_tlv_oe_cern_wrFlags_wrModeOn,
6618 { "wrModeOn", "ptp.v2.an.oe.cern.wr.wrFlags.wrModeOn",
6619 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_OE_CERN_WRFLAGS_WRMODEON_BITMASK,
6620 NULL, HFILL }
6622 /* Fields for IEEE_C37_238 TLV (OE TLV subtype) */
6623 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmasterid,
6624 { "grandmasterID", "ptp.v2.an.oe.grandmasterID",
6625 FT_UINT16, BASE_DEC, NULL, 0x00,
6626 NULL, HFILL }
6628 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_grandmastertimeinaccuracy,
6629 { "grandmasterTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.grandmasterTimeInaccuracy",
6630 FT_UINT32, BASE_DEC, NULL, 0x00,
6631 NULL, HFILL }
6633 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_networktimeinaccuracy,
6634 { "networkTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.networkTimeInaccuracy",
6635 FT_UINT32, BASE_DEC, NULL, 0x00,
6636 NULL, HFILL }
6638 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_reserved,
6639 { "reserved", "ptp.v2.an.oe.reserved",
6640 FT_UINT16, BASE_HEX, NULL, 0x00,
6641 NULL, HFILL }
6643 /* Additional fields in C37.238-2017 compared to C37.238-2011 */
6644 { &hf_ptp_v2_oe_tlv_subtype_c372382017tlv_reserved,
6645 { "reserved", "ptp.v2.an.oe.reserved",
6646 FT_UINT32, BASE_HEX, NULL, 0x00,
6647 NULL, HFILL }
6649 { &hf_ptp_v2_oe_tlv_subtype_c37238tlv_totaltimeinaccuracy,
6650 { "totalTimeInaccuracy (nanoseconds)", "ptp.v2.an.oe.totalTimeInaccuracy",
6651 FT_UINT32, BASE_DEC, NULL, 0x00,
6652 NULL, HFILL }
6654 /* Fields for ALTERNATE_TIME_OFFSET_INDICATOR TLV */
6655 { &hf_ptp_v2_atoi_tlv_keyfield,
6656 { "keyField", "ptp.v2.an.atoi.keyField",
6657 FT_UINT8, BASE_DEC, NULL, 0x00,
6658 NULL, HFILL }
6660 { &hf_ptp_v2_atoi_tlv_currentoffset,
6661 { "currentOffset", "ptp.v2.an.atoi.currentOffset",
6662 FT_INT32, BASE_DEC, NULL, 0x00,
6663 NULL, HFILL }
6665 { &hf_ptp_v2_atoi_tlv_jumpseconds,
6666 { "jumpSeconds", "ptp.v2.an.atoi.jumpSeconds",
6667 FT_INT32, BASE_DEC, NULL, 0x00,
6668 NULL, HFILL }
6670 { &hf_ptp_v2_atoi_tlv_timeofnextjump,
6671 { "timeOfNextJump", "ptp.v2.an.atoi.timeOfNextJump",
6672 FT_INT48, BASE_DEC, NULL, 0x00,
6673 NULL, HFILL }
6675 { &hf_ptp_v2_atoi_tlv_displayname,
6676 { "displayName", "ptp.v2.an.atoi.displayName",
6677 FT_STRING, BASE_NONE, NULL, 0x00,
6678 NULL, HFILL }
6680 { &hf_ptp_v2_atoi_tlv_displayname_length,
6681 { "length", "ptp.v2.an.atoi.displayName.length",
6682 FT_UINT8, BASE_DEC, NULL, 0x00,
6683 NULL, HFILL }
6685 /* Field for Path Trace TLV */
6686 { &hf_ptp_v2_an_tlv_pathsequence,
6687 { "PathSequence", "ptp.v2.an.pathsequence",
6688 FT_UINT64, BASE_HEX, NULL, 0x00,
6689 NULL, HFILL }
6692 /* Fields for undissected TLV */
6693 { &hf_ptp_v2_an_tlv_data,
6694 { "data", "ptp.v2.an.tlv.data",
6695 FT_BYTES, BASE_NONE, NULL, 0x00,
6696 NULL, HFILL }
6699 /* Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages */
6700 #if 0
6701 { &hf_ptp_v2_sdr_origintimestamp,
6702 { "originTimestamp", "ptp.v2.sdr.origintimestamp",
6703 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6704 NULL, HFILL }
6706 #endif
6707 { &hf_ptp_v2_sdr_origintimestamp_seconds,
6708 { "originTimestamp (seconds)", "ptp.v2.sdr.origintimestamp.seconds",
6709 FT_UINT64, BASE_DEC, NULL, 0x00,
6710 NULL, HFILL }
6712 { &hf_ptp_v2_sdr_origintimestamp_nanoseconds,
6713 { "originTimestamp (nanoseconds)", "ptp.v2.sdr.origintimestamp.nanoseconds",
6714 FT_INT32, BASE_DEC, NULL, 0x00,
6715 NULL, HFILL }
6718 { &hf_ptp_v2_sync_reserved,
6719 { "reserved", "ptp.v2.sync.reserved",
6720 FT_BYTES, BASE_NONE, NULL, 0x00,
6721 NULL, HFILL }
6724 /* Fields for PTP_Follow_Up (=fu) messages */
6725 #if 0
6726 { &hf_ptp_v2_fu_preciseorigintimestamp,
6727 { "preciseOriginTimestamp", "ptp.v2.fu.preciseorigintimestamp",
6728 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6729 NULL, HFILL }
6731 #endif
6732 { &hf_ptp_v2_fu_preciseorigintimestamp_seconds,
6733 { "preciseOriginTimestamp (seconds)", "ptp.v2.fu.preciseorigintimestamp.seconds",
6734 FT_UINT64, BASE_DEC, NULL, 0x00,
6735 NULL, HFILL }
6737 { &hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds,
6738 { "preciseOriginTimestamp (nanoseconds)", "ptp.v2.fu.preciseorigintimestamp.nanoseconds",
6739 FT_UINT32, BASE_DEC, NULL, 0x00,
6740 NULL, HFILL }
6742 { &hf_ptp_v2_fu_preciseorigintimestamp_32bit,
6743 { "preciseOriginTimestamp (32bit)", "ptp.v2.fu.preciseorigintimestamp.32bit",
6744 FT_BYTES, BASE_NONE, NULL, 0x00,
6745 NULL, HFILL }
6747 /* Fields for PTP_Follow_up TLVs */
6748 { &hf_ptp_as_fu_tlv_tlvtype,
6749 { "tlvType", "ptp.as.fu.tlvType",
6750 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
6751 NULL, HFILL }
6753 { &hf_ptp_as_fu_tlv_lengthfield,
6754 { "lengthField", "ptp.as.fu.lengthField",
6755 FT_UINT16, BASE_DEC, NULL, 0x00,
6756 NULL, HFILL }
6758 { &hf_ptp_as_fu_tlv_organization_id,
6759 { "organizationId", "ptp.as.fu.organizationId",
6760 FT_UINT24, BASE_DEC, NULL, 0x00,
6761 NULL, HFILL }
6763 { &hf_ptp_as_fu_tlv_organization_subtype,
6764 { "OrganizationSubType", "ptp.as.fu.organizationSubType",
6765 FT_INT24, BASE_DEC, NULL, 0x00,
6766 NULL, HFILL }
6768 { &hf_ptp_as_fu_tlv_cumulative_scaled_rate_offset,
6769 { "cumulativeScaledRateOffset", "ptp.as.fu.cumulativeScaledRateOffset",
6770 FT_INT32, BASE_DEC, NULL, 0x00,
6771 NULL, HFILL }
6773 { &hf_ptp_as_fu_tlv_cumulative_rate_ratio,
6774 { "cumulativeRateRatio", "ptp.as.fu.cumulativeRateRatio",
6775 FT_DOUBLE, BASE_NONE, NULL, 0x00,
6776 NULL, HFILL }
6778 { &hf_ptp_as_fu_tlv_gm_base_indicator,
6779 { "gmTimeBaseIndicator", "ptp.as.fu.gmTimeBaseIndicator",
6780 FT_UINT16, BASE_DEC, NULL, 0x00,
6781 NULL, HFILL }
6783 { &hf_ptp_as_fu_tlv_last_gm_phase_change,
6784 { "lastGMPhaseChange", "ptp.as.fu.lastGmPhaseChange",
6785 FT_BYTES, BASE_NONE, NULL, 0x00,
6786 NULL, HFILL }
6788 { &hf_ptp_as_fu_tlv_scaled_last_gm_freq_change,
6789 { "scaledLastGmFreqChange", "ptp.as.fu.scaledLastGmFreqChange",
6790 FT_INT32, BASE_DEC, NULL, 0x00,
6791 NULL, HFILL }
6794 /* Fields for PTP_DelayResponse (=dr) messages */
6795 #if 0
6796 { &hf_ptp_v2_dr_receivetimestamp,
6797 { "receiveTimestamp", "ptp.v2.dr.receivetimestamp",
6798 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6799 NULL, HFILL }
6801 #endif
6802 { &hf_ptp_v2_dr_receivetimestamp_seconds,
6803 { "receiveTimestamp (seconds)", "ptp.v2.dr.receivetimestamp.seconds",
6804 FT_UINT64, BASE_DEC, NULL, 0x00,
6805 NULL, HFILL }
6807 { &hf_ptp_v2_dr_receivetimestamp_nanoseconds,
6808 { "receiveTimestamp (nanoseconds)", "ptp.v2.dr.receivetimestamp.nanoseconds",
6809 FT_INT32, BASE_DEC, NULL, 0x00,
6810 NULL, HFILL }
6812 { &hf_ptp_v2_dr_requestingportidentity,
6813 { "requestingSourcePortIdentity", "ptp.v2.dr.requestingsourceportidentity",
6814 FT_UINT64, BASE_HEX, NULL, 0x00,
6815 NULL, HFILL }
6817 { &hf_ptp_v2_dr_requestingsourceportid,
6818 { "requestingSourcePortId", "ptp.v2.dr.requestingsourceportid",
6819 FT_UINT16, BASE_DEC, NULL, 0x00,
6820 NULL, HFILL }
6823 /* Fields for PTP_PDelayRequest (=pdrq) messages */
6824 #if 0
6825 { &hf_ptp_v2_pdrq_origintimestamp,
6826 { "originTimestamp", "ptp.v2.pdrq.origintimestamp",
6827 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6828 NULL, HFILL }
6830 #endif
6831 { &hf_ptp_v2_pdrq_origintimestamp_seconds,
6832 { "originTimestamp (seconds)", "ptp.v2.pdrq.origintimestamp.seconds",
6833 FT_UINT64, BASE_DEC, NULL, 0x00,
6834 NULL, HFILL }
6836 { &hf_ptp_v2_pdrq_origintimestamp_nanoseconds,
6837 { "originTimestamp (nanoseconds)", "ptp.v2.pdrq.origintimestamp.nanoseconds",
6838 FT_INT32, BASE_DEC, NULL, 0x00,
6839 NULL, HFILL }
6842 /* Fields for PTP_PDelayResponse (=pdrs) messages */
6843 #if 0
6844 { &hf_ptp_v2_pdrs_requestreceipttimestamp,
6845 { "requestreceiptTimestamp", "ptp.v2.pdrs.requestreceipttimestamp",
6846 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6847 NULL, HFILL }
6849 #endif
6850 { &hf_ptp_v2_pdrs_requestreceipttimestamp_seconds,
6851 { "requestreceiptTimestamp (seconds)", "ptp.v2.pdrs.requestreceipttimestamp.seconds",
6852 FT_UINT64, BASE_DEC, NULL, 0x00,
6853 NULL, HFILL }
6855 { &hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds,
6856 { "requestreceiptTimestamp (nanoseconds)", "ptp.v2.pdrs.requestreceipttimestamp.nanoseconds",
6857 FT_INT32, BASE_DEC, NULL, 0x00,
6858 NULL, HFILL }
6860 { &hf_ptp_v2_pdrs_requestingportidentity,
6861 { "requestingSourcePortIdentity", "ptp.v2.pdrs.requestingportidentity",
6862 FT_UINT64, BASE_HEX, NULL, 0x00,
6863 NULL, HFILL }
6865 { &hf_ptp_v2_pdrs_requestingsourceportid,
6866 { "requestingSourcePortId", "ptp.v2.pdrs.requestingsourceportid",
6867 FT_UINT16, BASE_DEC, NULL, 0x00,
6868 NULL, HFILL }
6871 /* Fields for PTP_PDelayResponseFollowUp (=pdfu) messages */
6872 #if 0
6873 { &hf_ptp_v2_pdfu_responseorigintimestamp,
6874 { "responseOriginTimestamp", "ptp.v2.pdfu.responseorigintimestamp",
6875 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
6876 NULL, HFILL }
6878 #endif
6879 { &hf_ptp_v2_pdfu_responseorigintimestamp_seconds,
6880 { "responseOriginTimestamp (seconds)", "ptp.v2.pdfu.responseorigintimestamp.seconds",
6881 FT_UINT64, BASE_DEC, NULL, 0x00,
6882 NULL, HFILL }
6884 { &hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds,
6885 { "responseOriginTimestamp (nanoseconds)", "ptp.v2.pdfu.responseorigintimestamp.nanoseconds",
6886 FT_INT32, BASE_DEC, NULL, 0x00,
6887 NULL, HFILL }
6889 { &hf_ptp_v2_pdfu_requestingportidentity,
6890 { "requestingSourcePortIdentity", "ptp.v2.pdfu.requestingportidentity",
6891 FT_UINT64, BASE_HEX, NULL, 0x00,
6892 NULL, HFILL }
6894 { &hf_ptp_v2_pdfu_requestingsourceportid,
6895 { "requestingSourcePortId", "ptp.v2.pdfu.requestingsourceportid",
6896 FT_UINT16, BASE_DEC, NULL, 0x00,
6897 NULL, HFILL }
6900 /* Fields for PTP_Signalling (=sig) messages */
6901 { &hf_ptp_v2_sig_targetportidentity,
6902 { "targetPortIdentity", "ptp.v2.sig.targetportidentity",
6903 FT_UINT64, BASE_HEX, NULL, 0x00,
6904 NULL, HFILL }
6906 { &hf_ptp_v2_sig_targetportid,
6907 { "targetPortId", "ptp.v2.sig.targetportid",
6908 FT_UINT16, BASE_DEC, NULL, 0x00,
6909 NULL, HFILL }
6911 { &hf_ptp_v2_sig_tlv_tlvType,
6912 { "tlvType", "ptp.v2.sig.tlv.tlvType",
6913 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
6914 NULL, HFILL }
6916 { &hf_ptp_v2_sig_tlv_lengthField,
6917 { "lengthField", "ptp.v2.sig.tlv.lengthField",
6918 FT_UINT16, BASE_DEC, NULL, 0x00,
6919 NULL, HFILL }
6921 { &hf_ptp_v2_sig_tlv_data,
6922 { "data", "ptp.v2.sig.tlv.data",
6923 FT_BYTES, BASE_NONE, NULL, 0x00,
6924 NULL, HFILL }
6926 { &hf_ptp_v2_sig_tlv_messageType,
6927 { "messageType", "ptp.v2.sig.tlv.messageType",
6928 FT_UINT8, BASE_HEX | BASE_EXT_STRING, & ptp_v2_messagetype_vals_ext, 0xF0,
6929 NULL, HFILL }
6931 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod,
6932 { "logInterMessagePeriod", "ptp.v2.sig.tlv.logInterMessagePeriod",
6933 FT_INT8, BASE_DEC, NULL, 0x00,
6934 NULL, HFILL }
6936 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod_period,
6937 { "period", "ptp.v2.sig.tlv.logInterMessagePeriod.period",
6938 FT_INT8, BASE_DEC, NULL, 0x00,
6939 NULL, HFILL }
6941 { &hf_ptp_v2_sig_tlv_logInterMessagePeriod_rate,
6942 { "rate", "ptp.v2.sig.tlv.logInterMessagePeriod.rate",
6943 FT_INT8, BASE_DEC, NULL, 0x00,
6944 NULL, HFILL }
6946 { &hf_ptp_v2_sig_tlv_durationField,
6947 { "durationField", "ptp.v2.sig.tlv.durationField",
6948 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
6949 NULL, HFILL }
6951 { &hf_ptp_v2_sig_tlv_renewalInvited,
6952 { "renewalInvited", "ptp.v2.sig.tlv.renewalInvited",
6953 FT_BOOLEAN, 8, NULL, 0x01,
6954 NULL, HFILL }
6956 { &hf_ptp_v2_sig_tlv_flags2,
6957 { "flags", "ptp.v2.sig.tlv.l1sync.flags",
6958 FT_UINT16, BASE_HEX, NULL, 0x00,
6959 NULL, HFILL }
6961 { &hf_ptp_v2_sig_tlv_flags3,
6962 { "flags", "ptp.v2.sig.tlv.l1sync.flags",
6963 FT_UINT24, BASE_HEX, NULL, 0x00,
6964 NULL, HFILL }
6966 { &hf_ptp_v2_sig_tlv_l1sync_flags2_tcr, /* Version with 2 bytes flags field */
6967 { "txCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.tcr",
6968 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK,
6969 NULL, HFILL }
6971 { &hf_ptp_v2_sig_tlv_l1sync_flags3_tcr, /* Version with 3 bytes flags field */
6972 { "txCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.tcr",
6973 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_TCR_BITMASK << 8,
6974 NULL, HFILL }
6976 { &hf_ptp_v2_sig_tlv_l1sync_flags2_rcr, /* Version with 2 bytes flags field */
6977 { "rxCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.rcr",
6978 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK,
6979 NULL, HFILL }
6981 { &hf_ptp_v2_sig_tlv_l1sync_flags3_rcr, /* Version with 3 bytes flags field */
6982 { "rxCoherentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.rcr",
6983 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_RCR_BITMASK << 8,
6984 NULL, HFILL }
6986 { &hf_ptp_v2_sig_tlv_l1sync_flags2_cr, /* Version with 2 bytes flags field */
6987 { "congruentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.cr",
6988 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK,
6989 NULL, HFILL }
6991 { &hf_ptp_v2_sig_tlv_l1sync_flags3_cr, /* Version with 3 bytes flags field */
6992 { "congruentIsRequired", "ptp.v2.sig.tlv.l1sync.flags.cr",
6993 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_CR_BITMASK << 8,
6994 NULL, HFILL }
6996 { &hf_ptp_v2_sig_tlv_l1sync_flags2_ope, /* Version with 2 bytes flags field */
6997 { "optParamsEnabled", "ptp.v2.sig.tlv.l1sync.flags.ope",
6998 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK,
6999 NULL, HFILL }
7001 { &hf_ptp_v2_sig_tlv_l1sync_flags3_ope, /* Version with 3 bytes flags field */
7002 { "optParamsEnabled", "ptp.v2.sig.tlv.l1sync.flags.ope",
7003 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS1_OPE_BITMASK << 8,
7004 NULL, HFILL }
7006 { &hf_ptp_v2_sig_tlv_l1sync_flags2_itc, /* Version with 2 bytes flags field */
7007 { "isTxCoherent", "ptp.v2.sig.tlv.l1sync.flags.itc",
7008 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK,
7009 NULL, HFILL }
7011 { &hf_ptp_v2_sig_tlv_l1sync_flags3_itc, /* Version with 3 bytes flags field */
7012 { "isTxCoherent", "ptp.v2.sig.tlv.l1sync.flags.itc",
7013 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_ITC_BITMASK << 8,
7014 NULL, HFILL }
7016 { &hf_ptp_v2_sig_tlv_l1sync_flags2_irc, /* Version with 2 bytes flags field */
7017 { "isRxCoherent", "ptp.v2.sig.tlv.l1sync.flags.irc",
7018 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK,
7019 NULL, HFILL }
7021 { &hf_ptp_v2_sig_tlv_l1sync_flags3_irc, /* Version with 3 bytes flags field */
7022 { "isRxCoherent", "ptp.v2.sig.tlv.l1sync.flags.irc",
7023 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IRC_BITMASK << 8,
7024 NULL, HFILL }
7026 { &hf_ptp_v2_sig_tlv_l1sync_flags2_ic, /* Version with 2 bytes flags field */
7027 { "isCongruent", "ptp.v2.sig.tlv.l1sync.flags.ic",
7028 FT_BOOLEAN, 16, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK,
7029 NULL, HFILL }
7031 { &hf_ptp_v2_sig_tlv_l1sync_flags3_ic, /* Version with 3 bytes flags field */
7032 { "isCongruent", "ptp.v2.sig.tlv.l1sync.flags.ic",
7033 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_IC_BITMASK << 8,
7034 NULL, HFILL }
7036 { &hf_ptp_v2_sig_tlv_l1sync_flags3_fov,
7037 { "frequencyOffsetTxValid", "ptp.v2.sig.tlv.l1sync.flags.fov",
7038 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_FOV_BITMASK,
7039 NULL, HFILL }
7041 { &hf_ptp_v2_sig_tlv_l1sync_flags3_pov,
7042 { "phaseOffsetTxValid", "ptp.v2.sig.tlv.l1sync.flags.pov",
7043 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_POV_BITMASK,
7044 NULL, HFILL }
7046 { &hf_ptp_v2_sig_tlv_l1sync_flags3_tct,
7047 { "timestampsCorrectedTx", "ptp.v2.sig.tlv.l1sync.flags.tct",
7048 FT_BOOLEAN, 24, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_TCT_BITMASK,
7049 NULL, HFILL }
7051 { &hf_ptp_v2_sig_tlv_l1sync_flags2_reserved,
7052 { "Reserved", "ptp.v2.sig.tlv.l1sync.flags.reserved",
7053 FT_UINT16, BASE_HEX, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS2_RESERVED_ALL_BITMASK,
7054 NULL, HFILL }
7056 { &hf_ptp_v2_sig_tlv_l1sync_flags3_reserved,
7057 { "Reserved", "ptp.v2.sig.tlv.l1sync.flags.reserved",
7058 FT_UINT24, BASE_HEX, NULL, PTP_V2_TLV_SIG_TLV_L1SYNC_FLAGS3_RESERVED_ALL_BITMASK,
7059 NULL, HFILL }
7061 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_ns,
7062 { "Ns", "ptp.v2.sig.tlv.l1sync.phaseOffsetTx.ns",
7063 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7064 NULL, HFILL }
7066 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTx_subns,
7067 { "SubNs", "ptp.v2.sig.tlv.l1sync.phaseOffsetTx.subns",
7068 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7069 NULL, HFILL }
7071 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_s,
7072 { "S", "ptp.v2.sig.tlv.l1sync.phaseOffsetTxTimestamp.s",
7073 FT_UINT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
7074 NULL, HFILL }
7076 { &hf_ptp_v2_sig_tlv_l1syncext_phaseOffsetTxTimestamp_ns,
7077 { "Ns", "ptp.v2.sig.tlv.l1sync.phaseOffsetTxTimestamp.ns",
7078 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7079 NULL, HFILL }
7081 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_ns,
7082 { "Ns", "ptp.v2.sig.tlv.l1sync.freqOffsetTx.ns",
7083 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7084 NULL, HFILL }
7086 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTx_subns,
7087 { "SubNs", "ptp.v2.sig.tlv.l1sync.freqOffsetTx.subns",
7088 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7089 NULL, HFILL }
7091 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_s,
7092 { "S", "ptp.v2.sig.tlv.l1sync.freqOffsetTxTimestamp.s",
7093 FT_UINT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_second_seconds), 0x00,
7094 NULL, HFILL }
7096 { &hf_ptp_v2_sig_tlv_l1syncext_freqOffsetTxTimestamp_ns,
7097 { "Ns", "ptp.v2.sig.tlv.l1sync.freqOffsetTxTimestamp.ns",
7098 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7099 NULL, HFILL }
7101 { &hf_ptp_v2_sig_oe_tlv_cern_subtype,
7102 { "organizationSubType", "ptp.v2.sig.oe.organizationSubType",
7103 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_cern_subtype_vals), 0x00,
7104 NULL, HFILL }
7106 { &hf_ptp_v2_sig_oe_tlv_itut_subtype,
7107 { "organizationSubType", "ptp.v2.sig.oe.organizationSubType",
7108 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_itut_subtype_vals), 0x00,
7109 NULL, HFILL }
7111 { &hf_ptp_v2_sig_oe_tlv_cern_wrMessageID,
7112 { "wrMessageID", "ptp.v2.sig.oe.cern.wr.wrMessageID",
7113 FT_UINT16, BASE_HEX, VALS(ptp_v2_org_cern_wrMessageID_vals), 0x00,
7114 NULL, HFILL }
7116 { &hf_ptp_v2_sig_oe_tlv_cern_calSendPattern,
7117 { "calSendPattern", "ptp.v2.sig.oe.cern.wr.calSendPattern",
7118 FT_BOOLEAN, 8, NULL, 0x01,
7119 NULL, HFILL }
7121 { &hf_ptp_v2_sig_oe_tlv_cern_calRety,
7122 { "calRety", "ptp.v2.sig.oe.cern.wr.calRety",
7123 FT_UINT8, BASE_DEC, NULL, 0x00,
7124 NULL, HFILL }
7126 { &hf_ptp_v2_sig_oe_tlv_cern_calPeriod,
7127 { "calPeriod", "ptp.v2.sig.oe.cern.wr.calPeriod",
7128 FT_UINT32, BASE_DEC, NULL, 0x00,
7129 NULL, HFILL }
7131 { &hf_ptp_v2_sig_oe_tlv_cern_deltaTx,
7132 { "deltaTx", "ptp.v2.sig.oe.cern.wr.deltaTx",
7133 FT_BYTES, BASE_NONE, NULL, 0x00,
7134 NULL, HFILL }
7136 { &hf_ptp_v2_sig_oe_tlv_cern_deltaRx,
7137 { "deltaRx", "ptp.v2.sig.oe.cern.wr.deltaRx",
7138 FT_BYTES, BASE_NONE, NULL, 0x00,
7139 NULL, HFILL }
7141 /* Fields for PTP_Signalling (=sig) TLVs */
7142 { &hf_ptp_as_sig_tlv_tlvtype,
7143 { "tlvType", "ptp.as.sig.tlvType",
7144 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
7145 NULL, HFILL }
7147 { &hf_ptp_as_sig_tlv_lengthfield,
7148 { "lengthField", "ptp.as.sig.lengthField",
7149 FT_UINT16, BASE_DEC, NULL, 0x00,
7150 NULL, HFILL }
7152 { &hf_ptp_as_sig_tlv_organization_id,
7153 { "organizationId", "ptp.as.sig.tlv.organizationId",
7154 FT_UINT24, BASE_HEX, VALS(ptp_as_TLV_oid_vals), 0x00,
7155 NULL, HFILL }
7157 { &hf_ptp_as_sig_tlv_organization_subtype,
7158 { "OrganizationSubType", "ptp.as.sig.tlv.organizationSubType",
7159 FT_INT24, BASE_DEC, NULL, 0x00,
7160 NULL, HFILL }
7162 { &hf_ptp_as_sig_tlv_link_delay_interval,
7163 { "linkDelayInterval", "ptp.as.sig.tlv.linkdelayinterval",
7164 FT_INT8, BASE_DEC, NULL, 0x00,
7165 NULL, HFILL }
7167 { &hf_ptp_as_sig_tlv_time_sync_interval,
7168 { "timeSyncInterval", "ptp.as.sig.tlv.timesyncinterval",
7169 FT_INT8, BASE_DEC, NULL, 0x00,
7170 NULL, HFILL }
7172 { &hf_ptp_as_sig_tlv_announce_interval,
7173 { "announceInterval", "ptp.as.sig.tlv.announceinterval",
7174 FT_INT8, BASE_DEC, NULL, 0x00,
7175 NULL, HFILL }
7177 { &hf_ptp_as_sig_tlv_flags,
7178 { "flags", "ptp.as.sig.tlv.flags",
7179 FT_UINT8, BASE_HEX, NULL, 0x00,
7180 NULL, HFILL }
7182 { &hf_ptp_as_sig_tlv_flags_comp_rate_ratio,
7183 { "computeNeighborRateRatio", "ptp.as.sig.tlv.flags.rateratio",
7184 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_COMP_NEIGHBOR_RATE_RATIO_BITMASK,
7185 NULL, HFILL }
7187 { &hf_ptp_as_sig_tlv_flags_comp_mean_link_delay,
7188 { "computeMeanLinkDelay", "ptp.as.sig.tlv.flags.meanlinkdelay",
7189 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_COMP_MEAN_LINK_DELAY_BITMASK,
7190 NULL, HFILL }
7192 { &hf_ptp_as_sig_tlv_flags_one_step_receive_capable,
7193 { "oneStepReceiveCapable", "ptp.as.sig.tlv.flags.stepreceivecapable",
7194 FT_BOOLEAN, 8, NULL, PTP_AS_FLAGS_ONE_STEP_RECEIVE_CAPABLE,
7195 NULL, HFILL }
7197 { &hf_ptp_as_sig_tlv_gptp_capable_message_interval,
7198 { "gptpCapableMessageInterval", "ptp.as.sig.tlv.gptpcapablemessageinterval",
7199 FT_INT8, BASE_DEC, NULL, 0x00,
7200 NULL, HFILL }
7202 { &hf_ptp_v2_sig_tlv_interface_bit_period,
7203 { "interfaceBitPeriod", "ptp.as.sig.tlv.interfaceBitPeriod",
7204 FT_UINT64, BASE_HEX, NULL, 0x00,
7205 NULL, HFILL }
7207 { &hf_ptp_v2_sig_tlv_numberbits_before_timestamp,
7208 { "numberBitsBeforeTimestamp", "ptp.as.sig.tlv.numberBitsBeforeTimestamp",
7209 FT_UINT16, BASE_DEC, NULL, 0x00,
7210 NULL, HFILL }
7212 { &hf_ptp_v2_sig_tlv_numberbits_after_timestamp,
7213 { "numberBitsAfterTimestamp", "ptp.as.sig.tlv.numberBitsAfterTimestamp",
7214 FT_UINT16, BASE_DEC, NULL, 0x00,
7215 NULL, HFILL }
7217 /* Fields for PTP_Management (=mm) messages */
7218 { &hf_ptp_v2_mm_targetportidentity,
7219 { "targetPortIdentity", "ptp.v2.mm.targetportidentity",
7220 FT_UINT64, BASE_HEX, NULL, 0x00,
7221 NULL, HFILL }
7223 { &hf_ptp_v2_mm_targetportid,
7224 { "targetPortId", "ptp.v2.mm.targetportid",
7225 FT_UINT16, BASE_DEC, NULL, 0x00,
7226 NULL, HFILL }
7228 { &hf_ptp_v2_mm_startingboundaryhops,
7229 { "startingBoundaryHops", "ptp.v2.mm.startingboundaryhops",
7230 FT_UINT8, BASE_DEC, NULL, 0x00,
7231 NULL, HFILL }
7233 { &hf_ptp_v2_mm_boundaryhops,
7234 { "boundaryHops", "ptp.v2.mm.boundaryhops",
7235 FT_UINT8, BASE_DEC, NULL, 0x00,
7236 NULL, HFILL }
7238 { &hf_ptp_v2_mm_action,
7239 { "action", "ptp.v2.mm.action",
7240 FT_UINT8, BASE_DEC, VALS(ptp_v2_mm_action_vals), 0x0F,
7241 NULL, HFILL }
7243 /* Management TLV */
7244 { &hf_ptp_v2_mm_tlvType,
7245 { "tlvType", "ptp.v2.mm.tlvType",
7246 FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ptp_v2_TLV_type_vals_ext, 0x00,
7247 NULL, HFILL }
7249 { &hf_ptp_v2_mm_lengthField,
7250 { "lengthField", "ptp.v2.mm.lengthField",
7251 FT_UINT16, BASE_DEC, NULL, 0x00,
7252 NULL, HFILL }
7254 { &hf_ptp_v2_mm_managementId,
7255 { "managementId", "ptp.v2.mm.managementId",
7256 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_managementID_vals_ext, 0x00,
7257 NULL, HFILL }
7259 { &hf_ptp_v2_mm_data,
7260 { "data", "ptp.v2.mm.data",
7261 FT_BYTES, BASE_NONE, NULL, 0x00,
7262 NULL, HFILL }
7264 /* Management TLV dataField */
7265 /* CLOCK_DESCRIPTION */
7266 { &hf_ptp_v2_mm_clockType,
7267 { "clockType", "ptp.v2.mm.clockType",
7268 FT_UINT16, BASE_HEX, NULL, 0x00,
7269 NULL, HFILL }
7271 { &hf_ptp_v2_mm_clockType_ordinaryClock,
7272 { "The node implements an ordinary clock", "ptp.v2.mm.clockType.OC",
7273 FT_BOOLEAN, 16, NULL, CLOCKTYPE_ORDINARY_CLOCK,
7274 NULL, HFILL }
7276 { &hf_ptp_v2_mm_clockType_boundaryClock,
7277 { "The node implements a boundary clock", "ptp.v2.mm.clockType.BC",
7278 FT_BOOLEAN, 16, NULL, CLOCKTYPE_BOUNDARY_CLOCK,
7279 NULL, HFILL }
7281 { &hf_ptp_v2_mm_clockType_p2p_transparentClock,
7282 { "The node implements a peer-to-peer transparent clock", "ptp.v2.mm.clockType.p2p_TC",
7283 FT_BOOLEAN, 16, NULL, CLOCKTYPE_P2P_TC,
7284 NULL, HFILL }
7286 { &hf_ptp_v2_mm_clockType_e2e_transparentClock,
7287 { "The node implements an end-to-end transparent clock", "ptp.v2.mm.clockType.e2e_TC",
7288 FT_BOOLEAN, 16, NULL, CLOCKTYPE_E2E_TC,
7289 NULL, HFILL }
7291 { &hf_ptp_v2_mm_clockType_managementNode,
7292 { "The node implements a management node", "ptp.v2.mm.clockType.MM",
7293 FT_BOOLEAN, 16, NULL, CLOCKTYPE_MANAGEMENT_NODE,
7294 NULL, HFILL }
7296 { &hf_ptp_v2_mm_clockType_reserved,
7297 { "Reserved", "ptp.v2.mm.clockType.reserved",
7298 FT_BOOLEAN, 16, NULL, CLOCKTYPE_RESERVED,
7299 NULL, HFILL }
7301 { &hf_ptp_v2_mm_physicalLayerProtocol,
7302 { "physicalLayerProtocol", "ptp.v2.mm.physicalLayerProtocol",
7303 FT_STRING, BASE_NONE, NULL, 0x00,
7304 NULL, HFILL }
7306 { &hf_ptp_v2_mm_physicalLayerProtocol_length,
7307 { "length", "ptp.v2.mm.physicalLayerProtocol.length",
7308 FT_UINT8, BASE_DEC, NULL, 0x00,
7309 NULL, HFILL }
7311 { &hf_ptp_v2_mm_physicalAddressLength,
7312 { "physical address length", "ptp.v2.mm.physicalAddressLength",
7313 FT_UINT16, BASE_DEC, NULL, 0x00,
7314 NULL, HFILL }
7316 { &hf_ptp_v2_mm_physicalAddress,
7317 { "physical address", "ptp.v2.mm.physicalAddress",
7318 FT_BYTES, BASE_NONE, NULL, 0x00,
7319 NULL, HFILL }
7321 { &hf_ptp_v2_mm_protocolAddress,
7322 { "protocol address", "ptp.v2.mm.protocolAddress",
7323 FT_BYTES, BASE_NONE, NULL, 0x00,
7324 NULL, HFILL }
7326 { &hf_ptp_v2_mm_protocolAddress_networkProtocol,
7327 { "network protocol", "ptp.v2.mm.networkProtocol",
7328 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_networkProtocol_vals_ext, 0x00,
7329 NULL, HFILL }
7331 { &hf_ptp_v2_mm_protocolAddress_length,
7332 { "length", "ptp.v2.mm.protocolAddress.length",
7333 FT_UINT16, BASE_DEC, NULL, 0x00,
7334 NULL, HFILL }
7336 { &hf_ptp_v2_mm_manufacturerIdentity,
7337 { "manufacturer identity", "ptp.v2.mm.manufacturerIdentity",
7338 FT_BYTES, BASE_NONE, NULL, 0x00,
7339 NULL, HFILL }
7341 { &hf_ptp_v2_mm_reserved,
7342 { "reserved", "ptp.v2.mm.reserved",
7343 FT_BYTES, BASE_NONE, NULL, 0x00,
7344 NULL, HFILL }
7346 { &hf_ptp_v2_mm_productDescription,
7347 { "product description", "ptp.v2.mm.productDescription",
7348 FT_STRING, BASE_NONE, NULL, 0x00,
7349 NULL, HFILL }
7351 { &hf_ptp_v2_mm_productDescription_length,
7352 { "length", "ptp.v2.mm.productDescription.length",
7353 FT_UINT8, BASE_DEC, NULL, 0x00,
7354 NULL, HFILL }
7356 { &hf_ptp_v2_mm_revisionData,
7357 { "revision data", "ptp.v2.mm.revisionData",
7358 FT_STRING, BASE_NONE, NULL, 0x00,
7359 NULL, HFILL }
7361 { &hf_ptp_v2_mm_revisionData_length,
7362 { "length", "ptp.v2.mm.revisionData.length",
7363 FT_UINT8, BASE_DEC, NULL, 0x00,
7364 NULL, HFILL }
7366 { &hf_ptp_v2_mm_userDescription,
7367 { "user description", "ptp.v2.mm.userDescription",
7368 FT_STRING, BASE_NONE, NULL, 0x00,
7369 NULL, HFILL }
7371 { &hf_ptp_v2_mm_userDescription_length,
7372 { "length", "ptp.v2.mm.userDescription.length",
7373 FT_UINT8, BASE_DEC, NULL, 0x00,
7374 NULL, HFILL }
7376 { &hf_ptp_v2_mm_profileIdentity,
7377 { "profileIdentity", "ptp.v2.mm.profileIdentity",
7378 FT_BYTES, BASE_NONE, NULL, 0x00,
7379 NULL, HFILL }
7381 { &hf_ptp_v2_mm_pad,
7382 { "Pad", "ptp.v2.mm.pad",
7383 FT_BYTES, BASE_NONE, NULL, 0x0,
7384 NULL, HFILL }
7386 { &hf_ptp_v2_mm_initializationKey,
7387 { "initialization key", "ptp.v2.mm.initializationKey",
7388 FT_UINT16, BASE_DEC, NULL, 0x00,
7389 NULL, HFILL }
7391 { &hf_ptp_v2_mm_numberOfFaultRecords,
7392 { "number of fault records", "ptp.v2.mm.numberOfFaultRecords",
7393 FT_UINT16, BASE_DEC, NULL, 0x00,
7394 NULL, HFILL }
7396 #if 0
7397 { &hf_ptp_v2_mm_faultRecord,
7398 { "fault record", "ptp.v2.mm.faultRecord",
7399 FT_BYTES, BASE_NONE, NULL, 0x00,
7400 NULL, HFILL }
7402 #endif
7403 { &hf_ptp_v2_mm_faultRecordLength,
7404 { "fault record length", "ptp.v2.mm.faultRecordLength",
7405 FT_UINT16, BASE_DEC, NULL, 0x00,
7406 NULL, HFILL }
7408 { &hf_ptp_v2_mm_severityCode,
7409 { "severity code", "ptp.v2.mm.severityCode",
7410 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_v2_severityCode_vals_ext, 0x00,
7411 NULL, HFILL }
7413 { &hf_ptp_v2_mm_faultName,
7414 { "faultName", "ptp.v2.mm.faultName",
7415 FT_STRING, BASE_NONE, NULL, 0x00,
7416 NULL, HFILL }
7418 { &hf_ptp_v2_mm_faultName_length,
7419 { "length", "ptp.v2.mm.faultName.length",
7420 FT_UINT8, BASE_DEC, NULL, 0x00,
7421 NULL, HFILL }
7423 { &hf_ptp_v2_mm_faultValue,
7424 { "faultValue", "ptp.v2.mm.faultValue",
7425 FT_STRING, BASE_NONE, NULL, 0x00,
7426 NULL, HFILL }
7428 { &hf_ptp_v2_mm_faultValue_length,
7429 { "length", "ptp.v2.mm.faultValue.length",
7430 FT_UINT8, BASE_DEC, NULL, 0x00,
7431 NULL, HFILL }
7433 { &hf_ptp_v2_mm_faultDescription,
7434 { "faultDescription", "ptp.v2.mm.faultDescription",
7435 FT_STRING, BASE_NONE, NULL, 0x00,
7436 NULL, HFILL }
7438 { &hf_ptp_v2_mm_faultDescription_length,
7439 { "length", "ptp.v2.mm.faultDescription.length",
7440 FT_UINT8, BASE_DEC, NULL, 0x00,
7441 NULL, HFILL }
7443 #if 0
7444 { &hf_ptp_v2_mm_faultTime,
7445 { "Fault time", "ptp.v2.mm.faultTime",
7446 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
7447 NULL, HFILL }
7449 #endif
7450 { &hf_ptp_v2_mm_faultTime_s,
7451 { "Fault time (seconds)", "ptp.v2.mm.faultTime.seconds",
7452 FT_UINT64, BASE_DEC, NULL, 0x00,
7453 NULL, HFILL }
7455 { &hf_ptp_v2_mm_faultTime_ns,
7456 { "Fault time (nanoseconds)", "ptp.v2.mm.faultTime.nanoseconds",
7457 FT_INT32, BASE_DEC, NULL, 0x00,
7458 NULL, HFILL }
7460 { &hf_ptp_v2_mm_currentTime_s,
7461 { "current time (seconds)", "ptp.v2.mm.currentTime.seconds",
7462 FT_UINT64, BASE_DEC, NULL, 0x00,
7463 NULL, HFILL }
7465 { &hf_ptp_v2_mm_currentTime_ns,
7466 { "current time (nanoseconds)", "ptp.v2.mm.currentTime.nanoseconds",
7467 FT_INT32, BASE_DEC, NULL, 0x00,
7468 NULL, HFILL }
7470 { &hf_ptp_v2_mm_clockAccuracy,
7471 { "Clock accuracy", "ptp.v2.mm.clockaccuracy",
7472 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
7473 NULL, HFILL }
7476 { &hf_ptp_v2_mm_priority1,
7477 { "priority1", "ptp.v2.mm.priority1",
7478 FT_UINT8, BASE_DEC, NULL, 0x00,
7479 NULL, HFILL }
7481 { &hf_ptp_v2_mm_priority2,
7482 { "priority2", "ptp.v2.mm.priority2",
7483 FT_UINT8, BASE_DEC, NULL, 0x00,
7484 NULL, HFILL }
7486 { &hf_ptp_v2_mm_dds_SO,
7487 { "Slave only", "ptp.v2.mm.SlaveOnly",
7488 FT_BOOLEAN, 8, NULL, 0x02,
7489 NULL, HFILL }
7491 { &hf_ptp_v2_mm_TSC,
7492 { "Two step", "ptp.v2.mm.twoStep",
7493 FT_BOOLEAN, 8, NULL, 0x01,
7494 NULL, HFILL }
7496 { &hf_ptp_v2_mm_numberPorts,
7497 { "number of ports", "ptp.v2.mm.numberPorts",
7498 FT_UINT16, BASE_DEC, NULL, 0x00,
7499 NULL, HFILL }
7501 { &hf_ptp_v2_mm_clockclass,
7502 { "Clock class", "ptp.v2.mm.clockclass",
7503 FT_UINT8, BASE_DEC, NULL, 0x00,
7504 NULL, HFILL }
7506 { &hf_ptp_v2_mm_clockaccuracy,
7507 { "Clock accuracy", "ptp.v2.mm.clockaccuracy",
7508 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
7509 NULL, HFILL }
7511 { &hf_ptp_v2_mm_clockvariance,
7512 { "Clock variance", "ptp.v2.mm.clockvariance",
7513 FT_UINT16, BASE_DEC, NULL, 0x00,
7514 NULL, HFILL }
7516 { &hf_ptp_v2_mm_clockidentity,
7517 { "Clock identity", "ptp.v2.mm.clockidentity",
7518 FT_UINT64, BASE_HEX, NULL, 0x00,
7519 NULL, HFILL }
7521 { &hf_ptp_v2_mm_domainNumber,
7522 { "domain number", "ptp.v2.mm.domainNumber",
7523 FT_UINT8, BASE_DEC, NULL , 0x00,
7524 NULL, HFILL }
7526 { &hf_ptp_v2_mm_SO,
7527 { "Slave only", "ptp.v2.mm.SlavOnly",
7528 FT_BOOLEAN, 8, NULL, 0x01,
7529 NULL, HFILL }
7531 { &hf_ptp_v2_mm_stepsRemoved,
7532 { "steps removed", "ptp.v2.mm.stepsRemoved",
7533 FT_INT16, BASE_DEC, NULL, 0x00,
7534 NULL, HFILL }
7536 { &hf_ptp_v2_mm_parentIdentity,
7537 { "parent ClockIdentity", "ptp.v2.mm.parentclockidentity",
7538 FT_UINT64, BASE_HEX, NULL, 0x00,
7539 NULL, HFILL }
7541 { &hf_ptp_v2_mm_parentPort,
7542 { "parent SourcePortID", "ptp.v2.mm.parentsourceportid",
7543 FT_UINT16, BASE_DEC, NULL, 0x00,
7544 NULL, HFILL }
7546 { &hf_ptp_v2_mm_parentStats,
7547 { "parent stats", "ptp.v2.mm.parentstats",
7548 FT_BOOLEAN, 8, NULL, 0x01,
7549 NULL, HFILL }
7551 { &hf_ptp_v2_mm_observedParentOffsetScaledLogVariance,
7552 { "observedParentOffsetScaledLogVariance", "ptp.v2.mm.observedParentOffsetScaledLogVariance",
7553 FT_UINT16, BASE_DEC, NULL, 0x00,
7554 NULL, HFILL }
7556 { &hf_ptp_v2_mm_observedParentClockPhaseChangeRate,
7557 { "observedParentClockPhaseChangeRate", "ptp.v2.mm.observedParentClockPhaseChangeRate",
7558 FT_INT32, BASE_DEC, NULL, 0x00,
7559 NULL, HFILL }
7561 { &hf_ptp_v2_mm_grandmasterPriority1,
7562 { "Grandmaster priority1", "ptp.v2.mm.grandmasterPriority1",
7563 FT_UINT8, BASE_DEC, NULL, 0x00,
7564 NULL, HFILL }
7566 { &hf_ptp_v2_mm_grandmasterPriority2,
7567 { "Grandmaster priority2", "ptp.v2.mm.grandmasterPriority2",
7568 FT_UINT8, BASE_DEC, NULL, 0x00,
7569 NULL, HFILL }
7571 { &hf_ptp_v2_mm_grandmasterclockclass,
7572 { "Grandmaster clock class", "ptp.v2.mm.grandmasterclockclass",
7573 FT_UINT8, BASE_DEC, NULL, 0x00,
7574 NULL, HFILL }
7576 { &hf_ptp_v2_mm_grandmasterclockaccuracy,
7577 { "Grandmaster clock accuracy", "ptp.v2.mm.grandmasterclockaccuracy",
7578 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_clockAccuracy_vals_ext, 0x00,
7579 NULL, HFILL }
7581 { &hf_ptp_v2_mm_grandmasterclockvariance,
7582 { "Grandmaster clock variance", "ptp.v2.mm.grandmasterclockvariance",
7583 FT_UINT16, BASE_DEC, NULL, 0x00,
7584 NULL, HFILL }
7586 { &hf_ptp_v2_mm_grandmasterIdentity,
7587 { "Grandmaster clock identity", "ptp.v2.mm.grandmasterclockidentity",
7588 FT_UINT64, BASE_HEX, NULL, 0x00,
7589 NULL, HFILL }
7591 { &hf_ptp_v2_mm_currentUtcOffset,
7592 { "CurrentUTCOffset", "ptp.v2.mm.currentutcoffset",
7593 FT_INT16, BASE_DEC, NULL, 0x00,
7594 NULL, HFILL }
7596 { &hf_ptp_v2_mm_LI_61,
7597 { "leap 61", "ptp.v2.mm.li61",
7598 FT_BOOLEAN, 8, NULL, 0x01,
7599 NULL, HFILL }
7601 { &hf_ptp_v2_mm_LI_59,
7602 { "leap 59", "ptp.v2.mm.li59",
7603 FT_BOOLEAN, 8, NULL, 0x02,
7604 NULL, HFILL }
7606 { &hf_ptp_v2_mm_UTCV,
7607 { "CurrentUTCOffset valid", "ptp.v2.mm.CurrentUTCOffsetValid",
7608 FT_BOOLEAN, 8, NULL, 0x04,
7609 NULL, HFILL }
7611 { &hf_ptp_v2_mm_PTP,
7612 { "PTP timescale", "ptp.v2.mm.ptptimescale",
7613 FT_BOOLEAN, 8, NULL, 0x08,
7614 NULL, HFILL }
7616 { &hf_ptp_v2_mm_TTRA,
7617 { "Time traceable", "ptp.v2.mm.timeTraceable",
7618 FT_BOOLEAN, 8, NULL, 0x10,
7619 NULL, HFILL }
7621 { &hf_ptp_v2_mm_FTRA,
7622 { "Frequency traceable", "ptp.v2.mm.frequencyTraceable",
7623 FT_BOOLEAN, 8, NULL, 0x20,
7624 NULL, HFILL }
7626 { &hf_ptp_v2_mm_timesource,
7627 { "TimeSource", "ptp.v2.mm.timesource",
7628 FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ptp_v2_timeSource_vals_ext, 0x00,
7629 NULL, HFILL }
7631 { &hf_ptp_v2_mm_offset_ns,
7632 { "Ns", "ptp.v2.mm.offset.ns",
7633 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7634 NULL, HFILL }
7636 { &hf_ptp_v2_mm_offset_subns,
7637 { "SubNs", "ptp.v2.mm.offset.subns",
7638 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7639 NULL, HFILL }
7641 { &hf_ptp_v2_mm_pathDelay_ns,
7642 { "Ns", "ptp.v2.mm.pathDelay.ns",
7643 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7644 NULL, HFILL }
7646 { &hf_ptp_v2_mm_pathDelay_subns,
7647 { "SubNs", "ptp.v2.mm.pathDelay.subns",
7648 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7649 NULL, HFILL }
7651 { &hf_ptp_v2_mm_PortNumber,
7652 { "PortNumber", "ptp.v2.mm.PortNumber",
7653 FT_UINT16, BASE_DEC, NULL, 0x00,
7654 NULL, HFILL }
7656 { &hf_ptp_v2_mm_portState,
7657 { "Port state", "ptp.v2.mm.portState",
7658 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ptp_v2_portState_vals_ext, 0x00,
7659 NULL, HFILL }
7661 { &hf_ptp_v2_mm_logMinDelayReqInterval,
7662 { "logMinDelayReqInterval", "ptp.v2.mm.logMinDelayReqInterval",
7663 FT_INT8, BASE_DEC, NULL, 0x00,
7664 NULL, HFILL }
7666 { &hf_ptp_v2_mm_peerMeanPathDelay_ns,
7667 { "Ns", "ptp.v2.mm.peerMeanPathDelay.ns",
7668 FT_INT64, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7669 NULL, HFILL }
7671 { &hf_ptp_v2_mm_peerMeanPathDelay_subns,
7672 { "SubNs", "ptp.v2.mm.peerMeanPathDelay.subns",
7673 FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_nanosecond_nanoseconds), 0x00,
7674 NULL, HFILL }
7676 { &hf_ptp_v2_mm_logAnnounceInterval,
7677 { "logAnnounceInterval", "ptp.v2.mm.logAnnounceInterval",
7678 FT_INT8, BASE_DEC, NULL, 0x00,
7679 NULL, HFILL }
7681 { &hf_ptp_v2_mm_announceReceiptTimeout,
7682 { "announceReceiptTimeout", "ptp.v2.mm.announceReceiptTimeout",
7683 FT_UINT8, BASE_DEC, NULL, 0x00,
7684 NULL, HFILL }
7686 { &hf_ptp_v2_mm_logSyncInterval,
7687 { "logSyncInterval", "ptp.v2.mm.logSyncInterval",
7688 FT_INT8, BASE_DEC, NULL, 0x00,
7689 NULL, HFILL }
7691 { &hf_ptp_v2_mm_delayMechanism,
7692 { "Delay mechanism", "ptp.v2.mm.delayMechanism",
7693 FT_UINT8, BASE_DEC, VALS(ptp_v2_delayMechanism_vals), 0x00,
7694 NULL, HFILL }
7696 { &hf_ptp_v2_mm_logMinPdelayReqInterval,
7697 { "logMinPdelayReqInterval", "ptp.v2.mm.logMinPdelayReqInterval",
7698 FT_INT8, BASE_DEC, NULL, 0x00,
7699 NULL, HFILL }
7701 { &hf_ptp_v2_mm_versionNumber,
7702 { "versionNumber", "ptp.v2.mm.versionNumber",
7703 FT_UINT8, BASE_DEC, NULL, 0x0F,
7704 NULL, HFILL }
7706 { &hf_ptp_v2_mm_primaryDomain,
7707 { "Primary domain number", "ptp.v2.mm.primaryDomain",
7708 FT_UINT8, BASE_DEC, NULL, 0x00,
7709 NULL, HFILL }
7711 { &hf_ptp_v2_mm_faultyFlag,
7712 { "Faulty flag", "ptp.v2.mm.faultyFlag",
7713 FT_BOOLEAN, 8, NULL, 0x01,
7714 NULL, HFILL }
7717 { &hf_ptp_v2_mm_managementErrorId,
7718 { "managementErrorId", "ptp.v2.mm.managementErrorId",
7719 FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ptp_v2_managementErrorId_vals_ext, 0x00,
7720 NULL, HFILL }
7722 { &hf_ptp_v2_mm_displayData,
7723 { "Display data", "ptp.v2.mm.displayData",
7724 FT_STRING, BASE_NONE, NULL, 0x00,
7725 NULL, HFILL }
7727 { &hf_ptp_v2_mm_displayData_length,
7728 { "length", "ptp.v2.mm.displayData.length",
7729 FT_UINT8, BASE_DEC, NULL, 0x00,
7730 NULL, HFILL }
7732 { &hf_ptp_v2_mm_ucEN,
7733 { "Enable unicast", "ptp.v2.mm.unicastEnable",
7734 FT_BOOLEAN, 8, NULL, 0x01,
7735 NULL, HFILL }
7737 { &hf_ptp_v2_mm_ptEN,
7738 { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
7739 FT_BOOLEAN, 8, NULL, 0x01,
7740 NULL, HFILL }
7742 { &hf_ptp_v2_mm_atEN,
7743 { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
7744 FT_BOOLEAN, 8, NULL, 0x01,
7745 NULL, HFILL }
7747 { &hf_ptp_v2_mm_keyField,
7748 { "Key field", "ptp.v2.mm.keyField",
7749 FT_UINT8, BASE_DEC, NULL, 0x00,
7750 NULL, HFILL }
7752 { &hf_ptp_v2_mm_displayName,
7753 { "Display name", "ptp.v2.mm.displayName",
7754 FT_STRING, BASE_NONE, NULL, 0x00,
7755 NULL, HFILL }
7757 { &hf_ptp_v2_mm_displayName_length,
7758 { "length", "ptp.v2.mm.displayName.length",
7759 FT_UINT8, BASE_DEC, NULL, 0x00,
7760 NULL, HFILL }
7762 { &hf_ptp_v2_mm_maxKey,
7763 { "Max key", "ptp.v2.mm.maxKey",
7764 FT_UINT8, BASE_DEC, NULL, 0x00,
7765 NULL, HFILL }
7767 { &hf_ptp_v2_mm_currentOffset,
7768 { "Current offset", "ptp.v2.mm.currentOffset",
7769 FT_INT32, BASE_DEC, NULL, 0x00,
7770 NULL, HFILL }
7772 { &hf_ptp_v2_mm_jumpSeconds,
7773 { "Jump seconds", "ptp.v2.mm.jumpSeconds",
7774 FT_INT32, BASE_DEC, NULL, 0x00,
7775 NULL, HFILL }
7777 { &hf_ptp_v2_mm_nextjumpSeconds,
7778 { "Time of next jump (seconds)", "ptp.v2.mm.nextjumpSeconds",
7779 FT_UINT64, BASE_DEC, NULL, 0x00,
7780 NULL, HFILL }
7782 { &hf_ptp_v2_mm_numberOfAlternateMasters,
7783 { "Number of alternate masters", "ptp.v2.mm.numberOfAlternateMasters",
7784 FT_UINT8, BASE_DEC, NULL, 0x00,
7785 NULL, HFILL }
7787 { &hf_ptp_v2_mm_logAlternateMulticastSyncInterval,
7788 { "Alternate multicast sync interval", "ptp.v2.mm.AlternateMulticastSyncInterval",
7789 FT_INT8, BASE_DEC, NULL, 0x00,
7790 NULL, HFILL }
7792 { &hf_ptp_v2_mm_transmitAlternateMulticastSync,
7793 { "Transmit alternate multicast sync", "ptp.v2.mm.transmitAlternateMulticastSync",
7794 FT_BOOLEAN, 8, NULL, 0x01,
7795 NULL, HFILL }
7797 { &hf_ptp_v2_oe_tlv_smpte_subtype,
7798 { "SMPTE SubType", "ptp.v2.oe.smpte.SubType",
7799 FT_UINT24, BASE_HEX, VALS(ptp_v2_org_smpte_subtype_vals), 0x00,
7800 NULL, HFILL }
7802 { &hf_ptp_v2_oe_tlv_subtype_smpte_data,
7803 { "SMPTE Data", "ptp.v2.oe.smpte.data",
7804 FT_NONE, BASE_NONE, NULL, 0x00,
7805 NULL, HFILL }
7807 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate,
7808 { "defaultSystemFramerate", "ptp.v2.oe.smpte.defaultsystemframerate",
7809 FT_BYTES, BASE_NONE, NULL, 0x00,
7810 NULL, HFILL }
7812 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_numerator,
7813 { "Numerator", "ptp.v2.oe.smpte.defaultsystemframerate.numerator",
7814 FT_UINT32, BASE_DEC, NULL, 0x00,
7815 NULL, HFILL }
7817 { &hf_ptp_v2_oe_tlv_subtype_smpte_defaultsystemframerate_denominator,
7818 { "Denominator", "ptp.v2.oe.smpte.defaultsystemframerate.denominator",
7819 FT_UINT32, BASE_DEC, NULL, 0x00,
7820 NULL, HFILL }
7822 { &hf_ptp_v2_oe_tlv_subtype_smpte_masterlockingstatus,
7823 { "masterLockingStatus", "ptp.v2.oe.smpte.masterlockingstatus",
7824 FT_UINT8, BASE_DEC, VALS(ptp_v2_org_smpte_subtype_masterlockingstatus_vals), 0x00,
7825 NULL, HFILL }
7827 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags,
7828 { "timeAddressFlags", "ptp.v2.oe.smpte.timeaddressflags",
7829 FT_UINT8, BASE_HEX, NULL, 0x00,
7830 NULL, HFILL }
7832 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_drop,
7833 { "Drop frame", "ptp.v2.oe.smpte.timeaddressflags.drop",
7834 FT_BOOLEAN, 8, TFS(&tfs_inuse_not_inuse), PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_DROP,
7835 NULL, HFILL }
7837 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeaddressflags_color,
7838 { "Color frame identification", "ptp.v2.oe.smpte.timeaddressflags.color",
7839 FT_BOOLEAN, 8, TFS(&tfs_inuse_not_inuse), PTP_V2_FLAGS_OE_SMPTE_TIME_ADDRESS_FIELD_COLOR,
7840 NULL, HFILL }
7842 { &hf_ptp_v2_oe_tlv_subtype_smpte_currentlocaloffset,
7843 { "currentLocalOffset", "ptp.v2.oe.smpte.currentlocaloffset",
7844 FT_INT32, BASE_DEC, NULL, 0x00,
7845 "Offset in seconds of Local Time from grandmaster PTP time", HFILL }
7847 { &hf_ptp_v2_oe_tlv_subtype_smpte_jumpseconds,
7848 { "jumpSeconds", "ptp.v2.oe.smpte.jumpseconds",
7849 FT_INT32, BASE_DEC, NULL, 0x00,
7850 "Size of next discontinuity, in seconds, of Local Time", HFILL }
7852 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjump,
7853 { "timeOfNextJump", "ptp.v2.oe.smpte.timeofnextjump",
7854 FT_UINT48, BASE_DEC, NULL, 0x00,
7855 "Value of the seconds portion at the time that the next discontinuity of the currentLocalOffset will occur", HFILL }
7857 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofnextjam,
7858 { "timeOfNextJam", "ptp.v2.oe.smpte.timeofnextjam",
7859 FT_UINT48, BASE_DEC, NULL, 0x00,
7860 "Value of the seconds portion to the next scheduled Daily Jam", HFILL }
7862 { &hf_ptp_v2_oe_tlv_subtype_smpte_timeofpreviousjam,
7863 { "timeOfPreviousJam", "ptp.v2.oe.smpte.timeofpreviousjam",
7864 FT_UINT48, BASE_DEC, NULL, 0x00,
7865 "Value of the seconds portion of the previous Daily Jam", HFILL }
7867 { &hf_ptp_v2_oe_tlv_subtype_smpte_previousjamlocaloffset,
7868 { "previousJamLocalOffset", "ptp.v2.oe.smpte.previousjamlocaloffset",
7869 FT_INT32, BASE_DEC, NULL, 0x00,
7870 "Value of current LocalOffset at the time of the previous Daily Jam", HFILL }
7872 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving,
7873 { "daylightSaving", "ptp.v2.oe.smpte.daylightsaving",
7874 FT_UINT8, BASE_HEX, NULL, 0x00,
7875 NULL, HFILL }
7877 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_current,
7878 { "Current", "ptp.v2.oe.smpte.daylightsaving.current",
7879 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_CURRENT,
7880 NULL, HFILL }
7882 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_next,
7883 { "Next", "ptp.v2.oe.smpte.daylightsaving.next",
7884 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_NEXT,
7885 NULL, HFILL }
7887 { &hf_ptp_v2_oe_tlv_subtype_smpte_daylightsaving_previous,
7888 { "Previous", "ptp.v2.oe.smpte.daylightsaving.previous",
7889 FT_BOOLEAN, 8, TFS(&tfs_used_notused), PTP_V2_FLAGS_OE_SMPTE_DAYLIGHT_SAVING_PREVIOUS,
7890 NULL, HFILL }
7892 { &hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump,
7893 { "leapSecondJump", "ptp.v2.oe.smpte.leapsecondjump",
7894 FT_UINT8, BASE_HEX, NULL, 0x00,
7895 NULL, HFILL }
7897 { &hf_ptp_v2_oe_tlv_subtype_smpte_leapsecondjump_change,
7898 { "Change in number", "ptp.v2.oe.smpte.leapsecondjump.change",
7899 FT_BOOLEAN, 8, TFS(&tfs_set_notset), PTP_V2_FLAGS_OE_SMPTE_LEAP_SECOND_JUMP_CHANGE,
7900 NULL, HFILL }
7902 { &hf_ptp_v2_analysis_followup_to_sync,
7903 { "This is a Follow Up to Sync in Frame", "ptp.v2.analysis.followuptosync",
7904 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7905 "Which message is this a Follow Up for", HFILL }
7907 { &hf_ptp_v2_analysis_sync_to_followup,
7908 { "This is a Sync to Follow Up in Frame", "ptp.v2.analysis.synctofollowup",
7909 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7910 "Which message is this a Sync for", HFILL }
7912 { &hf_ptp_v2_analysis_pdelayreq_to_pdelayres,
7913 { "This is a Peer Delay Request to Response in Frame", "ptp.v2.analysis.pdelayreqtores",
7914 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7915 "Which Peer Delay Response is this a Peer Delay Request for", HFILL }
7917 { &hf_ptp_v2_analysis_pdelayres_to_pdelayreq,
7918 { "This is a Peer Delay Response to Request in Frame", "ptp.v2.analysis.pdelayrestoreq",
7919 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7920 "Which Peer Delay Request is this a Peer Delay Response for", HFILL }
7922 { &hf_ptp_v2_analysis_pdelayres_to_pdelayfup,
7923 { "This is a Peer Delay Response to Follow Up in Frame", "ptp.v2.analysis.pdelayfuptores",
7924 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7925 "Which Peer Delay FollowUp is this a Peer Delay Response for", HFILL }
7927 { &hf_ptp_v2_analysis_pdelayfup_to_pdelayres,
7928 { "This is a Peer Delay Follow Up to Response in Frame", "ptp.v2.analysis.pdelayrestofup",
7929 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
7930 "Which Peer Delay Response is this a Peer Delay FollowUp for", HFILL }
7932 { &hf_ptp_v2_analysis_sync_timestamp,
7933 { "calculatedSyncTimestamp", "ptp.v2.analysis.sync.timestamp",
7934 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7935 NULL, HFILL }
7937 { &hf_ptp_v2_analysis_sync_timestamp_seconds,
7938 { "calculatedSyncTimestamp (s)", "ptp.v2.analysis.sync.timestamp_seconds",
7939 FT_UINT64, BASE_DEC, NULL, 0x00,
7940 NULL, HFILL }
7942 { &hf_ptp_v2_analysis_sync_timestamp_nanoseconds,
7943 { "calculatedSyncTimestamp (ns)", "ptp.v2.analysis.sync.timestamp_nanoseconds",
7944 FT_UINT32, BASE_DEC, NULL, 0x00,
7945 NULL, HFILL }
7947 { &hf_ptp_v2_analysis_sync_period,
7948 { "measuredMessagePeriod", "ptp.v2.analysis.sync.measuredMessagePeriod",
7949 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7950 NULL, HFILL }
7952 { &hf_ptp_v2_analysis_sync_rateRatio,
7953 { "calculatedSyncRateRatio", "ptp.v2.analysis.sync.calculatedRateRatio",
7954 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7955 NULL, HFILL }
7957 { &hf_ptp_v2_analysis_sync_rateRatio_ppm,
7958 { "calculatedSyncRateRatio PPM", "ptp.v2.analysis.sync.calculatedRateRatio_ppm",
7959 FT_INT32, BASE_DEC, NULL, 0x00,
7960 NULL, HFILL }
7962 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled,
7963 { "calculatedUnscaledMeanPropagationDelay", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled",
7964 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7965 NULL, HFILL }
7967 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled_seconds,
7968 { "calculatedUnscaledMeanPropagationDelay (s)", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled_seconds",
7969 FT_INT64, BASE_DEC, NULL, 0x00,
7970 NULL, HFILL }
7972 { &hf_ptp_v2_analysis_pdelay_mpd_unscaled_nanoseconds,
7973 { "calculatedUnscaledMeanPropagationDelay (ns)", "ptp.v2.analysis.pdelay.meanpropdelay_unscaled_nanoseconds",
7974 FT_INT32, BASE_DEC, NULL, 0x00,
7975 NULL, HFILL }
7977 { &hf_ptp_v2_analysis_pdelay_mpd_scaled,
7978 { "calculatedScaledMeanPropagationDelay", "ptp.v2.analysis.pdelay.meanpropdelay_scaled",
7979 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7980 NULL, HFILL }
7982 { &hf_ptp_v2_analysis_pdelay_period,
7983 { "measuredMessagePeriod", "ptp.v2.analysis.pdelay.measuredMessagePeriod",
7984 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7985 NULL, HFILL }
7987 { &hf_ptp_v2_analysis_pdelay_neighRateRatio,
7988 { "calculatedNeighborRateRatio", "ptp.v2.analysis.pdelay.calculatedNeighborRateRatio",
7989 FT_DOUBLE, BASE_NONE, NULL, 0x00,
7990 NULL, HFILL }
7992 { &hf_ptp_v2_analysis_pdelay_neighRateRatio_ppm,
7993 { "calculatedNeighborRateRatio PPM", "ptp.v2.analysis.pdelay.calculatedNeighborRateRatio_ppm",
7994 FT_INT32, BASE_DEC, NULL, 0x00,
7995 NULL, HFILL }
8000 /* Setup protocol subtree array */
8001 static int *ett[] = {
8002 &ett_ptp,
8003 &ett_ptp_flags,
8004 &ett_ptp_time,
8005 &ett_ptp_time2,
8006 &ett_ptp_v2,
8007 &ett_ptp_v2_majorsdoid,
8008 &ett_ptp_v2_flags,
8009 &ett_ptp_v2_clockidentity,
8010 &ett_ptp_v2_correction,
8011 &ett_ptp_v2_time,
8012 &ett_ptp_v2_time2,
8013 &ett_ptp_v2_managementData,
8014 &ett_ptp_v2_clockType,
8015 &ett_ptp_v2_physicalLayerProtocol,
8016 &ett_ptp_v2_protocolAddress,
8017 &ett_ptp_v2_ptptext,
8018 &ett_ptp_v2_faultRecord,
8019 &ett_ptp_v2_timeInterval,
8020 &ett_ptp_v2_tlv,
8021 &ett_ptp_v2_tlv_log_period,
8022 &ett_ptp_v2_sig_l1sync_flags,
8023 &ett_ptp_as_sig_tlv_flags,
8024 &ett_ptp_oe_wr_flags,
8025 &ett_ptp_oe_smpte_data,
8026 &ett_ptp_oe_smpte_framerate,
8027 &ett_ptp_oe_smpte_timeaddress,
8028 &ett_ptp_oe_smpte_daylightsaving,
8029 &ett_ptp_oe_smpte_leapsecondjump,
8030 &ett_ptp_analysis_timestamp,
8031 &ett_ptp_analysis_mean_propagation_delay,
8034 static ei_register_info ei[] = {
8035 { &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 }},
8036 { &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 }},
8037 { &ei_ptp_v2_sync_no_followup, { "ptp.v2.sync_no_fup", PI_PROTOCOL, PI_WARN, "No Follow Up for this Two Step Sync", EXPFILL }},
8038 { &ei_ptp_v2_sync_no_fup_tlv, { "ptp.v2.sync_no_fup_tlv", PI_PROTOCOL, PI_WARN, "No Follow Up TLV for this gPTP One Step Sync", EXPFILL }},
8039 { &ei_ptp_v2_followup_no_sync, { "ptp.v2.fup_without_sync", PI_PROTOCOL, PI_WARN, "No Sync for this Follow Up", EXPFILL }},
8040 { &ei_ptp_v2_pdreq_no_pdresp, { "ptp.v2.pdelay_req_without_resp", PI_PROTOCOL, PI_WARN, "No Response for this Peer Delay Request", EXPFILL }},
8041 { &ei_ptp_v2_pdresp_no_pdreq, { "ptp.v2.pdelay_resp_without_req", PI_PROTOCOL, PI_WARN, "No Request for this Peer Delay Response", EXPFILL }},
8042 { &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 }},
8043 { &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", EXPFILL }},
8044 { &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 }},
8045 { &ei_ptp_v2_period_invalid, { "ptp.v2.period.invalid", PI_PROTOCOL, PI_WARN, "Period invalid", EXPFILL }},
8048 expert_module_t* expert_ptp;
8050 /* Register the protocol name and description */
8051 proto_ptp = proto_register_protocol("Precision Time Protocol (IEEE1588)",
8052 "PTP", "ptp");
8054 /* Required function calls to register the header fields and subtrees used */
8055 proto_register_field_array(proto_ptp, hf, array_length(hf));
8056 proto_register_subtree_array(ett, array_length(ett));
8058 expert_ptp = expert_register_protocol(proto_ptp);
8059 expert_register_field_array(expert_ptp, ei, array_length(ei));
8061 /* Get the decimal point based on locale */
8062 decimal_point = localeconv()->decimal_point;
8063 /* Configuration */
8065 module_t *ptp_module = prefs_register_protocol(proto_ptp, NULL);
8066 prefs_register_bool_preference(ptp_module, "analyze_ptp_messages", "Analyze PTP messages",
8067 "Make the PTP dissector analyze PTP messages. Accurate Capture Timestamps required!",
8068 &ptp_analyze_messages);
8070 prefs_register_uint_preference(ptp_module, "analyze_ptp_delta", "Analysis: Max message delta",
8071 "Maximum allowed time between messages of same type when finding "
8072 "consecutive messages for analysis calculations.",
8073 10, &ptp_analysis_max_consecutive_delta);
8075 /* Setup analysis data structures */
8076 ptp_clocks = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
8079 void
8080 proto_reg_handoff_ptp(void)
8082 dissector_handle_t ptp_handle;
8083 dissector_handle_t ethertype_ptp_handle;
8085 ptp_handle = register_dissector("ptp", dissect_ptp, proto_ptp);
8086 ethertype_ptp_handle = register_dissector("ptp_over_ethernet", dissect_ptp_oE, proto_ptp);
8088 dissector_add_uint_range_with_preference("udp.port", PTP_PORT_RANGE, ptp_handle);
8089 dissector_add_uint("ethertype", ETHERTYPE_PTP, ethertype_ptp_handle);
8093 * Editor modelines - https://www.wireshark.org/tools/modelines.html
8095 * Local variables:
8096 * c-basic-offset: 4
8097 * tab-width: 8
8098 * indent-tabs-mode: nil
8099 * End:
8101 * vi: set shiftwidth=4 tabstop=8 expandtab:
8102 * :indentSize=4:tabSize=8:noTabs=true: