Coverage Report

Created: 2026-01-02 06:13

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