from Gerhard Gappmeier (ascolab):
[obnox/wireshark/wip.git] / plugins / opcua / opcua_enumparser.c
1 /******************************************************************************
2 ** $Id$
3 **
4 ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved.
5 ** Web: http://www.ascolab.com
6 ** 
7 ** This program is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU General Public License
9 ** as published by the Free Software Foundation; either version 2
10 ** of the License, or (at your option) any later version.
11 ** 
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 ** 
15 ** Project: OpcUa Wireshark Plugin
16 **
17 ** Description: OpcUa Enum Type Parser
18 **
19 ** This file was autogenerated on 8.5.2007 18:53:26.
20 ** DON'T MODIFY THIS FILE!
21 **
22 ******************************************************************************/
23
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27
28 #include <gmodule.h>
29 #include <epan/packet.h>
30
31 #include "opcua_enumparser.h"
32
33 \r
34 /** NodeClass enum table */\r
35 static const value_string g_NodeClassTable[] = {
36   { 0, "Node" },
37   { 1, "Object" },
38   { 2, "Variable" },
39   { 4, "Method" },
40   { 8, "ObjectType" },
41   { 16, "VariableType" },
42   { 32, "ReferenceType" },
43   { 64, "DataType" },
44   { 128, "View" },\r
45   { 0, NULL }\r
46 };\r
47 static int hf_opcua_NodeClass = -1;\r
48 \r
49 void parseNodeClass(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
50 {\r
51         proto_tree_add_item(tree, hf_opcua_NodeClass, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
52 }\r
53 \r
54 /** IdType enum table */\r
55 static const value_string g_IdTypeTable[] = {
56   { 0, "Numeric" },
57   { 1, "String" },
58   { 2, "Uri" },
59   { 3, "Guid" },
60   { 4, "Opaque" },\r
61   { 0, NULL }\r
62 };\r
63 static int hf_opcua_IdType = -1;\r
64 \r
65 void parseIdType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
66 {\r
67         proto_tree_add_item(tree, hf_opcua_IdType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
68 }\r
69 \r
70 /** MessageSecurityMode enum table */\r
71 static const value_string g_MessageSecurityModeTable[] = {
72   { 0, "None" },
73   { 1, "Sign" },
74   { 2, "SignAndEncrypt" },\r
75   { 0, NULL }\r
76 };\r
77 static int hf_opcua_MessageSecurityMode = -1;\r
78 \r
79 void parseMessageSecurityMode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
80 {\r
81         proto_tree_add_item(tree, hf_opcua_MessageSecurityMode, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
82 }\r
83 \r
84 /** UserTokenType enum table */\r
85 static const value_string g_UserTokenTypeTable[] = {
86   { 0, "Default" },
87   { 1, "UserName" },
88   { 2, "Certificate" },
89   { 3, "IssuedToken" },\r
90   { 0, NULL }\r
91 };\r
92 static int hf_opcua_UserTokenType = -1;\r
93 \r
94 void parseUserTokenType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
95 {\r
96         proto_tree_add_item(tree, hf_opcua_UserTokenType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
97 }\r
98 \r
99 /** ServerDescriptionType enum table */\r
100 static const value_string g_ServerDescriptionTypeTable[] = {
101   { 0, "Standard" },
102   { 1, "Discovery" },\r
103   { 0, NULL }\r
104 };\r
105 static int hf_opcua_ServerDescriptionType = -1;\r
106 \r
107 void parseServerDescriptionType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
108 {\r
109         proto_tree_add_item(tree, hf_opcua_ServerDescriptionType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
110 }\r
111 \r
112 /** SecurityTokenRequestType enum table */\r
113 static const value_string g_SecurityTokenRequestTypeTable[] = {
114   { 0, "Issue" },
115   { 1, "Renew" },\r
116   { 0, NULL }\r
117 };\r
118 static int hf_opcua_SecurityTokenRequestType = -1;\r
119 \r
120 void parseSecurityTokenRequestType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
121 {\r
122         proto_tree_add_item(tree, hf_opcua_SecurityTokenRequestType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
123 }\r
124 \r
125 /** ComplianceLevel enum table */\r
126 static const value_string g_ComplianceLevelTable[] = {
127   { 0, "Untested" },
128   { 1, "Partial" },
129   { 2, "SelfTested" },
130   { 3, "Certified" },\r
131   { 0, NULL }\r
132 };\r
133 static int hf_opcua_ComplianceLevel = -1;\r
134 \r
135 void parseComplianceLevel(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
136 {\r
137         proto_tree_add_item(tree, hf_opcua_ComplianceLevel, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
138 }\r
139 \r
140 /** RedundancySupport enum table */\r
141 static const value_string g_RedundancySupportTable[] = {
142   { 1, "None" },
143   { 2, "Cold" },
144   { 3, "Warm" },
145   { 4, "Hot" },\r
146   { 0, NULL }\r
147 };\r
148 static int hf_opcua_RedundancySupport = -1;\r
149 \r
150 void parseRedundancySupport(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
151 {\r
152         proto_tree_add_item(tree, hf_opcua_RedundancySupport, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
153 }\r
154 \r
155 /** ServerState enum table */\r
156 static const value_string g_ServerStateTable[] = {
157   { 1, "Running" },
158   { 2, "Failed" },
159   { 3, "NoConfiguration" },
160   { 4, "Suspended" },
161   { 5, "Shutdown" },
162   { 6, "Test" },
163   { 7, "CommunicationFault" },
164   { 8, "Unknown" },\r
165   { 0, NULL }\r
166 };\r
167 static int hf_opcua_ServerState = -1;\r
168 \r
169 void parseServerState(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
170 {\r
171         proto_tree_add_item(tree, hf_opcua_ServerState, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
172 }\r
173 \r
174 /** ExceptionDeviationType enum table */\r
175 static const value_string g_ExceptionDeviationTypeTable[] = {
176   { 1, "AbsoluteValue" },
177   { 2, "PercentOfRange" },
178   { 3, "PercentOfValue" },\r
179   { 0, NULL }\r
180 };\r
181 static int hf_opcua_ExceptionDeviationType = -1;\r
182 \r
183 void parseExceptionDeviationType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
184 {\r
185         proto_tree_add_item(tree, hf_opcua_ExceptionDeviationType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
186 }\r
187 \r
188 /** ColorsDataType enum table */\r
189 static const value_string g_ColorsDataTypeTable[] = {
190   { 1, "Red" },
191   { 2, "Orange" },
192   { 3, "Yellow" },
193   { 4, "Green" },
194   { 5, "Blue" },
195   { 6, "DarkBlue" },
196   { 7, "Violet" },\r
197   { 0, NULL }\r
198 };\r
199 static int hf_opcua_ColorsDataType = -1;\r
200 \r
201 void parseColorsDataType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
202 {\r
203         proto_tree_add_item(tree, hf_opcua_ColorsDataType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
204 }\r
205 \r
206 /** DiagnosticsMasks enum table */\r
207 static const value_string g_DiagnosticsMasksTable[] = {
208   { 1, "ServiceSymbolicId" },
209   { 2, "ServiceLocalizedText" },
210   { 4, "ServiceAdditionalInfo" },
211   { 8, "ServiceInnerStatusCode" },
212   { 16, "ServiceInnerDiagnostics" },
213   { 3, "ServiceSymbolicIdAndText" },
214   { 15, "ServiceNoInnerStatus" },
215   { 31, "ServiceAll" },
216   { 32, "OperationSymbolicId" },
217   { 64, "OperationLocalizedText" },
218   { 128, "OperationAdditionalInfo" },
219   { 256, "OperationInnerStatusCode" },
220   { 512, "OperationInnerDiagnostics" },
221   { 96, "OperationSymbolicIdAndText" },
222   { 224, "OperationNoInnerStatus" },
223   { 992, "OperationAll" },
224   { 33, "SymbolicId" },
225   { 66, "LocalizedText" },
226   { 132, "AdditionalInfo" },
227   { 264, "InnerStatusCode" },
228   { 528, "InnerDiagnostics" },
229   { 99, "SymbolicIdAndText" },
230   { 239, "NoInnerStatus" },
231   { 1023, "All" },\r
232   { 0, NULL }\r
233 };\r
234 static int hf_opcua_DiagnosticsMasks = -1;\r
235 \r
236 void parseDiagnosticsMasks(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
237 {\r
238         proto_tree_add_item(tree, hf_opcua_DiagnosticsMasks, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
239 }\r
240 \r
241 /** EnumeratedTestType enum table */\r
242 static const value_string g_EnumeratedTestTypeTable[] = {
243   { 1, "Red" },
244   { 4, "Yellow" },
245   { 5, "Green" },\r
246   { 0, NULL }\r
247 };\r
248 static int hf_opcua_EnumeratedTestType = -1;\r
249 \r
250 void parseEnumeratedTestType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
251 {\r
252         proto_tree_add_item(tree, hf_opcua_EnumeratedTestType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
253 }\r
254 \r
255 /** BrowseDirection enum table */\r
256 static const value_string g_BrowseDirectionTable[] = {
257   { 1, "Forward" },
258   { 2, "Inverse" },
259   { 3, "Both" },\r
260   { 0, NULL }\r
261 };\r
262 static int hf_opcua_BrowseDirection = -1;\r
263 \r
264 void parseBrowseDirection(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
265 {\r
266         proto_tree_add_item(tree, hf_opcua_BrowseDirection, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
267 }\r
268 \r
269 /** FilterOperator enum table */\r
270 static const value_string g_FilterOperatorTable[] = {
271   { 1, "Equals" },
272   { 2, "IsNull" },
273   { 3, "GreaterThan" },
274   { 4, "LessThan" },
275   { 5, "GreaterThanOrEqual" },
276   { 6, "LessThanOrEqual" },
277   { 7, "Like" },
278   { 8, "Not" },
279   { 9, "Between" },
280   { 10, "InList" },
281   { 11, "And" },
282   { 12, "Or" },
283   { 13, "InView" },
284   { 14, "OfType" },
285   { 15, "RelatedTo" },\r
286   { 0, NULL }\r
287 };\r
288 static int hf_opcua_FilterOperator = -1;\r
289 \r
290 void parseFilterOperator(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
291 {\r
292         proto_tree_add_item(tree, hf_opcua_FilterOperator, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
293 }\r
294 \r
295 /** TimestampsToReturn enum table */\r
296 static const value_string g_TimestampsToReturnTable[] = {
297   { 1, "Source" },
298   { 2, "Server" },
299   { 3, "Both" },
300   { 4, "Neither" },\r
301   { 0, NULL }\r
302 };\r
303 static int hf_opcua_TimestampsToReturn = -1;\r
304 \r
305 void parseTimestampsToReturn(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
306 {\r
307         proto_tree_add_item(tree, hf_opcua_TimestampsToReturn, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
308 }\r
309 \r
310 /** MonitoringMode enum table */\r
311 static const value_string g_MonitoringModeTable[] = {
312   { 0, "Disabled" },
313   { 1, "Sampling" },
314   { 2, "Reporting" },\r
315   { 0, NULL }\r
316 };\r
317 static int hf_opcua_MonitoringMode = -1;\r
318 \r
319 void parseMonitoringMode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
320 {\r
321         proto_tree_add_item(tree, hf_opcua_MonitoringMode, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
322 }\r
323 \r
324 /** DataChangeTrigger enum table */\r
325 static const value_string g_DataChangeTriggerTable[] = {
326   { 0, "Status" },
327   { 1, "StatusValue" },
328   { 2, "StatusValueTimestamp" },\r
329   { 0, NULL }\r
330 };\r
331 static int hf_opcua_DataChangeTrigger = -1;\r
332 \r
333 void parseDataChangeTrigger(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
334 {\r
335         proto_tree_add_item(tree, hf_opcua_DataChangeTrigger, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
336 }\r
337 \r
338 /** DeadbandType enum table */\r
339 static const value_string g_DeadbandTypeTable[] = {
340   { 0, "None" },
341   { 1, "Absolute" },
342   { 2, "Percentage" },\r
343   { 0, NULL }\r
344 };\r
345 static int hf_opcua_DeadbandType = -1;\r
346 \r
347 void parseDeadbandType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)\r
348 {\r
349         proto_tree_add_item(tree, hf_opcua_DeadbandType, tvb, *pOffset, 4, TRUE); *pOffset+=4;\r
350 }\r
351
352 /** header field definitions */
353 static hf_register_info hf[] =
354 {\r
355     { &hf_opcua_NodeClass,\r
356     {  "NodeClass", "", FT_UINT32, BASE_HEX,  VALS(g_NodeClassTable), 0x0, "", HFILL }\r
357     },\r
358     { &hf_opcua_IdType,\r
359     {  "IdType", "", FT_UINT32, BASE_HEX,  VALS(g_IdTypeTable), 0x0, "", HFILL }\r
360     },\r
361     { &hf_opcua_MessageSecurityMode,\r
362     {  "MessageSecurityMode", "", FT_UINT32, BASE_HEX,  VALS(g_MessageSecurityModeTable), 0x0, "", HFILL }\r
363     },\r
364     { &hf_opcua_UserTokenType,\r
365     {  "UserTokenType", "", FT_UINT32, BASE_HEX,  VALS(g_UserTokenTypeTable), 0x0, "", HFILL }\r
366     },\r
367     { &hf_opcua_ServerDescriptionType,\r
368     {  "ServerDescriptionType", "", FT_UINT32, BASE_HEX,  VALS(g_ServerDescriptionTypeTable), 0x0, "", HFILL }\r
369     },\r
370     { &hf_opcua_SecurityTokenRequestType,\r
371     {  "SecurityTokenRequestType", "", FT_UINT32, BASE_HEX,  VALS(g_SecurityTokenRequestTypeTable), 0x0, "", HFILL }\r
372     },\r
373     { &hf_opcua_ComplianceLevel,\r
374     {  "ComplianceLevel", "", FT_UINT32, BASE_HEX,  VALS(g_ComplianceLevelTable), 0x0, "", HFILL }\r
375     },\r
376     { &hf_opcua_RedundancySupport,\r
377     {  "RedundancySupport", "", FT_UINT32, BASE_HEX,  VALS(g_RedundancySupportTable), 0x0, "", HFILL }\r
378     },\r
379     { &hf_opcua_ServerState,\r
380     {  "ServerState", "", FT_UINT32, BASE_HEX,  VALS(g_ServerStateTable), 0x0, "", HFILL }\r
381     },\r
382     { &hf_opcua_ExceptionDeviationType,\r
383     {  "ExceptionDeviationType", "", FT_UINT32, BASE_HEX,  VALS(g_ExceptionDeviationTypeTable), 0x0, "", HFILL }\r
384     },\r
385     { &hf_opcua_ColorsDataType,\r
386     {  "ColorsDataType", "", FT_UINT32, BASE_HEX,  VALS(g_ColorsDataTypeTable), 0x0, "", HFILL }\r
387     },\r
388     { &hf_opcua_DiagnosticsMasks,\r
389     {  "DiagnosticsMasks", "", FT_UINT32, BASE_HEX,  VALS(g_DiagnosticsMasksTable), 0x0, "", HFILL }\r
390     },\r
391     { &hf_opcua_EnumeratedTestType,\r
392     {  "EnumeratedTestType", "", FT_UINT32, BASE_HEX,  VALS(g_EnumeratedTestTypeTable), 0x0, "", HFILL }\r
393     },\r
394     { &hf_opcua_BrowseDirection,\r
395     {  "BrowseDirection", "", FT_UINT32, BASE_HEX,  VALS(g_BrowseDirectionTable), 0x0, "", HFILL }\r
396     },\r
397     { &hf_opcua_FilterOperator,\r
398     {  "FilterOperator", "", FT_UINT32, BASE_HEX,  VALS(g_FilterOperatorTable), 0x0, "", HFILL }\r
399     },\r
400     { &hf_opcua_TimestampsToReturn,\r
401     {  "TimestampsToReturn", "", FT_UINT32, BASE_HEX,  VALS(g_TimestampsToReturnTable), 0x0, "", HFILL }\r
402     },\r
403     { &hf_opcua_MonitoringMode,\r
404     {  "MonitoringMode", "", FT_UINT32, BASE_HEX,  VALS(g_MonitoringModeTable), 0x0, "", HFILL }\r
405     },\r
406     { &hf_opcua_DataChangeTrigger,\r
407     {  "DataChangeTrigger", "", FT_UINT32, BASE_HEX,  VALS(g_DataChangeTriggerTable), 0x0, "", HFILL }\r
408     },\r
409     { &hf_opcua_DeadbandType,\r
410     {  "DeadbandType", "", FT_UINT32, BASE_HEX,  VALS(g_DeadbandTypeTable), 0x0, "", HFILL }\r
411     }
412 };
413
414 /** Register enum types. */
415 void registerEnumTypes(int proto)
416 {
417     proto_register_field_array(proto, hf, array_length(hf));
418 }