Enable Lua tcp tap userdata.
[obnox/wireshark/wip.git] / epan / dissectors / packet-ptp.c
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  *
9  * Revisions:
10  * - Markus Seehofer 09.08.2005 <mseehofe@nt.hirschmann.de>
11  *   - Included the "startingBoundaryHops" field in
12  *     ptp_management messages.
13  * - Christian Schaer 07.07.2006 <scc@zhwin.ch>
14  *   - Added support for PTP version 2
15  * - Markus Renz 2007-06-01
16  *   updated support for PTPv2
17  *  - Markus Renz added Management for PTPv2, update to Draft 2.2
18  *
19  * $Id$
20  *
21  * Wireshark - Network traffic analyzer
22  * By Gerald Combs <gerald@wireshark.org>
23  * Copyright 1998 Gerald Combs
24  *
25  * This program is free software; you can redistribute it and/or
26  * modify it under the terms of the GNU General Public License
27  * as published by the Free Software Foundation; either version 2
28  * of the License, or (at your option) any later version.
29  *
30  * This program is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33  * GNU General Public License for more details.
34  *
35  * You should have received a copy of the GNU General Public License
36  * along with this program; if not, write to the Free Software
37  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38  */
39
40 #ifdef HAVE_CONFIG_H
41 # include "config.h"
42 #endif
43
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47 #include <math.h>
48
49
50 #include <glib.h>
51
52 #include <epan/packet.h>
53 #include <epan/etypes.h>
54
55
56 /**********************************************************/
57 /* Port definition's for PTP                                                      */
58 /**********************************************************/
59 #define EVENT_PORT_PTP      319
60 #define GENERAL_PORT_PTP    320
61
62 /*END Port definition's for PTP*/
63
64 static int proto_ptp = -1;
65
66 /***********************************************************************************/
67 /* Definitions and fields for PTPv1 dissection.                                    */
68 /***********************************************************************************/
69
70
71 /**********************************************************/
72 /* Offsets of fields within a PTPv1 packet.                               */
73 /**********************************************************/
74
75 /*Common offsets for all Messages (Synch, Delay_Req, Follow_Up, Delay_Resp ....)*/
76 #define PTP_VERSIONPTP_OFFSET                   0
77 #define PTP_VERSIONNETWORK_OFFSET               2
78 #define PTP_SUBDOMAIN_OFFSET                    4
79 #define PTP_MESSAGETYPE_OFFSET                  20
80 #define PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET        21
81 #define PTP_SOURCEUUID_OFFSET                   22
82 #define PTP_SOURCEPORTID_OFFSET                 28
83 #define PTP_SEQUENCEID_OFFSET                   30
84 #define PTP_CONTROL_OFFSET                              32
85 #define PTP_FLAGS_OFFSET                                34
86 #define PTP_FLAGS_LI61_OFFSET                   34
87 #define PTP_FLAGS_LI59_OFFSET                   34
88 #define PTP_FLAGS_BOUNDARY_CLOCK_OFFSET 34
89 #define PTP_FLAGS_ASSIST_OFFSET                 34
90 #define PTP_FLAGS_EXT_SYNC_OFFSET               34
91 #define PTP_FLAGS_PARENT_STATS_OFFSET   34
92 #define PTP_FLAGS_SYNC_BURST_OFFSET             34
93
94 /*Offsets for PTP_Sync and Delay_Req (=SDR) messages*/
95 #define PTP_SDR_ORIGINTIMESTAMP_OFFSET                                          40
96 #define PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET                          40
97 #define PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET                      44
98 #define PTP_SDR_EPOCHNUMBER_OFFSET                                                      48
99 #define PTP_SDR_CURRENTUTCOFFSET_OFFSET                                         50
100 #define PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET       53
101 #define PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET                                     54
102 #define PTP_SDR_GRANDMASTERPORTID_OFFSET                                        60
103 #define PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET                            62
104 #define PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET                          67
105 #define PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET                       68
106 #define PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET                         74
107 #define PTP_SDR_GRANDMASTERPREFERRED_OFFSET                                     77
108 #define PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET                       79
109 #define PTP_SDR_SYNCINTERVAL_OFFSET                                                     83
110 #define PTP_SDR_LOCALCLOCKVARIANCE_OFFSET                                       86
111 #define PTP_SDR_LOCALSTEPSREMOVED_OFFSET                                        90
112 #define PTP_SDR_LOCALCLOCKSTRATUM_OFFSET                                        95
113 #define PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET                                     96
114 #define PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET            101
115 #define PTP_SDR_PARENTUUID_OFFSET                                                       102
116 #define PTP_SDR_PARENTPORTFIELD_OFFSET                                          110
117 #define PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET                          114
118 #define PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET                                     116
119 #define PTP_SDR_UTCREASONABLE_OFFSET                                            123
120
121 /*Offsets for Follow_Up (=FU) messages*/
122 #define PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET                                      42
123 #define PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET                            44
124 #define PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET            44
125 #define PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET        48
126
127 /*Offsets for Delay_Resp (=DR) messages*/
128 #define PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET                                     40
129 #define PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET                     40
130 #define PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET         44
131 #define PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET   49
132 #define PTP_DR_REQUESTINGSOURCEUUID_OFFSET                                      50
133 #define PTP_DR_REQUESTINGSOURCEPORTID_OFFSET                            56
134 #define PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET                        58
135
136 /*Offsets for Management (=MM) messages*/
137 #define PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET                     41
138 #define PTP_MM_TARGETUUID_OFFSET                                                        42
139 #define PTP_MM_TARGETPORTID_OFFSET                                                      48
140 #define PTP_MM_STARTINGBOUNDARYHOPS_OFFSET                                      50
141 #define PTP_MM_BOUNDARYHOPS_OFFSET                                                      52
142 #define PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET                                      55
143 #define PTP_MM_PARAMETERLENGTH_OFFSET                                           58
144         /*PARAMETERLENGTH > 0*/
145 #define PTP_MM_MESSAGEPARAMETERS_OFFSET                                         60
146         /*PTP_MM_CLOCK_IDENTITY (PARAMETERLENGTH = 64)*/
147 #define PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET       63
148 #define PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET                                     64
149 #define PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET                                     74
150 #define PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET                       76
151
152         /*PTP_MM_INITIALIZE_CLOCK (PARAMETERLENGTH = 4)*/
153 #define PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET                        62
154
155         /*PTP_MM_SET_SUBDOMAIN (PARAMETERLENGTH = 16)*/
156 #define PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET                                       60
157
158         /*PTP_MM_DEFAULT_DATA_SET (PARAMETERLENGTH = 76)*/
159 #define PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET     63
160 #define PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET                           64
161 #define PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET                           74
162 #define PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET                                     79
163 #define PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET                          80
164 #define PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET                            86
165 #define PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET                     89
166 #define PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET                                        95
167 #define PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET                            99
168 #define PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET                           103
169 #define PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET                          107
170 #define PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET                                     111
171 #define PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET                            112
172 #define PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET                                      130
173 #define PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET                     134
174
175         /*PTP_MM_UPDATE_DEFAULT_DATA_SET (PARAMETERLENGTH = 36)*/
176 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET                      63
177 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET           64
178 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET                     70
179 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET                         75
180 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET                      79
181 #define PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET                     80
182
183         /*PTP_MM_CURRENT_DATA_SET (PARAMETERLENGTH = 20)*/
184 #define PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET                                     62
185 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET                         64
186 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET          64
187 #define PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET      68
188 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET                                      72
189 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET                       72
190 #define PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET           76
191
192         /*PTP_MM_PARENT_DATA_SET (PARAMETERLENGTH = 90)*/
193 #define PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET     63
194 #define PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET                                        64
195 #define PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET                                      74
196 #define PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET      78
197 #define PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET                     83
198 #define PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET                      87
199 #define PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET                            90
200 #define PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET                                       95
201 #define PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET                          98
202 #define PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET                                     100
203 #define PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET                                     107
204 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET        111
205 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET                      112
206 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET            122
207 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET                        127
208 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET                     128
209 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET                       134
210 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET                      139
211 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET        143
212 #define PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET         146
213
214         /*PTP_MM_PORT_DATA_SET (PARAMETERLENGTH = 52)*/
215 #define PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET                          62
216 #define PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET                                           67
217 #define PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET         70
218 #define PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET      74
219 #define PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET         79
220 #define PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET                                       80
221 #define PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET                                         90
222 #define PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET                                        95
223 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET                      97
224 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET                      98
225 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET            99
226 #define PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET                            100
227 #define PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET                            106
228 #define PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET                          110
229
230         /*PTP_MM_GLOBAL_TIME_DATA_SET (PARAMETERLENGTH = 24)*/
231 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET                            60
232 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET                     60
233 #define PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET         64
234 #define PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET                     70
235 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET                                       75
236 #define PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET                                       79
237 #define PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET                          82
238
239         /*PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES (PARAMETERLENGTH = 16)*/
240 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET    62
241 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET                      67
242 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET                      71
243 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET         74
244
245         /*PTP_MM_GET_FOREIGN_DATA_SET (PARAMETERLENGTH = 4)*/
246 #define PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET                            62
247
248         /*PTP_MM_FOREIGN_DATA_SET (PARAMETERLENGTH = 28)*/
249 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET                       62
250 #define PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET                     66
251 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET     71
252 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET           72
253 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET         82
254 #define PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET                       86
255
256         /*PTP_MM_SET_SYNC_INTERVAL (PARAMETERLENGTH = 4)*/
257 #define PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET                            62
258
259         /*PTP_MM_SET_TIME (PARAMETERLENGTH = 8)*/
260 #define PTP_MM_SET_TIME_LOCALTIME_OFFSET                                                        60
261 #define PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET                                         60
262 #define PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET                                     64
263
264 /*END Offsets of fields within a PTP packet.*/
265
266 /**********************************************************/
267 /* flag-field-mask-definitions                                                    */
268 /**********************************************************/
269 #define PTP_FLAGS_LI61_BITMASK                          0x01
270 #define PTP_FLAGS_LI59_BITMASK                          0x02
271 #define PTP_FLAGS_BOUNDARY_CLOCK_BITMASK        0x04
272 #define PTP_FLAGS_ASSIST_BITMASK                        0x08
273 #define PTP_FLAGS_EXT_SYNC_BITMASK                      0x10
274 #define PTP_FLAGS_PARENT_STATS_BITMASK          0x20
275 #define PTP_FLAGS_SYNC_BURST_BITMASK            0x40
276
277 /*END flag-field-mask-definitions*/
278
279 /**********************************************************/
280 /* managementMessage definitions                                                  */
281 /**********************************************************/
282 #define PTP_MM_NULL                                                     0
283 #define PTP_MM_OBTAIN_IDENTITY                          1
284 #define PTP_MM_CLOCK_IDENTITY                           2
285 #define PTP_MM_INITIALIZE_CLOCK                         3
286 #define PTP_MM_SET_SUBDOMAIN                            4
287 #define PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER        5
288 #define PTP_MM_SET_DESIGNATED_PREFERRED_MASTER          6
289 #define PTP_MM_GET_DEFAULT_DATA_SET                     7
290 #define PTP_MM_DEFAULT_DATA_SET                         8
291 #define PTP_MM_UPDATE_DEFAULT_DATA_SET          9
292 #define PTP_MM_GET_CURRENT_DATA_SET             10
293 #define PTP_MM_CURRENT_DATA_SET                         11
294 #define PTP_MM_GET_PARENT_DATA_SET                      12
295 #define PTP_MM_PARENT_DATA_SET                          13
296 #define PTP_MM_GET_PORT_DATA_SET                        14
297 #define PTP_MM_PORT_DATA_SET                            15
298 #define PTP_MM_GET_GLOBAL_TIME_DATA_SET         16
299 #define PTP_MM_GLOBAL_TIME_DATA_SET                     17
300 #define PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES    18
301 #define PTP_MM_GOTO_FAULTY_STATE                        19
302 #define PTP_MM_GET_FOREIGN_DATA_SET             20
303 #define PTP_MM_FOREIGN_DATA_SET                         21
304 #define PTP_MM_SET_SYNC_INTERVAL                        22
305 #define PTP_MM_DISABLE_PORT                                     23
306 #define PTP_MM_ENABLE_PORT                                      24
307 #define PTP_MM_DISABLE_BURST                            25
308 #define PTP_MM_ENABLE_BURST                                     26
309 #define PTP_MM_SET_TIME                                         27
310
311 static const value_string ptp_managementMessageKey_vals[] = {
312   {PTP_MM_NULL,  "PTP_MM_NULL"},
313   {PTP_MM_OBTAIN_IDENTITY,  "PTP_MM_OBTAIN_IDENTITY"},
314   {PTP_MM_CLOCK_IDENTITY,  "PTP_MM_CLOCK_IDENTITY"},
315   {PTP_MM_INITIALIZE_CLOCK,  "PTP_MM_INITIALIZE_CLOCK"},
316   {PTP_MM_SET_SUBDOMAIN,  "PTP_MM_SET_SUBDOMAIN"},
317   {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER,  "PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER"},
318   {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER,  "PTP_MM_SET_DESIGNATED_PREFERRED_MASTER"},
319   {PTP_MM_GET_DEFAULT_DATA_SET,  "PTP_MM_GET_DEFAULT_DATA_SET"},
320   {PTP_MM_DEFAULT_DATA_SET,  "PTP_MM_DEFAULT_DATA_SET"},
321   {PTP_MM_UPDATE_DEFAULT_DATA_SET,  "PTP_MM_UPDATE_DEFAULT_DATA_SET"},
322   {PTP_MM_GET_CURRENT_DATA_SET,  "PTP_MM_GET_CURRENT_DATA_SET"},
323   {PTP_MM_CURRENT_DATA_SET,  "PTP_MM_CURRENT_DATA_SET"},
324   {PTP_MM_GET_PARENT_DATA_SET,  "PTP_MM_GET_PARENT_DATA_SET"},
325   {PTP_MM_PARENT_DATA_SET,  "PTP_MM_PARENT_DATA_SET"},
326   {PTP_MM_GET_PORT_DATA_SET,  "PTP_MM_GET_PORT_DATA_SET"},
327   {PTP_MM_PORT_DATA_SET,  "PTP_MM_PORT_DATA_SET"},
328   {PTP_MM_GET_GLOBAL_TIME_DATA_SET,  "PTP_MM_GET_GLOBAL_TIME_DATA_SET"},
329   {PTP_MM_GLOBAL_TIME_DATA_SET,  "PTP_MM_GLOBAL_TIME_DATA_SET"},
330   {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES,  "PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES"},
331   {PTP_MM_GOTO_FAULTY_STATE,  "PTP_MM_GOTO_FAULTY_STATE"},
332   {PTP_MM_GET_FOREIGN_DATA_SET,  "PTP_MM_GET_FOREIGN_DATA_SET"},
333   {PTP_MM_FOREIGN_DATA_SET,  "PTP_MM_FOREIGN_DATA_SET"},
334   {PTP_MM_SET_SYNC_INTERVAL,  "PTP_MM_SET_SYNC_INTERVAL"},
335   {PTP_MM_DISABLE_PORT,  "PTP_MM_DISABLE_PORT"},
336   {PTP_MM_ENABLE_PORT,  "PTP_MM_ENABLE_PORT"},
337   {PTP_MM_DISABLE_BURST,  "PTP_MM_DISABLE_BURST"},
338   {PTP_MM_ENABLE_BURST,  "PTP_MM_ENABLE_BURST"},
339   {PTP_MM_SET_TIME,  "PTP_MM_SET_TIME"},
340   {0,              NULL          } };
341         /*same again but better readable text for info column*/
342   static const value_string ptp_managementMessageKey_infocolumn_vals[] = {
343   {PTP_MM_NULL,  "Null"},
344   {PTP_MM_OBTAIN_IDENTITY,  "Obtain Identity"},
345   {PTP_MM_CLOCK_IDENTITY,  "Clock Identity"},
346   {PTP_MM_INITIALIZE_CLOCK,  "Initialize Clock"},
347   {PTP_MM_SET_SUBDOMAIN,  "Set Subdomain"},
348   {PTP_MM_CLEAR_DESIGNATED_PREFERRED_MASTER,  "Clear Designated Preferred Master"},
349   {PTP_MM_SET_DESIGNATED_PREFERRED_MASTER,  "Set Designated Preferred Master"},
350   {PTP_MM_GET_DEFAULT_DATA_SET,  "Get Default Data Set"},
351   {PTP_MM_DEFAULT_DATA_SET,  "Default Data Set"},
352   {PTP_MM_UPDATE_DEFAULT_DATA_SET,  "Update Default Data Set"},
353   {PTP_MM_GET_CURRENT_DATA_SET,  "Get Current Data Set"},
354   {PTP_MM_CURRENT_DATA_SET,  "Current Data Set"},
355   {PTP_MM_GET_PARENT_DATA_SET,  "Get Parent Data Set"},
356   {PTP_MM_PARENT_DATA_SET,  "Parent Data Set"},
357   {PTP_MM_GET_PORT_DATA_SET,  "Get Port Data Set"},
358   {PTP_MM_PORT_DATA_SET,  "Port Data Set"},
359   {PTP_MM_GET_GLOBAL_TIME_DATA_SET,  "Get Global Time Data Set"},
360   {PTP_MM_GLOBAL_TIME_DATA_SET,  "Global Time Data Set"},
361   {PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES,  "Update Global Time Properties"},
362   {PTP_MM_GOTO_FAULTY_STATE,  "Goto Faulty State"},
363   {PTP_MM_GET_FOREIGN_DATA_SET,  "Get Foreign Data Set"},
364   {PTP_MM_FOREIGN_DATA_SET,  "Foreign Data Set"},
365   {PTP_MM_SET_SYNC_INTERVAL,  "Set Sync Interval"},
366   {PTP_MM_DISABLE_PORT,  "Disable Port"},
367   {PTP_MM_ENABLE_PORT,  "Enable Port"},
368   {PTP_MM_DISABLE_BURST,  "Disable Burst"},
369   {PTP_MM_ENABLE_BURST,  "Enable Burst"},
370   {PTP_MM_SET_TIME,  "Set Time"},
371   {0,              NULL          } };
372
373 /*END managementMessage definitions*/
374
375 /**********************************************************/
376 /* CommunicationId definitions                                                    */
377 /**********************************************************/
378 #define PTP_CLOSED                              0
379 #define PTP_ETHER                               1
380 #define PTP_FFBUS                               4
381 #define PTP_PROFIBUS                    5
382 #define PTP_LON                                 6
383 #define PTP_DNET                                7
384 #define PTP_SDS                                 8
385 #define PTP_CONTROLNET                  9
386 #define PTP_CANOPEN                             10
387 #define PTP_IEEE1394                    243
388 #define PTP_IEEE802_11A                 244
389 #define PTP_IEEE_WIRELESS               245
390 #define PTP_INFINIBAND                  246
391 #define PTP_BLUETOOTH                   247
392 #define PTP_IEEE802_15_1                248
393 #define PTP_IEEE1451_3                  249
394 #define PTP_IEEE1451_5                  250
395 #define PTP_USB                                 251
396 #define PTP_ISA                                 252
397 #define PTP_PCI                                 253
398 #define PTP_VXI                                 254
399 #define PTP_DEFAULT                             255
400
401 static const value_string ptp_communicationid_vals[] = {
402   {PTP_CLOSED,  "Closed system outside the scope of this standard."},
403   {PTP_ETHER,  "IEEE 802.3 (Ethernet)"},
404   {PTP_FFBUS,  "FOUNDATION Fieldbus"},
405   {PTP_PROFIBUS,  "PROFIBUS"},
406   {PTP_LON,  "LonTalk"},
407   {PTP_DNET,  "DeviceNet"},
408   {PTP_SDS,  "SmartDistributedSystem"},
409   {PTP_CONTROLNET,  "ControlNet"},
410   {PTP_CANOPEN,  "CANopen"},
411   {PTP_IEEE1394,  "IEEE 1394"},
412   {PTP_IEEE802_11A,  "IEEE 802.11a"},
413   {PTP_IEEE_WIRELESS,  "IEEE 802.11b"},
414   {PTP_INFINIBAND,  "InfiniBand"},
415   {PTP_BLUETOOTH,  "Bluetooth wireless"},
416   {PTP_IEEE802_15_1,  "IEEE 802.15.1"},
417   {PTP_IEEE1451_3,  "IEEE 1451.3"},
418   {PTP_IEEE1451_5,  "IEEE 1451.5"},
419   {PTP_USB,  "USB bus"},
420   {PTP_ISA,  "ISA bus"},
421   {PTP_PCI,  "PCI bus"},
422   {PTP_VXI,  "VXI bus"},
423   {PTP_DEFAULT,  "Default value"},
424   {0,              NULL          } };
425
426 /*END CommunicationId definitions*/
427
428 /**********************************************************/
429 /* PTP message types    (PTP_CONTROL field)                               */
430 /**********************************************************/
431 #define PTP_SYNC_MESSAGE                0x00
432 #define PTP_DELAY_REQ_MESSAGE   0x01
433 #define PTP_FOLLOWUP_MESSAGE    0x02
434 #define PTP_DELAY_RESP_MESSAGE  0x03
435 #define PTP_MANAGEMENT_MESSAGE  0x04
436 #define PTP_OTHER_MESSAGE               0x05
437
438 static const value_string ptp_control_vals[] = {
439   {PTP_SYNC_MESSAGE,            "Sync Message"},
440   {PTP_DELAY_REQ_MESSAGE,       "Delay_Req Message"},
441   {PTP_FOLLOWUP_MESSAGE,    "Follow_Up Message"},
442   {PTP_DELAY_RESP_MESSAGE,      "Delay_Resp Message"},
443   {PTP_MANAGEMENT_MESSAGE,  "Management Message"},
444   {PTP_OTHER_MESSAGE,           "Other Message"},
445   {0,                                   NULL          } };
446
447 /*END PTP message types*/
448
449 /**********************************************************/
450 /* Channel values for the PTP_MESSAGETYPE field                   */
451 /**********************************************************/
452 #define PTP_MESSAGETYPE_EVENT   0x01
453 #define PTP_MESSAGETYPE_GENERAL 0x02
454
455 static const value_string ptp_messagetype_vals[] = {
456   {PTP_MESSAGETYPE_EVENT, "Event Message"},
457   {PTP_MESSAGETYPE_GENERAL, "General Message"},
458   {0,              NULL          } };
459
460 /*END channel values for the PTP_MESSAGETYPE field*/
461
462 /* Channel values for boolean vals (FLAGS)*/
463
464 static const value_string ptp_bool_vals[] = {
465   {1, "True"},
466   {0, "False"},
467   {0,              NULL          }};
468
469 /**********************************************************/
470 /* Initialize the protocol and registered fields                  */
471 /**********************************************************/
472
473 static int hf_ptp_versionptp = -1;
474 static int hf_ptp_versionnetwork = -1;
475 static int hf_ptp_subdomain = -1;
476 static int hf_ptp_messagetype = -1;
477 static int hf_ptp_sourcecommunicationtechnology = -1;
478 static int hf_ptp_sourceuuid = -1;
479 static int hf_ptp_sourceportid = -1;
480 static int hf_ptp_sequenceid = -1;
481 static int hf_ptp_control = -1;
482 static int hf_ptp_flags = -1;
483 static int hf_ptp_flags_li61 = -1;
484 static int hf_ptp_flags_li59 = -1;
485 static int hf_ptp_flags_boundary_clock = -1;
486 static int hf_ptp_flags_assist = -1;
487 static int hf_ptp_flags_ext_sync = -1;
488 static int hf_ptp_flags_parent = -1;
489 static int hf_ptp_flags_sync_burst = -1;
490
491 /*Fields for ptp_sync and delay_req (=sdr) messages*/
492 static int hf_ptp_sdr_origintimestamp = -1;     /*Field for seconds & nanoseconds*/
493 static int hf_ptp_sdr_origintimestamp_seconds = -1;
494 static int hf_ptp_sdr_origintimestamp_nanoseconds = -1;
495 static int hf_ptp_sdr_epochnumber = -1;
496 static int hf_ptp_sdr_currentutcoffset = -1;
497 static int hf_ptp_sdr_grandmastercommunicationtechnology = -1;
498 static int hf_ptp_sdr_grandmasterclockuuid = -1;
499 static int hf_ptp_sdr_grandmasterportid = -1;
500 static int hf_ptp_sdr_grandmastersequenceid = -1;
501 static int hf_ptp_sdr_grandmasterclockstratum = -1;
502 static int hf_ptp_sdr_grandmasterclockidentifier = -1;
503 static int hf_ptp_sdr_grandmasterclockvariance = -1;
504 static int hf_ptp_sdr_grandmasterpreferred = -1;
505 static int hf_ptp_sdr_grandmasterisboundaryclock = -1;
506 static int hf_ptp_sdr_syncinterval = -1;
507 static int hf_ptp_sdr_localclockvariance = -1;
508 static int hf_ptp_sdr_localstepsremoved = -1;
509 static int hf_ptp_sdr_localclockstratum = -1;
510 static int hf_ptp_sdr_localclockidentifier = -1;
511 static int hf_ptp_sdr_parentcommunicationtechnology = -1;
512 static int hf_ptp_sdr_parentuuid = -1;
513 static int hf_ptp_sdr_parentportfield = -1;
514 static int hf_ptp_sdr_estimatedmastervariance = -1;
515 static int hf_ptp_sdr_estimatedmasterdrift = -1;
516 static int hf_ptp_sdr_utcreasonable = -1;
517
518 /*Fields for follow_up (=fu) messages*/
519 static int hf_ptp_fu_associatedsequenceid = -1;
520 static int hf_ptp_fu_preciseorigintimestamp = -1;
521 static int hf_ptp_fu_preciseorigintimestamp_seconds = -1;
522 static int hf_ptp_fu_preciseorigintimestamp_nanoseconds = -1;
523
524 /*Fields for delay_resp (=dr) messages*/
525 static int hf_ptp_dr_delayreceipttimestamp = -1;
526 static int hf_ptp_dr_delayreceipttimestamp_seconds = -1;
527 static int hf_ptp_dr_delayreceipttimestamp_nanoseconds = -1;
528 static int hf_ptp_dr_requestingsourcecommunicationtechnology = -1;
529 static int hf_ptp_dr_requestingsourceuuid = -1;
530 static int hf_ptp_dr_requestingsourceportid = -1;
531 static int hf_ptp_dr_requestingsourcesequenceid = -1;
532
533 /*Fields for management (=mm) messages*/
534 static int hf_ptp_mm_targetcommunicationtechnology = -1;
535 static int hf_ptp_mm_targetuuid = -1;
536 static int hf_ptp_mm_targetportid = -1;
537 static int hf_ptp_mm_startingboundaryhops = -1;
538 static int hf_ptp_mm_boundaryhops = -1;
539 static int hf_ptp_mm_managementmessagekey = -1;
540 static int hf_ptp_mm_parameterlength = -1;
541         /*parameterlength > 0*/
542 static int hf_ptp_mm_messageparameters = -1;
543         /*ptp_mm_clock_identity (parameterlength = 64)*/
544 static int hf_ptp_mm_clock_identity_clockcommunicationtechnology = -1;
545 static int hf_ptp_mm_clock_identity_clockuuidfield = -1;
546 static int hf_ptp_mm_clock_identity_clockportfield = -1;
547 static int hf_ptp_mm_clock_identity_manufactureridentity = -1;
548
549         /*ptp_mm_initialize_clock (parameterlength = 4)*/
550 static int hf_ptp_mm_initialize_clock_initialisationkey = -1;
551
552         /*ptp_mm_set_subdomain (parameterlength = 16)*/
553 static int hf_ptp_mm_set_subdomain_subdomainname = -1;
554
555         /*ptp_mm_default_data_set (parameterlength = 76)*/
556 static int hf_ptp_mm_default_data_set_clockcommunicationtechnology = -1;
557 static int hf_ptp_mm_default_data_set_clockuuidfield = -1;
558 static int hf_ptp_mm_default_data_set_clockportfield = -1;
559 static int hf_ptp_mm_default_data_set_clockstratum = -1;
560 static int hf_ptp_mm_default_data_set_clockidentifier = -1;
561 static int hf_ptp_mm_default_data_set_clockvariance = -1;
562 static int hf_ptp_mm_default_data_set_clockfollowupcapable = -1;
563 static int hf_ptp_mm_default_data_set_preferred = -1;
564 static int hf_ptp_mm_default_data_set_initializable = -1;
565 static int hf_ptp_mm_default_data_set_externaltiming = -1;
566 static int hf_ptp_mm_default_data_set_isboundaryclock = -1;
567 static int hf_ptp_mm_default_data_set_syncinterval = -1;
568 static int hf_ptp_mm_default_data_set_subdomainname = -1;
569 static int hf_ptp_mm_default_data_set_numberports = -1;
570 static int hf_ptp_mm_default_data_set_numberforeignrecords = -1;
571
572         /*ptp_mm_update_default_data_set (parameterlength = 36)*/
573 static int hf_ptp_mm_update_default_data_set_clockstratum = -1;
574 static int hf_ptp_mm_update_default_data_set_clockidentifier = -1;
575 static int hf_ptp_mm_update_default_data_set_clockvariance = -1;
576 static int hf_ptp_mm_update_default_data_set_preferred = -1;
577 static int hf_ptp_mm_update_default_data_set_syncinterval = -1;
578 static int hf_ptp_mm_update_default_data_set_subdomainname = -1;
579
580         /*ptp_mm_current_data_set (parameterlength = 20)*/
581 static int hf_ptp_mm_current_data_set_stepsremoved = -1;
582 static int hf_ptp_mm_current_data_set_offsetfrommaster = -1;
583 static int hf_ptp_mm_current_data_set_offsetfrommasterseconds = -1;
584 static int hf_ptp_mm_current_data_set_offsetfrommasternanoseconds = -1;
585 static int hf_ptp_mm_current_data_set_onewaydelay = -1;
586 static int hf_ptp_mm_current_data_set_onewaydelayseconds = -1;
587 static int hf_ptp_mm_current_data_set_onewaydelaynanoseconds = -1;
588
589         /*ptp_mm_parent_data_set (parameterlength = 90)*/
590 static int hf_ptp_mm_parent_data_set_parentcommunicationtechnology = -1;
591 static int hf_ptp_mm_parent_data_set_parentuuid = -1;
592 static int hf_ptp_mm_parent_data_set_parentportid = -1;
593 static int hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber = -1;
594 static int hf_ptp_mm_parent_data_set_parentfollowupcapable = -1;
595 static int hf_ptp_mm_parent_data_set_parentexternaltiming = -1;
596 static int hf_ptp_mm_parent_data_set_parentvariance = -1;
597 static int hf_ptp_mm_parent_data_set_parentstats = -1;
598 static int hf_ptp_mm_parent_data_set_observedvariance = -1;
599 static int hf_ptp_mm_parent_data_set_observeddrift = -1;
600 static int hf_ptp_mm_parent_data_set_utcreasonable = -1;
601 static int hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology = -1;
602 static int hf_ptp_mm_parent_data_set_grandmasteruuidfield = -1;
603 static int hf_ptp_mm_parent_data_set_grandmasterportidfield = -1;
604 static int hf_ptp_mm_parent_data_set_grandmasterstratum = -1;
605 static int hf_ptp_mm_parent_data_set_grandmasteridentifier = -1;
606 static int hf_ptp_mm_parent_data_set_grandmastervariance = -1;
607 static int hf_ptp_mm_parent_data_set_grandmasterpreferred = -1;
608 static int hf_ptp_mm_parent_data_set_grandmasterisboundaryclock = -1;
609 static int hf_ptp_mm_parent_data_set_grandmastersequencenumber = -1;
610
611         /*ptp_mm_port_data_set (parameterlength = 52)*/
612 static int hf_ptp_mm_port_data_set_returnedportnumber = -1;
613 static int hf_ptp_mm_port_data_set_portstate = -1;
614 static int hf_ptp_mm_port_data_set_lastsynceventsequencenumber = -1;
615 static int hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber = -1;
616 static int hf_ptp_mm_port_data_set_portcommunicationtechnology = -1;
617 static int hf_ptp_mm_port_data_set_portuuidfield = -1;
618 static int hf_ptp_mm_port_data_set_portidfield = -1;
619 static int hf_ptp_mm_port_data_set_burstenabled = -1;
620 static int hf_ptp_mm_port_data_set_subdomainaddressoctets = -1;
621 static int hf_ptp_mm_port_data_set_eventportaddressoctets = -1;
622 static int hf_ptp_mm_port_data_set_generalportaddressoctets = -1;
623 static int hf_ptp_mm_port_data_set_subdomainaddress = -1;
624 static int hf_ptp_mm_port_data_set_eventportaddress = -1;
625 static int hf_ptp_mm_port_data_set_generalportaddress = -1;
626
627         /*ptp_mm_global_time_data_set (parameterlength = 24)*/
628 static int hf_ptp_mm_global_time_data_set_localtime = -1;
629 static int hf_ptp_mm_global_time_data_set_localtimeseconds = -1;
630 static int hf_ptp_mm_global_time_data_set_localtimenanoseconds = -1;
631 static int hf_ptp_mm_global_time_data_set_currentutcoffset = -1;
632 static int hf_ptp_mm_global_time_data_set_leap59 = -1;
633 static int hf_ptp_mm_global_time_data_set_leap61 = -1;
634 static int hf_ptp_mm_global_time_data_set_epochnumber = -1;
635
636         /*ptp_mm_update_global_time_properties (parameterlength = 16)*/
637 static int hf_ptp_mm_update_global_time_properties_currentutcoffset = -1;
638 static int hf_ptp_mm_update_global_time_properties_leap59 = -1;
639 static int hf_ptp_mm_update_global_time_properties_leap61 = -1;
640 static int hf_ptp_mm_update_global_time_properties_epochnumber = -1;
641
642         /*ptp_mm_get_foreign_data_set (parameterlength = 4)*/
643 static int hf_ptp_mm_get_foreign_data_set_recordkey = -1;
644
645         /*ptp_mm_foreign_data_set (parameterlength = 28)*/
646 static int hf_ptp_mm_foreign_data_set_returnedportnumber = -1;
647 static int hf_ptp_mm_foreign_data_set_returnedrecordnumber = -1;
648 static int hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology = -1;
649 static int hf_ptp_mm_foreign_data_set_foreignmasteruuidfield = -1;
650 static int hf_ptp_mm_foreign_data_set_foreignmasterportidfield = -1;
651 static int hf_ptp_mm_foreign_data_set_foreignmastersyncs = -1;
652
653         /*ptp_mm_set_sync_interval (parameterlength = 4)*/
654 static int hf_ptp_mm_set_sync_interval_syncinterval = -1;
655
656         /*ptp_mm_set_time (parameterlength = 8)*/
657 static int hf_ptp_mm_set_time_localtime = -1;
658 static int hf_ptp_mm_set_time_localtimeseconds = -1;
659 static int hf_ptp_mm_set_time_localtimenanoseconds = -1;
660
661 /*END Initialize the protocol and registered fields */
662
663 /* Initialize the subtree pointers */
664 static gint ett_ptp = -1;
665 static gint ett_ptp_flags = -1;
666 static gint ett_ptp_time = -1;
667 static gint ett_ptp_time2 = -1;
668
669 /* END Definitions and fields for PTPv1 dissection. */
670
671
672
673
674
675 /***********************************************************************************/
676 /* Definitions and fields for PTPv2 dissection.                                    */
677 /***********************************************************************************/
678
679
680 /**********************************************************/
681 /* Offsets of fields within a PTPv2 packet.                               */
682 /**********************************************************/
683
684 /*Common offsets for all Messages (Sync, Delay_Req, Follow_Up, Delay_Resp ....)*/
685 #define PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET                 0
686 #define PTP_V2_VERSIONPTP_OFFSET                                                1
687 #define PTP_V2_MESSAGE_LENGTH_OFFSET                                    2
688 #define PTP_V2_DOMAIN_NUMBER_OFFSET                                             4
689 #define PTP_V2_FLAGS_OFFSET                                         6
690 #define PTP_V2_CORRECTION_OFFSET                                    8
691 #define PTP_V2_CORRECTIONNS_OFFSET                                  8
692 #define PTP_V2_CORRECTIONSUBNS_OFFSET                               14
693 #define PTP_V2_CLOCKIDENTITY_OFFSET                                                                     20
694 #define PTP_V2_SOURCEPORTID_OFFSET                                  28
695 #define PTP_V2_SEQUENCEID_OFFSET                                    30
696 #define PTP_V2_CONTROL_OFFSET                                       32
697 #define PTP_V2_LOGMESSAGEPERIOD_OFFSET                              33
698
699
700 /*Offsets for PTP_Announce (=AN) messages*/
701 #define PTP_V2_AN_ORIGINTIMESTAMP_OFFSET                            34
702 #define PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET                     34
703 #define PTP_V2_AN_ORIGINTIMESTAMPNANOSECONDS_OFFSET                 40
704 #define PTP_V2_AN_ORIGINCURRENTUTCOFFSET_OFFSET                     44
705 #define PTP_V2_AN_PRIORITY_1_OFFSET                                 47
706 #define PTP_V2_AN_GRANDMASTERCLOCKCLASS_OFFSET                          48
707 #define PTP_V2_AN_GRANDMASTERCLOCKACCURACY_OFFSET                       49
708 #define PTP_V2_AN_GRANDMASTERCLOCKVARIANCE_OFFSET                       50
709 #define PTP_V2_AN_PRIORITY_2_OFFSET                                 52
710 #define PTP_V2_AN_GRANDMASTERCLOCKIDENTITY_OFFSET                   53
711 #define PTP_V2_AN_LOCALSTEPSREMOVED_OFFSET                          61
712 #define PTP_V2_AN_TIMESOURCE_OFFSET                                     63
713 #define PTP_V2_AN_TLV_OFFSET                                        64
714 /* Announce TLV field offsets */
715 #define PTP_V2_AN_TLV_TYPE_OFFSET                                    0
716 #define PTP_V2_AN_TLV_LENGTHFIELD_OFFSET                             2
717 /* PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR field offsets */
718 #define PTP_V2_AN_TLV_ATOI_KEYFIELD_OFFSET                           4
719 #define PTP_V2_AN_TLV_ATOI_CURRENTOFFSET_OFFSET                      5
720 #define PTP_V2_AN_TLV_ATOI_JUMPSECONDS_OFFSET                        9
721 #define PTP_V2_AN_TLV_ATOI_TIMEOFNEXTJUMP_OFFSET                    13
722 #define PTP_V2_AN_TLV_ATOI_DISPLAYNAME_OFFSET                       19
723 /* Undissected TLV field offset */
724 #define PTP_V2_AN_TLV_DATA_OFFSET                                    4
725
726 /*Offsets for PTP_Sync AND PTP_DelayRequest (=SDR) messages*/
727 #define PTP_V2_SDR_ORIGINTIMESTAMP_OFFSET                           34
728 #define PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET                    34
729 #define PTP_V2_SDR_ORIGINTIMESTAMPNANOSECONDS_OFFSET                40
730
731
732 /*Offsets for PTP_Follow_Up (=FU) messages*/
733 #define PTP_V2_FU_PRECISEORIGINTIMESTAMP_OFFSET                     34
734 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET              34
735 #define PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET          40
736
737 /*Offsets for PTP_DelayResponse (=DR) messages*/
738 #define PTP_V2_DR_RECEIVETIMESTAMP_OFFSET                           34
739 #define PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET                    34
740 #define PTP_V2_DR_RECEIVETIMESTAMPNANOSECONDS_OFFSET                40
741 #define PTP_V2_DR_REQUESTINGPORTIDENTITY_OFFSET                     44
742 #define PTP_V2_DR_REQUESTINGSOURCEPORTID_OFFSET                     52
743
744
745 /*Offsets for PTP_PDelayRequest (=PDRQ) messages*/
746 #define PTP_V2_PDRQ_ORIGINTIMESTAMP_OFFSET                          34
747 #define PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET                   34
748 #define PTP_V2_PDRQ_ORIGINTIMESTAMPNANOSECONDS_OFFSET               40
749 #define PTP_V2_PDRQ_RESERVED_OFFSET                                             44
750
751
752 /*Offsets for PTP_PDelayResponse (=PDRS) messages*/
753 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMP_OFFSET                  34
754 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET           34
755 #define PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET       40
756 #define PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET                   44 /* ++ */
757 #define PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET                   52 /* ++ */
758
759
760 /*Offsets for PTP_PDelayResponseFollowUp (=PDFU) messages*/
761 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMP_OFFSET                  34
762 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET           34
763 #define PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET       40
764 #define PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET                   44 /* ++ */
765 #define PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET                   52
766
767
768 /*Offsets for PTP_Signalling (=SIG) messages*/
769 #define PTP_V2_SIG_TARGETPORTIDENTITY_OFFSET                            34
770 #define PTP_V2_SIG_TARGETPORTID_OFFSET                                  42
771
772
773 /*Offsets for PTP_V2_Management (=MM) messages*/
774 #define PTP_V2_MM_TARGETPORTIDENTITY_OFFSET             34
775 #define PTP_V2_MM_TARGETPORTID_OFFSET                   42
776 #define PTP_V2_MM_STARTINGBOUNDARYHOPS_OFFSET           44
777 #define PTP_V2_MM_BOUNDARYHOPS_OFFSET                   45
778 #define PTP_V2_MM_ACTION_OFFSET                         46
779 #define PTP_V2_MM_RESERVED_OFFSET                       47
780
781 #define PTP_V2_MM_MANAGEMENTTLV_OFFSET                                  48
782 /* Management TLV */
783 #define PTP_V2_MM_TLV_TYPE_OFFSET                                               48
784 #define PTP_V2_MM_TLV_LENGTHFIELD_OFFSET                                50
785 #define PTP_V2_MM_TLV_MANAGEMENTID_OFFSET                               52
786 #define PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET                  52
787 #define PTP_V2_MM_TLV_DATAFIELD_OFFSET                                  54
788
789 /* TLV Types */
790 #define PTP_V2_TLV_TYPE_RESERVED                                                0x0000
791 #define PTP_V2_TLV_TYPE_MANAGEMENT                                              0x0001
792 #define PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS                 0x0002
793 #define PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION                  0x0003
794 #define PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION    0x0004
795 #define PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION              0x0005
796 #define PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION             0x0006
797 #define PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION 0x0007
798 #define PTP_V2_TLV_TYPE_PATH_TRACE                                              0x0008
799 #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
805 /* PTPv2 Management clockType Boolean[16] Bits mask */
806 #define CLOCKTYPE_ORDINARY_CLOCK                                                0x8000
807 #define CLOCKTYPE_BOUNDARY_CLOCK                                                0x4000
808 #define CLOCKTYPE_P2P_TC                                                                0x2000
809 #define CLOCKTYPE_E2E_TC                                                                0x1000
810 #define CLOCKTYPE_MANAGEMENT_NODE                                               0x0800
811 #define CLOCKTYPE_RESERVED                                                              0x07FF
812
813 /* PTPv2 Management IDs */
814 #define PTP_V2_MM_ID_NULL_MANAGEMENT                                    0x0000
815 #define PTP_V2_MM_ID_CLOCK_DESCRIPTION                                  0x0001
816 #define PTP_V2_MM_ID_USER_DESCRIPTION                                   0x0002
817 #define PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE               0x0003
818 #define PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE                 0x0004
819 #define PTP_V2_MM_ID_INITIALIZE                                                 0x0005
820 #define PTP_V2_MM_ID_FAULT_LOG                                                  0x0006
821 #define PTP_V2_MM_ID_FAULT_LOG_RESET                                    0x0007
822 #define PTP_V2_MM_ID_DEFAULT_DATA_SET                                   0x2000
823 #define PTP_V2_MM_ID_CURRENT_DATA_SET                                   0x2001
824 #define PTP_V2_MM_ID_PARENT_DATA_SET                                    0x2002
825 #define PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET                   0x2003
826 #define PTP_V2_MM_ID_PORT_DATA_SET                                              0x2004
827 #define PTP_V2_MM_ID_PRIORITY1                                                  0x2005
828 #define PTP_V2_MM_ID_PRIORITY2                                                  0x2006
829 #define PTP_V2_MM_ID_DOMAIN                                                             0x2007
830 #define PTP_V2_MM_ID_SLAVE_ONLY                                                 0x2008
831 #define PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL                              0x2009
832 #define PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT                   0x200A
833 #define PTP_V2_MM_ID_LOG_SYNC_INTERVAL                                  0x200B
834 #define PTP_V2_MM_ID_VERSION_NUMBER                                             0x200C
835 #define PTP_V2_MM_ID_ENABLE_PORT                                                0x200D
836 #define PTP_V2_MM_ID_DISABLE_PORT                                               0x200E
837 #define PTP_V2_MM_ID_TIME                                                               0x200F
838 #define PTP_V2_MM_ID_CLOCK_ACCURACY                                             0x2010
839 #define PTP_V2_MM_ID_UTC_PROPERTIES                                             0x2011
840 #define PTP_V2_MM_ID_TRACEABILITY_PROPERTIES                    0x2012
841 #define PTP_V2_MM_ID_TIMESCALE_PROPERTIES                               0x2013
842 #define PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE                 0x2014
843 #define PTP_V2_MM_ID_PATH_TRACE_LIST                                    0x2015
844 #define PTP_V2_MM_ID_PATH_TRACE_ENABLE                                  0x2016
845 #define PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE                  0x2017
846 #define PTP_V2_MM_ID_UNICAST_MASTER_TABLE                               0x2018
847 #define PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE              0x2019
848 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE                    0x201A
849 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED    0x201B
850 #define PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE   0x201C
851 #define PTP_V2_MM_ID_ALTERNATE_MASTER                                   0x201D
852 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE               0x201E
853 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME                 0x201F
854 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY              0x2020
855 #define PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES   0x2021
856 #define PTP_V2_MM_ID_TC_DEFAULT_DATA_SET                                0x4000
857 #define PTP_V2_MM_ID_TC_PORT_DATA_SET                                   0x4001
858 #define PTP_V2_MM_ID_PRIMARY_DOMAIN                                             0x4002
859 #define PTP_V2_MM_ID_DELAY_MECHANISM                                    0x6000
860 #define PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL                0x6001
861
862 /* Management DataField for DefaultDS */
863 #define PTP_V2_MM_RESERVED1                                                             PTP_V2_MM_TLV_DATAFIELD_OFFSET + 1
864 #define PTP_V2_MM_NUMBERPORTS                                                   PTP_V2_MM_TLV_DATAFIELD_OFFSET + 2
865 #define PTP_V2_MM_PRIORITY1                                                             PTP_V2_MM_TLV_DATAFIELD_OFFSET + 4
866 #define PTP_V2_MM_CLOCKQUALITY                                                  PTP_V2_MM_TLV_DATAFIELD_OFFSET + 5
867 #define PTP_V2_MM_PRIORITY2                                                             PTP_V2_MM_TLV_DATAFIELD_OFFSET + 9
868 #define PTP_V2_MM_CLOCKIDENTITY                                                 PTP_V2_MM_TLV_DATAFIELD_OFFSET + 10
869 #define PTP_V2_MM_DOMAINNUMBER                                                  PTP_V2_MM_TLV_DATAFIELD_OFFSET + 18
870 #define PTP_V2_MM_RESERVED2                                                             PTP_V2_MM_TLV_DATAFIELD_OFFSET + 19
871
872 #define PTP_V2_TRANSPORTSPECIFIC_V1COMPATIBILITY_BITMASK                        0x10
873
874
875
876 /**********************************************************/
877 /* flag-field-mask-definitions                                                    */
878 /**********************************************************/
879 #define PTP_V2_FLAGS_LI61_BITMASK                                                               0x0001
880 #define PTP_V2_FLAGS_LI59_BITMASK                                                               0x0002
881 #define PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK                                   0x0004
882 #define PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK                                              0x0008
883 #define PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK                                             0x0010
884 #define PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK                                    0x0020
885 #define PTP_V2_FLAGS_ALTERNATE_BITMASK                                                  0x0100
886 #define PTP_V2_FLAGS_TWO_STEP_BITMASK                                                   0x0200
887 #define PTP_V2_FLAGS_UNICAST_BITMASK                                                    0x0400
888 #define PTP_V2_FLAGS_SPECIFIC1_BITMASK                                                  0x2000
889 #define PTP_V2_FLAGS_SPECIFIC2_BITMASK                                                  0x4000
890 #define PTP_V2_FLAGS_SECURITY_BITMASK                                                   0x8000
891
892
893
894 /**********************************************************/
895 /* PTP v2 message ids   (ptp messageid field)                 */
896 /**********************************************************/
897 #define PTP_V2_SYNC_MESSAGE                     0x00
898 #define PTP_V2_DELAY_REQ_MESSAGE                0x01
899 #define PTP_V2_PATH_DELAY_REQ_MESSAGE           0x02
900 #define PTP_V2_PATH_DELAY_RESP_MESSAGE          0x03
901 #define PTP_V2_FOLLOWUP_MESSAGE                 0x08
902 #define PTP_V2_DELAY_RESP_MESSAGE               0x09
903 #define PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE      0x0A
904 #define PTP_V2_ANNOUNCE_MESSAGE                 0x0B
905 #define PTP_V2_SIGNALLING_MESSAGE               0x0C
906 #define PTP_V2_MANAGEMENT_MESSAGE               0x0D
907
908
909 static const value_string ptp_v2_managementID_vals[] = {
910         {PTP_V2_MM_ID_NULL_MANAGEMENT                                   ,"NULL_MANAGEMENT"},
911         {PTP_V2_MM_ID_CLOCK_DESCRIPTION                                 ,"CLOCK_DESCRIPTION"},
912         {PTP_V2_MM_ID_USER_DESCRIPTION                                  ,"USER_DESCRIPTION"},
913         {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE              ,"SAVE_IN_NON_VOLATILE_STORAGE"},
914         {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE                ,"RESET_NON_VOLATILE_STORAGE"},
915         {PTP_V2_MM_ID_INITIALIZE                                                ,"INITIALIZE"},
916         {PTP_V2_MM_ID_FAULT_LOG                                                 ,"FAULT_LOG"},
917         {PTP_V2_MM_ID_FAULT_LOG_RESET                                   ,"FAULT_LOG_RESET"},
918         {PTP_V2_MM_ID_DEFAULT_DATA_SET                                  ,"DEFAULT_DATA_SET"},
919         {PTP_V2_MM_ID_CURRENT_DATA_SET                                  ,"CURRENT_DATA_SET"},
920         {PTP_V2_MM_ID_PARENT_DATA_SET                                   ,"PARENT_DATA_SET"},
921         {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET                  ,"TIME_PROPERTIES_DATA_SET"},
922         {PTP_V2_MM_ID_PORT_DATA_SET                                             ,"PORT_DATA_SET"},
923         {PTP_V2_MM_ID_PRIORITY1                                                 ,"PRIORITY1"},
924         {PTP_V2_MM_ID_PRIORITY2                                                 ,"PRIORITY2"},
925         {PTP_V2_MM_ID_DOMAIN                                                    ,"DOMAIN"},
926         {PTP_V2_MM_ID_SLAVE_ONLY                                                ,"SLAVE_ONLY"},
927         {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL                             ,"LOG_ANNOUNCE_INTERVAL"},
928         {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT                  ,"ANNOUNCE_RECEIPT_TIMEOUT"},
929         {PTP_V2_MM_ID_LOG_SYNC_INTERVAL                                 ,"LOG_SYNC_INTERVAL"},
930         {PTP_V2_MM_ID_VERSION_NUMBER                                    ,"VERSION_NUMBER"},
931         {PTP_V2_MM_ID_ENABLE_PORT                                               ,"ENABLE_PORT"},
932         {PTP_V2_MM_ID_DISABLE_PORT                                              ,"DISABLE_PORT"},
933         {PTP_V2_MM_ID_TIME                                                              ,"TIME"},
934         {PTP_V2_MM_ID_CLOCK_ACCURACY                                    ,"CLOCK_ACCURACY"},
935         {PTP_V2_MM_ID_UTC_PROPERTIES                                    ,"UTC_PROPERTIES"},
936         {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES                   ,"TRACEABILITY_PROPERTIES"},
937         {PTP_V2_MM_ID_TIMESCALE_PROPERTIES                              ,"TIMESCALE_PROPERTIES"},
938         {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE                ,"UNICAST_NEGOTIATION_ENABLE"},
939         {PTP_V2_MM_ID_PATH_TRACE_LIST                                   ,"PATH_TRACE_LIST"},
940         {PTP_V2_MM_ID_PATH_TRACE_ENABLE                                 ,"PATH_TRACE_ENABLE"},
941         {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE                 ,"GRANDMASTER_CLUSTER_TABLE"},
942         {PTP_V2_MM_ID_UNICAST_MASTER_TABLE                              ,"UNICAST_MASTER_TABLE"},
943         {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE             ,"UNICAST_MASTER_MAX_TABLE_SIZE"},
944         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE                   ,"ACCEPTABLE_MASTER_TABLE"},
945         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED   ,"ACCEPTABLE_MASTER_TABLE_ENABLED"},
946         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE  ,"ACCEPTABLE_MASTER_MAX_TABLE_SIZE"},
947         {PTP_V2_MM_ID_ALTERNATE_MASTER                                  ,"ALTERNATE_MASTER"},
948         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE              ,"ALTERNATE_TIME_OFFSET_ENABLE"},
949         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME                ,"ALTERNATE_TIME_OFFSET_NAME"},
950         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY             ,"ALTERNATE_TIME_OFFSET_MAX_KEY"},
951         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES  ,"ALTERNATE_TIME_OFFSET_PROPERTIES"},
952         {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET                               ,"TC_DEFAULT_DATA_SET"},
953         {PTP_V2_MM_ID_TC_PORT_DATA_SET                                  ,"TC_PORT_DATA_SET"},
954         {PTP_V2_MM_ID_PRIMARY_DOMAIN                                    ,"PRIMARY_DOMAIN"},
955         {PTP_V2_MM_ID_DELAY_MECHANISM                                   ,"DELAY_MECHANISM"},
956         {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL               ,"LOG_MIN_PDELAY_REQ_INTERVAL"},
957     {0                                                                                          ,NULL} };
958
959 /*same again but better readable text for info column*/
960 static const value_string ptp_v2_managementID_infocolumn_vals[] = {
961         {PTP_V2_MM_ID_NULL_MANAGEMENT                                   ,"Null management"},
962         {PTP_V2_MM_ID_CLOCK_DESCRIPTION                                 ,"Clock description"},
963         {PTP_V2_MM_ID_USER_DESCRIPTION                                  ,"User description"},
964         {PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE              ,"Save in non volatile storage"},
965         {PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE                ,"Reset non volatile storage"},
966         {PTP_V2_MM_ID_INITIALIZE                                                ,"Initialize"},
967         {PTP_V2_MM_ID_FAULT_LOG                                                 ,"Fault log"},
968         {PTP_V2_MM_ID_FAULT_LOG_RESET                                   ,"Fault log reset"},
969         {PTP_V2_MM_ID_DEFAULT_DATA_SET                                  ,"Default dataset"},
970         {PTP_V2_MM_ID_CURRENT_DATA_SET                                  ,"Current dataset"},
971         {PTP_V2_MM_ID_PARENT_DATA_SET                                   ,"Parent dataset"},
972         {PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET                  ,"Time properties dataset"},
973         {PTP_V2_MM_ID_PORT_DATA_SET                                             ,"Port dataset"},
974         {PTP_V2_MM_ID_PRIORITY1                                                 ,"Priority 1"},
975         {PTP_V2_MM_ID_PRIORITY2                                                 ,"Priority 2"},
976         {PTP_V2_MM_ID_DOMAIN                                                    ,"Domain"},
977         {PTP_V2_MM_ID_SLAVE_ONLY                                                ,"Slave only"},
978         {PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL                             ,"Log announce interval"},
979         {PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT                  ,"Announce receipt timeout"},
980         {PTP_V2_MM_ID_LOG_SYNC_INTERVAL                                 ,"Log sync interval"},
981         {PTP_V2_MM_ID_VERSION_NUMBER                                    ,"Version number"},
982         {PTP_V2_MM_ID_ENABLE_PORT                                               ,"Enable port"},
983         {PTP_V2_MM_ID_DISABLE_PORT                                              ,"Disable port"},
984         {PTP_V2_MM_ID_TIME                                                              ,"Time"},
985         {PTP_V2_MM_ID_CLOCK_ACCURACY                                    ,"Clock accuracy"},
986         {PTP_V2_MM_ID_UTC_PROPERTIES                                    ,"UTC properties"},
987         {PTP_V2_MM_ID_TRACEABILITY_PROPERTIES                   ,"Traceability properties"},
988         {PTP_V2_MM_ID_TIMESCALE_PROPERTIES                              ,"Timescale properties"},
989         {PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE                ,"Unicast negotiation enable"},
990         {PTP_V2_MM_ID_PATH_TRACE_LIST                                   ,"Path trace list"},
991         {PTP_V2_MM_ID_PATH_TRACE_ENABLE                                 ,"Path trace enable"},
992         {PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE                 ,"Grandmaster cluster table"},
993         {PTP_V2_MM_ID_UNICAST_MASTER_TABLE                              ,"Unicast master table"},
994         {PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE             ,"Unicast master max table size"},
995         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE                   ,"Acceptable master table"},
996         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED   ,"Acceptable master table enabled"},
997         {PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE  ,"Acceptable master max table size"},
998         {PTP_V2_MM_ID_ALTERNATE_MASTER                                  ,"Alternate master"},
999         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE              ,"Alternate time offset enable"},
1000         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME                ,"Alternate time offset name"},
1001         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY             ,"Alternate time offset max key"},
1002         {PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES  ,"Alternate time offset properties"},
1003         {PTP_V2_MM_ID_TC_DEFAULT_DATA_SET                               ,"Transparent clock default dataset"},
1004         {PTP_V2_MM_ID_TC_PORT_DATA_SET                                  ,"Transparent clock port dataset"},
1005         {PTP_V2_MM_ID_PRIMARY_DOMAIN                                    ,"Primary domain"},
1006         {PTP_V2_MM_ID_DELAY_MECHANISM                                   ,"Delay mechanism"},
1007         {PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL               ,"Log min pdelay req. interval"},
1008     {0                                                                                          , NULL} };
1009
1010 static const value_string ptp_v2_TLV_type_vals[] = {
1011         {PTP_V2_TLV_TYPE_RESERVED                                               ,"Reserved"},
1012         {PTP_V2_TLV_TYPE_MANAGEMENT                                             ,"Management"},
1013         {PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS                ,"Management error status"},
1014         {PTP_V2_TLV_TYPE_ORGANIZATION_EXTENSION                 ,"Organization extension"},
1015         {PTP_V2_TLV_TYPE_REQUEST_UNICAST_TRANSMISSION   ,"Request unicast transmission"},
1016         {PTP_V2_TLV_TYPE_GRANT_UNICAST_TRANSMISSION             ,"Grant unicast transmission"},
1017         {PTP_V2_TLV_TYPE_CANCEL_UNICAST_TRANSMISSION    ,"Cancel unicast transmission"},
1018         {PTP_V2_TLV_TYPE_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION        ,"Acknowledge cancel unicast transmission"},
1019         {PTP_V2_TLV_TYPE_PATH_TRACE                                             ,"Path trace"},
1020         {PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR,"Alternate time offset indicator"},
1021         {PTP_V2_TLV_TYPE_AUTHENTICATION                                 ,"Authentication"},
1022         {PTP_V2_TLV_TYPE_AUTHENTICATION_CHALLENGE               ,"Authentication challenge"},
1023         {PTP_V2_TLV_TYPE_SECURITY_ASSOCIATION_UPDATE    ,"Security association update"},
1024         {PTP_V2_TLV_TYPE_CUM_FREQ_SCALE_FACTOR_OFFSET   ,"Cum. freq. scale factor offset"},
1025     {0                                                                                          , NULL} };
1026
1027
1028 static const value_string ptp2_networkProtocol_vals[] = {
1029   {0x0000,  "Reserved"},
1030   {0x0001,  "UDP/IPv4"},
1031   {0x0002,  "UDP/IPv6"},
1032   {0x0003,  "IEEE 802.3"},
1033   {0x0004,  "DeviceNet"},
1034   {0x0005,  "ControlNet"},
1035   {0x0006,  "PROFINET"},
1036   {0x0007,  "Reserved"},
1037   {0xFFFE,  "Unknown Protocol"},
1038   {0xFFFF,  "Reserved"},
1039   {0,              NULL          } };
1040
1041
1042 static const value_string ptp_v2_messageid_vals[] = {
1043     {PTP_V2_SYNC_MESSAGE,                               "Sync Message"},
1044     {PTP_V2_DELAY_REQ_MESSAGE,                  "Delay_Req Message"},
1045     {PTP_V2_PATH_DELAY_REQ_MESSAGE,             "Path_Delay_Req Message"},
1046     {PTP_V2_PATH_DELAY_RESP_MESSAGE,    "Path_Delay_Resp Message"},
1047     {PTP_V2_FOLLOWUP_MESSAGE,                   "Follow_Up Message"},
1048     {PTP_V2_DELAY_RESP_MESSAGE,                 "Delay_Resp Message"},
1049     {PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE,"Path_Delay_Resp_Follow_Up Message"},
1050     {PTP_V2_ANNOUNCE_MESSAGE,                   "Announce Message"},
1051     {PTP_V2_SIGNALLING_MESSAGE,                 "Signalling Message"},
1052     {PTP_V2_MANAGEMENT_MESSAGE,                 "Management Message"},
1053     {0,                                                                  NULL }
1054 };
1055
1056 static const value_string ptp_v2_clockaccuracy_vals[] = {
1057     {0x20,  "The time is accurate to within 25 ns"},
1058         {0x21,  "The time is accurate to within 100 ns"},
1059         {0x22,  "The time is accurate to within 250 ns"},
1060         {0x23,  "The time is accurate to within 1 us"},
1061         {0x24,  "The time is accurate to within 2,5 us"},
1062         {0x25,  "The time is accurate to within 10 us"},
1063         {0x26,  "The time is accurate to within 25 us"},
1064         {0x27,  "The time is accurate to within 100 us"},
1065         {0x28,  "The time is accurate to within 250 us"},
1066         {0x29,  "The time is accurate to within 1 ms"},
1067         {0x2A,  "The time is accurate to within 2,5 ms"},
1068         {0x2B,  "The time is accurate to within 10 ms"},
1069         {0x2C,  "The time is accurate to within 25 ms"},
1070         {0x2D,  "The time is accurate to within 100 ms"},
1071         {0x2E,  "The time is accurate to within 250 ms"},
1072         {0x2F,  "The time is accurate to within 1 s"},
1073         {0x30,  "The time is accurate to within 10 s"},
1074         {0x31,  "The time is accurate to >10 s"},
1075         {0x32,  "reserved"},
1076         {0x80,  "For use by alternate PTP profiles"},
1077         {0xFE,  "Accuracy Unknown"},
1078         {0xFF,  "reserved"},
1079         {0,              NULL          }
1080 };
1081
1082 static const value_string ptp_v2_timesource_vals[] = {
1083     {0x10,  "ATOMIC_CLOCK"},
1084         {0x20,  "GPS"},
1085         {0x30,  "TERRESTRIAL_RADIO"},
1086         {0x40,  "PTP"},
1087         {0x50,  "NTP"},
1088         {0x60,  "HAND_SET"},
1089         {0x90,  "OTHER"},
1090         {0xA0,  "INTERNAL_OSCILLATOR"},
1091         {0xFF,  "reserved"},
1092         {0,              NULL          }
1093 };
1094
1095 static const value_string ptp_v2_mm_action_vals[] = {
1096     {0x0,  "GET"},
1097         {0x1,  "SET"},
1098         {0x2,  "RESPONSE"},
1099         {0x3,  "COMMAND"},
1100         {0x4,  "ACKNOWLEDGE"},
1101         {0,              NULL          }
1102 };
1103
1104 static const value_string ptp2_severityCode_vals[] = {
1105   {0x00,  "Emergency: system is unusable"},
1106   {0x01,  "Alert: immediate action needed"},
1107   {0x02,  "Critical: critical conditions"},
1108   {0x03,  "Error: error conditions"},
1109   {0x04,  "Warning: warning conditions"},
1110   {0x05,  "Notice: normal but significant condition"},
1111   {0x06,  "Informational: informational messages"},
1112   {0x07,  "Debug: debug-level messages"},
1113   {0x08,  "Reserved"},
1114   {0xFF,  "Reserved"},
1115   {0,      NULL}
1116 };
1117
1118 static const value_string ptp2_portState_vals[] = {
1119   {0x01,  "INITIALIZING"},
1120   {0x02,  "FAULTY"},
1121   {0x03,  "DISABLED"},
1122   {0x04,  "LISTENING"},
1123   {0x05,  "PRE_MASTER"},
1124   {0x06,  "MASTER"},
1125   {0x07,  "PASSIVE"},
1126   {0x08,  "UNCALIBRATED"},
1127   {0x09,  "SLAVE"},
1128   {0,     NULL}
1129 };
1130
1131 static const value_string ptp2_delayMechanism_vals[] = {
1132   {0x01,  "E2E"},
1133   {0x02,  "P2P"},
1134   {0xFE,  "DISABLED"},
1135   {0,     NULL}
1136 };
1137
1138 static const value_string ptp2_managementErrorId_vals[] = {
1139   {0x0000,  "Reserved"},
1140   {0x0001,  "RESPONSE_TOO_BIG"},
1141   {0x0002,  "NO_SUCH_ID"},
1142   {0x0003,  "WRONG_LENGTH"},
1143   {0x0004,  "WRONG_VALUE"},
1144   {0x0005,  "NOT_SETABLE"},
1145   {0x0006,  "NOT_SUPPORTED"},
1146   {0x0007,  "Reserved"},
1147   {0xFFFE,  "GENERAL_ERROR"},
1148   {0xFFFF,  "Reserved"},
1149   {0,     NULL}
1150 };
1151
1152 /**********************************************************/
1153 /* Initialize the protocol and registered fields                  */
1154 /**********************************************************/
1155
1156 static int hf_ptp_v2_transportspecific = -1;
1157 static int hf_ptp_v2_transportspecific_v1_compatibility = -1; /* over UDP */
1158 static int hf_ptp_v2_transportspecific_802as_conform = -1; /* over Ethernet */
1159 static int hf_ptp_v2_messageid = -1;
1160 static int hf_ptp_v2_versionptp = -1;
1161 static int hf_ptp_v2_messagelength = -1;
1162 static int hf_ptp_v2_domainnumber = -1;
1163 static int hf_ptp_v2_flags = -1;
1164 static int hf_ptp_v2_flags_alternatemaster = -1;
1165 static int hf_ptp_v2_flags_twostep = -1;
1166 static int hf_ptp_v2_flags_unicast = -1;
1167 static int hf_ptp_v2_flags_specific1 = -1;
1168 static int hf_ptp_v2_flags_specific2 = -1;
1169 static int hf_ptp_v2_flags_security = -1;
1170 static int hf_ptp_v2_flags_li61 = -1;
1171 static int hf_ptp_v2_flags_li59 = -1;
1172 static int hf_ptp_v2_flags_utcoffsetvalid = -1;
1173 static int hf_ptp_v2_flags_ptptimescale = -1;
1174 static int hf_ptp_v2_flags_timetraceable = -1;
1175 static int hf_ptp_v2_flags_frequencytraceable = -1;
1176 static int hf_ptp_v2_correction = -1;
1177 static int hf_ptp_v2_correctionsubns = -1;
1178 static int hf_ptp_v2_clockidentity = -1;
1179 static int hf_ptp_v2_sourceportid = -1;
1180 static int hf_ptp_v2_sequenceid = -1;
1181 static int hf_ptp_v2_control = -1;
1182 static int hf_ptp_v2_logmessageperiod = -1;
1183
1184
1185 /*Fields for PTP_Announce (=an) messages*/
1186 static int hf_ptp_v2_an_origintimestamp = -1;   /*Field for seconds & nanoseconds*/
1187 static int hf_ptp_v2_an_origintimestamp_seconds = -1;
1188 static int hf_ptp_v2_an_origintimestamp_nanoseconds = -1;
1189 static int hf_ptp_v2_an_origincurrentutcoffset = -1;
1190 static int hf_ptp_v2_an_timesource = -1;
1191 static int hf_ptp_v2_an_localstepsremoved = -1;
1192 static int hf_ptp_v2_an_grandmasterclockidentity = -1;
1193 static int hf_ptp_v2_an_grandmasterclockclass = -1;
1194 static int hf_ptp_v2_an_grandmasterclockaccuracy = -1;
1195 static int hf_ptp_v2_an_grandmasterclockvariance = -1;
1196 static int hf_ptp_v2_an_priority1 = -1;
1197 static int hf_ptp_v2_an_priority2 = -1;
1198
1199 /* Fields for PTP_Announce TLVs */
1200 static int hf_ptp_v2_an_tlv_tlvtype = -1;
1201 static int hf_ptp_v2_an_tlv_lengthfield = -1;
1202 /* Fields for the ALTERNATE_TIME_OFFSET_INDICATOR TLV */
1203 static int hf_ptp_v2_atoi_tlv_keyfield = -1;
1204 static int hf_ptp_v2_atoi_tlv_currentoffset = -1;
1205 static int hf_ptp_v2_atoi_tlv_jumpseconds = -1;
1206 static int hf_ptp_v2_atoi_tlv_timeofnextjump = -1;
1207 static int hf_ptp_v2_atoi_tlv_displayname = -1;
1208 static int hf_ptp_v2_atoi_tlv_displayname_length = -1;
1209
1210 /* Fields for an undissected TLV */
1211 static int hf_ptp_v2_an_tlv_data = -1;
1212
1213 /*Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages*/
1214 static int hf_ptp_v2_sdr_origintimestamp = -1;  /*Field for seconds & nanoseconds*/
1215 static int hf_ptp_v2_sdr_origintimestamp_seconds = -1;
1216 static int hf_ptp_v2_sdr_origintimestamp_nanoseconds = -1;
1217
1218
1219 /*Fields for PTP_Follow_Up (=fu) messages*/
1220 static int hf_ptp_v2_fu_preciseorigintimestamp = -1;    /*Field for seconds & nanoseconds*/
1221 static int hf_ptp_v2_fu_preciseorigintimestamp_seconds = -1;
1222 static int hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds = -1;
1223
1224
1225 /*Fields for PTP_DelayResponse (=dr) messages*/
1226 static int hf_ptp_v2_dr_receivetimestamp = -1;  /*Field for seconds & nanoseconds*/
1227 static int hf_ptp_v2_dr_receivetimestamp_seconds = -1;
1228 static int hf_ptp_v2_dr_receivetimestamp_nanoseconds = -1;
1229 static int hf_ptp_v2_dr_requestingportidentity = -1;
1230 static int hf_ptp_v2_dr_requestingsourceportid = -1;
1231
1232
1233 /*Fields for PTP_PDelayRequest (=pdrq) messages*/
1234 static int hf_ptp_v2_pdrq_origintimestamp = -1; /*Field for seconds & nanoseconds*/
1235 static int hf_ptp_v2_pdrq_origintimestamp_seconds = -1;
1236 static int hf_ptp_v2_pdrq_origintimestamp_nanoseconds = -1;
1237
1238
1239 /*Fields for PTP_PDelayResponse (=pdrs) messages*/
1240 static int hf_ptp_v2_pdrs_requestreceipttimestamp = -1; /*Field for seconds & nanoseconds*/
1241 static int hf_ptp_v2_pdrs_requestreceipttimestamp_seconds = -1;
1242 static int hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds = -1;
1243 static int hf_ptp_v2_pdrs_requestingportidentity = -1;
1244 static int hf_ptp_v2_pdrs_requestingsourceportid = -1;
1245
1246
1247 /*Fields for PTP_PDelayResponseFollowUp (=pdfu) messages*/
1248 static int hf_ptp_v2_pdfu_responseorigintimestamp = -1; /*Field for seconds & nanoseconds*/
1249 static int hf_ptp_v2_pdfu_responseorigintimestamp_seconds = -1;
1250 static int hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds = -1;
1251 static int hf_ptp_v2_pdfu_requestingportidentity = -1;
1252 static int hf_ptp_v2_pdfu_requestingsourceportid = -1;
1253
1254
1255 /*Fields for PTP_Signalling (=sig) messages*/
1256 static int hf_ptp_v2_sig_targetportidentity = -1;
1257 static int hf_ptp_v2_sig_targetportid = -1;
1258
1259
1260 /*Fields for PTP_Management (=mm) messages*/
1261 static int hf_ptp_v2_mm_targetportidentity = -1;
1262 static int hf_ptp_v2_mm_targetportid = -1;
1263 static int hf_ptp_v2_mm_startingboundaryhops = -1;
1264 static int hf_ptp_v2_mm_boundaryhops = -1;
1265 static int hf_ptp_v2_mm_action = -1;
1266
1267 /* management TLV */
1268 static int hf_ptp_v2_mm_tlvType = -1;
1269 static int hf_ptp_v2_mm_lengthField = -1;
1270 static int hf_ptp_v2_mm_managementId = -1;
1271 static int hf_ptp_v2_mm_data = -1;
1272 /* Management dataField  */
1273
1274 static int hf_ptp_v2_mm_clockType = -1;
1275 static int hf_ptp_v2_mm_clockType_ordinaryClock = -1;
1276 static int hf_ptp_v2_mm_clockType_boundaryClock = -1;
1277 static int hf_ptp_v2_mm_clockType_p2p_transparentClock = -1;
1278 static int hf_ptp_v2_mm_clockType_e2e_transparentClock = -1;
1279 static int hf_ptp_v2_mm_clockType_managementNode = -1;
1280 static int hf_ptp_v2_mm_clockType_reserved = -1;
1281 static int hf_ptp_v2_mm_physicalLayerProtocol = -1;
1282 static int hf_ptp_v2_mm_physicalLayerProtocol_length = -1;
1283 static int hf_ptp_v2_mm_physicalAddressLength = -1;
1284 static int hf_ptp_v2_mm_physicalAddress = -1;
1285 static int hf_ptp_v2_mm_protocolAddress = -1;
1286 static int hf_ptp_v2_mm_protocolAddress_networkProtocol = -1;
1287 static int hf_ptp_v2_mm_protocolAddress_length = -1;
1288 static int hf_ptp_v2_mm_manufacturerIdentity = -1;
1289
1290 static int hf_ptp_v2_mm_reserved = -1;
1291 static int hf_ptp_v2_mm_productDescription = -1;
1292 static int hf_ptp_v2_mm_productDescription_length = -1;
1293 static int hf_ptp_v2_mm_revisionData = -1;
1294 static int hf_ptp_v2_mm_revisionData_length = -1;
1295 static int hf_ptp_v2_mm_userDescription = -1;
1296 static int hf_ptp_v2_mm_userDescription_length = -1;
1297 static int hf_ptp_v2_mm_profileIdentity = -1;
1298 static int hf_ptp_v2_mm_pad = -1;
1299
1300 static int hf_ptp_v2_mm_numberOfFaultRecords = -1;
1301 static int hf_ptp_v2_mm_faultRecord = -1;
1302
1303 static int hf_ptp_v2_mm_initializationKey = -1;
1304 static int hf_ptp_v2_mm_severityCode = -1;
1305 static int hf_ptp_v2_mm_faultRecordLength = -1;
1306 static int hf_ptp_v2_mm_faultTime = -1;
1307 static int hf_ptp_v2_mm_faultTime_s = -1;
1308 static int hf_ptp_v2_mm_faultTime_ns = -1;
1309 static int hf_ptp_v2_mm_faultValue = -1;
1310 static int hf_ptp_v2_mm_faultName = -1;
1311 static int hf_ptp_v2_mm_faultName_length = -1;
1312 static int hf_ptp_v2_mm_faultValue_length = -1;
1313 static int hf_ptp_v2_mm_faultDescription = -1;
1314 static int hf_ptp_v2_mm_faultDescription_length = -1;
1315 static int hf_ptp_v2_mm_currentTime_s = -1;
1316 static int hf_ptp_v2_mm_currentTime_ns = -1;
1317 static int hf_ptp_v2_mm_clockAccuracy = -1;
1318 static int hf_ptp_v2_mm_priority1 = -1;
1319 static int hf_ptp_v2_mm_priority2 = -1;
1320 static int hf_ptp_v2_mm_dds_SO = -1;
1321 static int hf_ptp_v2_mm_TSC = -1;
1322 static int hf_ptp_v2_mm_numberPorts = -1;
1323 static int hf_ptp_v2_mm_clockclass = -1;
1324 static int hf_ptp_v2_mm_clockaccuracy = -1;
1325 static int hf_ptp_v2_mm_clockvariance = -1;
1326 static int hf_ptp_v2_mm_clockidentity = -1;
1327 static int hf_ptp_v2_mm_domainNumber = -1;
1328 static int hf_ptp_v2_mm_SO = -1;
1329 static int hf_ptp_v2_mm_stepsRemoved = -1;
1330 static int hf_ptp_v2_mm_parentIdentity = -1;
1331 static int hf_ptp_v2_mm_parentPort = -1;
1332 static int hf_ptp_v2_mm_parentStats = -1;
1333 static int hf_ptp_v2_mm_observedParentOffsetScaledLogVariance = -1;
1334 static int hf_ptp_v2_mm_observedParentClockPhaseChangeRate = -1;
1335 static int hf_ptp_v2_mm_grandmasterPriority1 = -1;
1336 static int hf_ptp_v2_mm_grandmasterPriority2 = -1;
1337 static int hf_ptp_v2_mm_grandmasterclockclass = -1;
1338 static int hf_ptp_v2_mm_grandmasterclockaccuracy = -1;
1339 static int hf_ptp_v2_mm_grandmasterclockvariance = -1;
1340 static int hf_ptp_v2_mm_grandmasterIdentity = -1;
1341 static int hf_ptp_v2_mm_currentUtcOffset = -1;
1342 static int hf_ptp_v2_mm_LI_61 = -1;
1343 static int hf_ptp_v2_mm_LI_59 = -1;
1344 static int hf_ptp_v2_mm_UTCV = -1;
1345 static int hf_ptp_v2_mm_PTP = -1;
1346 static int hf_ptp_v2_mm_TTRA = -1;
1347 static int hf_ptp_v2_mm_FTRA = -1;
1348 static int hf_ptp_v2_mm_timesource = -1;
1349 static int hf_ptp_v2_mm_offset_ns = -1;
1350 static int hf_ptp_v2_mm_pathDelay_ns = -1;
1351 static int hf_ptp_v2_mm_offset_subns = -1;
1352 static int hf_ptp_v2_mm_pathDelay_subns = -1;
1353 static int hf_ptp_v2_mm_PortNumber = -1;
1354 static int hf_ptp_v2_mm_portState = -1;
1355 static int hf_ptp_v2_mm_logMinDelayReqInterval = -1;
1356 static int hf_ptp_v2_mm_peerMeanPathDelay_ns = -1;
1357 static int hf_ptp_v2_mm_peerMeanPathDelay_subns = -1;
1358 static int hf_ptp_v2_mm_logAnnounceInterval = -1;
1359 static int hf_ptp_v2_mm_announceReceiptTimeout = -1;
1360 static int hf_ptp_v2_mm_logSyncInterval = -1;
1361 static int hf_ptp_v2_mm_delayMechanism = -1;
1362 static int hf_ptp_v2_mm_logMinPdelayReqInterval = -1;
1363 static int hf_ptp_v2_mm_versionNumber = -1;
1364 static int hf_ptp_v2_mm_primaryDomain = -1;
1365 static int hf_ptp_v2_mm_faultyFlag = -1;
1366 static int hf_ptp_v2_mm_managementErrorId = -1;
1367 static int hf_ptp_v2_mm_displayData = -1;
1368 static int hf_ptp_v2_mm_displayData_length = -1;
1369 static int hf_ptp_v2_mm_ucEN = -1;
1370 static int hf_ptp_v2_mm_ptEN = -1;
1371 static int hf_ptp_v2_mm_atEN = -1;
1372 static int hf_ptp_v2_mm_keyField = -1;
1373 static int hf_ptp_v2_mm_displayName = -1;
1374 static int hf_ptp_v2_mm_displayName_length = -1;
1375 static int hf_ptp_v2_mm_maxKey = -1;
1376 static int hf_ptp_v2_mm_currentOffset = -1;
1377 static int hf_ptp_v2_mm_jumpSeconds = -1;
1378 static int hf_ptp_v2_mm_logAlternateMulticastSyncInterval = -1;
1379 static int hf_ptp_v2_mm_numberOfAlternateMasters = -1;
1380 static int hf_ptp_v2_mm_transmitAlternateMulticastSync = -1;
1381
1382 /* Initialize the subtree pointers */
1383 static gint ett_ptp_v2 = -1;
1384 static gint ett_ptp_v2_flags = -1;
1385 static gint ett_ptp_v2_correction = -1;
1386 static gint ett_ptp_v2_time = -1;
1387 static gint ett_ptp_v2_time2 = -1;
1388 static gint ett_ptp_v2_managementData = -1;
1389 static gint ett_ptp_v2_clockType = -1;
1390 static gint ett_ptp_v2_physicalLayerProtocol = -1;
1391 static gint ett_ptp_v2_protocolAddress = -1;
1392 static gint ett_ptp_v2_faultRecord = -1;
1393 static gint ett_ptp_v2_ptptext = -1;
1394 static gint ett_ptp_v2_timeInterval = -1;
1395 static gint ett_ptp_v2_tlv = -1;
1396
1397 /* static gint ett_ptp_v2_timesource = -1;
1398 static gint ett_ptp_v2_priority = -1; */
1399 static gint ett_ptp_v2_transportspecific = -1;
1400
1401 /* For tronsport specific field  Ethernet or UDP */
1402 static gboolean ptpv2_oE = FALSE;
1403 /* END Definitions and fields for PTPv2 dissection. */
1404
1405
1406 /* forward declaration of local functions for v1 and v2 */
1407
1408 static void
1409 dissect_ptp_oE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1410
1411 static int
1412 is_ptp_v1(tvbuff_t *tvb);
1413
1414 static void
1415 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1416
1417 static gboolean
1418 is_ptp_v2(tvbuff_t *tvb);
1419
1420 static void
1421 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1422
1423 /**********************************************************/
1424 /* Implementation of the functions                                */
1425 /**********************************************************/
1426
1427
1428 /* Code to dissect the packet */
1429
1430 static void
1431 dissect_ptp_oE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1432 {
1433         ptpv2_oE = TRUE;
1434         /* PTP over Ethernet only available with PTPv2 */
1435         dissect_ptp_v2(tvb, pinfo, tree);
1436 }
1437
1438 static void
1439 dissect_ptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1440 {
1441         ptpv2_oE = FALSE;
1442         if(is_ptp_v1(tvb))
1443         dissect_ptp_v1(tvb, pinfo, tree);
1444     else if(is_ptp_v2(tvb))
1445         dissect_ptp_v2(tvb, pinfo, tree);
1446 }
1447
1448
1449 /* Code to check if packet is PTPv1 */
1450
1451 static gboolean
1452 is_ptp_v1(tvbuff_t *tvb)
1453 {
1454     guint16 version_ptp;
1455
1456     version_ptp = tvb_get_ntohs(tvb, PTP_VERSIONPTP_OFFSET);
1457
1458     if( version_ptp == 1) return TRUE;
1459     else return FALSE;
1460 }
1461
1462
1463 /* Code to check if packet is PTPv2 */
1464
1465 static gboolean
1466 is_ptp_v2(tvbuff_t *tvb)
1467 {
1468     guint8 version_ptp;
1469
1470     version_ptp = 0x0F & tvb_get_guint8(tvb, PTP_V2_VERSIONPTP_OFFSET);
1471
1472     if( version_ptp == 2) return TRUE;
1473     else return FALSE;
1474 }
1475
1476
1477 /* Code to actually dissect the PTPv1 packets */
1478
1479 static void
1480 dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1481 {
1482     guint8      ptp_control, ptp_mm_messagekey = 0;
1483         nstime_t ts;    /*time structure with seconds and nanoseconds*/
1484
1485 /* Set up structures needed to add the protocol subtree and manage it */
1486         proto_item *ti, *flags_ti, *time_ti, *time2_ti;
1487         proto_tree *ptp_tree, *ptp_flags_tree, *ptp_time_tree, *ptp_time2_tree;
1488
1489 /* Make entries in Protocol column and Info column on summary display */
1490         if (check_col(pinfo->cinfo, COL_PROTOCOL))
1491                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv1");
1492
1493
1494 /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
1495
1496         ptp_control = tvb_get_guint8 (tvb, PTP_CONTROL_OFFSET);
1497         /* MGMT packet? */
1498         if ( ptp_control == PTP_MANAGEMENT_MESSAGE ){
1499                 /* Get the managementMessageKey */
1500                         ptp_mm_messagekey = tvb_get_guint8(tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET);
1501         }
1502
1503 /* Create and set the string for "Info" column */
1504         switch(ptp_control){
1505                 case PTP_SYNC_MESSAGE:{
1506                         if (check_col(pinfo->cinfo, COL_INFO))
1507                                 col_set_str(pinfo->cinfo, COL_INFO, "Sync Message");
1508                         break;
1509                 }
1510                 case PTP_DELAY_REQ_MESSAGE:{
1511                         if (check_col(pinfo->cinfo, COL_INFO))
1512                                 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Request Message");
1513                         break;
1514                 }
1515                 case PTP_FOLLOWUP_MESSAGE:{
1516                         if (check_col(pinfo->cinfo, COL_INFO))
1517                                 col_set_str(pinfo->cinfo, COL_INFO, "Follow_Up Message");
1518                         break;
1519                 }
1520                 case PTP_DELAY_RESP_MESSAGE:{
1521                         if (check_col(pinfo->cinfo, COL_INFO))
1522                                 col_set_str(pinfo->cinfo, COL_INFO, "Delay_Response Message");
1523                         break;
1524                 }
1525                 case PTP_MANAGEMENT_MESSAGE:{
1526                         if (check_col(pinfo->cinfo, COL_INFO)){
1527                                 col_add_fstr(pinfo->cinfo, COL_INFO, "Management Message (%s)",
1528                                     val_to_str(ptp_mm_messagekey,
1529                                         ptp_managementMessageKey_infocolumn_vals,
1530                                         "Unknown message key %u"));
1531                         }
1532                         break;
1533                 }
1534                 default:{
1535                         if (check_col(pinfo->cinfo, COL_INFO))
1536                                 col_set_str(pinfo->cinfo, COL_INFO, "Unknown Message");
1537                         break;
1538                 }
1539         }
1540
1541         if (tree) {
1542
1543                 /* create display subtree for the protocol */
1544                 ti = proto_tree_add_item(tree, proto_ptp, tvb, 0, -1, FALSE);
1545
1546                 ptp_tree = proto_item_add_subtree(ti, ett_ptp);
1547
1548                 proto_tree_add_item(ptp_tree,
1549                     hf_ptp_versionptp, tvb, PTP_VERSIONPTP_OFFSET, 2, FALSE);
1550
1551                 proto_tree_add_item(ptp_tree,
1552                     hf_ptp_versionnetwork, tvb, PTP_VERSIONNETWORK_OFFSET, 2, FALSE);
1553
1554                 proto_tree_add_item(ptp_tree,
1555                     hf_ptp_subdomain, tvb, PTP_SUBDOMAIN_OFFSET, 16, FALSE);
1556
1557                 proto_tree_add_item(ptp_tree,
1558                     hf_ptp_messagetype, tvb, PTP_MESSAGETYPE_OFFSET, 1, FALSE);
1559
1560                 proto_tree_add_item(ptp_tree,
1561                     hf_ptp_sourcecommunicationtechnology, tvb, PTP_SOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1562
1563                 proto_tree_add_item(ptp_tree,
1564                     hf_ptp_sourceuuid, tvb, PTP_SOURCEUUID_OFFSET, 6, FALSE);
1565
1566                 proto_tree_add_item(ptp_tree,
1567                     hf_ptp_sourceportid, tvb, PTP_SOURCEPORTID_OFFSET, 2, FALSE);
1568
1569                 proto_tree_add_item(ptp_tree,
1570                     hf_ptp_sequenceid, tvb, PTP_SEQUENCEID_OFFSET, 2, FALSE);
1571
1572                 proto_tree_add_item(ptp_tree,
1573                     hf_ptp_control, tvb, PTP_CONTROL_OFFSET, 1, FALSE);
1574
1575                 /*Subtree for the flag-field*/
1576                 if(tree){
1577                         flags_ti = proto_tree_add_item(ptp_tree,
1578                         hf_ptp_flags, tvb, PTP_FLAGS_OFFSET, 2, FALSE);
1579
1580                         ptp_flags_tree = proto_item_add_subtree(flags_ti, ett_ptp_flags);
1581
1582                         proto_tree_add_item(ptp_flags_tree,
1583                         hf_ptp_flags_li61, tvb, PTP_FLAGS_LI61_OFFSET, 2, FALSE);
1584
1585                         proto_tree_add_item(ptp_flags_tree,
1586                         hf_ptp_flags_li59, tvb, PTP_FLAGS_LI59_OFFSET, 2, FALSE);
1587
1588                         proto_tree_add_item(ptp_flags_tree,
1589                         hf_ptp_flags_boundary_clock, tvb, PTP_FLAGS_BOUNDARY_CLOCK_OFFSET, 2, FALSE);
1590
1591                         proto_tree_add_item(ptp_flags_tree,
1592                         hf_ptp_flags_assist, tvb, PTP_FLAGS_ASSIST_OFFSET, 2, FALSE);
1593
1594                         proto_tree_add_item(ptp_flags_tree,
1595                                 hf_ptp_flags_ext_sync, tvb, PTP_FLAGS_EXT_SYNC_OFFSET, 2, FALSE);
1596
1597                         proto_tree_add_item(ptp_flags_tree,
1598                         hf_ptp_flags_parent, tvb, PTP_FLAGS_PARENT_STATS_OFFSET, 2, FALSE);
1599
1600                         proto_tree_add_item(ptp_flags_tree,
1601                         hf_ptp_flags_sync_burst, tvb, PTP_FLAGS_SYNC_BURST_OFFSET, 2, FALSE);
1602                 }
1603
1604                 /* The rest of the ptp-dissector depends on the control-field  */
1605
1606                 switch(ptp_control){
1607                         case PTP_SYNC_MESSAGE:
1608                         case PTP_DELAY_REQ_MESSAGE:{
1609
1610                         /*Subtree for the timestamp-field*/
1611                         ts.secs = tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET);
1612                         ts.nsecs =  tvb_get_ntohl(tvb, PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET);
1613                         if(tree){
1614                                 time_ti = proto_tree_add_time(ptp_tree,
1615                                 hf_ptp_sdr_origintimestamp, tvb, PTP_SDR_ORIGINTIMESTAMP_OFFSET, 8, &ts);
1616
1617                                 ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
1618
1619                                 proto_tree_add_item(ptp_time_tree,
1620                                                 hf_ptp_sdr_origintimestamp_seconds, tvb,
1621                                                 PTP_SDR_ORIGINTIMESTAMP_SECONDS_OFFSET, 4, FALSE);
1622
1623                                         proto_tree_add_item(ptp_time_tree, hf_ptp_sdr_origintimestamp_nanoseconds, tvb,
1624                                                         PTP_SDR_ORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, FALSE);
1625                                 }
1626
1627                                 proto_tree_add_item(ptp_tree,
1628                                                 hf_ptp_sdr_epochnumber, tvb, PTP_SDR_EPOCHNUMBER_OFFSET, 2, FALSE);
1629
1630                                 proto_tree_add_item(ptp_tree,
1631                                     hf_ptp_sdr_currentutcoffset, tvb, PTP_SDR_CURRENTUTCOFFSET_OFFSET, 2, FALSE);
1632
1633                                 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmastercommunicationtechnology, tvb,
1634                                                 PTP_SDR_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1635
1636                                 proto_tree_add_item(ptp_tree,
1637                                     hf_ptp_sdr_grandmasterclockuuid, tvb, PTP_SDR_GRANDMASTERCLOCKUUID_OFFSET, 6, FALSE);
1638
1639                                 proto_tree_add_item(ptp_tree,
1640                                     hf_ptp_sdr_grandmasterportid, tvb, PTP_SDR_GRANDMASTERPORTID_OFFSET, 2, FALSE);
1641
1642                                 proto_tree_add_item(ptp_tree,
1643                                     hf_ptp_sdr_grandmastersequenceid, tvb, PTP_SDR_GRANDMASTERSEQUENCEID_OFFSET, 2, FALSE);
1644
1645                                 proto_tree_add_item(ptp_tree,
1646                                     hf_ptp_sdr_grandmasterclockstratum, tvb,
1647                                                 PTP_SDR_GRANDMASTERCLOCKSTRATUM_OFFSET, 1, FALSE);
1648
1649                                 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterclockidentifier, tvb,
1650                                                 PTP_SDR_GRANDMASTERCLOCKIDENTIFIER_OFFSET, 4, FALSE);
1651
1652                                 proto_tree_add_item(ptp_tree,
1653                                     hf_ptp_sdr_grandmasterclockvariance, tvb,
1654                                                 PTP_SDR_GRANDMASTERCLOCKVARIANCE_OFFSET, 2, FALSE);
1655
1656                                 proto_tree_add_item(ptp_tree,
1657                                     hf_ptp_sdr_grandmasterpreferred, tvb, PTP_SDR_GRANDMASTERPREFERRED_OFFSET, 1, FALSE);
1658
1659                                 proto_tree_add_item(ptp_tree, hf_ptp_sdr_grandmasterisboundaryclock, tvb,
1660                                                 PTP_SDR_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, FALSE);
1661
1662                                 proto_tree_add_item(ptp_tree,
1663                                     hf_ptp_sdr_syncinterval, tvb, PTP_SDR_SYNCINTERVAL_OFFSET, 1, FALSE);
1664
1665                                 proto_tree_add_item(ptp_tree,
1666                                     hf_ptp_sdr_localclockvariance, tvb, PTP_SDR_LOCALCLOCKVARIANCE_OFFSET, 2, FALSE);
1667
1668                                 proto_tree_add_item(ptp_tree,
1669                                     hf_ptp_sdr_localstepsremoved, tvb, PTP_SDR_LOCALSTEPSREMOVED_OFFSET, 2, FALSE);
1670
1671                                 proto_tree_add_item(ptp_tree,
1672                                     hf_ptp_sdr_localclockstratum, tvb, PTP_SDR_LOCALCLOCKSTRATUM_OFFSET, 1, FALSE);
1673
1674                                 proto_tree_add_item(ptp_tree,
1675                                     hf_ptp_sdr_localclockidentifier, tvb, PTP_SDR_LOCALCLOCKIDENTIFIER_OFFSET, 4, FALSE);
1676
1677                                 proto_tree_add_item(ptp_tree, hf_ptp_sdr_parentcommunicationtechnology, tvb,
1678                                                 PTP_SDR_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1679
1680                                 proto_tree_add_item(ptp_tree,
1681                                     hf_ptp_sdr_parentuuid, tvb, PTP_SDR_PARENTUUID_OFFSET, 6, FALSE);
1682
1683                                 proto_tree_add_item(ptp_tree,
1684                                     hf_ptp_sdr_parentportfield, tvb, PTP_SDR_PARENTPORTFIELD_OFFSET, 2, FALSE);
1685
1686                                 proto_tree_add_item(ptp_tree,
1687                                     hf_ptp_sdr_estimatedmastervariance, tvb,
1688                                                 PTP_SDR_ESTIMATEDMASTERVARIANCE_OFFSET, 2, FALSE);
1689
1690                                 proto_tree_add_item(ptp_tree,
1691                                     hf_ptp_sdr_estimatedmasterdrift, tvb, PTP_SDR_ESTIMATEDMASTERDRIFT_OFFSET, 4, FALSE);
1692
1693                                 proto_tree_add_item(ptp_tree,
1694                                     hf_ptp_sdr_utcreasonable, tvb, PTP_SDR_UTCREASONABLE_OFFSET, 1, FALSE);
1695                                 break;
1696                         }
1697                         case PTP_FOLLOWUP_MESSAGE:{
1698                                 proto_tree_add_item(ptp_tree,
1699                                     hf_ptp_fu_associatedsequenceid, tvb, PTP_FU_ASSOCIATEDSEQUENCEID_OFFSET, 2, FALSE);
1700
1701                                 /*Subtree for the timestamp-field*/
1702                                 ts.secs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET);
1703                                 ts.nsecs = tvb_get_ntohl(tvb, PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET);
1704                                 if(tree){
1705                                         time_ti = proto_tree_add_time(ptp_tree,
1706                                                 hf_ptp_fu_preciseorigintimestamp, tvb,
1707                                                         PTP_FU_PRECISEORIGINTIMESTAMP_OFFSET, 8, &ts);
1708
1709                                         ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
1710
1711                                         proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_seconds, tvb,
1712                                                         PTP_FU_PRECISEORIGINTIMESTAMP_SECONDS_OFFSET, 4, FALSE);
1713
1714                                         proto_tree_add_item(ptp_time_tree, hf_ptp_fu_preciseorigintimestamp_nanoseconds, tvb,
1715                                                         PTP_FU_PRECISEORIGINTIMESTAMP_NANOSECONDS_OFFSET, 4, FALSE);
1716                                 }
1717                                 break;
1718                         }
1719                         case PTP_DELAY_RESP_MESSAGE:{
1720                                 /*Subtree for the timestamp-field*/
1721                                 ts.secs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET);
1722                                 ts.nsecs = tvb_get_ntohl(tvb, PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET);
1723                                 if(tree){
1724                                         time_ti = proto_tree_add_time(ptp_tree,
1725                                                 hf_ptp_dr_delayreceipttimestamp, tvb,
1726                                                         PTP_DR_DELAYRECEIPTTIMESTAMP_OFFSET, 8, &ts);
1727
1728                                         ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
1729
1730                                         proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_seconds, tvb,
1731                                                         PTP_DR_DELAYRECEIPTTIMESTAMP_SECONDS_OFFSET, 4, FALSE);
1732
1733                                         proto_tree_add_item(ptp_time_tree, hf_ptp_dr_delayreceipttimestamp_nanoseconds, tvb,
1734                                                         PTP_DR_DELAYRECEIPTTIMESTAMP_NANOSECONDS_OFFSET, 4, FALSE);
1735                                 }
1736
1737                                 proto_tree_add_item(ptp_tree, hf_ptp_dr_requestingsourcecommunicationtechnology, tvb,
1738                                         PTP_DR_REQUESTINGSOURCECOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1739
1740                                 proto_tree_add_item(ptp_tree,
1741                                     hf_ptp_dr_requestingsourceuuid, tvb, PTP_DR_REQUESTINGSOURCEUUID_OFFSET, 6, FALSE);
1742
1743                                 proto_tree_add_item(ptp_tree,
1744                                     hf_ptp_dr_requestingsourceportid, tvb, PTP_DR_REQUESTINGSOURCEPORTID_OFFSET, 2, FALSE);
1745
1746                                 proto_tree_add_item(ptp_tree,
1747                                     hf_ptp_dr_requestingsourcesequenceid, tvb,
1748                                                 PTP_DR_REQUESTINGSOURCESEQUENCEID_OFFSET, 2, FALSE);
1749                                 break;
1750                         }
1751                         case PTP_MANAGEMENT_MESSAGE:{
1752                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_targetcommunicationtechnology, tvb,
1753                                                 PTP_MM_TARGETCOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1754
1755                                 proto_tree_add_item(ptp_tree,
1756                                     hf_ptp_mm_targetuuid, tvb, PTP_MM_TARGETUUID_OFFSET, 6, FALSE);
1757
1758                                 proto_tree_add_item(ptp_tree,
1759                                     hf_ptp_mm_targetportid, tvb, PTP_MM_TARGETPORTID_OFFSET, 2, FALSE);
1760
1761                                 proto_tree_add_item(ptp_tree,
1762                                     hf_ptp_mm_startingboundaryhops, tvb, PTP_MM_STARTINGBOUNDARYHOPS_OFFSET, 2, FALSE);
1763
1764                                 proto_tree_add_item(ptp_tree,
1765                                     hf_ptp_mm_boundaryhops, tvb, PTP_MM_BOUNDARYHOPS_OFFSET, 2, FALSE);
1766
1767
1768                                 proto_tree_add_item(ptp_tree,
1769                                     hf_ptp_mm_managementmessagekey, tvb, PTP_MM_MANAGEMENTMESSAGEKEY_OFFSET, 1, FALSE);
1770
1771                                 proto_tree_add_item(ptp_tree,
1772                                     hf_ptp_mm_parameterlength, tvb, PTP_MM_PARAMETERLENGTH_OFFSET, 2, FALSE);
1773
1774                                 switch(ptp_mm_messagekey){
1775                                         case PTP_MM_CLOCK_IDENTITY:{
1776                                                 proto_tree_add_item(ptp_tree,
1777                                                                 hf_ptp_mm_clock_identity_clockcommunicationtechnology, tvb,
1778                                                                 PTP_MM_CLOCK_IDENTITY_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1779
1780                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockuuidfield, tvb,
1781                                                                 PTP_MM_CLOCK_IDENTITY_CLOCKUUIDFIELD_OFFSET, 6, FALSE);
1782
1783                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_clockportfield, tvb,
1784                                                                 PTP_MM_CLOCK_IDENTITY_CLOCKPORTFIELD_OFFSET, 2, FALSE);
1785
1786                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_clock_identity_manufactureridentity, tvb,
1787                                                                 PTP_MM_CLOCK_IDENTITY_MANUFACTURERIDENTITY_OFFSET, 48, FALSE);
1788                                                 break;
1789                                         }
1790                                         case PTP_MM_INITIALIZE_CLOCK:{
1791                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_initialize_clock_initialisationkey, tvb,
1792                                                         PTP_MM_INITIALIZE_CLOCK_INITIALISATIONKEY_OFFSET, 2, FALSE);
1793                                                 break;
1794                                         }
1795                                         case PTP_MM_SET_SUBDOMAIN:{
1796                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_subdomain_subdomainname, tvb,
1797                                                                 PTP_MM_SET_SUBDOMAIN_SUBDOMAINNAME_OFFSET, 16, FALSE);
1798                                                 break;
1799                                         }
1800                                         case PTP_MM_DEFAULT_DATA_SET:{
1801                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockcommunicationtechnology,
1802                                                                 tvb, PTP_MM_DEFAULT_DATA_SET_CLOCKCOMMUNICATIONTECHNOLOGY_OFFSET,
1803                                                                  1, FALSE);
1804
1805                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockuuidfield, tvb,
1806                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKUUIDFIELD_OFFSET, 6, FALSE);
1807
1808                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockportfield, tvb,
1809                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKPORTFIELD_OFFSET, 2, FALSE);
1810
1811                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockstratum, tvb,
1812                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, FALSE);
1813
1814                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockidentifier, tvb,
1815                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, FALSE);
1816
1817                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockvariance, tvb,
1818                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, FALSE);
1819
1820                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_clockfollowupcapable, tvb,
1821                                                                 PTP_MM_DEFAULT_DATA_SET_CLOCKFOLLOWUPCAPABLE_OFFSET, 1, FALSE);
1822
1823                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_preferred, tvb,
1824                                                                 PTP_MM_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, FALSE);
1825
1826                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_initializable, tvb,
1827                                                                 PTP_MM_DEFAULT_DATA_SET_INITIALIZABLE_OFFSET, 1, FALSE);
1828
1829                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_externaltiming, tvb,
1830                                                                 PTP_MM_DEFAULT_DATA_SET_EXTERNALTIMING_OFFSET, 1, FALSE);
1831
1832                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_isboundaryclock, tvb,
1833                                                                 PTP_MM_DEFAULT_DATA_SET_ISBOUNDARYCLOCK_OFFSET, 1, FALSE);
1834
1835                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_syncinterval, tvb,
1836                                                                 PTP_MM_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, FALSE);
1837
1838                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_subdomainname, tvb,
1839                                                                 PTP_MM_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, FALSE);
1840
1841                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberports, tvb,
1842                                                                 PTP_MM_DEFAULT_DATA_SET_NUMBERPORTS_OFFSET, 2, FALSE);
1843
1844                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_default_data_set_numberforeignrecords, tvb,
1845                                                                 PTP_MM_DEFAULT_DATA_SET_NUMBERFOREIGNRECORDS_OFFSET, 2, FALSE);
1846                                                 break;
1847                                         }
1848                                         case PTP_MM_UPDATE_DEFAULT_DATA_SET:{
1849                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockstratum, tvb,
1850                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKSTRATUM_OFFSET, 1, FALSE);
1851
1852                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockidentifier, tvb,
1853                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKIDENTIFIER_OFFSET, 4, FALSE);
1854
1855                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_clockvariance, tvb,
1856                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_CLOCKVARIANCE_OFFSET, 2, FALSE);
1857
1858                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_preferred, tvb,
1859                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_PREFERRED_OFFSET, 1, FALSE);
1860
1861                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_syncinterval, tvb,
1862                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_SYNCINTERVAL_OFFSET, 1, FALSE);
1863
1864                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_default_data_set_subdomainname, tvb,
1865                                                                 PTP_MM_UPDATE_DEFAULT_DATA_SET_SUBDOMAINNAME_OFFSET, 16, FALSE);
1866                                                 break;
1867                                         }
1868                                         case PTP_MM_CURRENT_DATA_SET:{
1869                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_current_data_set_stepsremoved, tvb,
1870                                                                 PTP_MM_CURRENT_DATA_SET_STEPSREMOVED_OFFSET, 2, FALSE);
1871
1872                                                 /* Subtree for offset from master*/
1873                                                 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET);
1874
1875                                                 ts.nsecs = tvb_get_ntohl(tvb,
1876                                                                 PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET);
1877
1878                                                 if (ts.nsecs & 0x80000000) ts.nsecs = ts.nsecs & 0x7FFFFFFF;
1879
1880                                                 if(tree){
1881                                                         time_ti = proto_tree_add_time(ptp_tree,
1882                                                                         hf_ptp_mm_current_data_set_offsetfrommaster, tvb,
1883                                                                         PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTER_OFFSET, 8, &ts);
1884
1885                                                         ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
1886
1887                                                         proto_tree_add_item(ptp_time_tree,
1888                                                                         hf_ptp_mm_current_data_set_offsetfrommasterseconds, tvb,
1889                                                                         PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERSECONDS_OFFSET, 4, FALSE);
1890
1891                                                         proto_tree_add_item(ptp_time_tree,
1892                                                                         hf_ptp_mm_current_data_set_offsetfrommasternanoseconds, tvb,
1893                                                                         PTP_MM_CURRENT_DATA_SET_OFFSETFROMMASTERNANOSECONDS_OFFSET, 4, FALSE);
1894                                                 }
1895
1896                                                 /* Subtree for offset from master*/
1897                                                 ts.secs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET);
1898
1899                                                 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET);
1900
1901                                                 if(tree){
1902                                                         time2_ti = proto_tree_add_time(ptp_tree,
1903                                                                         hf_ptp_mm_current_data_set_onewaydelay, tvb,
1904                                                                         PTP_MM_CURRENT_DATA_SET_ONEWAYDELAY_OFFSET, 8, &ts);
1905
1906                                                         ptp_time2_tree = proto_item_add_subtree(time2_ti, ett_ptp_time2);
1907
1908                                                         proto_tree_add_item(ptp_time2_tree, hf_ptp_mm_current_data_set_onewaydelayseconds,
1909                                                                         tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYSECONDS_OFFSET, 4, FALSE);
1910
1911                                                         proto_tree_add_item(ptp_time2_tree,
1912                                                                         hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
1913                                                                         tvb, PTP_MM_CURRENT_DATA_SET_ONEWAYDELAYNANOSECONDS_OFFSET, 4, FALSE);
1914                                                 }
1915                                                 break;
1916                                         }
1917                                         case PTP_MM_PARENT_DATA_SET:{
1918                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
1919                                                                 tvb, PTP_MM_PARENT_DATA_SET_PARENTCOMMUNICATIONTECHNOLOGY_OFFSET,
1920                                                                 1, FALSE);
1921
1922                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentuuid, tvb,
1923                                                                 PTP_MM_PARENT_DATA_SET_PARENTUUID_OFFSET, 6, FALSE);
1924
1925                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentportid, tvb,
1926                                                                 PTP_MM_PARENT_DATA_SET_PARENTPORTID_OFFSET, 2, FALSE);
1927
1928                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
1929                                                                 tvb, PTP_MM_PARENT_DATA_SET_PARENTLASTSYNCSEQUENCENUMBER_OFFSET,
1930                                                                 2, FALSE);
1931
1932                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentfollowupcapable, tvb,
1933                                                                 PTP_MM_PARENT_DATA_SET_PARENTFOLLOWUPCAPABLE_OFFSET, 1, FALSE);
1934
1935                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentexternaltiming, tvb,
1936                                                                 PTP_MM_PARENT_DATA_SET_PARENTEXTERNALTIMING_OFFSET, 1, FALSE);
1937
1938                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentvariance, tvb,
1939                                                                 PTP_MM_PARENT_DATA_SET_PARENTVARIANCE_OFFSET, 2, FALSE);
1940
1941                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_parentstats, tvb,
1942                                                                 PTP_MM_PARENT_DATA_SET_PARENTSTATS_OFFSET, 1, FALSE);
1943
1944                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observedvariance, tvb,
1945                                                                 PTP_MM_PARENT_DATA_SET_OBSERVEDVARIANCE_OFFSET, 2, FALSE);
1946
1947                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_observeddrift, tvb,
1948                                                                 PTP_MM_PARENT_DATA_SET_OBSERVEDDRIFT_OFFSET, 4, FALSE);
1949
1950                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_utcreasonable, tvb,
1951                                                                 PTP_MM_PARENT_DATA_SET_UTCREASONABLE_OFFSET, 1, FALSE);
1952
1953                                                 proto_tree_add_item(ptp_tree,
1954                                                                 hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
1955                                                                 tvb, PTP_MM_PARENT_DATA_SET_GRANDMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
1956                                                                 FALSE);
1957
1958                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteruuidfield, tvb,
1959                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERUUIDFIELD_OFFSET, 6, FALSE);
1960
1961                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterportidfield, tvb,
1962                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERPORTIDFIELD_OFFSET, 2, FALSE);
1963
1964                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterstratum, tvb,
1965                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERSTRATUM_OFFSET, 1, FALSE);
1966
1967                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasteridentifier, tvb,
1968                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERIDENTIFIER_OFFSET, 4, FALSE);
1969
1970                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastervariance, tvb,
1971                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERVARIANCE_OFFSET, 2, FALSE);
1972
1973                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterpreferred, tvb,
1974                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERPREFERRED_OFFSET, 1, FALSE);
1975
1976                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmasterisboundaryclock, tvb,
1977                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERISBOUNDARYCLOCK_OFFSET, 1, FALSE);
1978
1979                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_parent_data_set_grandmastersequencenumber, tvb,
1980                                                                 PTP_MM_PARENT_DATA_SET_GRANDMASTERSEQUENCENUMBER_OFFSET, 2, FALSE);
1981                                                 break;
1982                                         }
1983                                         case PTP_MM_PORT_DATA_SET:{
1984                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_returnedportnumber, tvb,
1985                                                                 PTP_MM_PORT_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, FALSE);
1986
1987                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portstate, tvb,
1988                                                                 PTP_MM_PORT_DATA_SET_PORTSTATE_OFFSET, 1, FALSE);
1989
1990                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastsynceventsequencenumber, tvb,
1991                                                                 PTP_MM_PORT_DATA_SET_LASTSYNCEVENTSEQUENCENUMBER_OFFSET, 2, FALSE);
1992
1993                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
1994                                                                 tvb, PTP_MM_PORT_DATA_SET_LASTGENERALEVENTSEQUENCENUMBER_OFFSET,
1995                                                                 2, FALSE);
1996
1997                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portcommunicationtechnology, tvb,
1998                                                                 PTP_MM_PORT_DATA_SET_PORTCOMMUNICATIONTECHNOLOGY_OFFSET, 1, FALSE);
1999
2000                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portuuidfield, tvb,
2001                                                                 PTP_MM_PORT_DATA_SET_PORTUUIDFIELD_OFFSET, 6, FALSE);
2002
2003                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_portidfield, tvb,
2004                                                                 PTP_MM_PORT_DATA_SET_PORTIDFIELD_OFFSET, 2, FALSE);
2005
2006                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_burstenabled, tvb,
2007                                                                 PTP_MM_PORT_DATA_SET_BURSTENABLED_OFFSET, 1, FALSE);
2008
2009                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddressoctets, tvb,
2010                                                                 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESSOCTETS_OFFSET, 1, FALSE);
2011
2012                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddressoctets, tvb,
2013                                                                 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESSOCTETS_OFFSET, 1, FALSE);
2014
2015                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddressoctets, tvb,
2016                                                                 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESSOCTETS_OFFSET, 1, FALSE);
2017
2018                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_subdomainaddress, tvb,
2019                                                                 PTP_MM_PORT_DATA_SET_SUBDOMAINADDRESS_OFFSET, 4, FALSE);
2020
2021                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_eventportaddress, tvb,
2022                                                                 PTP_MM_PORT_DATA_SET_EVENTPORTADDRESS_OFFSET, 2, FALSE);
2023
2024                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_port_data_set_generalportaddress, tvb,
2025                                                                 PTP_MM_PORT_DATA_SET_GENERALPORTADDRESS_OFFSET, 2, FALSE);
2026                                                 break;
2027                                         }
2028                                         case PTP_MM_GLOBAL_TIME_DATA_SET:{
2029                                                 /* Subtree for local time*/
2030                                                 ts.secs = tvb_get_ntohl(tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET);
2031
2032                                                 ts.nsecs = tvb_get_ntohl(tvb,
2033                                                                 PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET);
2034
2035                                                 if(tree){
2036                                                         time_ti = proto_tree_add_time(ptp_tree,
2037                                                                         hf_ptp_mm_global_time_data_set_localtime, tvb,
2038                                                                         PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIME_OFFSET, 8, &ts);
2039
2040                                                         ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2041
2042                                                         proto_tree_add_item(ptp_time_tree,
2043                                                                         hf_ptp_mm_global_time_data_set_localtimeseconds, tvb,
2044                                                                         PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMESECONDS_OFFSET, 4, FALSE);
2045
2046                                                         proto_tree_add_item(ptp_time_tree,
2047                                                                         hf_ptp_mm_global_time_data_set_localtimenanoseconds,
2048                                                                         tvb, PTP_MM_GLOBAL_TIME_DATA_SET_LOCALTIMENANOSECONDS_OFFSET, 4, FALSE);
2049                                                 }
2050
2051                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_currentutcoffset, tvb,
2052                                                                 PTP_MM_GLOBAL_TIME_DATA_SET_CURRENTUTCOFFSET_OFFSET, 2, FALSE);
2053
2054                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap59, tvb,
2055                                                                 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP59_OFFSET, 1, FALSE);
2056
2057                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_leap61, tvb,
2058                                                                 PTP_MM_GLOBAL_TIME_DATA_SET_LEAP61_OFFSET, 1, FALSE);
2059
2060                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_global_time_data_set_epochnumber, tvb,
2061                                                                 PTP_MM_GLOBAL_TIME_DATA_SET_EPOCHNUMBER_OFFSET, 2, FALSE);
2062                                                 break;
2063                                         }
2064                                         case PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES:{
2065                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_currentutcoffset,
2066                                                                 tvb, PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_CURRENTUTCOFFSET_OFFSET,
2067                                                                 2, FALSE);
2068
2069                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap59, tvb,
2070                                                                 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP59_OFFSET, 1, FALSE);
2071
2072                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_update_global_time_properties_leap61, tvb,
2073                                                                 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_LEAP61_OFFSET, 1, FALSE);
2074
2075                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2076                                                                 PTP_MM_UPDATE_GLOBAL_TIME_PROPERTIES_EPOCHNUMBER_OFFSET, 2, FALSE);
2077                                                 break;
2078                                         }
2079                                         case PTP_MM_GET_FOREIGN_DATA_SET:{
2080                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_get_foreign_data_set_recordkey, tvb,
2081                                                                 PTP_MM_GET_FOREIGN_DATA_SET_RECORDKEY_OFFSET, 2, FALSE);
2082                                                 break;
2083                                         }
2084                                         case PTP_MM_FOREIGN_DATA_SET:{
2085                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedportnumber, tvb,
2086                                                                 PTP_MM_FOREIGN_DATA_SET_RETURNEDPORTNUMBER_OFFSET, 2, FALSE);
2087
2088                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_returnedrecordnumber, tvb,
2089                                                                 PTP_MM_FOREIGN_DATA_SET_RETURNEDRECORDNUMBER_OFFSET, 2, FALSE);
2090
2091                                                 proto_tree_add_item(ptp_tree,
2092                                                                 hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
2093                                                                 tvb, PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERCOMMUNICATIONTECHNOLOGY_OFFSET, 1,
2094                                                                 FALSE);
2095
2096                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasteruuidfield, tvb,
2097                                                                 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERUUIDFIELD_OFFSET, 6, FALSE);
2098
2099                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmasterportidfield, tvb,
2100                                                                 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERPORTIDFIELD_OFFSET, 2, FALSE);
2101
2102                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_foreign_data_set_foreignmastersyncs, tvb,
2103                                                                 PTP_MM_FOREIGN_DATA_SET_FOREIGNMASTERSYNCS_OFFSET, 2, FALSE);
2104                                                 break;
2105                                         }
2106                                         case PTP_MM_SET_SYNC_INTERVAL:{
2107                                                 proto_tree_add_item(ptp_tree, hf_ptp_mm_set_sync_interval_syncinterval, tvb,
2108                                                                 PTP_MM_SET_SYNC_INTERVAL_SYNCINTERVAL_OFFSET, 2, FALSE);
2109                                                 break;
2110                                         }
2111                                         case PTP_MM_SET_TIME:{
2112                                                 /* Subtree for local time*/
2113                                                 ts.secs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET);
2114
2115                                                 ts.nsecs = tvb_get_ntohl(tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET);
2116
2117                                                 if(tree){
2118                                                         time_ti = proto_tree_add_time(ptp_tree, hf_ptp_mm_set_time_localtime, tvb,
2119                                                                         PTP_MM_SET_TIME_LOCALTIME_OFFSET, 8, &ts);
2120
2121                                                         ptp_time_tree = proto_item_add_subtree(time_ti, ett_ptp_time);
2122
2123                                                         proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimeseconds, tvb,
2124                                                                         PTP_MM_SET_TIME_LOCALTIMESECONDS_OFFSET, 4, FALSE);
2125
2126                                                         proto_tree_add_item(ptp_time_tree, hf_ptp_mm_set_time_localtimenanoseconds,
2127                                                                         tvb, PTP_MM_SET_TIME_LOCALTIMENANOSECONDS_OFFSET, 4, FALSE);
2128                                                 }
2129                                                 break;
2130                                         }
2131                                         default :{
2132                                                 /*- don't dissect any further. */
2133                                                 break;
2134                                         }
2135                                 }
2136                                 break;
2137                         }
2138                         default :{
2139                                 /* Not a valid MessageType - can't dissect. */
2140                                 break;
2141                         }
2142                 }
2143         }
2144 }
2145
2146
2147 /* Code to dissect PTPText */
2148 static void
2149 dissect_ptp_v2_text(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, int hf_ptp_v2_mm_ptptext, int hf_ptp_v2_mm_ptptext_length)
2150 {
2151         guint8  length = 0;
2152         proto_item      *ptptext_ti;
2153         proto_tree      *ptptext_subtree;
2154
2155         length = tvb_get_guint8 (tvb, *cur_offset);
2156
2157         if (tree)
2158         {
2159                 ptptext_ti = proto_tree_add_item(tree, hf_ptp_v2_mm_ptptext, tvb,
2160                         *cur_offset+1, length, FALSE);
2161
2162                 ptptext_subtree = proto_item_add_subtree(ptptext_ti, ett_ptp_v2_ptptext);
2163                         /* subtree */
2164                         proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext_length, tvb,
2165                                 *cur_offset, 1, FALSE);
2166                         proto_tree_add_item(ptptext_subtree, hf_ptp_v2_mm_ptptext, tvb,
2167                                 *cur_offset+1, length, FALSE);
2168
2169                 *cur_offset = *cur_offset + length + 1;
2170         }
2171 }
2172
2173 static void
2174 dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns)
2175 {
2176
2177         double time;
2178         gint64 time_ns;
2179         guint16 time_subns;
2180         proto_item      *ptptimeInterval_ti;
2181         proto_tree      *ptptimeInterval_subtree;
2182
2183         time_ns = tvb_get_ntohl(tvb, *cur_offset);
2184
2185         time_subns = tvb_get_ntohs(tvb, *cur_offset+6);
2186
2187         time_ns = time_ns << 16;
2188
2189         if(time_ns & 0x800000){
2190                 time_ns = time_ns | G_GINT64_CONSTANT(0xFFFFFFFFFF000000);
2191                 time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4);
2192
2193                 time = ((1.0*time_ns) + (time_subns/65536.0));
2194         }
2195         else
2196         {
2197                 time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4);
2198                 time = time_ns + (time_subns/65536.0);
2199         }
2200
2201         ptptimeInterval_ti = proto_tree_add_text(tree, tvb, *cur_offset, 8,
2202                 "%s: %f nanoseconds", name, time);
2203
2204         ptptimeInterval_subtree = proto_item_add_subtree(ptptimeInterval_ti, ett_ptp_v2_timeInterval);
2205
2206         proto_tree_add_uint64_format_value(ptptimeInterval_subtree,
2207                 hf_ptp_v2_timeInterval_ns, tvb, *cur_offset, 6, time_ns, "Ns: %" G_GINT64_MODIFIER "d nanoseconds", time_ns);
2208
2209         proto_tree_add_double_format(ptptimeInterval_subtree,
2210                 hf_ptp_v2_timeInterval_subns, tvb, *cur_offset+6, 2, (time_subns/65536.0),
2211                 "SubNs: %f nanoseconds", (time_subns/65536.0));
2212
2213         *cur_offset = *cur_offset + 8;
2214 }
2215
2216 /* Code to actually dissect the PTPv2 packets */
2217
2218 static void
2219 dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2220 {
2221     guint8 ptp_v2_messageid = 0;
2222         guint16 ptp_v2_mm_managementId = 0;
2223         guint8 ptp_v2_management_action = 0;
2224     guint64 timeStamp;
2225     guint16 temp;
2226
2227
2228     /* Set up structures needed to add the protocol subtree and manage it */
2229     proto_item  *ti, *transportspecific_ti, *flags_ti, *managementData_ti, *clockType_ti, *protocolAddress_ti;
2230     proto_tree  *ptp_tree, *ptp_transportspecific_tree, *ptp_flags_tree, *ptp_managementData_tree,
2231                                 *ptp_clockType_tree, *ptp_protocolAddress_tree;
2232
2233     /* Make entries in Protocol column and Info column on summary display */
2234     if (check_col(pinfo->cinfo, COL_PROTOCOL))
2235         col_set_str(pinfo->cinfo, COL_PROTOCOL, "PTPv2");
2236
2237     /* Get control field (what kind of message is this? (Sync, DelayReq, ...) */
2238
2239     ptp_v2_messageid = 0x0F & tvb_get_guint8 (tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET);
2240
2241         /* Extend  Info column with managementId */
2242         if (check_col(pinfo->cinfo, COL_INFO))
2243         {
2244                 /* Create and set the string for "Info" column */
2245                 if ( ptp_v2_messageid == PTP_V2_MANAGEMENT_MESSAGE )
2246                 {
2247                         guint16 tlv_type;
2248                         /* Get TLV Type */
2249                         tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
2250                         /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */
2251                         switch(tlv_type)
2252                         {
2253                                 case PTP_V2_TLV_TYPE_MANAGEMENT:
2254                                         /* Get the managementId */
2255                                         ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET);
2256                                         ptp_v2_management_action = 0x0F & tvb_get_guint8(tvb, PTP_V2_MM_ACTION_OFFSET);
2257                                         col_add_fstr(pinfo->cinfo, COL_INFO, "Management (%s) %s", 
2258                                                 val_to_str(ptp_v2_mm_managementId, ptp_v2_managementID_infocolumn_vals, "Unknown management Id %u"),
2259                                                 val_to_str(ptp_v2_management_action, ptp_v2_mm_action_vals, "Unknown Action %u"));
2260                                         break;
2261                                 case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS:
2262                                         /* Get the managementErrorId */
2263                                         ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET);
2264                                         col_add_fstr(pinfo->cinfo, COL_INFO, "Management Error Message (%s)", val_to_str(ptp_v2_mm_managementId,
2265                                                  ptp2_managementErrorId_vals, "Unknown Error Id %u"));
2266                                         break;
2267                                 default:
2268                                         col_set_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)"));
2269                                         break;
2270                         }
2271                 }
2272                 else
2273                 {
2274                     col_set_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)"));
2275                 }
2276         }
2277
2278    if (tree) {
2279
2280         ti = proto_tree_add_item(tree, proto_ptp, tvb, 0, -1, FALSE);
2281
2282         ptp_tree = proto_item_add_subtree(ti, ett_ptp_v2);
2283
2284         transportspecific_ti = proto_tree_add_item(ptp_tree,
2285             hf_ptp_v2_transportspecific, tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET, 1, FALSE);
2286
2287         ptp_transportspecific_tree = proto_item_add_subtree(transportspecific_ti, ett_ptp_v2_transportspecific);
2288
2289         if (ptpv2_oE == TRUE)
2290         {
2291             proto_tree_add_item(ptp_transportspecific_tree,
2292                 hf_ptp_v2_transportspecific_802as_conform, tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET, 1, FALSE);
2293         }
2294         else
2295         {
2296             proto_tree_add_item(ptp_transportspecific_tree,
2297                 hf_ptp_v2_transportspecific_v1_compatibility, tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET, 1, FALSE);
2298         }
2299
2300         proto_tree_add_item(ptp_tree,
2301             hf_ptp_v2_messageid, tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET, 1, FALSE);
2302
2303         proto_tree_add_item(ptp_tree,
2304             hf_ptp_v2_versionptp, tvb, PTP_V2_VERSIONPTP_OFFSET, 1, FALSE);
2305
2306         proto_tree_add_item(ptp_tree,
2307             hf_ptp_v2_messagelength, tvb, PTP_V2_MESSAGE_LENGTH_OFFSET, 2, FALSE);
2308
2309         proto_tree_add_item(ptp_tree,
2310             hf_ptp_v2_domainnumber, tvb, PTP_V2_DOMAIN_NUMBER_OFFSET, 1, FALSE);
2311
2312
2313         flags_ti = proto_tree_add_item(ptp_tree,
2314             hf_ptp_v2_flags, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2315
2316         ptp_flags_tree = proto_item_add_subtree(flags_ti, ett_ptp_v2_flags);
2317
2318         proto_tree_add_item(ptp_flags_tree,
2319             hf_ptp_v2_flags_security, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2320
2321         proto_tree_add_item(ptp_flags_tree,
2322             hf_ptp_v2_flags_specific2, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2323
2324         proto_tree_add_item(ptp_flags_tree,
2325             hf_ptp_v2_flags_specific1, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2326
2327         proto_tree_add_item(ptp_flags_tree,
2328             hf_ptp_v2_flags_unicast, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2329
2330         proto_tree_add_item(ptp_flags_tree,
2331             hf_ptp_v2_flags_twostep, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2332
2333         proto_tree_add_item(ptp_flags_tree,
2334             hf_ptp_v2_flags_alternatemaster, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2335
2336         proto_tree_add_item(ptp_flags_tree,
2337             hf_ptp_v2_flags_frequencytraceable, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2338
2339         proto_tree_add_item(ptp_flags_tree,
2340             hf_ptp_v2_flags_timetraceable, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2341
2342         proto_tree_add_item(ptp_flags_tree,
2343             hf_ptp_v2_flags_ptptimescale, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2344
2345         proto_tree_add_item(ptp_flags_tree,
2346             hf_ptp_v2_flags_utcoffsetvalid, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2347
2348         proto_tree_add_item(ptp_flags_tree,
2349             hf_ptp_v2_flags_li59, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2350
2351         proto_tree_add_item(ptp_flags_tree,
2352             hf_ptp_v2_flags_li61, tvb, PTP_V2_FLAGS_OFFSET, 2, FALSE);
2353
2354         temp = PTP_V2_CORRECTIONNS_OFFSET;
2355
2356         dissect_ptp_v2_timeInterval(tvb, &temp, ptp_tree, "correction", hf_ptp_v2_correction, hf_ptp_v2_correctionsubns);
2357
2358         proto_tree_add_item(ptp_tree,
2359             hf_ptp_v2_clockidentity, tvb, PTP_V2_CLOCKIDENTITY_OFFSET, 8, FALSE);
2360
2361         proto_tree_add_item(ptp_tree,
2362             hf_ptp_v2_sourceportid, tvb, PTP_V2_SOURCEPORTID_OFFSET, 2, FALSE);
2363
2364         proto_tree_add_item(ptp_tree,
2365             hf_ptp_v2_sequenceid, tvb, PTP_V2_SEQUENCEID_OFFSET, 2, FALSE);
2366
2367         proto_tree_add_item(ptp_tree,
2368             hf_ptp_v2_control, tvb, PTP_V2_CONTROL_OFFSET, 1, FALSE);
2369
2370         proto_tree_add_item(ptp_tree,
2371             hf_ptp_v2_logmessageperiod, tvb, PTP_V2_LOGMESSAGEPERIOD_OFFSET, 1, FALSE);
2372
2373         switch(ptp_v2_messageid){
2374             case PTP_V2_ANNOUNCE_MESSAGE:{
2375                 guint16     Offset;
2376                 guint16     tlv_type;
2377                 guint16     tlv_length;
2378                 guint16     tlv_total_length;
2379                 proto_item *tlv_ti;
2380                 proto_tree *ptp_tlv_tree;
2381
2382                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET);
2383                 timeStamp = timeStamp << 16;
2384                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET+4);
2385
2386                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_seconds, tvb,
2387                             PTP_V2_AN_ORIGINTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2388                                         
2389                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origintimestamp_nanoseconds, tvb,
2390                             PTP_V2_AN_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2391
2392                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_origincurrentutcoffset, tvb,
2393                     PTP_V2_AN_ORIGINCURRENTUTCOFFSET_OFFSET, 2, FALSE);
2394
2395                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority1, tvb,
2396                     PTP_V2_AN_PRIORITY_1_OFFSET, 1, FALSE);
2397
2398                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockclass, tvb,
2399                     PTP_V2_AN_GRANDMASTERCLOCKCLASS_OFFSET, 1, FALSE);
2400
2401                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockaccuracy, tvb,
2402                     PTP_V2_AN_GRANDMASTERCLOCKACCURACY_OFFSET, 1, FALSE);
2403
2404                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockvariance, tvb,
2405                     PTP_V2_AN_GRANDMASTERCLOCKVARIANCE_OFFSET, 2, FALSE);
2406
2407                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_priority2, tvb,
2408                     PTP_V2_AN_PRIORITY_2_OFFSET, 1, FALSE);
2409
2410                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_grandmasterclockidentity, tvb,
2411                     PTP_V2_AN_GRANDMASTERCLOCKIDENTITY_OFFSET, 8, FALSE);
2412
2413                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_an_localstepsremoved, tvb,
2414                         PTP_V2_AN_LOCALSTEPSREMOVED_OFFSET, 2, FALSE);
2415
2416                                 proto_tree_add_item(ptp_tree,
2417                     hf_ptp_v2_an_timesource, tvb, PTP_V2_AN_TIMESOURCE_OFFSET, 1, FALSE);
2418
2419                                 tlv_total_length = 0;
2420                                 while (tvb_reported_length_remaining(tvb, PTP_V2_AN_TLV_OFFSET + tlv_total_length) >= 2)
2421                                 {
2422                                         /* There are TLV's to be processed */
2423                                         tlv_type = tvb_get_ntohs (tvb, PTP_V2_AN_TLV_OFFSET+tlv_total_length+PTP_V2_AN_TLV_TYPE_OFFSET);
2424                                         tlv_length = tvb_get_ntohs (tvb, PTP_V2_AN_TLV_OFFSET+tlv_total_length+PTP_V2_AN_TLV_LENGTHFIELD_OFFSET);
2425
2426                                         tlv_ti = proto_tree_add_text(
2427                                                 ptp_tree,
2428                                                 tvb,
2429                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length,
2430                                                 tlv_length + PTP_V2_AN_TLV_DATA_OFFSET,
2431                                                 "%s TLV",
2432                                                 val_to_str(tlv_type,
2433                                                                    ptp_v2_TLV_type_vals,
2434                                                                    "Unknown (%u)"));
2435
2436                                         ptp_tlv_tree = proto_item_add_subtree(tlv_ti, ett_ptp_v2_tlv);
2437
2438                                         proto_tree_add_item(ptp_tlv_tree,
2439                                                                                 hf_ptp_v2_an_tlv_tlvtype,
2440                                                                                 tvb,
2441                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_TYPE_OFFSET,
2442                                                                                 2,
2443                                                                                 FALSE);
2444
2445                                         proto_tree_add_item(ptp_tlv_tree,
2446                                                                                 hf_ptp_v2_an_tlv_lengthfield,
2447                                                                                 tvb,
2448                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_LENGTHFIELD_OFFSET,
2449                                                                                 2,
2450                                                                                 FALSE);
2451
2452                                         switch (tlv_type)
2453                                         {
2454                                                 case PTP_V2_TLV_TYPE_ALTERNATE_TIME_OFFSET_INDICATOR:
2455                                                 {
2456                                                         proto_tree_add_item(ptp_tlv_tree,
2457                                                                                                 hf_ptp_v2_atoi_tlv_keyfield,
2458                                                                                                 tvb,
2459                                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_KEYFIELD_OFFSET,
2460                                                                                                 1,
2461                                                                                                 FALSE);
2462
2463                                                         proto_tree_add_item(ptp_tlv_tree,
2464                                                                                                 hf_ptp_v2_atoi_tlv_currentoffset,
2465                                                                                                 tvb,
2466                                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_CURRENTOFFSET_OFFSET,
2467                                                                                                 4,
2468                                                                                                 FALSE);
2469
2470                                                         proto_tree_add_item(ptp_tlv_tree,
2471                                                                                                 hf_ptp_v2_atoi_tlv_jumpseconds,
2472                                                                                                 tvb,
2473                                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_JUMPSECONDS_OFFSET,
2474                                                                                                 4,
2475                                                                                                 FALSE);
2476
2477                                                         proto_tree_add_item(ptp_tlv_tree,
2478                                                                                                 hf_ptp_v2_atoi_tlv_timeofnextjump,
2479                                                                                                 tvb,
2480                                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_TIMEOFNEXTJUMP_OFFSET,
2481                                                                                                 6,
2482                                                                                                 FALSE);
2483
2484                                                         Offset = PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_ATOI_DISPLAYNAME_OFFSET;
2485                                                         dissect_ptp_v2_text(tvb,
2486                                                                                             &Offset,
2487                                                                                             ptp_tlv_tree,
2488                                                                                             hf_ptp_v2_atoi_tlv_displayname,
2489                                                                                             hf_ptp_v2_atoi_tlv_displayname_length);
2490
2491                                                         break;
2492                                                 }
2493                                                 default:
2494                                                 {
2495                                                         proto_tree_add_item(ptp_tlv_tree,
2496                                                                                                 hf_ptp_v2_an_tlv_data,
2497                                                                                                 tvb,
2498                                                                                                 PTP_V2_AN_TLV_OFFSET + tlv_total_length + PTP_V2_AN_TLV_DATA_OFFSET,
2499                                                                                                 tlv_length,
2500                                                                                                 FALSE);
2501                                                         break;
2502                                                 }
2503                                         }
2504
2505                                         tlv_total_length += (tlv_length + PTP_V2_AN_TLV_DATA_OFFSET);
2506                                 }
2507
2508                 break;
2509             }
2510
2511             case PTP_V2_SYNC_MESSAGE:
2512             case PTP_V2_DELAY_REQ_MESSAGE:{
2513                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET);
2514                 timeStamp = timeStamp << 16;
2515                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET+4);
2516
2517                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_seconds, tvb,
2518                     PTP_V2_SDR_ORIGINTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2519                     
2520                 proto_tree_add_item(ptp_tree, hf_ptp_v2_sdr_origintimestamp_nanoseconds, tvb,
2521                     PTP_V2_SDR_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2522
2523                 break;
2524             }
2525
2526             case PTP_V2_FOLLOWUP_MESSAGE:{
2527                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET);
2528                 timeStamp = timeStamp << 16;
2529                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET+4);
2530                 
2531                 proto_tree_add_item(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_seconds, tvb,
2532                     PTP_V2_FU_PRECISEORIGINTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2533
2534                 proto_tree_add_item(ptp_tree, hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds, tvb,
2535                     PTP_V2_FU_PRECISEORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2536
2537                 break;
2538             }
2539
2540             case PTP_V2_DELAY_RESP_MESSAGE:{
2541                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET);
2542                 timeStamp = timeStamp << 16;
2543                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET+4);
2544
2545                 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_seconds, tvb,
2546                     PTP_V2_DR_RECEIVETIMESTAMPSECONDS_OFFSET, 6, FALSE);
2547                                         
2548                 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_receivetimestamp_nanoseconds, tvb,
2549                     PTP_V2_DR_RECEIVETIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2550
2551                 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingportidentity, tvb,
2552                     PTP_V2_DR_REQUESTINGPORTIDENTITY_OFFSET, 8, FALSE);
2553
2554                 proto_tree_add_item(ptp_tree, hf_ptp_v2_dr_requestingsourceportid, tvb,
2555                     PTP_V2_DR_REQUESTINGSOURCEPORTID_OFFSET, 2, FALSE);
2556
2557                 break;
2558             }
2559
2560             case PTP_V2_PATH_DELAY_REQ_MESSAGE:{
2561                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET);
2562                 timeStamp = timeStamp << 16;
2563                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET+4);
2564
2565                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_seconds, tvb,
2566                     PTP_V2_PDRQ_ORIGINTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2567
2568                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrq_origintimestamp_nanoseconds, tvb,
2569                     PTP_V2_PDRQ_ORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2570
2571                 break;
2572             }
2573
2574             case PTP_V2_PATH_DELAY_RESP_MESSAGE:{
2575                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET);
2576                 timeStamp = timeStamp << 16;
2577                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET+4);
2578
2579                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_seconds, tvb,
2580                     PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2581
2582                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds, tvb,
2583                     PTP_V2_PDRS_REQUESTRECEIPTTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2584
2585                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingportidentity, tvb,
2586                     PTP_V2_PDRS_REQUESTINGPORTIDENTITY_OFFSET, 8, FALSE);
2587
2588                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdrs_requestingsourceportid, tvb,
2589                     PTP_V2_PDRS_REQUESTINGSOURCEPORTID_OFFSET, 2, FALSE);
2590
2591                 break;
2592             }
2593
2594             case PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE:{
2595                 timeStamp = tvb_get_ntohl(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET);
2596                 timeStamp = timeStamp << 16;
2597                 timeStamp = timeStamp | tvb_get_ntohs(tvb, PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET+4);
2598
2599                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_seconds, tvb,
2600                     PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPSECONDS_OFFSET, 6, FALSE);
2601
2602                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds, tvb,
2603                     PTP_V2_PDFU_RESPONSEORIGINTIMESTAMPNANOSECONDS_OFFSET, 4, FALSE);
2604
2605
2606                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingportidentity, tvb,
2607                     PTP_V2_PDFU_REQUESTINGPORTIDENTITY_OFFSET, 8, FALSE);
2608
2609                 proto_tree_add_item(ptp_tree, hf_ptp_v2_pdfu_requestingsourceportid, tvb,
2610                     PTP_V2_PDFU_REQUESTINGSOURCEPORTID_OFFSET, 2, FALSE);
2611
2612                 break;
2613             }
2614
2615             case PTP_V2_SIGNALLING_MESSAGE:{
2616
2617                                 guint16 tlv_type, tlv_length;
2618
2619                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportidentity, tvb,
2620                     PTP_V2_SIG_TARGETPORTIDENTITY_OFFSET, 8, FALSE);
2621
2622                 proto_tree_add_item(ptp_tree, hf_ptp_v2_sig_targetportid, tvb,
2623                     PTP_V2_SIG_TARGETPORTID_OFFSET, 2, FALSE);
2624
2625                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_tlvType, tvb,
2626                                 PTP_V2_SIG_TARGETPORTID_OFFSET+2, 2, FALSE);
2627
2628                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_lengthField, tvb,
2629                                 PTP_V2_SIG_TARGETPORTID_OFFSET+4, 2, FALSE);
2630
2631                                 tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
2632                                 tlv_length = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_LENGTHFIELD_OFFSET);
2633
2634                                 if (tlv_length <= 2)
2635                                 {
2636                                         /* no data */
2637                                         break;
2638                                 }
2639                                 /* ToDO: Add dissector for TLVs and allow multiple TLVs */
2640                                 proto_tree_add_text(ptp_tree, tvb, PTP_V2_SIG_TARGETPORTID_OFFSET+6, tlv_length, "Data");
2641                                 break;
2642             }
2643
2644             case PTP_V2_MANAGEMENT_MESSAGE:
2645                         {
2646                                 guint16 tlv_type, tlv_length;
2647
2648                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportidentity, tvb,
2649                                 PTP_V2_MM_TARGETPORTIDENTITY_OFFSET, 8, FALSE);
2650
2651                             proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_targetportid, tvb,
2652                                 PTP_V2_MM_TARGETPORTID_OFFSET, 2, FALSE);
2653
2654                             proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_startingboundaryhops, tvb,
2655                                 PTP_V2_MM_STARTINGBOUNDARYHOPS_OFFSET, 1, FALSE);
2656
2657                             proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_boundaryhops, tvb,
2658                                 PTP_V2_MM_BOUNDARYHOPS_OFFSET, 1, FALSE);
2659
2660                             proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_action, tvb,
2661                                 PTP_V2_MM_ACTION_OFFSET, 1, FALSE);
2662
2663                                 /* management TLV */
2664                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_tlvType, tvb,
2665                                 PTP_V2_MM_TLV_TYPE_OFFSET, 2, FALSE);
2666
2667                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_lengthField, tvb,
2668                                 PTP_V2_MM_TLV_LENGTHFIELD_OFFSET, 2, FALSE);
2669
2670                                 tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET);
2671                                 tlv_length = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_LENGTHFIELD_OFFSET);
2672
2673                                 /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */
2674                                 switch(tlv_type) {
2675                                         case PTP_V2_TLV_TYPE_MANAGEMENT:
2676                                         {
2677                                                 guint16 ptp_v2_managementId;
2678                                                 guint16 Offset = PTP_V2_MM_TLV_DATAFIELD_OFFSET;
2679
2680                                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementId, tvb,
2681                                                 PTP_V2_MM_TLV_MANAGEMENTID_OFFSET, 2, FALSE);
2682
2683                                                 ptp_v2_managementId = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET);
2684
2685                                                 if (tlv_length <= 2)
2686                                                 {
2687                                                         /* no data */
2688                                                         break;
2689                                                 }
2690
2691                                                 managementData_ti = proto_tree_add_text(ptp_tree, tvb, Offset, tlv_length, "Data");
2692
2693                                                 /* data field of the management message (subtree)*/
2694                                                 ptp_managementData_tree = proto_item_add_subtree(managementData_ti, ett_ptp_v2_managementData);
2695
2696                                                 switch(ptp_v2_managementId) {
2697                                                         case PTP_V2_MM_ID_NULL_MANAGEMENT:
2698                                                         {
2699                                                                 /* no data in NULL management */
2700                                                                 break;
2701                                                         }
2702                                                         case PTP_V2_MM_ID_CLOCK_DESCRIPTION:
2703                                                         {
2704                                                                 guint16 N = 0, S = 0;
2705                                                                 clockType_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockType, tvb,
2706                                                                         Offset, 2, FALSE);
2707
2708                                                                 ptp_clockType_tree = proto_item_add_subtree(clockType_ti, ett_ptp_v2_clockType);
2709                                                                         /* ClockType Subtree */
2710                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_ordinaryClock, tvb,
2711                                                                                 Offset, 2, FALSE);
2712
2713                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_boundaryClock, tvb,
2714                                                                                 Offset, 2, FALSE);
2715
2716                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_p2p_transparentClock, tvb,
2717                                                                                 Offset, 2, FALSE);
2718
2719                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_e2e_transparentClock, tvb,
2720                                                                                 Offset, 2, FALSE);
2721
2722                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_managementNode, tvb,
2723                                                                                 Offset, 2, FALSE);
2724
2725                                                                         proto_tree_add_item(ptp_clockType_tree, hf_ptp_v2_mm_clockType_reserved, tvb,
2726                                                                                 Offset, 2, FALSE);
2727                                                                 Offset +=2;
2728
2729                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
2730                                                                                                          hf_ptp_v2_mm_physicalLayerProtocol, hf_ptp_v2_mm_physicalLayerProtocol_length);
2731
2732                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddressLength, tvb,
2733                                                                         Offset, 2, FALSE);
2734
2735                                                                 S = tvb_get_ntohs (tvb, Offset);
2736                                                                 Offset +=2;
2737
2738                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_physicalAddress, tvb,
2739                                                                         Offset, S, FALSE);
2740                                                                 Offset += S;
2741
2742                                                                 N = tvb_get_ntohs (tvb, Offset+2);
2743
2744                                                                 protocolAddress_ti = proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_protocolAddress, tvb,
2745                                                                         Offset+4, N, FALSE);
2746
2747                                                                 ptp_protocolAddress_tree = proto_item_add_subtree(protocolAddress_ti, ett_ptp_v2_protocolAddress);
2748                                                                         /* physicalLayerProtocol subtree */
2749                                                                         proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_networkProtocol, tvb,
2750                                                                                 Offset, 2, FALSE);
2751
2752                                                                         proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress_length, tvb,
2753                                                                                 Offset+2, 2, FALSE);
2754
2755                                                                         proto_tree_add_item(ptp_protocolAddress_tree, hf_ptp_v2_mm_protocolAddress, tvb,
2756                                                                                 Offset+4, N, FALSE);
2757                                                                 N = N + 4;
2758                                                                 Offset += N;
2759
2760                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_manufacturerIdentity, tvb,
2761                                                                         Offset, 3, FALSE);
2762
2763                                                                 Offset += 3;
2764
2765                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
2766                                                                         Offset, 1, FALSE);
2767                                                                 Offset += 1;
2768
2769                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
2770                                                                                                          hf_ptp_v2_mm_productDescription, hf_ptp_v2_mm_productDescription_length);
2771                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
2772                                                                                                          hf_ptp_v2_mm_revisionData, hf_ptp_v2_mm_revisionData_length);
2773                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
2774                                                                                                          hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
2775
2776                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_profileIdentity, tvb,
2777                                                                         Offset, 6, FALSE);
2778                                                                 Offset += 6;
2779
2780                                                                 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
2781                                                                 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
2782                                                                 {
2783                                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
2784                                                                         Offset, 1, FALSE);
2785                                                                 }
2786                                                                 break;
2787                                                         }
2788                                                         case PTP_V2_MM_ID_USER_DESCRIPTION:
2789                                                         {
2790
2791                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
2792                                                                                                          hf_ptp_v2_mm_userDescription, hf_ptp_v2_mm_userDescription_length);
2793
2794                                                                 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
2795                                                                 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
2796                                                                 {
2797                                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
2798                                                                         Offset, 1, FALSE);
2799                                                                 }
2800                                                                 break;
2801                                                         }
2802                                                         case PTP_V2_MM_ID_SAVE_IN_NON_VOLATILE_STORAGE:
2803                                                         {
2804                                                                 /* no data */
2805                                                                 break;
2806                                                         }
2807                                                         case PTP_V2_MM_ID_RESET_NON_VOLATILE_STORAGE:
2808                                                         {
2809                                                                 /* no data */
2810                                                                 break;
2811                                                         }
2812                                                         case PTP_V2_MM_ID_INITIALIZE:
2813                                                         {
2814                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_initializationKey, tvb,
2815                                                                         Offset, 2, FALSE);
2816                                                                 break;
2817                                                         }
2818                                                         case PTP_V2_MM_ID_FAULT_LOG:
2819                                                         {
2820                                                                 guint16 i, num = 0;
2821                                                                 proto_item      *ptpError_ti;
2822                                                                 proto_tree      *ptpError_subtree;
2823
2824                                                                 num = tvb_get_ntohs (tvb, Offset);
2825
2826                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfFaultRecords, tvb,
2827                                                                         Offset, 2, FALSE);
2828                                                                 Offset +=2;
2829
2830                                                                 for (i = 1; i <= num; i++)
2831                                                                 {
2832                                                                         ptpError_ti = proto_tree_add_text(ptp_managementData_tree, tvb, Offset, tvb_get_ntohs (tvb, Offset), "Fault record");
2833
2834                                                                         /*  (subtree)*/
2835                                                                         ptpError_subtree = proto_item_add_subtree(ptpError_ti, ett_ptp_v2_faultRecord);
2836
2837                                                                         proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultRecordLength, tvb,
2838                                                                                 Offset, 2, FALSE);
2839                                                                         Offset +=2;
2840
2841                                                                         timeStamp = tvb_get_ntohl(tvb, Offset);
2842                                                         timeStamp = timeStamp << 16;
2843                                                         timeStamp = timeStamp | tvb_get_ntohs(tvb, Offset+4);
2844
2845                                                                         proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_s, tvb,
2846                                                                     Offset, 6, FALSE);
2847
2848                                                                         Offset +=6;
2849                                                         proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_faultTime_ns, tvb,
2850                                                                     Offset, 4, FALSE);
2851                                                                         Offset +=4;
2852                                                                         proto_tree_add_item(ptpError_subtree, hf_ptp_v2_mm_severityCode, tvb,
2853                                                                     Offset, 1, FALSE);
2854                                                                         Offset +=1;
2855
2856                                                                         dissect_ptp_v2_text     (tvb, &Offset, ptpError_subtree,
2857                                                                                                                  hf_ptp_v2_mm_faultName, hf_ptp_v2_mm_faultName_length);
2858
2859                                                                         dissect_ptp_v2_text     (tvb, &Offset, ptpError_subtree,
2860                                                                                                                  hf_ptp_v2_mm_faultValue, hf_ptp_v2_mm_faultValue_length);
2861
2862                                                                         dissect_ptp_v2_text     (tvb, &Offset, ptpError_subtree,
2863                                                                                                                  hf_ptp_v2_mm_faultDescription, hf_ptp_v2_mm_faultDescription_length);
2864                                                                 }
2865
2866                                                                 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
2867                                                                 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
2868                                                                 {
2869                                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
2870                                                                                 Offset, 1, FALSE);
2871                                                                 }
2872                                                                 break;
2873                                                         }
2874                                                         case PTP_V2_MM_ID_FAULT_LOG_RESET:
2875                                                         {
2876                                                                 /* no data */
2877                                                                 break;
2878                                                         }
2879                                                         case PTP_V2_MM_ID_DEFAULT_DATA_SET:
2880                                                         {
2881                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TSC, tvb,
2882                                                                         PTP_V2_MM_TLV_DATAFIELD_OFFSET, 1, FALSE);
2883
2884                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_dds_SO, tvb,
2885                                                                         PTP_V2_MM_TLV_DATAFIELD_OFFSET, 1, FALSE);
2886
2887                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
2888                                                                         PTP_V2_MM_RESERVED1, 1, FALSE);
2889
2890                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb,
2891                                                                         PTP_V2_MM_NUMBERPORTS, 2, FALSE);
2892
2893                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb,
2894                                                                         PTP_V2_MM_PRIORITY1, 1, FALSE);
2895
2896                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockclass, tvb,
2897                                                                         PTP_V2_MM_CLOCKQUALITY, 1, FALSE);
2898
2899                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockaccuracy, tvb,
2900                                                                         PTP_V2_MM_CLOCKQUALITY+1, 1, FALSE);
2901
2902                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockvariance, tvb,
2903                                                                         PTP_V2_MM_CLOCKQUALITY+2, 2, FALSE);
2904
2905                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb,
2906                                                                         PTP_V2_MM_PRIORITY2, 1, FALSE);
2907
2908                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
2909                                                                         PTP_V2_MM_CLOCKIDENTITY, 8, FALSE);
2910
2911                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb,
2912                                                                         PTP_V2_MM_DOMAINNUMBER, 1, FALSE);
2913
2914                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
2915                                                                         PTP_V2_MM_RESERVED2, 1, FALSE);
2916                                                                 break;
2917                                                         }
2918                                                         case PTP_V2_MM_ID_CURRENT_DATA_SET:
2919                                                         {
2920                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_stepsRemoved, tvb,
2921                                                                         Offset, 2, FALSE);
2922                                                                 Offset +=2;
2923
2924                                                                 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
2925                                                                         "Offset from Master", hf_ptp_v2_mm_offset_ns, hf_ptp_v2_mm_offset_subns);
2926                                                                 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
2927                                                                         "Mean path delay", hf_ptp_v2_mm_pathDelay_ns, hf_ptp_v2_mm_pathDelay_subns);
2928                                                                 break;
2929                                                         }
2930                                                         case PTP_V2_MM_ID_PARENT_DATA_SET:
2931                                                         {
2932                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentIdentity, tvb,
2933                                                                         Offset, 8, FALSE);
2934
2935                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentPort, tvb,
2936                                                                         Offset+8, 2, FALSE);
2937                                                                 Offset +=10;
2938
2939                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_parentStats, tvb,
2940                                                                         Offset, 1, FALSE);
2941                                                                 Offset +=1;
2942
2943                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
2944                                                                         Offset, 1, FALSE);
2945                                                                 Offset +=1;
2946
2947                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentOffsetScaledLogVariance, tvb,
2948                                                                         Offset, 2, FALSE);
2949                                                                 Offset +=2;
2950
2951                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_observedParentClockPhaseChangeRate, tvb,
2952                                                                         Offset, 4, FALSE);
2953                                                                 Offset +=4;
2954
2955                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority1, tvb,
2956                                                                         Offset, 1, FALSE);
2957                                                                 Offset +=1;
2958
2959                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockclass, tvb,
2960                                                                         Offset, 1, FALSE);
2961
2962                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockaccuracy, tvb,
2963                                                                         Offset+1, 1, FALSE);
2964
2965                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterclockvariance, tvb,
2966                                                                         Offset+2, 2, FALSE);
2967                                                                 Offset += 4;
2968
2969                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterPriority2, tvb,
2970                                                                         Offset, 1, FALSE);
2971                                                                 Offset +=1;
2972
2973                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_grandmasterIdentity, tvb,
2974                                                                         Offset, 8, FALSE);
2975
2976                                                                 break;
2977                                                         }
2978                                                         case PTP_V2_MM_ID_TIME_PROPERTIES_DATA_SET:
2979                                                         {
2980                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb,
2981                                                                         Offset, 2, FALSE);
2982                                                                 Offset +=2;
2983
2984                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb,
2985                                                                         Offset, 1, FALSE);
2986                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb,
2987                                                                         Offset, 1, FALSE);
2988                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb,
2989                                                                         Offset, 1, FALSE);
2990                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb,
2991                                                                         Offset, 1, FALSE);
2992                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb,
2993                                                                         Offset, 1, FALSE);
2994                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb,
2995                                                                         Offset, 1, FALSE);
2996                                                                 Offset +=1;
2997
2998                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb,
2999                                                                         Offset, 1, FALSE);
3000
3001                                                                 break;
3002                                                         }
3003                                                         case PTP_V2_MM_ID_PORT_DATA_SET:
3004                                                         {
3005                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
3006                                                                         Offset, 8, FALSE);
3007                                                                 Offset +=8;
3008
3009                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb,
3010                                                                         Offset, 2, FALSE);
3011                                                                 Offset +=2;
3012
3013                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_portState, tvb,
3014                                                                         Offset, 1, FALSE);
3015                                                                 Offset +=1;
3016
3017                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinDelayReqInterval, tvb,
3018                                                                         Offset, 1, FALSE);
3019                                                                 Offset +=1;
3020
3021                                                                 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
3022                                                                         "Peer mean path delay", hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns);
3023
3024                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb,
3025                                                                         Offset, 1, FALSE);
3026                                                                 Offset +=1;
3027
3028                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb,
3029                                                                         Offset, 1, FALSE);
3030                                                                 Offset +=1;
3031
3032                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb,
3033                                                                         Offset, 1, FALSE);
3034                                                                 Offset +=1;
3035
3036                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
3037                                                                         Offset, 1, FALSE);
3038                                                                 Offset +=1;
3039
3040                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
3041                                                                         Offset, 1, FALSE);
3042                                                                 Offset +=1;
3043
3044                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb,
3045                                                                         Offset, 1, FALSE);
3046                                                                 Offset +=1;
3047
3048                                                                 break;
3049                                                         }
3050                                                         case PTP_V2_MM_ID_PRIORITY1:
3051                                                         {
3052                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority1, tvb,
3053                                                                         Offset, 1, FALSE);
3054                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3055                                                                         Offset+1, 1, FALSE);
3056                                                                 break;
3057                                                         }
3058                                                         case PTP_V2_MM_ID_PRIORITY2:
3059                                                         {
3060                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_priority2, tvb,
3061                                                                         Offset, 1, FALSE);
3062                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3063                                                                         Offset+1, 1, FALSE);
3064                                                                 break;
3065                                                         }
3066                                                         case PTP_V2_MM_ID_DOMAIN:
3067                                                         {
3068                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_domainNumber, tvb,
3069                                                                         Offset, 1, FALSE);
3070                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3071                                                                         Offset+1, 1, FALSE);
3072                                                                 break;
3073                                                         }
3074                                                         case PTP_V2_MM_ID_SLAVE_ONLY:
3075                                                         {
3076                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_SO, tvb,
3077                                                                         Offset, 1, FALSE);
3078                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3079                                                                         Offset+1, 1, FALSE);
3080                                                                 break;
3081                                                         }
3082                                                         case PTP_V2_MM_ID_LOG_ANNOUNCE_INTERVAL:
3083                                                         {
3084                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAnnounceInterval, tvb,
3085                                                                         Offset, 1, FALSE);
3086
3087                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3088                                                                         Offset+1, 1, FALSE);
3089                                                                 break;
3090                                                         }
3091                                                         case PTP_V2_MM_ID_ANNOUNCE_RECEIPT_TIMEOUT:
3092                                                         {
3093                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_announceReceiptTimeout, tvb,
3094                                                                         Offset, 1, FALSE);
3095
3096                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3097                                                                         Offset+1, 1, FALSE);
3098                                                                 break;
3099                                                         }
3100                                                         case PTP_V2_MM_ID_LOG_SYNC_INTERVAL:
3101                                                         {
3102                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logSyncInterval, tvb,
3103                                                                         Offset, 1, FALSE);
3104
3105                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3106                                                                         Offset+1, 1, FALSE);
3107                                                                 break;
3108                                                         }
3109                                                         case PTP_V2_MM_ID_VERSION_NUMBER:
3110                                                         {
3111                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_versionNumber, tvb,
3112                                                                         Offset, 1, FALSE);
3113
3114                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3115                                                                         Offset+1, 1, FALSE);
3116                                                                 break;
3117                                                         }
3118                                                         case PTP_V2_MM_ID_ENABLE_PORT:
3119                                                         {
3120                                                                 /* no data */
3121                                                                 break;
3122                                                         }
3123                                                         case PTP_V2_MM_ID_DISABLE_PORT:
3124                                                         {
3125                                                                 /* no data */
3126                                                                 break;
3127                                                         }
3128                                                         case PTP_V2_MM_ID_TIME:
3129                                                         {
3130                                                                 timeStamp = tvb_get_ntohl(tvb, Offset);
3131                                                                 timeStamp = timeStamp << 16;
3132                                                                 timeStamp = timeStamp | tvb_get_ntohs(tvb, Offset+4);
3133
3134                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_s, tvb,
3135                                                                                         Offset, 6, FALSE);
3136                                                                 
3137                                                                 Offset +=6;
3138                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentTime_ns, tvb,
3139                                                                                         Offset, 4, FALSE);
3140                                                                 break;
3141                                                         }
3142                                                         case PTP_V2_MM_ID_CLOCK_ACCURACY:
3143                                                         {
3144                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockAccuracy, tvb,
3145                                                                         Offset, 1, FALSE);
3146                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3147                                                                         Offset+1, 1, FALSE);
3148                                                                 break;
3149                                                         }
3150                                                         case PTP_V2_MM_ID_UTC_PROPERTIES:
3151                                                         {
3152                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentUtcOffset, tvb,
3153                                                                         Offset, 2, FALSE);
3154                                                                 Offset +=2;
3155
3156                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_61, tvb,
3157                                                                         Offset, 1, FALSE);
3158                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_LI_59, tvb,
3159                                                                         Offset, 1, FALSE);
3160                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_UTCV, tvb,
3161                                                                         Offset, 1, FALSE);
3162                                                                 Offset +=1;
3163
3164                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3165                                                                         Offset, 1, FALSE);
3166                                                                 break;
3167                                                         }
3168                                                         case PTP_V2_MM_ID_TRACEABILITY_PROPERTIES:
3169                                                         {
3170                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_TTRA, tvb,
3171                                                                         Offset, 1, FALSE);
3172                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_FTRA, tvb,
3173                                                                         Offset, 1, FALSE);
3174                                                                 Offset +=1;
3175
3176                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3177                                                                         Offset, 1, FALSE);
3178
3179                                                                 break;
3180                                                         }
3181                                                         case PTP_V2_MM_ID_TIMESCALE_PROPERTIES:
3182                                                         {
3183                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PTP, tvb,
3184                                                                         Offset, 1, FALSE);
3185                                                                 Offset +=1;
3186
3187                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_timesource, tvb,
3188                                                                         Offset, 1, FALSE);
3189
3190                                                                 break;
3191                                                         }
3192                                                         case PTP_V2_MM_ID_UNICAST_NEGOTIATION_ENABLE:
3193                                                         {
3194                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ucEN, tvb,
3195                                                                         Offset, 1, FALSE);
3196                                                                 Offset +=1;
3197
3198                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3199                                                                         Offset, 1, FALSE);
3200                                                                 break;
3201                                                         }
3202                                                         case PTP_V2_MM_ID_PATH_TRACE_LIST:
3203                                                         {
3204                                                                 guint16 i = 0;
3205                                                                 /* one or more ClockIdentity */
3206                                                                 for (i = 1; i <= (tlv_length / 8); i++)
3207                                                                 {
3208                                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
3209                                                                                 Offset, 8, FALSE);
3210                                                                 }
3211
3212                                                                 break;
3213                                                         }
3214                                                         case PTP_V2_MM_ID_PATH_TRACE_ENABLE:
3215                                                         {
3216                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_ptEN, tvb,
3217                                                                         Offset, 1, FALSE);
3218                                                                 Offset +=1;
3219
3220                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3221                                                                         Offset, 1, FALSE);
3222
3223                                                                 break;
3224                                                         }
3225                                                         case PTP_V2_MM_ID_GRANDMASTER_CLUSTER_TABLE:
3226                                                                 {
3227                                                                 /* ToDo */
3228                                                                 break;
3229                                                                 }
3230                                                         case PTP_V2_MM_ID_UNICAST_MASTER_TABLE:
3231                                                                 {
3232                                                                 /* ToDo */
3233                                                                 break;
3234                                                                 }
3235                                                         case PTP_V2_MM_ID_UNICAST_MASTER_MAX_TABLE_SIZE:
3236                                                                 {
3237                                                                 /* ToDo */
3238                                                                 break;
3239                                                                 }
3240                                                         case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE:
3241                                                                 {
3242                                                                 /* ToDo */
3243                                                                 break;
3244                                                                 }
3245                                                         case PTP_V2_MM_ID_ACCEPTABLE_MASTER_TABLE_ENABLED:
3246                                                                 {
3247                                                                 /* ToDo */
3248                                                                 break;
3249                                                                 }
3250                                                         case PTP_V2_MM_ID_ACCEPTABLE_MASTER_MAX_TABLE_SIZE:
3251                                                                 {
3252                                                                 /* ToDo */
3253                                                                 break;
3254                                                                 }
3255                                                         case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_ENABLE:
3256                                                         {
3257                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
3258                                                                         Offset, 1, FALSE);
3259                                                                 Offset +=1;
3260
3261                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_atEN, tvb,
3262                                                                         Offset, 1, FALSE);
3263                                                                 Offset +=1;
3264
3265                                                                 break;
3266                                                         }
3267                                                         case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_NAME:
3268                                                         {
3269                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
3270                                                                         Offset, 1, FALSE);
3271                                                                 Offset +=1;
3272
3273                                                                 dissect_ptp_v2_text     (tvb, &Offset, ptp_managementData_tree,
3274                                                                         hf_ptp_v2_mm_displayName, hf_ptp_v2_mm_displayName_length);
3275
3276                                                                 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
3277                                                                 if ( (Offset - PTP_V2_MM_TLV_DATAFIELD_OFFSET) % 2 )
3278                                                                 {
3279                                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_pad, tvb,
3280                                                                                 Offset, 1, FALSE);
3281                                                                 }
3282                                                                 break;
3283                                                         }
3284                                                         case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_MAX_KEY:
3285                                                         {
3286                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_maxKey, tvb,
3287                                                                         Offset, 1, FALSE);
3288                                                                 Offset +=1;
3289
3290                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3291                                                                         Offset, 1, FALSE);
3292
3293                                                                 break;
3294                                                         }
3295                                                         case PTP_V2_MM_ID_ALTERNATE_MASTER:
3296                                                         {
3297                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_transmitAlternateMulticastSync, tvb,
3298                                                                         Offset, 1, FALSE);
3299                                                                 Offset +=1;
3300
3301                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberOfAlternateMasters, tvb,
3302                                                                         Offset, 1, FALSE);
3303                                                                 Offset +=1;
3304
3305                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logAlternateMulticastSyncInterval, tvb,
3306                                                                         Offset, 1, FALSE);
3307                                                                 Offset +=1;
3308
3309                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3310                                                                         Offset, 1, FALSE);
3311                                                                 break;
3312                                                         }
3313                                                         case PTP_V2_MM_ID_ALTERNATE_TIME_OFFSET_PROPERTIES:
3314                                                         {
3315                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_keyField, tvb,
3316                                                                         Offset, 1, FALSE);
3317                                                                 Offset +=1;
3318
3319                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_currentOffset, tvb,
3320                                                                         Offset, 4, FALSE);
3321                                                                 Offset +=4;
3322
3323                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_jumpSeconds, tvb,
3324                                                                         Offset, 4, FALSE);
3325                                                                 Offset +=4;
3326
3327                                                                 timeStamp = tvb_get_ntohl(tvb, Offset);
3328                                                                 timeStamp = timeStamp << 16;
3329                                                                 timeStamp = timeStamp | tvb_get_ntohs(tvb, Offset+4);
3330
3331                                                                 proto_tree_add_text(ptp_managementData_tree, tvb, Offset, 6,
3332                                                                         "Time of next jump (seconds): %" G_GINT64_MODIFIER "u", timeStamp);
3333                                                                 Offset +=6;
3334
3335                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3336                                                                         Offset, 1, FALSE);
3337                                                                 break;
3338                                                         }
3339                                                         case PTP_V2_MM_ID_TC_DEFAULT_DATA_SET:
3340                                                         {
3341                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
3342                                                                         Offset, 8, FALSE);
3343                                                                 Offset +=8;
3344
3345                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_numberPorts, tvb,
3346                                                                         Offset, 2, FALSE);
3347                                                                 Offset +=2;
3348
3349                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
3350                                                                         Offset, 1, FALSE);
3351                                                                 Offset +=1;
3352
3353                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb,
3354                                                                         Offset, 1, FALSE);
3355
3356                                                                 break;
3357                                                         }
3358                                                         case PTP_V2_MM_ID_TC_PORT_DATA_SET:
3359                                                         {
3360                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_clockidentity, tvb,
3361                                                                         Offset, 8, FALSE);
3362                                                                 Offset +=8;
3363
3364                                                         proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_PortNumber, tvb,
3365                                                                         Offset, 2, FALSE);
3366                                                                 Offset +=2;
3367
3368                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_faultyFlag, tvb,
3369                                                                         Offset, 1, FALSE);
3370                                                                 Offset +=1;
3371
3372                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
3373                                                                         Offset, 1, FALSE);
3374                                                                 Offset +=1;
3375
3376                                                                 dissect_ptp_v2_timeInterval(tvb, &Offset, ptp_managementData_tree,
3377                                                                         "Peer mean path delay", hf_ptp_v2_mm_peerMeanPathDelay_ns, hf_ptp_v2_mm_peerMeanPathDelay_subns);
3378                                                                 break;
3379                                                         }
3380                                                         case PTP_V2_MM_ID_PRIMARY_DOMAIN:
3381                                                         {
3382                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_primaryDomain, tvb,
3383                                                                         Offset, 1, FALSE);
3384
3385                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3386                                                                         Offset+1, 1, FALSE);
3387                                                                 break;
3388                                                         }
3389                                                         case PTP_V2_MM_ID_DELAY_MECHANISM:
3390                                                         {
3391                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_delayMechanism, tvb,
3392                                                                         Offset, 1, FALSE);
3393
3394                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3395                                                                         Offset+1, 1, FALSE);
3396                                                                 break;
3397                                                         }
3398                                                         case PTP_V2_MM_ID_LOG_MIN_PDELAY_REQ_INTERVAL:
3399                                                         {
3400                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_logMinPdelayReqInterval, tvb,
3401                                                                         Offset, 1, FALSE);
3402
3403                                                                 proto_tree_add_item(ptp_managementData_tree, hf_ptp_v2_mm_reserved, tvb,
3404                                                                         Offset+1, 1, FALSE);
3405                                                                 break;
3406                                                         }
3407                                                         default:
3408                                                         {
3409                                                                 /* no data */
3410                                                                 break;
3411                                                         }
3412                                                 } /* switch(ptp_v2_managementId) */
3413                                                 break;
3414                                         }
3415                                         case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS:
3416                                         {
3417                                                 /* there is only one error TLV */
3418                                                 guint16 Offset = PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET;
3419
3420                                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementErrorId, tvb,
3421                                                 Offset, 2, FALSE);
3422                                                 Offset +=2;
3423
3424                                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_managementId, tvb,
3425                                                 Offset, 2, FALSE);
3426                                                 Offset +=2;
3427
3428                                                 proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_reserved, tvb,
3429                                                         Offset, 4, FALSE);
3430                                                 Offset +=4;
3431
3432                                                 /* optional Field! */
3433                                                 if (Offset - PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET + 2 < tlv_length)
3434                                                 {
3435                                                         dissect_ptp_v2_text     (tvb, &Offset, ptp_tree,
3436                                                                 hf_ptp_v2_mm_displayData, hf_ptp_v2_mm_displayData_length);
3437                                                 }
3438
3439                                                 /* Wenn Offset nicht gerade folgt noch ein pad Bit */
3440                                                 if ( (Offset - PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET) % 2 )
3441                                                 {
3442                                                         proto_tree_add_item(ptp_tree, hf_ptp_v2_mm_pad, tvb,
3443                                                                 Offset, 1, FALSE);
3444                                                 }
3445                                                 break;
3446                                         }
3447                                         default:
3448                                         {
3449                                                 break;
3450                                         }
3451                                 } /* switch TLV Type */
3452                         } /* case Management Message */
3453         } /* switch message ID*/
3454    } /* tree */
3455 }
3456
3457
3458 /* Register the protocol with Wireshark */
3459
3460 void
3461 proto_register_ptp(void)
3462 {
3463         static hf_register_info hf[] = {
3464         /* PTPv1 fields **********************************************************/
3465         /*Common fields for all frames*/
3466         { &hf_ptp_versionptp,
3467             { "versionPTP",           "ptp.versionptp",
3468             FT_UINT16, BASE_DEC, NULL, 0x00,
3469             NULL, HFILL }
3470         },
3471         { &hf_ptp_versionnetwork,
3472             { "versionNetwork",           "ptp.versionnetwork",
3473             FT_UINT16, BASE_DEC, NULL, 0x00,
3474             NULL, HFILL }
3475         },
3476         { &hf_ptp_subdomain,
3477             { "subdomain",           "ptp.subdomain",
3478             FT_STRING, BASE_DEC, NULL, 0x00,
3479             NULL, HFILL }
3480         },
3481         { &hf_ptp_messagetype,
3482             { "messageType",           "ptp.messagetype",
3483             FT_UINT8, BASE_DEC, VALS(ptp_messagetype_vals), 0x00,
3484             NULL, HFILL }
3485         },
3486         { &hf_ptp_sourcecommunicationtechnology,
3487             { "sourceCommunicationTechnology",           "ptp.sourcecommunicationtechnology",
3488             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3489             NULL, HFILL }
3490         },
3491         { &hf_ptp_sourceuuid,
3492             { "sourceUuid",           "ptp.sourceuuid",
3493             FT_ETHER, BASE_DEC, NULL, 0x00,
3494             NULL, HFILL }
3495         },
3496         { &hf_ptp_sourceportid,
3497             { "sourcePortId",           "ptp.sourceportid",
3498             FT_UINT16, BASE_DEC, NULL, 0x00,
3499             NULL, HFILL }
3500         },
3501         { &hf_ptp_sequenceid,
3502             { "sequenceId",           "ptp.sequenceid",
3503             FT_UINT16, BASE_DEC, NULL, 0x00,
3504             NULL, HFILL }
3505         },
3506         { &hf_ptp_control,
3507             { "control",           "ptp.control",
3508             FT_UINT8, BASE_DEC, VALS(ptp_control_vals), 0x00,
3509             NULL, HFILL }
3510         },
3511         /*THE FLAGS-FIELD*/
3512         { &hf_ptp_flags,
3513             { "flags",           "ptp.flags",
3514             FT_UINT16, BASE_HEX, NULL, 0x00,
3515             NULL, HFILL }
3516         },
3517         { &hf_ptp_flags_li61,
3518             { "PTP_LI61",           "ptp.flags.li61",
3519             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_LI61_BITMASK,
3520             NULL, HFILL }
3521         },
3522         { &hf_ptp_flags_li59,
3523             { "PTP_LI59",           "ptp.flags.li59",
3524             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_LI59_BITMASK,
3525             NULL, HFILL }
3526         },
3527         { &hf_ptp_flags_boundary_clock,
3528             { "PTP_BOUNDARY_CLOCK",           "ptp.flags.boundary_clock",
3529             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_BOUNDARY_CLOCK_BITMASK,
3530             NULL, HFILL }
3531         },
3532         { &hf_ptp_flags_assist,
3533             { "PTP_ASSIST",           "ptp.flags.assist",
3534             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_ASSIST_BITMASK,
3535             NULL, HFILL }
3536         },
3537         { &hf_ptp_flags_ext_sync,
3538             { "PTP_EXT_SYNC",           "ptp.flags.ext_sync",
3539             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_EXT_SYNC_BITMASK,
3540             NULL, HFILL }
3541         },
3542         { &hf_ptp_flags_parent,
3543             { "PTP_PARENT_STATS",           "ptp.flags.parent_stats",
3544             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_PARENT_STATS_BITMASK,
3545             NULL, HFILL }
3546         },
3547         { &hf_ptp_flags_sync_burst,
3548             { "PTP_SYNC_BURST",           "ptp.flags.sync_burst",
3549             FT_UINT16, BASE_DEC, VALS(ptp_bool_vals), PTP_FLAGS_SYNC_BURST_BITMASK,
3550             NULL, HFILL }
3551         },
3552         /*END OF THE FLAG-FIELD*/
3553
3554         /*offsets for ptp_sync and delay_req (=sdr) messages*/
3555         { &hf_ptp_sdr_origintimestamp,
3556             { "originTimestamp",           "ptp.sdr.origintimestamp",
3557             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3558             NULL, HFILL }
3559         },
3560         { &hf_ptp_sdr_origintimestamp_seconds,
3561             { "originTimestamp (seconds)",           "ptp.sdr.origintimestamp_seconds",
3562             FT_UINT32, BASE_DEC, NULL, 0x00,
3563             NULL, HFILL }
3564         },
3565         { &hf_ptp_sdr_origintimestamp_nanoseconds,
3566             { "originTimestamp (nanoseconds)",           "ptp.sdr.origintimestamp_nanoseconds",
3567             FT_INT32, BASE_DEC, NULL, 0x00,
3568             NULL, HFILL }
3569         },
3570         { &hf_ptp_sdr_epochnumber,
3571             { "epochNumber",           "ptp.sdr.epochnumber",
3572             FT_UINT16, BASE_DEC, NULL, 0x00,
3573             NULL, HFILL }
3574         },
3575         { &hf_ptp_sdr_currentutcoffset,
3576             { "currentUTCOffset",           "ptp.sdr.currentutcoffset",
3577             FT_INT16, BASE_DEC, NULL, 0x00,
3578             NULL, HFILL }
3579         },
3580         { &hf_ptp_sdr_grandmastercommunicationtechnology,
3581             { "grandmasterCommunicationTechnology",           "ptp.sdr.grandmastercommunicationtechnology",
3582             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3583             NULL, HFILL }
3584         },
3585         { &hf_ptp_sdr_grandmasterclockuuid,
3586             { "grandMasterClockUuid",           "ptp.sdr.grandmasterclockuuid",
3587             FT_ETHER, BASE_DEC, NULL, 0x00,
3588             NULL, HFILL }
3589         },
3590         { &hf_ptp_sdr_grandmasterportid,
3591             { "grandmasterPortId",           "ptp.sdr.grandmasterportid",
3592             FT_UINT16, BASE_DEC, NULL, 0x00,
3593             NULL, HFILL }
3594         },
3595         { &hf_ptp_sdr_grandmastersequenceid,
3596             { "grandmasterSequenceId",           "ptp.sdr.grandmastersequenceid",
3597             FT_UINT16, BASE_DEC, NULL, 0x00,
3598             NULL, HFILL }
3599         },
3600         { &hf_ptp_sdr_grandmasterclockstratum,
3601             { "grandmasterClockStratum",           "ptp.sdr.grandmasterclockstratum",
3602             FT_UINT8, BASE_DEC, NULL, 0x00,
3603             NULL, HFILL }
3604         },
3605         { &hf_ptp_sdr_grandmasterclockidentifier,
3606             { "grandmasterClockIdentifier",           "ptp.sdr.grandmasterclockidentifier",
3607             FT_STRING, BASE_DEC, NULL, 0x00,
3608             NULL, HFILL }
3609         },
3610         { &hf_ptp_sdr_grandmasterclockvariance,
3611             { "grandmasterClockVariance",           "ptp.sdr.grandmasterclockvariance",
3612             FT_INT16, BASE_DEC, NULL, 0x00,
3613             NULL, HFILL }
3614         },
3615         { &hf_ptp_sdr_grandmasterpreferred,
3616             { "grandmasterPreferred",           "ptp.sdr.grandmasterpreferred",
3617             FT_UINT8, BASE_DEC, NULL, 0x00,
3618             NULL, HFILL }
3619         },
3620         { &hf_ptp_sdr_grandmasterisboundaryclock,
3621             { "grandmasterIsBoundaryClock",           "ptp.sdr.grandmasterisboundaryclock",
3622             FT_UINT8, BASE_DEC, NULL, 0x00,
3623             NULL, HFILL }
3624         },
3625         { &hf_ptp_sdr_syncinterval,
3626             { "syncInterval",           "ptp.sdr.syncinterval",
3627             FT_INT8, BASE_DEC, NULL, 0x00,
3628             NULL, HFILL }
3629         },
3630         { &hf_ptp_sdr_localclockvariance,
3631             { "localClockVariance",           "ptp.sdr.localclockvariance",
3632             FT_INT16, BASE_DEC, NULL, 0x00,
3633             NULL, HFILL }
3634         },
3635         { &hf_ptp_sdr_localstepsremoved,
3636             { "localStepsRemoved",           "ptp.sdr.localstepsremoved",
3637             FT_UINT16, BASE_DEC, NULL, 0x00,
3638             NULL, HFILL }
3639         },
3640         { &hf_ptp_sdr_localclockstratum,
3641             { "localClockStratum",           "ptp.sdr.localclockstratum",
3642             FT_UINT8, BASE_DEC, NULL, 0x00,
3643             NULL, HFILL }
3644         },
3645         { &hf_ptp_sdr_localclockidentifier,
3646             { "localClockIdentifier",           "ptp.sdr.localclockidentifier",
3647             FT_STRING, BASE_DEC, NULL, 0x00,
3648             NULL, HFILL }
3649         },
3650         { &hf_ptp_sdr_parentcommunicationtechnology,
3651             { "parentCommunicationTechnology",           "ptp.sdr.parentcommunicationtechnology",
3652             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3653             NULL, HFILL }
3654         },
3655         { &hf_ptp_sdr_parentuuid,
3656             { "parentUuid",           "ptp.sdr.parentuuid",
3657             FT_ETHER, BASE_DEC, NULL, 0x00,
3658             NULL, HFILL }
3659         },
3660         { &hf_ptp_sdr_parentportfield,
3661             { "parentPortField",           "ptp.sdr.parentportfield",
3662             FT_UINT16, BASE_DEC, NULL, 0x00,
3663             NULL, HFILL }
3664         },
3665         { &hf_ptp_sdr_estimatedmastervariance,
3666             { "estimatedMasterVariance",           "ptp.sdr.estimatedmastervariance",
3667             FT_INT16, BASE_DEC, NULL, 0x00,
3668             NULL, HFILL }
3669         },
3670         { &hf_ptp_sdr_estimatedmasterdrift,
3671             { "estimatedMasterDrift",           "ptp.sdr.estimatedmasterdrift",
3672             FT_INT32, BASE_DEC, NULL, 0x00,
3673             NULL, HFILL }
3674         },
3675         { &hf_ptp_sdr_utcreasonable,
3676             { "utcReasonable",           "ptp.sdr.utcreasonable",
3677             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3678             NULL, HFILL }
3679         },
3680         /*offsets for follow_up (=fu) messages*/
3681         { &hf_ptp_fu_associatedsequenceid,
3682             { "associatedSequenceId",           "ptp.fu.associatedsequenceid",
3683             FT_UINT16, BASE_DEC, NULL, 0x00,
3684             NULL, HFILL }
3685         },
3686         { &hf_ptp_fu_preciseorigintimestamp,
3687             { "preciseOriginTimestamp",    "ptp.fu.hf_ptp_fu_preciseorigintimestamp",
3688             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3689             NULL, HFILL }
3690         },
3691         { &hf_ptp_fu_preciseorigintimestamp_seconds,
3692             { "preciseOriginTimestamp (seconds)",    "ptp.fu.hf_ptp_fu_preciseorigintimestamp_seconds",
3693             FT_UINT32, BASE_DEC, NULL, 0x00,
3694             NULL, HFILL }
3695         },
3696         { &hf_ptp_fu_preciseorigintimestamp_nanoseconds,
3697             { "preciseOriginTimestamp (nanoseconds)",           "ptp.fu.preciseorigintimestamp_nanoseconds",
3698             FT_INT32, BASE_DEC, NULL, 0x00,
3699             NULL, HFILL }
3700         },
3701         /*offsets for delay_resp (=dr) messages*/
3702         { &hf_ptp_dr_delayreceipttimestamp,
3703             { "delayReceiptTimestamp",           "ptp.dr.delayreceipttimestamp",
3704             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3705             NULL, HFILL }
3706         },
3707         { &hf_ptp_dr_delayreceipttimestamp_seconds,
3708             { "delayReceiptTimestamp (Seconds)",           "ptp.dr.delayreceipttimestamp_seconds",
3709             FT_UINT32, BASE_DEC, NULL, 0x00,
3710             NULL, HFILL }
3711         },
3712         { &hf_ptp_dr_delayreceipttimestamp_nanoseconds,
3713             { "delayReceiptTimestamp (nanoseconds)",           "ptp.dr.delayreceipttimestamp_nanoseconds",
3714             FT_INT32, BASE_DEC, NULL, 0x00,
3715             NULL, HFILL }
3716         },
3717         { &hf_ptp_dr_requestingsourcecommunicationtechnology,
3718             { "requestingSourceCommunicationTechnology",    "ptp.dr.requestingsourcecommunicationtechnology",
3719             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3720             NULL, HFILL }
3721         },
3722         { &hf_ptp_dr_requestingsourceuuid,
3723             { "requestingSourceUuid",           "ptp.dr.requestingsourceuuid",
3724             FT_ETHER, BASE_DEC, NULL, 0x00,
3725             NULL, HFILL }
3726         },
3727         { &hf_ptp_dr_requestingsourceportid,
3728             { "requestingSourcePortId",           "ptp.dr.requestingsourceportid",
3729             FT_UINT16, BASE_DEC, NULL, 0x00,
3730             NULL, HFILL }
3731         },
3732         { &hf_ptp_dr_requestingsourcesequenceid,
3733             { "requestingSourceSequenceId",           "ptp.dr.requestingsourcesequenceid",
3734             FT_UINT16, BASE_DEC, NULL, 0x00,
3735             NULL, HFILL }
3736         },
3737         /*offsets for management (=mm) messages*/
3738         { &hf_ptp_mm_targetcommunicationtechnology,
3739             { "targetCommunicationTechnology",           "ptp.mm.targetcommunicationtechnology",
3740             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3741             NULL, HFILL }
3742         },
3743         { &hf_ptp_mm_targetuuid,
3744             { "targetUuid",           "ptp.mm.targetuuid",
3745             FT_ETHER, BASE_DEC, NULL, 0x00,
3746             NULL, HFILL }
3747         },
3748         { &hf_ptp_mm_targetportid,
3749             { "targetPortId",           "ptp.mm.targetportid",
3750             FT_UINT16, BASE_DEC, NULL, 0x00,
3751             NULL, HFILL }
3752         },
3753         { &hf_ptp_mm_startingboundaryhops,
3754             { "startingBoundaryHops",           "ptp.mm.startingboundaryhops",
3755             FT_INT16, BASE_DEC, NULL, 0x00,
3756             NULL, HFILL }
3757         },
3758         { &hf_ptp_mm_boundaryhops,
3759             { "boundaryHops",           "ptp.mm.boundaryhops",
3760             FT_INT16, BASE_DEC, NULL, 0x00,
3761             NULL, HFILL }
3762         },
3763         { &hf_ptp_mm_managementmessagekey,
3764             { "managementMessageKey",           "ptp.mm.managementmessagekey",
3765             FT_UINT8, BASE_DEC, VALS(ptp_managementMessageKey_vals), 0x00,
3766             NULL, HFILL }
3767         },
3768         { &hf_ptp_mm_parameterlength,
3769             { "parameterLength",           "ptp.mm.parameterlength",
3770             FT_UINT16, BASE_DEC, NULL, 0x00,
3771             NULL, HFILL }
3772         },
3773         /*parameterlength > 0*/
3774         { &hf_ptp_mm_messageparameters,
3775             { "messageParameters",           "ptp.mm.messageparameters",
3776             FT_BYTES, BASE_DEC, NULL, 0x00,
3777             NULL, HFILL }
3778         },
3779         /*ptp_mm_clock_identity (parameterlength = 64)*/
3780         { &hf_ptp_mm_clock_identity_clockcommunicationtechnology,
3781             { "clockCommunicationTechnology",           "ptp.mm.clock.identity.clockcommunicationtechnology",
3782             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3783             NULL, HFILL }
3784         },
3785         { &hf_ptp_mm_clock_identity_clockuuidfield,
3786             { "clockUuidField",           "ptp.mm.clock.identity.clockuuidfield",
3787             FT_ETHER, BASE_DEC, NULL, 0x00,
3788             NULL, HFILL }
3789         },
3790         { &hf_ptp_mm_clock_identity_clockportfield,
3791             { "clockPortField",           "ptp.mm.clock.identity.clockportfield",
3792             FT_UINT16, BASE_DEC, NULL, 0x00,
3793             NULL, HFILL }
3794         },
3795         { &hf_ptp_mm_clock_identity_manufactureridentity,
3796             { "manufacturerIdentity",           "ptp.mm.clock.identity.manufactureridentity",
3797             FT_BYTES, BASE_DEC, NULL, 0x00,
3798             NULL, HFILL }
3799         },
3800
3801         /*ptp_mm_initialize_clock (parameterlength = 4)*/
3802         { &hf_ptp_mm_initialize_clock_initialisationkey,
3803             { "initialisationKey",           "ptp.mm.initialize.clock.initialisationkey",
3804             FT_UINT16, BASE_DEC, NULL, 0x00,
3805             NULL, HFILL }
3806         },
3807         /*ptp_mm_set_subdomain (parameterlength = 16)*/
3808         { &hf_ptp_mm_set_subdomain_subdomainname,
3809             { "subdomainName",           "ptp.mm.set.subdomain.subdomainname",
3810             FT_STRING, BASE_DEC, NULL, 0x00,
3811             NULL, HFILL }
3812         },
3813         /*ptp_mm_default_data_set (parameterlength = 76)*/
3814         { &hf_ptp_mm_default_data_set_clockcommunicationtechnology,
3815             { "clockCommunicationTechnology",           "ptp.mm.default.data.set.clockcommunicationtechnology",
3816             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3817             NULL, HFILL }
3818         },
3819         { &hf_ptp_mm_default_data_set_clockuuidfield,
3820             { "clockUuidField",           "ptp.mm.default.data.set.clockuuidfield",
3821             FT_ETHER, BASE_DEC, NULL, 0x00,
3822             NULL, HFILL }
3823         },
3824         { &hf_ptp_mm_default_data_set_clockportfield,
3825             { "clockPortField",           "ptp.mm.default.data.set.clockportfield",
3826             FT_UINT16, BASE_DEC, NULL, 0x00,
3827             NULL, HFILL }
3828         },
3829         { &hf_ptp_mm_default_data_set_clockstratum,
3830             { "clockStratum",           "ptp.mm.default.data.set.clockstratum",
3831             FT_UINT8, BASE_DEC, NULL, 0x00,
3832             NULL, HFILL }
3833         },
3834         { &hf_ptp_mm_default_data_set_clockidentifier,
3835             { "clockIdentifier",           "ptp.mm.default.data.set.clockidentifier",
3836             FT_BYTES, BASE_DEC, NULL, 0x00,
3837             NULL, HFILL }
3838         },
3839         { &hf_ptp_mm_default_data_set_clockvariance,
3840             { "clockVariance",           "ptp.mm.default.data.set.clockvariance",
3841             FT_UINT16, BASE_DEC, NULL, 0x00,
3842             NULL, HFILL }
3843         },
3844         { &hf_ptp_mm_default_data_set_clockfollowupcapable,
3845             { "clockFollowupCapable",           "ptp.mm.default.data.set.clockfollowupcapable",
3846             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3847             NULL, HFILL }
3848         },
3849         { &hf_ptp_mm_default_data_set_preferred,
3850             { "preferred",           "ptp.mm.default.data.set.preferred",
3851             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3852             NULL, HFILL }
3853         },
3854         { &hf_ptp_mm_default_data_set_initializable,
3855             { "initializable",           "ptp.mm.default.data.set.initializable",
3856             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3857             NULL, HFILL }
3858         },
3859         { &hf_ptp_mm_default_data_set_externaltiming,
3860             { "externalTiming",           "ptp.mm.default.data.set.externaltiming",
3861             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3862             NULL, HFILL }
3863         },
3864         { &hf_ptp_mm_default_data_set_isboundaryclock,
3865             { "isBoundaryClock",           "ptp.mm.default.data.set.isboundaryclock",
3866             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3867             NULL, HFILL }
3868         },
3869         { &hf_ptp_mm_default_data_set_syncinterval,
3870             { "syncInterval",           "ptp.mm.default.data.set.syncinterval",
3871             FT_INT8, BASE_DEC, NULL, 0x00,
3872             NULL, HFILL }
3873         },
3874         { &hf_ptp_mm_default_data_set_subdomainname,
3875             { "subDomainName",           "ptp.mm.default.data.set.subdomainname",
3876             FT_STRING, BASE_DEC, NULL, 0x00,
3877             NULL, HFILL }
3878         },
3879         { &hf_ptp_mm_default_data_set_numberports,
3880             { "numberPorts",           "ptp.mm.default.data.set.numberports",
3881             FT_UINT16, BASE_DEC, NULL, 0x00,
3882             NULL, HFILL }
3883         },
3884         { &hf_ptp_mm_default_data_set_numberforeignrecords,
3885             { "numberForeignRecords",           "ptp.mm.default.data.set.numberforeignrecords",
3886             FT_UINT16, BASE_DEC, NULL, 0x00,
3887             NULL, HFILL }
3888         },
3889         /*ptp_mm_update_default_data_set (parameterlength = 36)*/
3890         { &hf_ptp_mm_update_default_data_set_clockstratum,
3891             { "clockStratum",           "ptp.mm.update.default.data.set.clockstratum",
3892             FT_UINT8, BASE_DEC, NULL, 0x00,
3893             NULL, HFILL }
3894         },
3895         { &hf_ptp_mm_update_default_data_set_clockidentifier,
3896             { "clockIdentifier",           "ptp.mm.update.default.data.set.clockidentifier",
3897             FT_BYTES, BASE_DEC, NULL, 0x00,
3898             NULL, HFILL }
3899         },
3900         { &hf_ptp_mm_update_default_data_set_clockvariance,
3901             { "clockVariance",           "ptp.mm.update.default.data.set.clockvariance",
3902             FT_UINT16, BASE_DEC, NULL, 0x00,
3903             NULL, HFILL }
3904         },
3905         { &hf_ptp_mm_update_default_data_set_preferred,
3906             { "preferred",           "ptp.mm.update.default.data.set.preferred",
3907             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3908             NULL, HFILL }
3909         },
3910         { &hf_ptp_mm_update_default_data_set_syncinterval,
3911             { "syncInterval",           "ptp.mm.update.default.data.set.syncinterval",
3912             FT_INT8, BASE_DEC, NULL, 0x00,
3913             NULL, HFILL }
3914         },
3915         { &hf_ptp_mm_update_default_data_set_subdomainname,
3916             { "subdomainName",           "ptp.mm.update.default.data.set.subdomainname",
3917             FT_STRING, BASE_DEC, NULL, 0x00,
3918             NULL, HFILL }
3919         },
3920         /*ptp_mm_current_data_set (parameterlength = 20)*/
3921         { &hf_ptp_mm_current_data_set_stepsremoved,
3922             { "stepsRemoved",           "ptp.mm.current.data.set.stepsremoved",
3923             FT_UINT16, BASE_DEC, NULL, 0x00,
3924             NULL, HFILL }
3925         },
3926         { &hf_ptp_mm_current_data_set_offsetfrommaster,
3927             { "offsetFromMaster",           "ptp.mm.current.data.set.offsetfrommaster",
3928             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3929             NULL, HFILL }
3930         },
3931         { &hf_ptp_mm_current_data_set_offsetfrommasterseconds,
3932             { "offsetFromMasterSeconds",           "ptp.mm.current.data.set.offsetfrommasterseconds",
3933             FT_UINT32, BASE_DEC, NULL, 0x00,
3934             NULL, HFILL }
3935         },
3936         { &hf_ptp_mm_current_data_set_offsetfrommasternanoseconds,
3937             { "offsetFromMasterNanoseconds",           "ptp.mm.current.data.set.offsetfrommasternanoseconds",
3938             FT_INT32, BASE_DEC, NULL, 0x00,
3939             NULL, HFILL }
3940         },
3941         { &hf_ptp_mm_current_data_set_onewaydelay,
3942             { "oneWayDelay",           "ptp.mm.current.data.set.onewaydelay",
3943             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3944             NULL, HFILL }
3945         },
3946         { &hf_ptp_mm_current_data_set_onewaydelayseconds,
3947             { "oneWayDelaySeconds",           "ptp.mm.current.data.set.onewaydelayseconds",
3948             FT_UINT32, BASE_DEC, NULL, 0x00,
3949             NULL, HFILL }
3950         },
3951         { &hf_ptp_mm_current_data_set_onewaydelaynanoseconds,
3952             { "oneWayDelayNanoseconds",           "ptp.mm.current.data.set.onewaydelaynanoseconds",
3953             FT_INT32, BASE_DEC, NULL, 0x00,
3954             NULL, HFILL }
3955         },
3956         /*ptp_mm_parent_data_set (parameterlength = 90)*/
3957         { &hf_ptp_mm_parent_data_set_parentcommunicationtechnology,
3958             { "parentCommunicationTechnology",           "ptp.mm.parent.data.set.parentcommunicationtechnology",
3959             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
3960             NULL, HFILL }
3961         },
3962         { &hf_ptp_mm_parent_data_set_parentuuid,
3963             { "parentUuid",           "ptp.mm.parent.data.set.parentuuid",
3964             FT_ETHER, BASE_DEC, NULL, 0x00,
3965             NULL, HFILL }
3966         },
3967         { &hf_ptp_mm_parent_data_set_parentportid,
3968             { "parentPortId",           "ptp.mm.parent.data.set.parentportid",
3969             FT_UINT16, BASE_DEC, NULL, 0x00,
3970             NULL, HFILL }
3971         },
3972         { &hf_ptp_mm_parent_data_set_parentlastsyncsequencenumber,
3973             { "parentLastSyncSequenceNumber",           "ptp.mm.parent.data.set.parentlastsyncsequencenumber",
3974             FT_UINT16, BASE_DEC, NULL, 0x00,
3975             NULL, HFILL }
3976         },
3977         { &hf_ptp_mm_parent_data_set_parentfollowupcapable,
3978             { "parentFollowupCapable",           "ptp.mm.parent.data.set.parentfollowupcapable",
3979             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3980             NULL, HFILL }
3981         },
3982         { &hf_ptp_mm_parent_data_set_parentexternaltiming,
3983             { "parentExternalTiming",           "ptp.mm.parent.data.set.parentexternaltiming",
3984             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3985             NULL, HFILL }
3986         },
3987         { &hf_ptp_mm_parent_data_set_parentvariance,
3988             { "parentVariance",           "ptp.mm.parent.data.set.parentvariance",
3989             FT_UINT16, BASE_DEC, NULL, 0x00,
3990             NULL, HFILL }
3991         },
3992         { &hf_ptp_mm_parent_data_set_parentstats,
3993             { "parentStats",           "ptp.mm.parent.data.set.parentstats",
3994             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
3995             NULL, HFILL }
3996         },
3997         { &hf_ptp_mm_parent_data_set_observedvariance,
3998             { "observedVariance",           "ptp.mm.parent.data.set.observedvariance",
3999             FT_INT16, BASE_DEC, NULL, 0x00,
4000             NULL, HFILL }
4001         },
4002         { &hf_ptp_mm_parent_data_set_observeddrift,
4003             { "observedDrift",           "ptp.mm.parent.data.set.observeddrift",
4004             FT_INT32, BASE_DEC, NULL, 0x00,
4005             NULL, HFILL }
4006         },
4007         { &hf_ptp_mm_parent_data_set_utcreasonable,
4008             { "utcReasonable",           "ptp.mm.parent.data.set.utcreasonable",
4009             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4010             NULL, HFILL }
4011         },
4012         { &hf_ptp_mm_parent_data_set_grandmastercommunicationtechnology,
4013             { "grandmasterCommunicationTechnology",    "ptp.mm.parent.data.set.grandmastercommunicationtechnology",
4014             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
4015             NULL, HFILL }
4016         },
4017         { &hf_ptp_mm_parent_data_set_grandmasteruuidfield,
4018             { "grandmasterUuidField",           "ptp.mm.parent.data.set.grandmasteruuidfield",
4019             FT_ETHER, BASE_DEC, NULL, 0x00,
4020             NULL, HFILL }
4021         },
4022         { &hf_ptp_mm_parent_data_set_grandmasterportidfield,
4023             { "grandmasterPortIdField",           "ptp.mm.parent.data.set.grandmasterportidfield",
4024             FT_UINT16, BASE_DEC, NULL, 0x00,
4025             NULL, HFILL }
4026         },
4027         { &hf_ptp_mm_parent_data_set_grandmasterstratum,
4028             { "grandmasterStratum",           "ptp.mm.parent.data.set.grandmasterstratum",
4029             FT_UINT8, BASE_DEC, NULL, 0x00,
4030             NULL, HFILL }
4031         },
4032         { &hf_ptp_mm_parent_data_set_grandmasteridentifier,
4033             { "grandmasterIdentifier",           "ptp.mm.parent.data.set.grandmasteridentifier",
4034             FT_BYTES, BASE_DEC, NULL, 0x00,
4035             NULL, HFILL }
4036         },
4037         { &hf_ptp_mm_parent_data_set_grandmastervariance,
4038             { "grandmasterVariance",           "ptp.mm.parent.data.set.grandmastervariance",
4039             FT_INT16, BASE_DEC, NULL, 0x00,
4040             NULL, HFILL }
4041         },
4042         { &hf_ptp_mm_parent_data_set_grandmasterpreferred,
4043             { "grandmasterPreferred",           "ptp.mm.parent.data.set.grandmasterpreferred",
4044             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4045             NULL, HFILL }
4046         },
4047         { &hf_ptp_mm_parent_data_set_grandmasterisboundaryclock,
4048             { "grandmasterIsBoundaryClock",           "ptp.mm.parent.data.set.grandmasterisboundaryclock",
4049             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4050             NULL, HFILL }
4051         },
4052         { &hf_ptp_mm_parent_data_set_grandmastersequencenumber,
4053             { "grandmasterSequenceNumber",           "ptp.mm.parent.data.set.grandmastersequencenumber",
4054             FT_UINT16, BASE_DEC, NULL, 0x00,
4055             NULL, HFILL }
4056         },
4057         /*ptp_mm_port_data_set (parameterlength = 52)*/
4058         { &hf_ptp_mm_port_data_set_returnedportnumber,
4059             { "returnedPortNumber",           "ptp.mm.port.data.set.returnedportnumber",
4060             FT_UINT16, BASE_DEC, NULL, 0x00,
4061             NULL, HFILL }
4062         },
4063         { &hf_ptp_mm_port_data_set_portstate,
4064             { "portState",           "ptp.mm.port.data.set.portstate",
4065             FT_UINT8, BASE_DEC, NULL, 0x00,
4066             NULL, HFILL }
4067         },
4068         { &hf_ptp_mm_port_data_set_lastsynceventsequencenumber,
4069             { "lastSyncEventSequenceNumber",           "ptp.mm.port.data.set.lastsynceventsequencenumber",
4070             FT_UINT16, BASE_DEC, NULL, 0x00,
4071             NULL, HFILL }
4072         },
4073         { &hf_ptp_mm_port_data_set_lastgeneraleventsequencenumber,
4074             { "lastGeneralEventSequenceNumber",           "ptp.mm.port.data.set.lastgeneraleventsequencenumber",
4075             FT_UINT16, BASE_DEC, NULL, 0x00,
4076             NULL, HFILL }
4077         },
4078         { &hf_ptp_mm_port_data_set_portcommunicationtechnology,
4079             { "portCommunicationTechnology",           "ptp.mm.port.data.set.portcommunicationtechnology",
4080             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
4081             NULL, HFILL }
4082         },
4083         { &hf_ptp_mm_port_data_set_portuuidfield,
4084             { "portUuidField",           "ptp.mm.port.data.set.portuuidfield",
4085             FT_ETHER, BASE_DEC, NULL, 0x00,
4086             NULL, HFILL }
4087         },
4088         { &hf_ptp_mm_port_data_set_portidfield,
4089             { "portIdField",           "ptp.mm.port.data.set.portidfield",
4090             FT_UINT16, BASE_DEC, NULL, 0x00,
4091             NULL, HFILL }
4092         },
4093         { &hf_ptp_mm_port_data_set_burstenabled,
4094             { "burstEnabled",           "ptp.mm.port.data.set.burstenabled",
4095             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4096             NULL, HFILL }
4097         },
4098         { &hf_ptp_mm_port_data_set_subdomainaddressoctets,
4099             { "subdomainAddressOctets",           "ptp.mm.port.data.set.subdomainaddressoctets",
4100             FT_UINT8, BASE_DEC, NULL, 0x00,
4101             NULL, HFILL }
4102         },
4103         { &hf_ptp_mm_port_data_set_eventportaddressoctets,
4104             { "eventPortAddressOctets",           "ptp.mm.port.data.set.eventportaddressoctets",
4105             FT_UINT8, BASE_DEC, NULL, 0x00,
4106             NULL, HFILL }
4107         },
4108         { &hf_ptp_mm_port_data_set_generalportaddressoctets,
4109             { "generalPortAddressOctets",           "ptp.mm.port.data.set.generalportaddressoctets",
4110             FT_UINT8, BASE_DEC, NULL, 0x00,
4111             NULL, HFILL }
4112         },
4113         { &hf_ptp_mm_port_data_set_subdomainaddress,
4114             { "subdomainAddress",           "ptp.mm.port.data.set.subdomainaddress",
4115             FT_BYTES, BASE_DEC, NULL, 0x00,
4116             NULL, HFILL }
4117         },
4118         { &hf_ptp_mm_port_data_set_eventportaddress,
4119             { "eventPortAddress",           "ptp.mm.port.data.set.eventportaddress",
4120             FT_BYTES, BASE_DEC, NULL, 0x00,
4121             NULL, HFILL }
4122         },
4123         { &hf_ptp_mm_port_data_set_generalportaddress,
4124             { "generalPortAddress",           "ptp.mm.port.data.set.generalportaddress",
4125             FT_BYTES, BASE_DEC, NULL, 0x00,
4126             NULL, HFILL }
4127         },
4128         /*ptp_mm_global_time_data_set (parameterlength = 24)*/
4129         { &hf_ptp_mm_global_time_data_set_localtime,
4130             { "localTime",           "ptp.mm.global.time.data.set.localtime",
4131             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4132             NULL, HFILL }
4133         },
4134         { &hf_ptp_mm_global_time_data_set_localtimeseconds,
4135             { "localTimeSeconds",           "ptp.mm.global.time.data.set.localtimeseconds",
4136             FT_UINT32, BASE_DEC, NULL, 0x00,
4137             NULL, HFILL }
4138         },
4139         { &hf_ptp_mm_global_time_data_set_localtimenanoseconds,
4140             { "localTimeNanoseconds",           "ptp.mm.global.time.data.set.localtimenanoseconds",
4141             FT_INT32, BASE_DEC, NULL, 0x00,
4142             NULL, HFILL }
4143         },
4144         { &hf_ptp_mm_global_time_data_set_currentutcoffset,
4145             { "currentUtcOffset",           "ptp.mm.global.time.data.set.currentutcoffset",
4146             FT_INT16, BASE_DEC, NULL, 0x00,
4147             NULL, HFILL }
4148         },
4149         { &hf_ptp_mm_global_time_data_set_leap59,
4150             { "leap59",           "ptp.mm.global.time.data.set.leap59",
4151             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4152             NULL, HFILL }
4153         },
4154         { &hf_ptp_mm_global_time_data_set_leap61,
4155             { "leap61",           "ptp.mm.global.time.data.set.leap61",
4156             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4157             NULL, HFILL }
4158         },
4159         { &hf_ptp_mm_global_time_data_set_epochnumber,
4160             { "epochNumber",           "ptp.mm.global.time.data.set.epochnumber",
4161             FT_UINT16, BASE_DEC, NULL, 0x00,
4162             NULL, HFILL }
4163         },
4164         /*ptp_mm_update_global_time_properties (parameterlength = 16)*/
4165         { &hf_ptp_mm_update_global_time_properties_currentutcoffset,
4166             { "currentUtcOffset",           "ptp.mm.update.global.time.properties.currentutcoffset",
4167             FT_UINT16, BASE_DEC, NULL, 0x00,
4168             NULL, HFILL }
4169         },
4170         { &hf_ptp_mm_update_global_time_properties_leap59,
4171             { "leap59",           "ptp.mm.update.global.time.properties.leap59",
4172             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4173             NULL, HFILL }
4174         },
4175         { &hf_ptp_mm_update_global_time_properties_leap61,
4176             { "leap61",           "ptp.mm.update.global.time.properties.leap61",
4177             FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4178             NULL, HFILL }
4179         },
4180         { &hf_ptp_mm_update_global_time_properties_epochnumber,
4181             { "epochNumber",           "ptp.mm.update.global.time.properties.epochnumber",
4182             FT_UINT16, BASE_DEC, NULL, 0x00,
4183             NULL, HFILL }
4184         },
4185         /*ptp_mm_get_foreign_data_set (parameterlength = 4)*/
4186         { &hf_ptp_mm_get_foreign_data_set_recordkey,
4187             { "recordKey",           "ptp.mm.get.foreign.data.set.recordkey",
4188             FT_UINT16, BASE_DEC, NULL, 0x00,
4189             NULL, HFILL }
4190         },
4191         /*ptp_mm_foreign_data_set (parameterlength = 28)*/
4192         { &hf_ptp_mm_foreign_data_set_returnedportnumber,
4193             { "returnedPortNumber",           "ptp.mm.foreign.data.set.returnedportnumber",
4194             FT_UINT16, BASE_DEC, NULL, 0x00,
4195             NULL, HFILL }
4196         },
4197         { &hf_ptp_mm_foreign_data_set_returnedrecordnumber,
4198             { "returnedRecordNumber",           "ptp.mm.foreign.data.set.returnedrecordnumber",
4199             FT_UINT16, BASE_DEC, NULL, 0x00,
4200             NULL, HFILL }
4201         },
4202         { &hf_ptp_mm_foreign_data_set_foreignmastercommunicationtechnology,
4203             { "foreignMasterCommunicationTechnology",
4204               "ptp.mm.foreign.data.set.foreignmastercommunicationtechnology",
4205             FT_UINT8, BASE_DEC, VALS(ptp_communicationid_vals), 0x00,
4206             NULL, HFILL }
4207         },
4208         { &hf_ptp_mm_foreign_data_set_foreignmasteruuidfield,
4209             { "foreignMasterUuidField",           "ptp.mm.foreign.data.set.foreignmasteruuidfield",
4210             FT_ETHER, BASE_DEC, NULL, 0x00,
4211             NULL, HFILL }
4212         },
4213         { &hf_ptp_mm_foreign_data_set_foreignmasterportidfield,
4214             { "foreignMasterPortIdField",           "ptp.mm.foreign.data.set.foreignmasterportidfield",
4215             FT_UINT16, BASE_DEC, NULL, 0x00,
4216             NULL, HFILL }
4217         },
4218         { &hf_ptp_mm_foreign_data_set_foreignmastersyncs,
4219             { "foreignMasterSyncs",           "ptp.mm.foreign.data.set.foreignmastersyncs",
4220             FT_UINT16, BASE_DEC, NULL, 0x00,
4221             NULL, HFILL }
4222         },
4223         /*ptp_mm_set_sync_interval (parameterlength = 4)*/
4224         { &hf_ptp_mm_set_sync_interval_syncinterval,
4225             { "syncInterval",           "ptp.mm.set.sync.interval.syncinterval",
4226             FT_UINT16, BASE_DEC, NULL, 0x00,
4227             NULL, HFILL }
4228         },
4229         /*ptp_mm_set_time (parameterlength = 8)*/
4230         { &hf_ptp_mm_set_time_localtime,
4231             { "localtime",           "ptp.mm.set.time.localtime",
4232             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4233             NULL, HFILL }
4234         },
4235         { &hf_ptp_mm_set_time_localtimeseconds,
4236             { "localtimeSeconds",           "ptp.mm.set.time.localtimeseconds",
4237             FT_UINT32, BASE_DEC, NULL, 0x00,
4238             NULL, HFILL }
4239         },
4240         { &hf_ptp_mm_set_time_localtimenanoseconds,
4241             { "localTimeNanoseconds",           "ptp.mm.set.time.localtimenanoseconds",
4242             FT_INT32, BASE_DEC, NULL, 0x0,
4243             NULL, HFILL }
4244         },
4245
4246
4247
4248
4249         /* PTPv2 fields **********************************************************/
4250         /*Common fields for all frames*/
4251         { &hf_ptp_v2_transportspecific,
4252             { "transportSpecific",           "ptp.v2.transportspecific",
4253             FT_UINT8, BASE_HEX, NULL, 0xF0,
4254             NULL, HFILL }
4255         },
4256         { &hf_ptp_v2_transportspecific_v1_compatibility,
4257             { "V1 Compatibility",           "ptp.v2.transportspecific.v1compatibility",
4258             FT_BOOLEAN, 8, NULL, PTP_V2_TRANSPORTSPECIFIC_V1COMPATIBILITY_BITMASK,
4259             NULL, HFILL }
4260         },
4261         { &hf_ptp_v2_transportspecific_802as_conform,
4262             { "802.1as conform",           "ptp.v2.transportspecific.802.1asconform",
4263             FT_BOOLEAN, 8, NULL, PTP_V2_TRANSPORTSPECIFIC_V1COMPATIBILITY_BITMASK,
4264             NULL, HFILL }
4265         },
4266         { &hf_ptp_v2_messageid,
4267             { "messageId",           "ptp.v2.messageid",
4268             FT_UINT8, BASE_HEX, VALS(ptp_v2_messageid_vals), 0x0F,
4269             NULL, HFILL }
4270         },
4271         { &hf_ptp_v2_versionptp,
4272             { "versionPTP",           "ptp.v2.versionptp",
4273             FT_UINT8, BASE_DEC, NULL, 0x0F,
4274             NULL, HFILL }
4275         },
4276         { &hf_ptp_v2_messagelength,
4277             { "messageLength",           "ptp.v2.messagelength",
4278             FT_UINT16, BASE_DEC, NULL, 0x00,
4279             NULL, HFILL }
4280         },
4281         { &hf_ptp_v2_domainnumber,
4282             { "subdomainNumber",           "ptp.v2.subdomainnumber",
4283             FT_UINT8, BASE_DEC, NULL, 0x00,
4284             NULL, HFILL }
4285         },
4286         { &hf_ptp_v2_flags,
4287             { "flags",           "ptp.v2.flags",
4288             FT_UINT16, BASE_HEX, NULL, 0x00,
4289             NULL, HFILL }
4290         },
4291         { &hf_ptp_v2_flags_alternatemaster,
4292             { "PTP_ALTERNATE_MASTER",     "ptp.v2.flags.alternatemaster",
4293             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_ALTERNATE_BITMASK,
4294             NULL, HFILL }
4295         },
4296         { &hf_ptp_v2_flags_twostep,
4297             { "PTP_TWO_STEP",           "ptp.v2.flags.twostep",
4298             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TWO_STEP_BITMASK,
4299             NULL, HFILL }
4300         },
4301         { &hf_ptp_v2_flags_unicast,
4302             { "PTP_UNICAST",           "ptp.v2.flags.unicast",
4303             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UNICAST_BITMASK,
4304             NULL, HFILL }
4305         },
4306         { &hf_ptp_v2_flags_specific1,
4307             { "PTP profile Specific 1",           "ptp.v2.flags.specific1",
4308             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC1_BITMASK,
4309             NULL, HFILL }
4310         },
4311         { &hf_ptp_v2_flags_specific2,
4312             { "PTP profile Specific 2",           "ptp.v2.flags.specific2",
4313             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SPECIFIC2_BITMASK,
4314             NULL, HFILL }
4315         },
4316         { &hf_ptp_v2_flags_security,
4317             { "PTP_SECURITY",           "ptp.v2.flags.security",
4318             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_SECURITY_BITMASK,
4319             NULL, HFILL }
4320         },
4321         { &hf_ptp_v2_flags_li61,
4322             { "PTP_LI_61",           "ptp.v2.flags.li61",
4323             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI61_BITMASK,
4324             NULL, HFILL }
4325         },
4326         { &hf_ptp_v2_flags_li59,
4327             { "PTP_LI_59",           "ptp.v2.flags.li59",
4328             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_LI59_BITMASK,
4329             NULL, HFILL }
4330         },
4331         { &hf_ptp_v2_flags_utcoffsetvalid,
4332             { "PTP_UTC_REASONABLE",           "ptp.v2.flags.utcreasonable",
4333             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_UTC_OFFSET_VALID_BITMASK,
4334             NULL, HFILL }
4335         },
4336         { &hf_ptp_v2_flags_ptptimescale,
4337             { "PTP_TIMESCALE",           "ptp.v2.flags.timescale",
4338             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_PTP_TIMESCALE_BITMASK,
4339             NULL, HFILL }
4340         },
4341         { &hf_ptp_v2_flags_timetraceable,
4342             { "TIME_TRACEABLE",           "ptp.v2.flags.timetraceable",
4343             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_TIME_TRACEABLE_BITMASK,
4344             NULL, HFILL }
4345         },
4346         { &hf_ptp_v2_flags_frequencytraceable,
4347             { "FREQUENCY_TRACEABLE",           "ptp.v2.flags.frequencytraceable",
4348             FT_BOOLEAN, 16, NULL, PTP_V2_FLAGS_FREQUENCY_TRACEABLE_BITMASK,
4349             NULL, HFILL }
4350         },
4351         { &hf_ptp_v2_correction,
4352             { "correction",           "ptp.v2.correction.ns",
4353             FT_UINT64, BASE_DEC, NULL, 0x00,
4354             NULL, HFILL }
4355         },
4356         { &hf_ptp_v2_correctionsubns,
4357             { "correctionSubNs",           "ptp.v2.correction.subns",
4358             FT_DOUBLE, BASE_DEC, NULL, 0x00,
4359             NULL, HFILL }
4360         },
4361         { &hf_ptp_v2_clockidentity,
4362             { "ClockIdentity",           "ptp.v2.clockidentity",
4363             FT_UINT64, BASE_HEX, NULL, 0x00,
4364             NULL, HFILL }
4365         },
4366         { &hf_ptp_v2_sourceportid,
4367             { "SourcePortID",           "ptp.v2.sourceportid",
4368             FT_UINT16, BASE_DEC, NULL, 0x00,
4369             NULL, HFILL }
4370         },
4371         { &hf_ptp_v2_sequenceid,
4372             { "sequenceId",           "ptp.v2.sequenceid",
4373             FT_UINT16, BASE_DEC, NULL, 0x00,
4374             NULL, HFILL }
4375         },
4376         { &hf_ptp_v2_control,
4377             { "control",           "ptp.v2.control",
4378             FT_UINT8, BASE_DEC, VALS(ptp_control_vals), 0x00,
4379             NULL, HFILL }
4380         },
4381         { &hf_ptp_v2_logmessageperiod,
4382             { "logMessagePeriod",           "ptp.v2.logmessageperiod",
4383             FT_INT8, BASE_DEC, NULL, 0x00,
4384             NULL, HFILL }
4385         },
4386
4387         /*Fields for PTP_Announce (=an) messages*/
4388         { &hf_ptp_v2_an_origintimestamp,
4389             { "originTimestamp",           "ptp.v2.an.origintimestamp",
4390             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4391             NULL, HFILL }
4392         },
4393         { &hf_ptp_v2_an_origintimestamp_seconds,
4394             { "originTimestamp (seconds)",           "ptp.v2.an.origintimestamp.seconds",
4395             FT_UINT64, BASE_DEC, NULL, 0x00,
4396             NULL, HFILL }
4397         },
4398         { &hf_ptp_v2_an_origintimestamp_nanoseconds,
4399             { "originTimestamp (nanoseconds)",           "ptp.v2.an.origintimestamp.nanoseconds",
4400             FT_INT32, BASE_DEC, NULL, 0x00,
4401             NULL, HFILL }
4402         },
4403         { &hf_ptp_v2_an_origincurrentutcoffset,
4404             { "originCurrentUTCOffset",           "ptp.v2.an.origincurrentutcoffset",
4405             FT_INT16, BASE_DEC, NULL, 0x00,
4406             NULL, HFILL }
4407         },
4408         { &hf_ptp_v2_an_timesource,
4409             { "TimeSource",           "ptp.v2.timesource",
4410             FT_UINT8, BASE_HEX, VALS(ptp_v2_timesource_vals), 0x00,
4411             NULL, HFILL }
4412         },
4413         { &hf_ptp_v2_an_localstepsremoved,
4414             { "localStepsRemoved",           "ptp.v2.an.localstepsremoved",
4415             FT_UINT16, BASE_DEC, NULL, 0x00,
4416             NULL, HFILL }
4417         },
4418         { &hf_ptp_v2_an_grandmasterclockidentity,
4419             { "grandmasterClockIdentity",           "ptp.v2.an.grandmasterclockidentity",
4420             FT_UINT64, BASE_HEX, NULL, 0x00,
4421             NULL, HFILL }
4422         },
4423         { &hf_ptp_v2_an_grandmasterclockclass,
4424             { "grandmasterClockClass",           "ptp.v2.an.grandmasterclockclass",
4425             FT_UINT8, BASE_DEC, NULL, 0x00,
4426             NULL, HFILL }
4427         },
4428         { &hf_ptp_v2_an_grandmasterclockaccuracy,
4429             { "grandmasterClockAccuracy",           "ptp.v2.an.grandmasterclockaccuracy",
4430             FT_UINT8, BASE_HEX, VALS(ptp_v2_clockaccuracy_vals), 0x00,
4431             NULL, HFILL }
4432         },
4433         { &hf_ptp_v2_an_grandmasterclockvariance,
4434             { "grandmasterClockVariance",           "ptp.v2.an.grandmasterclockvariance",
4435             FT_UINT16, BASE_DEC, NULL, 0x00,
4436             NULL, HFILL }
4437         },
4438         { &hf_ptp_v2_an_priority1,
4439             { "priority1",           "ptp.v2.an.priority1",
4440             FT_UINT8, BASE_DEC, NULL, 0x00,
4441             NULL, HFILL }
4442         },
4443         { &hf_ptp_v2_an_priority2,
4444             { "priority2",           "ptp.v2.an.priority2",
4445             FT_UINT8, BASE_DEC, NULL, 0x00,
4446             NULL, HFILL }
4447         },
4448
4449         /*Fields for PTP_Announce TLVs */
4450         { &hf_ptp_v2_an_tlv_tlvtype,
4451             { "tlvType", "ptp.v2.an.tlvType",
4452             FT_UINT16, BASE_DEC, VALS(ptp_v2_TLV_type_vals), 0x00,
4453             NULL, HFILL }
4454         },
4455         { &hf_ptp_v2_an_tlv_lengthfield,
4456             { "lengthField", "ptp.v2.an.lengthField",
4457             FT_UINT16, BASE_DEC, NULL, 0x00,
4458             NULL, HFILL }
4459         },
4460         /*Fields for ALTERNATE_TIME_OFFSET_INDICATOR TLV */
4461         { &hf_ptp_v2_atoi_tlv_keyfield,
4462             { "keyField", "ptp.v2.an.atoi.keyField",
4463             FT_UINT8, BASE_DEC, NULL, 0x00,
4464             NULL, HFILL }
4465         },
4466         { &hf_ptp_v2_atoi_tlv_currentoffset,
4467             { "currentOffset", "ptp.v2.an.atoi.currentOffset",
4468             FT_INT32, BASE_DEC, NULL, 0x00,
4469             NULL, HFILL }
4470         },
4471         { &hf_ptp_v2_atoi_tlv_jumpseconds,
4472             { "jumpSeconds", "ptp.v2.an.atoi.jumpSeconds",
4473             FT_INT32, BASE_DEC, NULL, 0x00,
4474             NULL, HFILL }
4475         },
4476         { &hf_ptp_v2_atoi_tlv_timeofnextjump,
4477             { "timeOfNextJump", "ptp.v2.an.atoi.timeOfNextJump",
4478             FT_BYTES, BASE_NONE, NULL, 0x00,
4479             NULL, HFILL }
4480         },
4481         { &hf_ptp_v2_atoi_tlv_displayname,
4482             { "displayName", "ptp.v2.an.atoi.dislpayName",
4483             FT_STRING, BASE_NONE, NULL, 0x00,
4484             NULL, HFILL }
4485         },
4486         { &hf_ptp_v2_atoi_tlv_displayname_length,
4487             { "length",           "ptp.v2.an.atoi.dislpayName.length",
4488             FT_UINT8, BASE_DEC, NULL, 0x00,
4489             NULL, HFILL }
4490         },
4491
4492         /* Fields for undissected TLV */
4493         { &hf_ptp_v2_an_tlv_data,
4494             { "data",           "ptp.v2.an.tlv.data",
4495             FT_BYTES, BASE_NONE, NULL, 0x00,
4496             NULL, HFILL }
4497         },
4498
4499         /*Fields for PTP_Sync AND PTP_DelayRequest (=sdr) messages*/
4500         { &hf_ptp_v2_sdr_origintimestamp,
4501             { "originTimestamp",           "ptp.v2.sdr.origintimestamp",
4502             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4503             NULL, HFILL }
4504         },
4505         { &hf_ptp_v2_sdr_origintimestamp_seconds,
4506             { "originTimestamp (seconds)",           "ptp.v2.sdr.origintimestamp.seconds",
4507             FT_UINT64, BASE_DEC, NULL, 0x00,
4508             NULL, HFILL }
4509         },
4510         { &hf_ptp_v2_sdr_origintimestamp_nanoseconds,
4511             { "originTimestamp (nanoseconds)",           "ptp.v2.sdr.origintimestamp.nanoseconds",
4512             FT_INT32, BASE_DEC, NULL, 0x00,
4513             NULL, HFILL }
4514         },
4515
4516         /*Fields for PTP_Follow_Up (=fu) messages*/
4517         { &hf_ptp_v2_fu_preciseorigintimestamp,
4518             { "preciseOriginTimestamp",           "ptp.v2.fu.preciseorigintimestamp",
4519             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4520             NULL, HFILL }
4521         },
4522         { &hf_ptp_v2_fu_preciseorigintimestamp_seconds,
4523             { "preciseOriginTimestamp (seconds)",           "ptp.v2.fu.preciseorigintimestamp.seconds",
4524             FT_UINT64, BASE_DEC, NULL, 0x00,
4525             NULL, HFILL }
4526         },
4527         { &hf_ptp_v2_fu_preciseorigintimestamp_nanoseconds,
4528             { "preciseOriginTimestamp (nanoseconds)",           "ptp.v2.fu.preciseorigintimestamp.nanoseconds",
4529             FT_INT32, BASE_DEC, NULL, 0x00,
4530             NULL, HFILL }
4531         },
4532
4533         /*Fields for PTP_DelayResponse (=dr) messages*/
4534         { &hf_ptp_v2_dr_receivetimestamp,
4535             { "receiveTimestamp",           "ptp.v2.dr.receivetimestamp",
4536             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4537             NULL, HFILL }
4538         },
4539         { &hf_ptp_v2_dr_receivetimestamp_seconds,
4540             { "receiveTimestamp (seconds)",           "ptp.v2.dr.receivetimestamp.seconds",
4541             FT_UINT64, BASE_DEC, NULL, 0x00,
4542             NULL, HFILL }
4543         },
4544         { &hf_ptp_v2_dr_receivetimestamp_nanoseconds,
4545             { "receiveTimestamp (nanoseconds)",           "ptp.v2.dr.receivetimestamp.nanoseconds",
4546             FT_INT32, BASE_DEC, NULL, 0x00,
4547             NULL, HFILL }
4548         },
4549         { &hf_ptp_v2_dr_requestingportidentity,
4550             { "requestingSourcePortIdentity",           "ptp.v2.dr.requestingsourceportidentity",
4551             FT_UINT64, BASE_HEX, NULL, 0x00,
4552             NULL, HFILL }
4553         },
4554         { &hf_ptp_v2_dr_requestingsourceportid,
4555             { "requestingSourcePortId",           "ptp.v2.dr.requestingsourceportid",
4556             FT_UINT16, BASE_DEC, NULL, 0x00,
4557             NULL, HFILL }
4558         },
4559
4560         /*Fields for PTP_PDelayRequest (=pdrq) messages*/
4561         { &hf_ptp_v2_pdrq_origintimestamp,
4562             { "originTimestamp",           "ptp.v2.pdrq.origintimestamp",
4563             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4564             NULL, HFILL }
4565         },
4566         { &hf_ptp_v2_pdrq_origintimestamp_seconds,
4567             { "originTimestamp (seconds)",           "ptp.v2.pdrq.origintimestamp.seconds",
4568             FT_UINT64, BASE_DEC, NULL, 0x00,
4569             NULL, HFILL }
4570         },
4571         { &hf_ptp_v2_pdrq_origintimestamp_nanoseconds,
4572             { "originTimestamp (nanoseconds)",           "ptp.v2.pdrq.origintimestamp.nanoseconds",
4573             FT_INT32, BASE_DEC, NULL, 0x00,
4574             NULL, HFILL }
4575         },
4576
4577         /*Fields for PTP_PDelayResponse (=pdrs) messages*/
4578         { &hf_ptp_v2_pdrs_requestreceipttimestamp,
4579             { "requestreceiptTimestamp",           "ptp.v2.pdrs.requestreceipttimestamp",
4580             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4581             NULL, HFILL }
4582         },
4583         { &hf_ptp_v2_pdrs_requestreceipttimestamp_seconds,
4584             { "requestreceiptTimestamp (seconds)",           "ptp.v2.pdrs.requestreceipttimestamp.seconds",
4585             FT_UINT64, BASE_DEC, NULL, 0x00,
4586             NULL, HFILL }
4587         },
4588         { &hf_ptp_v2_pdrs_requestreceipttimestamp_nanoseconds,
4589             { "requestreceiptTimestamp (nanoseconds)",           "ptp.v2.pdrs.requestreceipttimestamp.nanoseconds",
4590             FT_INT32, BASE_DEC, NULL, 0x00,
4591             NULL, HFILL }
4592         },
4593         { &hf_ptp_v2_pdrs_requestingportidentity,
4594             { "requestingSourcePortIdentity",           "ptp.v2.pdrs.requestingportidentity",
4595             FT_UINT64, BASE_HEX, NULL, 0x00,
4596             NULL, HFILL }
4597         },
4598         { &hf_ptp_v2_pdrs_requestingsourceportid,
4599             { "requestingSourcePortId",           "ptp.v2.pdrs.requestingsourceportid",
4600             FT_UINT16, BASE_DEC, NULL, 0x00,
4601             NULL, HFILL }
4602         },
4603
4604         /*Fields for PTP_PDelayResponseFollowUp (=pdfu) messages*/
4605         { &hf_ptp_v2_pdfu_responseorigintimestamp,
4606             { "responseOriginTimestamp",           "ptp.v2.pdfu.responseorigintimestamp",
4607             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4608             NULL, HFILL }
4609         },
4610         { &hf_ptp_v2_pdfu_responseorigintimestamp_seconds,
4611             { "responseOriginTimestamp (seconds)",           "ptp.v2.pdfu.responseorigintimestamp.seconds",
4612             FT_UINT64, BASE_DEC, NULL, 0x00,
4613             NULL, HFILL }
4614         },
4615         { &hf_ptp_v2_pdfu_responseorigintimestamp_nanoseconds,
4616             { "responseOriginTimestamp (nanoseconds)",           "ptp.v2.pdfu.responseorigintimestamp.nanoseconds",
4617             FT_INT32, BASE_DEC, NULL, 0x00,
4618             NULL, HFILL }
4619         },
4620         { &hf_ptp_v2_pdfu_requestingportidentity,
4621             { "requestingSourcePortIdentity",           "ptp.v2.pdfu.requestingportidentity",
4622             FT_UINT64, BASE_HEX, NULL, 0x00,
4623             NULL, HFILL }
4624         },
4625         { &hf_ptp_v2_pdfu_requestingsourceportid,
4626             { "requestingSourcePortId",           "ptp.v2.pdfu.requestingsourceportid",
4627             FT_UINT16, BASE_DEC, NULL, 0x00,
4628             NULL, HFILL }
4629         },
4630
4631         /*Fields for PTP_Signalling (=sig) messages*/
4632         { &hf_ptp_v2_sig_targetportidentity,
4633             { "targetPortIdentity",           "ptp.v2.sig.targetportidentity",
4634             FT_UINT64, BASE_HEX, NULL, 0x00,
4635             NULL, HFILL }
4636         },
4637         { &hf_ptp_v2_sig_targetportid,
4638             { "targetPortId",           "ptp.v2.sig.targetportid",
4639             FT_UINT16, BASE_DEC, NULL, 0x00,
4640             NULL, HFILL }
4641         },
4642
4643         /*Fields for PTP_Management (=mm) messages*/
4644         { &hf_ptp_v2_mm_targetportidentity,
4645             { "targetPortIdentity",           "ptp.v2.mm.targetportidentity",
4646             FT_UINT64, BASE_HEX, NULL, 0x00,
4647             NULL, HFILL }
4648         },
4649         { &hf_ptp_v2_mm_targetportid,
4650             { "targetPortId",           "ptp.v2.mm.targetportid",
4651             FT_UINT16, BASE_DEC, NULL, 0x00,
4652             NULL, HFILL }
4653         },
4654         { &hf_ptp_v2_mm_startingboundaryhops,
4655             { "startingBoundaryHops",           "ptp.v2.mm.startingboundaryhops",
4656             FT_UINT8, BASE_DEC, NULL, 0x00,
4657             NULL, HFILL }
4658         },
4659         { &hf_ptp_v2_mm_boundaryhops,
4660             { "boundaryHops",           "ptp.v2.mm.boundaryhops",
4661             FT_UINT8, BASE_DEC, NULL, 0x00,
4662             NULL, HFILL }
4663         },
4664         { &hf_ptp_v2_mm_action,
4665             { "action",           "ptp.v2.mm.action",
4666             FT_UINT8, BASE_DEC, VALS(ptp_v2_mm_action_vals), 0x0F,
4667             NULL, HFILL }
4668         },
4669         /* Management TLV */
4670         { &hf_ptp_v2_mm_tlvType,
4671             { "tlvType",           "ptp.v2.mm.tlvType",
4672             FT_UINT16, BASE_DEC, VALS(ptp_v2_TLV_type_vals), 0x00,
4673             NULL, HFILL }
4674         },
4675         { &hf_ptp_v2_mm_lengthField,
4676             { "lengthField",           "ptp.v2.mm.lengthField",
4677             FT_UINT16, BASE_DEC, NULL, 0x00,
4678             NULL, HFILL }
4679         },
4680         { &hf_ptp_v2_mm_managementId,
4681             { "managementId",           "ptp.v2.mm.managementId",
4682             FT_UINT16, BASE_DEC, VALS(ptp_v2_managementID_vals), 0x00,
4683             NULL, HFILL }
4684         },
4685         { &hf_ptp_v2_mm_data,
4686             { "data",           "ptp.v2.mm.data",
4687             FT_BYTES, BASE_HEX, NULL, 0x00,
4688             NULL, HFILL }
4689         },
4690         /* Management TLV dataField */
4691         /* CLOCK_DESCRIPTION */
4692         { &hf_ptp_v2_mm_clockType,
4693             { "clockType",           "ptp.v2.mm.clockType",
4694             FT_UINT16, BASE_HEX, NULL, 0x00,
4695             NULL, HFILL }
4696         },
4697         { &hf_ptp_v2_mm_clockType_ordinaryClock,
4698             { "The node implements an ordinary clock", "ptp.v2.mm.clockType.OC",
4699             FT_BOOLEAN, 16, NULL, CLOCKTYPE_ORDINARY_CLOCK,
4700             NULL, HFILL }
4701         },
4702         { &hf_ptp_v2_mm_clockType_boundaryClock,
4703             { "The node implements a boundary clock", "ptp.v2.mm.clockType.BC",
4704             FT_BOOLEAN, 16, NULL, CLOCKTYPE_BOUNDARY_CLOCK,
4705             NULL, HFILL }
4706         },
4707         { &hf_ptp_v2_mm_clockType_p2p_transparentClock,
4708             { "The node implements a peer-to-peer transparent clock", "ptp.v2.mm.clockType.p2p_TC",
4709             FT_BOOLEAN, 16, NULL, CLOCKTYPE_P2P_TC,
4710             NULL, HFILL }
4711         },
4712         { &hf_ptp_v2_mm_clockType_e2e_transparentClock,
4713             { "The node implements an end-to-end transparent clock", "ptp.v2.mm.clockType.e2e_TC",
4714             FT_BOOLEAN, 16, NULL, CLOCKTYPE_E2E_TC,
4715             NULL, HFILL }
4716         },
4717         { &hf_ptp_v2_mm_clockType_managementNode,
4718             { "The node implements a management node", "ptp.v2.mm.clockType.MM",
4719             FT_BOOLEAN, 16, NULL, CLOCKTYPE_MANAGEMENT_NODE,
4720             NULL, HFILL }
4721         },
4722         { &hf_ptp_v2_mm_clockType_reserved,
4723             { "Reserved", "ptp.v2.mm.clockType.reserved",
4724             FT_BOOLEAN, 16, NULL, CLOCKTYPE_RESERVED,
4725             NULL, HFILL }
4726         },
4727         { &hf_ptp_v2_mm_physicalLayerProtocol,
4728             { "physicalLayerProtocol",           "ptp.v2.mm.physicalLayerProtocol",
4729             FT_STRING, BASE_DEC, NULL, 0x00,
4730             NULL, HFILL }
4731         },
4732         { &hf_ptp_v2_mm_physicalLayerProtocol_length,
4733             { "length",           "ptp.v2.mm.physicalLayerProtocol.length",
4734             FT_UINT8, BASE_DEC, NULL, 0x00,
4735             NULL, HFILL }
4736         },
4737         { &hf_ptp_v2_mm_physicalAddressLength,
4738             { "physical address length",  "ptp.v2.mm.physicalAddressLength",
4739             FT_UINT16, BASE_DEC, NULL, 0x00,
4740             NULL, HFILL }
4741         },
4742         { &hf_ptp_v2_mm_physicalAddress,
4743             { "physical address",  "ptp.v2.mm.physicalAddress",
4744             FT_BYTES, BASE_HEX, NULL, 0x00,
4745             NULL, HFILL }
4746         },
4747         { &hf_ptp_v2_mm_protocolAddress,
4748             { "protocol address",  "ptp.v2.mm.protocolAddress",
4749             FT_BYTES, BASE_HEX, NULL, 0x00,
4750             NULL, HFILL }
4751         },
4752         { &hf_ptp_v2_mm_protocolAddress_networkProtocol,
4753             { "network protocol",           "ptp.v2.mm.networkProtocol",
4754             FT_UINT16, BASE_DEC, VALS(ptp2_networkProtocol_vals), 0x00,
4755             NULL, HFILL }
4756         },
4757         { &hf_ptp_v2_mm_protocolAddress_length,
4758             { "length",  "ptp.v2.mm.protocolAddress.length",
4759             FT_UINT16, BASE_DEC, NULL, 0x00,
4760             NULL, HFILL }
4761         },
4762         { &hf_ptp_v2_mm_manufacturerIdentity,
4763             { "manufacturer identity",  "ptp.v2.mm.manufacturerIdentity",
4764             FT_BYTES, BASE_HEX, NULL, 0x00,
4765             NULL, HFILL }
4766         },
4767         { &hf_ptp_v2_mm_reserved,
4768             { "reserved",  "ptp.v2.mm.reserved",
4769             FT_BYTES, BASE_HEX, NULL, 0x00,
4770             NULL, HFILL }
4771         },
4772         { &hf_ptp_v2_mm_productDescription,
4773             { "product description",  "ptp.v2.mm.productDescription",
4774             FT_STRING, BASE_DEC, NULL, 0x00,
4775             NULL, HFILL }
4776         },
4777         { &hf_ptp_v2_mm_productDescription_length,
4778             { "length",           "ptp.v2.mm.productDescription.length",
4779             FT_UINT8, BASE_DEC, NULL, 0x00,
4780             NULL, HFILL }
4781         },
4782         { &hf_ptp_v2_mm_revisionData,
4783             { "revision data",  "ptp.v2.mm.revisionData",
4784             FT_STRING, BASE_DEC, NULL, 0x00,
4785             NULL, HFILL }
4786         },
4787         { &hf_ptp_v2_mm_revisionData_length,
4788             { "length",           "ptp.v2.mm.revisionData.length",
4789             FT_UINT8, BASE_DEC, NULL, 0x00,
4790             NULL, HFILL }
4791         },
4792         { &hf_ptp_v2_mm_userDescription,
4793             { "user description",  "ptp.v2.mm.userDescription",
4794             FT_STRING, BASE_DEC, NULL, 0x00,
4795             NULL, HFILL }
4796         },
4797         { &hf_ptp_v2_mm_userDescription_length,
4798             { "length",           "ptp.v2.mm.userDescription.length",
4799             FT_UINT8, BASE_DEC, NULL, 0x00,
4800             NULL, HFILL }
4801         },
4802         { &hf_ptp_v2_mm_profileIdentity,
4803             { "profileIdentity",           "ptp.v2.mm.profileIdentity",
4804             FT_BYTES, BASE_HEX, NULL, 0x00,
4805             NULL, HFILL }
4806         },
4807         { &hf_ptp_v2_mm_pad,
4808             { "Pad",           "ptp.v2.mm.pad",
4809             FT_BYTES, BASE_HEX, NULL, 0x01,
4810             NULL, HFILL }
4811         },
4812         { &hf_ptp_v2_mm_initializationKey,
4813             { "initialization key",           "ptp.v2.mm.initializationKey",
4814             FT_UINT16, BASE_DEC, NULL, 0x00,
4815             NULL, HFILL }
4816         },
4817         { &hf_ptp_v2_mm_numberOfFaultRecords,
4818             { "number of fault records",  "ptp.v2.mm.numberOfFaultRecords",
4819             FT_UINT16, BASE_DEC, NULL, 0x00,
4820             NULL, HFILL }
4821         },
4822         { &hf_ptp_v2_mm_faultRecord,
4823             { "fault record",  "ptp.v2.mm.faultRecord",
4824             FT_BYTES, BASE_HEX, NULL, 0x00,
4825             NULL, HFILL }
4826         },
4827         { &hf_ptp_v2_mm_faultRecordLength,
4828             { "fault record length",           "ptp.v2.mm.faultRecordLength",
4829             FT_UINT16, BASE_DEC, NULL, 0x00,
4830             NULL, HFILL }
4831         },
4832         { &hf_ptp_v2_mm_severityCode,
4833             { "severity code",           "ptp.v2.mm.severityCode",
4834             FT_UINT8, BASE_DEC, VALS(ptp2_severityCode_vals), 0x00,
4835             NULL, HFILL }
4836         },
4837         { &hf_ptp_v2_mm_faultName,
4838             { "faultName",  "ptp.v2.mm.faultName",
4839             FT_STRING, BASE_DEC, NULL, 0x00,
4840             NULL, HFILL }
4841         },
4842         { &hf_ptp_v2_mm_faultName_length,
4843             { "length",           "ptp.v2.mm.faultName.length",
4844             FT_UINT8, BASE_DEC, NULL, 0x00,
4845             NULL, HFILL }
4846         },
4847         { &hf_ptp_v2_mm_faultValue,
4848             { "faultValue",  "ptp.v2.mm.faultValue",
4849             FT_STRING, BASE_DEC, NULL, 0x00,
4850             NULL, HFILL }
4851         },
4852         { &hf_ptp_v2_mm_faultValue_length,
4853             { "length",           "ptp.v2.mm.faultValue.length",
4854             FT_UINT8, BASE_DEC, NULL, 0x00,
4855             NULL, HFILL }
4856         },
4857         { &hf_ptp_v2_mm_faultDescription,
4858             { "faultDescription",  "ptp.v2.mm.faultDescription",
4859             FT_STRING, BASE_DEC, NULL, 0x00,
4860             NULL, HFILL }
4861         },
4862         { &hf_ptp_v2_mm_faultDescription_length,
4863             { "length",           "ptp.v2.mm.faultDescription.length",
4864             FT_UINT8, BASE_DEC, NULL, 0x00,
4865             NULL, HFILL }
4866         },
4867         { &hf_ptp_v2_mm_faultTime,
4868             { "Fault time", "ptp.v2.mm.faultTime",
4869             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
4870             NULL, HFILL }
4871         },
4872         { &hf_ptp_v2_mm_faultTime_s,
4873             { "Fault time (seconds)", "ptp.v2.mm.faultTime.seconds",
4874             FT_UINT64, BASE_DEC, NULL, 0x00,
4875             NULL, HFILL }
4876         },
4877         { &hf_ptp_v2_mm_faultTime_ns,
4878             { "Fault time (nanoseconds)", "ptp.v2.mm.faultTime.nanoseconds",
4879             FT_INT32, BASE_DEC, NULL, 0x00,
4880             NULL, HFILL }
4881         },
4882         { &hf_ptp_v2_mm_currentTime_s,
4883             { "current time (seconds)", "ptp.v2.mm.currentTime.seconds",
4884             FT_UINT64, BASE_DEC, NULL, 0x00,
4885             NULL, HFILL }
4886         },
4887         { &hf_ptp_v2_mm_currentTime_ns,
4888             { "current time (nanoseconds)", "ptp.v2.mm.currentTime.nanoseconds",
4889             FT_INT32, BASE_DEC, NULL, 0x00,
4890             NULL, HFILL }
4891         },
4892         { &hf_ptp_v2_mm_clockAccuracy,
4893             { "Clock accuracy",           "ptp.v2.mm.clockaccuracy",
4894             FT_UINT8, BASE_HEX, VALS(ptp_v2_clockaccuracy_vals), 0x00,
4895             NULL, HFILL }
4896         },
4897
4898         { &hf_ptp_v2_mm_priority1,
4899             { "priority1",           "ptp.v2.mm.priority1",
4900             FT_UINT8, BASE_DEC, NULL, 0x00,
4901             NULL, HFILL }
4902         },
4903         { &hf_ptp_v2_mm_priority2,
4904             { "priority2",           "ptp.v2.mm.priority2",
4905             FT_UINT8, BASE_DEC, NULL, 0x00,
4906             NULL, HFILL }
4907         },
4908         { &hf_ptp_v2_mm_dds_SO,
4909             { "Slave only",           "ptp.v2.mm.SlavOnly",
4910             FT_BOOLEAN, 8, NULL, 0x02,
4911             NULL, HFILL }
4912         },
4913         { &hf_ptp_v2_mm_TSC,
4914             { "Two step",           "ptp.v2.mm.twoStep",
4915             FT_BOOLEAN, 8, NULL, 0x01,
4916             NULL, HFILL }
4917         },
4918         { &hf_ptp_v2_mm_numberPorts,
4919             { "number of ports",  "ptp.v2.mm.numberPorts",
4920             FT_UINT16, BASE_DEC, NULL, 0x00,
4921             NULL, HFILL }
4922         },
4923         { &hf_ptp_v2_mm_clockclass,
4924             { "Clock class",           "ptp.v2.mm.clockclass",
4925             FT_UINT8, BASE_DEC, NULL, 0x00,
4926             NULL, HFILL }
4927         },
4928         { &hf_ptp_v2_mm_clockaccuracy,
4929             { "Clock accuracy",           "ptp.v2.mm.clockaccuracy",
4930             FT_UINT8, BASE_HEX, VALS(ptp_v2_clockaccuracy_vals), 0x00,
4931             NULL, HFILL }
4932         },
4933         { &hf_ptp_v2_mm_clockvariance,
4934             { "Clock variance",           "ptp.v2.mm.clockvariance",
4935             FT_UINT16, BASE_DEC, NULL, 0x00,
4936             NULL, HFILL }
4937         },
4938         { &hf_ptp_v2_mm_clockidentity,
4939             { "Clock identity",           "ptp.v2.mm.clockidentity",
4940             FT_UINT64, BASE_HEX, NULL, 0x00,
4941             NULL, HFILL }
4942         },
4943         { &hf_ptp_v2_mm_domainNumber,
4944             { "domain number",           "ptp.v2.mm.domainNumber",
4945             FT_UINT8, BASE_DEC, NULL , 0x00,
4946             NULL, HFILL }
4947         },
4948         { &hf_ptp_v2_mm_SO,
4949             { "Slave only",           "ptp.v2.mm.SlavOnly",
4950             FT_BOOLEAN, 8, NULL, 0x01,
4951             NULL, HFILL }
4952         },
4953         { &hf_ptp_v2_mm_stepsRemoved,
4954             { "steps removed",           "ptp.v2.mm.stepsRemoved",
4955             FT_INT16, BASE_DEC, NULL, 0x00,
4956             NULL, HFILL }
4957         },
4958         { &hf_ptp_v2_mm_parentIdentity,
4959             { "parent ClockIdentity",           "ptp.v2.mm.parentclockidentity",
4960             FT_UINT64, BASE_HEX, NULL, 0x00,
4961             NULL, HFILL }
4962         },
4963         { &hf_ptp_v2_mm_parentPort,
4964             { "parent SourcePortID",           "ptp.v2.mm.parentsourceportid",
4965             FT_UINT16, BASE_DEC, NULL, 0x00,
4966             NULL, HFILL }
4967         },
4968         { &hf_ptp_v2_mm_parentStats,
4969             { "parent stats",           "ptp.v2.mm.parentstats",
4970             FT_BOOLEAN, 8, NULL, 0x01,
4971             NULL, HFILL }
4972         },
4973         { &hf_ptp_v2_mm_observedParentOffsetScaledLogVariance,
4974             { "observedParentOffsetScaledLogVariance", "ptp.v2.mm.observedParentOffsetScaledLogVariance",
4975             FT_UINT16, BASE_DEC, NULL, 0x00,
4976             NULL, HFILL }
4977         },
4978         { &hf_ptp_v2_mm_observedParentClockPhaseChangeRate,
4979             { "observedParentClockPhaseChangeRate", "ptp.v2.mm.observedParentClockPhaseChangeRate",
4980             FT_INT32, BASE_DEC, NULL, 0x00,
4981             NULL, HFILL }
4982         },
4983         { &hf_ptp_v2_mm_grandmasterPriority1,
4984             { "Grandmaster priority1", "ptp.v2.mm.grandmasterPriority1",
4985             FT_UINT8, BASE_DEC, NULL, 0x00,
4986             NULL, HFILL }
4987         },
4988         { &hf_ptp_v2_mm_grandmasterPriority2,
4989             { "Grandmaster priority2", "ptp.v2.mm.grandmasterPriority2",
4990             FT_UINT8, BASE_DEC, NULL, 0x00,
4991             NULL, HFILL }
4992         },
4993         { &hf_ptp_v2_mm_grandmasterclockclass,
4994             { "Grandmaster clock class", "ptp.v2.mm.grandmasterclockclass",
4995             FT_UINT8, BASE_DEC, NULL, 0x00,
4996             NULL, HFILL }
4997         },
4998         { &hf_ptp_v2_mm_grandmasterclockaccuracy,
4999             { "Grandmaster clock accuracy", "ptp.v2.mm.grandmasterclockaccuracy",
5000             FT_UINT8, BASE_HEX, VALS(ptp_v2_clockaccuracy_vals), 0x00,
5001             NULL, HFILL }
5002         },
5003         { &hf_ptp_v2_mm_grandmasterclockvariance,
5004             { "Grandmaster clock variance", "ptp.v2.mm.grandmasterclockvariance",
5005             FT_UINT16, BASE_DEC, NULL, 0x00,
5006             NULL, HFILL }
5007         },
5008         { &hf_ptp_v2_mm_grandmasterIdentity,
5009             { "Grandmaster clock identity", "ptp.v2.mm.grandmasterclockidentity",
5010             FT_UINT64, BASE_HEX, NULL, 0x00,
5011             NULL, HFILL }
5012         },
5013         { &hf_ptp_v2_mm_currentUtcOffset,
5014             { "CurrentUTCOffset", "ptp.v2.mm.currentutcoffset",
5015             FT_INT16, BASE_DEC, NULL, 0x00,
5016             NULL, HFILL }
5017         },
5018         { &hf_ptp_v2_mm_LI_61,
5019             { "leap 61", "ptp.v2.mm.li61",
5020             FT_BOOLEAN, 8, NULL, 0x01,
5021             NULL, HFILL }
5022         },
5023         { &hf_ptp_v2_mm_LI_59,
5024             { "leap 59", "ptp.v2.mm.li59",
5025             FT_BOOLEAN, 8, NULL, 0x02,
5026             NULL, HFILL }
5027         },
5028         { &hf_ptp_v2_mm_UTCV,
5029             { "CurrentUTCOffset valid", "ptp.v2.mm.CurrentUTCOffsetValid",
5030             FT_BOOLEAN, 8, NULL, 0x04,
5031             NULL, HFILL }
5032         },
5033         { &hf_ptp_v2_mm_PTP,
5034             { "PTP timescale", "ptp.v2.mm.ptptimescale",
5035             FT_BOOLEAN, 8, NULL, 0x08,
5036             NULL, HFILL }
5037         },
5038         { &hf_ptp_v2_mm_TTRA,
5039             { "Time traceable", "ptp.v2.mm.timeTraceable",
5040             FT_BOOLEAN, 8, NULL, 0x10,
5041             NULL, HFILL }
5042         },
5043         { &hf_ptp_v2_mm_FTRA,
5044             { "Frequency traceable", "ptp.v2.mm.frequencyTraceable",
5045             FT_BOOLEAN, 8, NULL, 0x20,
5046             NULL, HFILL }
5047         },
5048         { &hf_ptp_v2_mm_timesource,
5049             { "TimeSource",           "ptp.v2.mm.timesource",
5050             FT_UINT8, BASE_HEX, VALS(ptp_v2_timesource_vals), 0x00,
5051             NULL, HFILL }
5052         },
5053         { &hf_ptp_v2_mm_offset_ns,
5054             { "correction",           "ptp.v2.mm.offset.ns",
5055             FT_UINT64, BASE_DEC, NULL, 0x00,
5056             NULL, HFILL }
5057         },
5058         { &hf_ptp_v2_mm_offset_subns,
5059             { "SubNs",           "ptp.v2.mm.offset.subns",
5060             FT_DOUBLE, BASE_DEC, NULL, 0x00,
5061             NULL, HFILL }
5062         },
5063         { &hf_ptp_v2_mm_pathDelay_ns,
5064             { "ns",           "ptp.v2.mm.pathDelay.ns",
5065             FT_UINT64, BASE_DEC, NULL, 0x00,
5066             NULL, HFILL }
5067         },
5068         { &hf_ptp_v2_mm_pathDelay_subns,
5069             { "SubNs",           "ptp.v2.mm.pathDelay.subns",
5070             FT_DOUBLE, BASE_DEC, NULL, 0x00,
5071             NULL, HFILL }
5072         },
5073         { &hf_ptp_v2_mm_PortNumber,
5074             { "PortNumber",           "ptp.v2.mm.PortNumber",
5075             FT_UINT16, BASE_DEC, NULL, 0x00,
5076             NULL, HFILL }
5077         },
5078         { &hf_ptp_v2_mm_portState,
5079             { "Port state",           "ptp.v2.mm.portState",
5080             FT_UINT8, BASE_DEC, VALS(ptp2_portState_vals), 0x00,
5081             NULL, HFILL }
5082         },
5083         { &hf_ptp_v2_mm_logMinDelayReqInterval,
5084                 { "logMinDelayReqInterval",           "ptp.v2.mm.logMinDelayReqInterval",
5085                 FT_INT8, BASE_DEC, NULL, 0x00,
5086                 NULL, HFILL }
5087         },
5088         { &hf_ptp_v2_mm_peerMeanPathDelay_ns,
5089                 { "ns",           "ptp.v2.mm.peerMeanPathDelay.ns",
5090                 FT_UINT64, BASE_DEC, NULL, 0x00,
5091                 NULL, HFILL }
5092         },
5093         { &hf_ptp_v2_mm_peerMeanPathDelay_subns,
5094                 { "SubNs",           "ptp.v2.mm.peerMeanPathDelay.subns",
5095                 FT_DOUBLE, BASE_DEC, NULL, 0x00,
5096                 NULL, HFILL }
5097         },
5098         { &hf_ptp_v2_mm_logAnnounceInterval,
5099                 { "logAnnounceInterval",           "ptp.v2.mm.logAnnounceInterval",
5100                 FT_INT8, BASE_DEC, NULL, 0x00,
5101                 NULL, HFILL }
5102         },
5103         { &hf_ptp_v2_mm_announceReceiptTimeout,
5104                 { "announceReceiptTimeout",           "ptp.v2.mm.announceReceiptTimeout",
5105                 FT_UINT8, BASE_DEC, NULL, 0x00,
5106                 NULL, HFILL }
5107         },
5108         { &hf_ptp_v2_mm_logSyncInterval,
5109                 { "logSyncInterval",           "ptp.v2.mm.logSyncInterval",
5110                 FT_INT8, BASE_DEC, NULL, 0x00,
5111                 NULL, HFILL }
5112         },
5113         { &hf_ptp_v2_mm_delayMechanism,
5114                 { "Delay mechanism",           "ptp.v2.mm.delayMechanism",
5115                 FT_UINT8, BASE_DEC, VALS(ptp2_delayMechanism_vals), 0x00,
5116                 NULL, HFILL }
5117         },
5118         { &hf_ptp_v2_mm_logMinPdelayReqInterval,
5119                 { "logMinPdelayReqInterval",           "ptp.v2.mm.logMinPdelayReqInterval",
5120                 FT_INT8, BASE_DEC, NULL, 0x00,
5121                 NULL, HFILL }
5122         },
5123         { &hf_ptp_v2_mm_versionNumber,
5124                 { "versionNumber",           "ptp.v2.mm.versionNumber",
5125                 FT_UINT8, BASE_DEC, NULL, 0x0F,
5126                 NULL, HFILL }
5127         },
5128         { &hf_ptp_v2_mm_primaryDomain,
5129                 { "Primary domain number",  "ptp.v2.mm.primaryDomain",
5130                 FT_UINT8, BASE_DEC, NULL, 0x00,
5131                 NULL, HFILL }
5132         },
5133         { &hf_ptp_v2_mm_faultyFlag,
5134                 { "Faulty flag", "ptp.v2.mm.faultyFlag",
5135                 FT_BOOLEAN, 8, NULL, 0x01,
5136                 NULL, HFILL }
5137         },
5138
5139         { &hf_ptp_v2_mm_managementErrorId,
5140                 { "managementErrorId",  "ptp.v2.mm.managementErrorId",
5141                 FT_UINT16, BASE_DEC, VALS(ptp2_managementErrorId_vals), 0x00,
5142                 NULL, HFILL }
5143         },
5144         { &hf_ptp_v2_mm_displayData,
5145                 { "Display data",           "ptp.v2.mm.displayData",
5146                 FT_STRING, BASE_DEC, NULL, 0x00,
5147                 NULL, HFILL }
5148         },
5149         { &hf_ptp_v2_mm_displayData_length,
5150                 { "length",           "ptp.v2.mm.displayData.length",
5151                 FT_UINT8, BASE_DEC, NULL, 0x00,
5152                 NULL, HFILL }
5153         },
5154         { &hf_ptp_v2_mm_ucEN,
5155             { "Enable unicast", "ptp.v2.mm.unicastEnable",
5156             FT_BOOLEAN, 8, NULL, 0x01,
5157             NULL, HFILL }
5158         },
5159         { &hf_ptp_v2_mm_ptEN,
5160             { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
5161             FT_BOOLEAN, 8, NULL, 0x01,
5162             NULL, HFILL }
5163         },
5164         { &hf_ptp_v2_mm_atEN,
5165             { "Path trace unicast", "ptp.v2.mm.pathTraceEnable",
5166             FT_BOOLEAN, 8, NULL, 0x01,
5167             NULL, HFILL }
5168         },
5169         { &hf_ptp_v2_mm_keyField,
5170             { "Key field", "ptp.v2.mm.keyField",
5171             FT_UINT8, BASE_DEC, NULL, 0x00,
5172             NULL, HFILL }
5173         },
5174         { &hf_ptp_v2_mm_displayName,
5175             { "Display name",           "ptp.v2.mm.displayName",
5176             FT_STRING, BASE_DEC, NULL, 0x00,
5177             NULL, HFILL }
5178         },
5179         { &hf_ptp_v2_mm_displayName_length,
5180             { "length",           "ptp.v2.mm.displayName.length",
5181             FT_UINT8, BASE_DEC, NULL, 0x00,
5182             NULL, HFILL }
5183         },
5184         { &hf_ptp_v2_mm_maxKey,
5185             { "Max key", "ptp.v2.mm.maxKey",
5186             FT_UINT8, BASE_DEC, NULL, 0x00,
5187             NULL, HFILL }
5188         },
5189         { &hf_ptp_v2_mm_currentOffset,
5190             { "Current offset", "ptp.v2.mm.currentOffset",
5191             FT_INT32, BASE_DEC, NULL, 0x00,
5192             NULL, HFILL }
5193         },
5194         { &hf_ptp_v2_mm_jumpSeconds,
5195             { "Jump seconds", "ptp.v2.mm.jumpSeconds",
5196             FT_INT32, BASE_DEC, NULL, 0x00,
5197             NULL, HFILL }
5198         },
5199         { &hf_ptp_v2_mm_numberOfAlternateMasters,
5200             { "Number of alternate masters", "ptp.v2.mm.numberOfAlternateMasters",
5201             FT_UINT8, BASE_DEC, NULL, 0x00,
5202             NULL, HFILL }
5203         },
5204         { &hf_ptp_v2_mm_logAlternateMulticastSyncInterval,
5205             { "Alternate multicast sync interval", "ptp.v2.mm.AlternateMulticastSyncInterval",
5206             FT_INT8, BASE_DEC, NULL, 0x00,
5207             NULL, HFILL }
5208         },
5209         { &hf_ptp_v2_mm_transmitAlternateMulticastSync,
5210             { "Transmit alternate multicast sync", "ptp.v2.mm.transmitAlternateMulticastSync",
5211             FT_BOOLEAN, 8, NULL, 0x01,
5212             NULL, HFILL }
5213         },
5214     };
5215
5216
5217 /* Setup protocol subtree array */
5218     static gint *ett[] = {
5219         &ett_ptp,
5220         &ett_ptp_flags,
5221         &ett_ptp_time,
5222         &ett_ptp_time2,
5223         &ett_ptp_v2,
5224         &ett_ptp_v2_transportspecific,
5225         &ett_ptp_v2_flags,
5226         &ett_ptp_v2_correction,
5227         &ett_ptp_v2_time,
5228         &ett_ptp_v2_time2,
5229         &ett_ptp_v2_managementData,
5230         &ett_ptp_v2_clockType,
5231         &ett_ptp_v2_physicalLayerProtocol,
5232         &ett_ptp_v2_protocolAddress,
5233         &ett_ptp_v2_ptptext,
5234         &ett_ptp_v2_faultRecord,
5235         &ett_ptp_v2_timeInterval,
5236         &ett_ptp_v2_tlv,
5237     };
5238
5239 /* Register the protocol name and description */
5240     proto_ptp = proto_register_protocol("Precision Time Protocol (IEEE1588)",
5241         "PTP", "ptp");
5242
5243 /* Required function calls to register the header fields and subtrees used */
5244     proto_register_field_array(proto_ptp, hf, array_length(hf));
5245     proto_register_subtree_array(ett, array_length(ett));
5246 }
5247
5248 void
5249 proto_reg_handoff_ptp(void)
5250 {
5251     dissector_handle_t event_port_ptp_handle;
5252     dissector_handle_t general_port_ptp_handle;
5253     dissector_handle_t ethertype_ptp_handle;
5254
5255     event_port_ptp_handle = create_dissector_handle(dissect_ptp, proto_ptp);
5256     general_port_ptp_handle = create_dissector_handle(dissect_ptp, proto_ptp);
5257     ethertype_ptp_handle = create_dissector_handle(dissect_ptp_oE, proto_ptp);
5258
5259     dissector_add("udp.port", EVENT_PORT_PTP, event_port_ptp_handle);
5260     dissector_add("udp.port", GENERAL_PORT_PTP, general_port_ptp_handle);
5261     dissector_add("ethertype", ETHERTYPE_PTP, ethertype_ptp_handle);
5262 }