2 * Routines for SML dissection
3 * Copyright 2013, Alexander Gaertner <gaertner.alex@gmx.de>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 SML dissector is based on v1.03 (12.11.2008) specifications of "smart message language" protocol
29 Link to specifications: http://www.vde.com/de/fnn/arbeitsgebiete/messwesen/Sym2/infomaterial/seiten/sml-spezifikation.aspx
31 Short description of the SML protocol on the SML Wireshark Wiki page: http://wiki.wireshark.org/SML
36 #include <epan/packet.h>
37 #include <epan/prefs.h>
38 #include <epan/crc16-tvb.h>
39 #include <epan/expert.h>
41 #define TCP_PORT_SML 0
42 #define UDP_PORT_SML 0
44 #define ESC_SEQ_END G_GUINT64_CONSTANT(0x1b1b1b1b1a)
45 #define ESC_SEQ 0x1b1b1b1b
47 #define OPEN_REQ 0x0100
48 #define OPEN_RES 0x0101
49 #define CLOSE_REQ 0x0200
50 #define CLOSE_RES 0x0201
51 #define PROFILEPACK_REQ 0x0300
52 #define PROFILEPACK_RES 0x0301
53 #define PROFILELIST_REQ 0x0400
54 #define PROFILELIST_RES 0x0401
55 #define GETPROCPARAMETER_REQ 0x0500
56 #define GETPROCPARAMETER_RES 0x0501
57 #define SETPROCPARAMETER_REQ 0x0600
58 #define GETLIST_REQ 0x0700
59 #define GETLIST_RES 0x0701
60 #define ATTENTION 0xFF01
62 #define PROC_VALUE 0x01
63 #define PROC_PERIOD 0x02
64 #define PROC_TUPEL 0x03
65 #define PROC_TIME 0x04
67 #define SHORT_LIST 0x70
68 #define LONG_LIST 0xF0
72 #define UNSIGNED8 0x62
73 #define UNSIGNED16 0x63
75 #define LIST_6_ELEMENTS 0x76
78 static guint tcp_port_pref
= TCP_PORT_SML
;
79 static guint udp_port_pref
= UDP_PORT_SML
;
81 /* Forward declaration we need below (if using proto_reg_handoff as a prefs callback)*/
82 void proto_reg_handoff_sml(void);
84 /* Initialize the protocol and registered fields */
85 static int proto_sml
= -1;
87 static int hf_sml_esc
= -1;
88 static int hf_sml_version_1
= -1;
89 static int hf_sml_groupNo
= -1;
90 static int hf_sml_transactionId
= -1;
91 static int hf_sml_datatype
= -1;
92 static int hf_sml_abortOnError
= -1;
93 static int hf_sml_MessageBody
= -1;
94 static int hf_sml_crc16
= -1;
95 static int hf_sml_endOfSmlMsg
= -1;
96 static int hf_sml_end
= -1;
97 static int hf_sml_codepage
= -1;
98 static int hf_sml_clientId
= -1;
99 static int hf_sml_reqFileId
= -1;
100 static int hf_sml_serverId
= -1;
101 static int hf_sml_username
= -1;
102 static int hf_sml_password
= -1;
103 static int hf_sml_smlVersion
= -1;
104 static int hf_sml_listName
= -1;
105 static int hf_sml_globalSignature
= -1;
106 static int hf_sml_refTime
= -1;
107 static int hf_sml_actSensorTime
= -1;
108 static int hf_sml_timetype
= -1;
109 static int hf_sml_objName
= -1;
110 static int hf_sml_status
= -1;
111 static int hf_sml_valTime
= -1;
112 static int hf_sml_unit
= -1;
113 static int hf_sml_scaler
= -1;
114 static int hf_sml_value
= -1;
115 static int hf_sml_valueSignature
= -1;
116 static int hf_sml_listSignature
= -1;
117 static int hf_sml_actGatewayTime
= -1;
118 static int hf_sml_parameterTreePath
= -1;
119 static int hf_sml_attribute
= -1;
120 static int hf_sml_parameterName
= -1;
121 static int hf_sml_procParValue
= -1;
122 static int hf_sml_procParValueTime
= -1;
123 static int hf_sml_padding
= -1;
124 static int hf_sml_secIndex
= -1;
125 static int hf_sml_attentionNo
= -1;
126 static int hf_sml_attentionMsg
= -1;
127 static int hf_sml_withRawdata
= -1;
128 static int hf_sml_beginTime
= -1;
129 static int hf_sml_endTime
= -1;
130 static int hf_sml_object_list_Entry
= -1;
131 static int hf_sml_actTime
= -1;
132 static int hf_sml_regPeriod
= -1;
133 static int hf_sml_rawdata
= -1;
134 static int hf_sml_periodSignature
= -1;
135 static int hf_sml_profileSignature
= -1;
136 static int hf_sml_signature_mA_R2_R3
= -1;
137 static int hf_sml_signature_pA_R1_R4
= -1;
138 static int hf_sml_unit_mA
= -1;
139 static int hf_sml_scaler_mA
= -1;
140 static int hf_sml_value_mA
= -1;
141 static int hf_sml_unit_pA
= -1;
142 static int hf_sml_scaler_pA
= -1;
143 static int hf_sml_value_pA
= -1;
144 static int hf_sml_unit_R1
= -1;
145 static int hf_sml_scaler_R1
= -1;
146 static int hf_sml_value_R1
= -1;
147 static int hf_sml_unit_R2
= -1;
148 static int hf_sml_scaler_R2
= -1;
149 static int hf_sml_value_R2
= -1;
150 static int hf_sml_unit_R3
= -1;
151 static int hf_sml_scaler_R3
= -1;
152 static int hf_sml_value_R3
= -1;
153 static int hf_sml_unit_R4
= -1;
154 static int hf_sml_scaler_R4
= -1;
155 static int hf_sml_value_R4
= -1;
157 static const value_string datatype
[]={
159 {0x53, "Integer 16"},
160 {0x54, "Integer cropped"},
161 {0x55, "Integer 32"},
162 {0x56, "Integer cropped"},
163 {0x57, "Integer cropped"},
164 {0x58, "Integer cropped"},
165 {0x59, "Integer 64"},
166 {0x62, "Unsigned 8"},
167 {0x63, "Unsigned 16"},
168 {0x64, "Unsigned cropped"},
169 {0x65, "Unsigned 32"},
170 {0x66, "Unsigned cropped"},
171 {0x67, "Unsigned cropped"},
172 {0x68, "Unsigned cropped"},
173 {0x69, "Unsigned 64"},
178 static const value_string sml_abort
[]={
180 {0x01, "Continue at next group"},
181 {0x02, "Continue than abort"},
186 static const value_string sml_body
[]={
187 {OPEN_REQ
, "PublicOpen.Req"},
188 {OPEN_RES
, "PublicOpen.Res"},
189 {CLOSE_REQ
, "PublicClose.Req"},
190 {CLOSE_RES
, "PublicClose.Res"},
191 {PROFILEPACK_REQ
, "GetProfilePack.Req"},
192 {PROFILEPACK_RES
, "GetProfilePack.Res"},
193 {PROFILELIST_REQ
, "GetProfileList.Req"},
194 {PROFILELIST_RES
, "GetProfileList.Res"},
195 {GETPROCPARAMETER_REQ
, "GetProcParameter.Req"},
196 {GETPROCPARAMETER_RES
, "GetProcParameter.Res"},
197 {SETPROCPARAMETER_REQ
, "SetProcParameter.Req"},
198 {GETLIST_REQ
, "GetList.Req"},
199 {GETLIST_RES
, "GetList.Res"},
200 {ATTENTION
, "Attention.Res"},
204 static const value_string sml_timetypes
[]={
210 static const value_string procvalues
[]={
211 {PROC_VALUE
, "Value"},
212 {PROC_PERIOD
, "PeriodEntry"},
213 {PROC_TUPEL
, "TupelEntry"},
218 static const range_string attentionValues
[]={
219 {0xE000, 0xFCFF, "application specific"},
220 {0xFD00, 0xFD00, "acknowledged"},
221 {0xFD01, 0xFD01, "order will be executed later"},
222 {0xFE00, 0xFE00, "error undefined"},
223 {0xFE01, 0xFE01, "unknown SML designator"},
224 {0xFE02, 0xFE02, "User/Password wrong"},
225 {0xFE03, 0xFE03, "serverId not available"},
226 {0xFE04, 0xFE04, "reqFileId not available"},
227 {0xFE05, 0xFE05, "destination attributes cannot be written"},
228 {0xFE06, 0xFE06, "destination attributes cannot be read"},
229 {0xFE07, 0xFE07, "communication disturbed"},
230 {0xFE08, 0xFE08, "rawdata cannot be interpreted"},
231 {0xFE09, 0xFE09, "value out of range"},
232 {0xFE0A, 0xFE0A, "order not executed"},
233 {0xFE0B, 0xFE0B, "checksum failed"},
234 {0xFE0C, 0xFE0C, "broadcast not supported"},
235 {0xFE0D, 0xFE0D, "unexpected message"},
236 {0xFE0E, 0xFE0E, "unknown object in the profile"},
237 {0xFE0F, 0xFE0F, "datatype not supported"},
238 {0xFE10, 0xFE10, "optional element not supported"},
239 {0xFE11, 0xFE11, "no entry in requested profile"},
240 {0xFE12, 0xFE12, "end limit before begin limit"},
241 {0xFE13, 0xFE13, "no entry in requested area"},
242 {0xFE14, 0xFE14, "SML file without close"},
243 {0xFE15, 0xFE15, "busy, response cannot be sent"},
247 static const range_string bools
[]={
248 {0x00, 0x00, "false"},
249 {0x01, 0xFF, "true"},
253 /* Initialize the subtree pointers */
254 static gint ett_sml
= -1;
255 static gint ett_sml_mainlist
= -1;
256 static gint ett_sml_version
= -1;
257 static gint ett_sml_sublist
= -1;
258 static gint ett_sml_trans
= -1;
259 static gint ett_sml_group
= -1;
260 static gint ett_sml_abort
= -1;
261 static gint ett_sml_body
= -1;
262 static gint ett_sml_mblist
= -1;
263 static gint ett_sml_mttree
= -1;
264 static gint ett_sml_crc16
= -1;
265 static gint ett_sml_clientId
= -1;
266 static gint ett_sml_codepage
= -1;
267 static gint ett_sml_reqFileId
= -1;
268 static gint ett_sml_serverId
= -1;
269 static gint ett_sml_username
= -1;
270 static gint ett_sml_password
= -1;
271 static gint ett_sml_smlVersion
= -1;
272 static gint ett_sml_listName
= -1;
273 static gint ett_sml_globalSignature
= -1;
274 static gint ett_sml_refTime
= -1;
275 static gint ett_sml_actSensorTime
= -1;
276 static gint ett_sml_timetype
= -1;
277 static gint ett_sml_time
= -1;
278 static gint ett_sml_valList
= -1;
279 static gint ett_sml_listEntry
= -1;
280 static gint ett_sml_objName
= -1;
281 static gint ett_sml_status
= -1;
282 static gint ett_sml_valTime
= -1;
283 static gint ett_sml_unit
= -1;
284 static gint ett_sml_scaler
= -1;
285 static gint ett_sml_value
= -1;
286 static gint ett_sml_valueSignature
= -1;
287 static gint ett_sml_listSignature
= -1;
288 static gint ett_sml_valtree
= -1;
289 static gint ett_sml_actGatewayTime
= -1;
290 static gint ett_sml_treepath
= -1;
291 static gint ett_sml_parameterTreePath
= -1;
292 static gint ett_sml_attribute
= -1;
293 static gint ett_sml_parameterTree
= -1;
294 static gint ett_sml_parameterName
= -1;
295 static gint ett_sml_child
= -1;
296 static gint ett_sml_periodEntry
= -1;
297 static gint ett_sml_procParValue
= -1;
298 static gint ett_sml_procParValueTime
= -1;
299 static gint ett_sml_procParValuetype
= -1;
300 static gint ett_sml_msgend
= -1;
301 static gint ett_sml_tupel
= -1;
302 static gint ett_sml_secIndex
= -1;
303 static gint ett_sml_signature
= -1;
304 static gint ett_sml_attentionNo
= -1;
305 static gint ett_sml_attentionMsg
= -1;
306 static gint ett_sml_withRawdata
= -1;
307 static gint ett_sml_beginTime
= -1;
308 static gint ett_sml_endTime
= -1;
309 static gint ett_sml_object_list
= -1;
310 static gint ett_sml_object_list_Entry
= -1;
311 static gint ett_sml_actTime
= -1;
312 static gint ett_sml_regPeriod
= -1;
313 static gint ett_sml_rawdata
= -1;
314 static gint ett_sml_periodSignature
= -1;
315 static gint ett_sml_period_List_Entry
= -1;
316 static gint ett_sml_periodList
= -1;
317 static gint ett_sml_headerList
= -1;
318 static gint ett_sml_header_List_Entry
= -1;
319 static gint ett_sml_profileSignature
= -1;
320 static gint ett_sml_valuelist
= -1;
321 static gint ett_sml_value_List_Entry
= -1;
322 static gint ett_sml_signature_mA_R2_R3
= -1;
323 static gint ett_sml_signature_pA_R1_R4
= -1;
324 static gint ett_sml_unit_mA
= -1;
325 static gint ett_sml_scaler_mA
= -1;
326 static gint ett_sml_value_mA
= -1;
327 static gint ett_sml_unit_pA
= -1;
328 static gint ett_sml_scaler_pA
= -1;
329 static gint ett_sml_value_pA
= -1;
330 static gint ett_sml_unit_R1
= -1;
331 static gint ett_sml_scaler_R1
= -1;
332 static gint ett_sml_value_R1
= -1;
333 static gint ett_sml_unit_R2
= -1;
334 static gint ett_sml_scaler_R2
= -1;
335 static gint ett_sml_value_R2
= -1;
336 static gint ett_sml_unit_R3
= -1;
337 static gint ett_sml_scaler_R3
= -1;
338 static gint ett_sml_value_R3
= -1;
339 static gint ett_sml_unit_R4
= -1;
340 static gint ett_sml_scaler_R4
= -1;
341 static gint ett_sml_value_R4
= -1;
342 static gint ett_sml_tree_Entry
= -1;
343 static gint ett_sml_dasDetails
= -1;
344 static gint ett_sml_attentionDetails
= -1;
346 static expert_field ei_sml_messagetype_unknown
= EI_INIT
;
347 static expert_field ei_sml_procParValue_errror
= EI_INIT
;
348 static expert_field ei_sml_procParValue_invalid
= EI_INIT
;
349 static expert_field ei_sml_segment_needed
= EI_INIT
;
350 static expert_field ei_sml_endOfSmlMsg
= EI_INIT
;
351 static expert_field ei_sml_crc_error
= EI_INIT
;
352 static expert_field ei_sml_tupel_error
= EI_INIT
;
353 static expert_field ei_sml_crc_error_length
= EI_INIT
;
354 static expert_field ei_sml_invalid_count
= EI_INIT
;
355 static expert_field ei_sml_MessageBody
= EI_INIT
;
356 static expert_field ei_sml_esc_error
= EI_INIT
;
359 static gboolean sml_reassemble
= TRUE
;
360 static gboolean sml_crc_enabled
= FALSE
;
362 /*get number of length octets and calculate how many data octets, it's like BER but not the same! */
363 static void get_length(tvbuff_t
*tvb
, guint
*offset
, guint
*data
, guint
*length
){
365 guint temp_offset
= 0;
367 temp_offset
= *offset
;
371 check
= tvb_get_guint8(tvb
, temp_offset
);
372 if (check
== OPTIONAL
){
375 else if ((check
& 0x80) == MSB
){
376 while ((check
& 0x80) == MSB
){
377 check
= check
& 0x0F;
379 *data
= *data
+ check
;
384 check
= tvb_get_guint8(tvb
, temp_offset
);
386 check
= check
& 0x0F;
388 *data
= *data
+ check
;
390 *data
= *data
- *length
;
393 check
= check
& 0x0F;
395 *data
= check
- *length
;
399 /*often used fields*/
400 static void sml_value(tvbuff_t
*tvb
,proto_tree
*insert_tree
,guint
*offset
, guint
*data
, guint
*length
){
401 proto_item
*value
= NULL
;
402 proto_tree
*value_tree
= NULL
;
404 get_length(tvb
, offset
, data
, length
);
405 value
= proto_tree_add_bytes_format (insert_tree
, hf_sml_value
, tvb
, *offset
, *length
+ *data
, NULL
,"value %s", (*data
== 0)? ": NOT SET" : "");
407 if (tvb_get_guint8(tvb
, *offset
) != OPTIONAL
){
408 value_tree
= proto_item_add_subtree (value
, ett_sml_value
);
409 if ((tvb_get_guint8(tvb
, *offset
) & 0x80) == MSB
|| (tvb_get_guint8(tvb
, *offset
) & 0xF0) == 0){
410 proto_tree_add_text (value_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
414 proto_tree_add_item (value_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
417 proto_tree_add_item (value_tree
, hf_sml_value
, tvb
, *offset
, *data
, ENC_NA
);
424 static void sml_time_type(tvbuff_t
*tvb
, proto_tree
*SML_time_tree
, guint
*offset
){
425 proto_item
*timetype
= NULL
;
426 proto_tree
*timetype_tree
= NULL
;
428 timetype
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, 2, "SML-Time Type");
429 timetype_tree
= proto_item_add_subtree (timetype
, ett_sml_timetype
);
431 proto_tree_add_item (timetype_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
433 proto_tree_add_item (timetype_tree
, hf_sml_timetype
, tvb
, *offset
, 1, ENC_NA
);
437 static void field_codepage(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
438 proto_item
*codepage
= NULL
;
439 proto_tree
*codepage_tree
= NULL
;
441 get_length(tvb
, offset
, data
, length
);
442 codepage
= proto_tree_add_bytes_format (insert_tree
, hf_sml_codepage
, tvb
, *offset
, *length
+ *data
, NULL
,"Codepage %s", (*data
== 0)? ": NOT SET" : "");
445 codepage_tree
= proto_item_add_subtree (codepage
, ett_sml_codepage
);
446 proto_tree_add_text (codepage_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
,plurality(*data
, "octet", "octets"));
449 proto_tree_add_item (codepage_tree
, hf_sml_codepage
, tvb
, *offset
, *data
, ENC_NA
);
456 static void field_clientId(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
457 proto_item
*clientId
= NULL
;
458 proto_tree
*clientId_tree
= NULL
;
460 get_length(tvb
, offset
, data
, length
);
461 clientId
= proto_tree_add_bytes_format (insert_tree
, hf_sml_clientId
, tvb
, *offset
, *length
+ *data
, NULL
, "clientID %s", (*data
== 0)? ": NOT SET" : "");
464 clientId_tree
= proto_item_add_subtree (clientId
, ett_sml_clientId
);
465 proto_tree_add_text (clientId_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
467 proto_tree_add_item (clientId_tree
, hf_sml_clientId
, tvb
, *offset
, *data
, ENC_NA
);
474 static void field_reqFileId(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
475 proto_item
*reqFileId
= NULL
;
476 proto_tree
*reqFileId_tree
= NULL
;
478 get_length(tvb
, offset
, data
, length
);
479 reqFileId
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
, "reqFileId");
481 reqFileId_tree
= proto_item_add_subtree (reqFileId
, ett_sml_reqFileId
);
482 proto_tree_add_text (reqFileId_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
484 proto_tree_add_item (reqFileId_tree
, hf_sml_reqFileId
, tvb
, *offset
, *data
, ENC_NA
);
488 static void field_serverId(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
489 proto_item
*serverId
= NULL
;
490 proto_tree
*serverId_tree
= NULL
;
492 /*Server ID OPTIONAL*/
493 get_length(tvb
, offset
, data
, length
);
494 serverId
= proto_tree_add_bytes_format (insert_tree
,hf_sml_serverId
, tvb
, *offset
, *length
+ *data
, NULL
, "Server ID %s", (*data
== 0)? ": NOT SET" : "");
497 serverId_tree
= proto_item_add_subtree (serverId
, ett_sml_serverId
);
498 proto_tree_add_text (serverId_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
500 proto_tree_add_item (serverId_tree
, hf_sml_serverId
, tvb
, *offset
, *data
, ENC_NA
);
507 static void field_username(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
508 proto_item
*username
= NULL
;
509 proto_tree
*username_tree
= NULL
;
511 /*Username OPTIONAL*/
512 get_length(tvb
, offset
, data
, length
);
513 username
= proto_tree_add_string_format (insert_tree
,hf_sml_username
, tvb
, *offset
, *length
+ *data
, NULL
, "Username %s", (*data
== 0)? ": NOT SET" : "");
516 username_tree
= proto_item_add_subtree (username
, ett_sml_username
);
517 proto_tree_add_text (username_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
519 proto_tree_add_item (username_tree
, hf_sml_username
, tvb
, *offset
, *data
, ENC_ASCII
| ENC_BIG_ENDIAN
);
526 static void field_password(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
527 proto_item
*password
= NULL
;
528 proto_tree
*password_tree
= NULL
;
530 /*Password OPTIONAL*/
531 get_length(tvb
, offset
, data
, length
);
532 password
= proto_tree_add_string_format (insert_tree
,hf_sml_password
, tvb
, *offset
, *length
+ *data
, NULL
, "Password %s", (*data
== 0)? ": NOT SET" : "");
535 password_tree
= proto_item_add_subtree (password
, ett_sml_password
);
536 proto_tree_add_text (password_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
538 proto_tree_add_item (password_tree
, hf_sml_password
, tvb
, *offset
, *data
, ENC_ASCII
| ENC_BIG_ENDIAN
);
545 static void field_smlVersion(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
546 proto_item
*smlVersion
= NULL
;
547 proto_tree
*smlVersion_tree
= NULL
;
549 /*sml-Version OPTIONAL*/
550 get_length(tvb
, offset
, data
, length
);
551 smlVersion
= proto_tree_add_uint_format (insert_tree
, hf_sml_smlVersion
, tvb
, *offset
, *length
+ *data
, *length
+ *data
, "SML-Version %s", (*data
== 0)? ": Version 1" : "");
554 smlVersion_tree
= proto_item_add_subtree (smlVersion
, ett_sml_smlVersion
);
555 proto_tree_add_item (smlVersion_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
558 proto_tree_add_item (smlVersion_tree
, hf_sml_smlVersion
, tvb
, *offset
, 1,ENC_NA
);
565 static void field_globalSignature(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
566 proto_item
*globalSignature
= NULL
;
567 proto_tree
*globalSignature_tree
= NULL
;
569 /*Global Signature OPTIONAL*/
570 get_length(tvb
, offset
, data
, length
);
572 globalSignature
= proto_tree_add_bytes_format (insert_tree
, hf_sml_globalSignature
, tvb
, *offset
, *length
+ *data
, NULL
, "global Signature %s", (*data
== 0)? ": NOT SET" : "");
575 globalSignature_tree
= proto_item_add_subtree (globalSignature
, ett_sml_globalSignature
);
576 proto_tree_add_text (globalSignature_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
578 proto_tree_add_item (globalSignature_tree
, hf_sml_globalSignature
, tvb
, *offset
, *data
, ENC_NA
);
585 static void field_listName(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
586 proto_item
*listName
= NULL
;
587 proto_tree
*listName_tree
= NULL
;
589 /*List Name OPTIONAL*/
590 get_length(tvb
, offset
, data
, length
);
591 listName
= proto_tree_add_bytes_format (insert_tree
,hf_sml_listName
, tvb
, *offset
, *length
+ *data
, NULL
, "List Name %s", (*data
== 0)? ": NOT SET" : "");
594 listName_tree
= proto_item_add_subtree (listName
, ett_sml_listName
);
595 proto_tree_add_text (listName_tree
, tvb
, *offset
, *length
, "Length: %d %s", *length
,plurality(*data
, "octet", "octets"));
597 proto_tree_add_item (listName_tree
, hf_sml_listName
, tvb
, *offset
, *data
, ENC_NA
);
604 static void field_objName(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
605 proto_item
*objName
= NULL
;
606 proto_tree
*objName_tree
= NULL
;
609 get_length(tvb
, offset
, data
, length
);
610 objName
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
,"Objectname");
612 objName_tree
= proto_item_add_subtree (objName
, ett_sml_objName
);
613 proto_tree_add_text (objName_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
,plurality(*data
, "octet", "octets"));
615 proto_tree_add_item (objName_tree
, hf_sml_objName
, tvb
, *offset
, *data
, ENC_NA
);
619 static void field_status(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
620 proto_item
*status
= NULL
;
621 proto_tree
*status_tree
= NULL
;
623 get_length(tvb
, offset
, data
, length
);
624 status
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
,"status %s", (*data
== 0)? ": NOT SET" : "");
627 status_tree
= proto_item_add_subtree (status
, ett_sml_status
);
628 proto_tree_add_item (status_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
630 proto_tree_add_item (status_tree
, hf_sml_status
, tvb
, *offset
, *data
, ENC_BIG_ENDIAN
);
637 static void field_unit(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
638 proto_item
*unit
= NULL
;
639 proto_tree
*unit_tree
= NULL
;
642 get_length(tvb
, offset
, data
, length
);
643 unit
= proto_tree_add_uint_format (insert_tree
, hf_sml_unit
, tvb
, *offset
, *length
+ *data
, *length
+ *data
, "Unit %s", (*data
== 0)? ": NOT SET" : "");
645 unit_tree
= proto_item_add_subtree (unit
, ett_sml_unit
);
646 proto_tree_add_item (unit_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
648 proto_tree_add_item(unit_tree
, hf_sml_unit
, tvb
, *offset
, 1, ENC_NA
);
655 static void field_scaler(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
656 proto_item
*scaler
= NULL
;
657 proto_tree
*scaler_tree
= NULL
;
660 get_length(tvb
, offset
, data
, length
);
661 scaler
= proto_tree_add_uint_format (insert_tree
, hf_sml_scaler
, tvb
, *offset
, *length
+ *data
, *length
+ *data
, "Scaler %s", (*data
== 0)? ": NOT SET" : "");
664 scaler_tree
= proto_item_add_subtree (scaler
, ett_sml_scaler
);
665 proto_tree_add_item (scaler_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
667 proto_tree_add_item(scaler_tree
, hf_sml_scaler
, tvb
, *offset
, 1, ENC_NA
);
674 static void field_valueSignature(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
675 proto_item
*valueSignature
= NULL
;
676 proto_tree
*valueSignature_tree
= NULL
;
679 get_length(tvb
, offset
, data
, length
);
680 valueSignature
= proto_tree_add_bytes_format (insert_tree
, hf_sml_valueSignature
, tvb
, *offset
, *length
+ *data
, NULL
, "ValueSignature %s", (*data
== 0)? ": NOT SET" : "");
683 valueSignature_tree
= proto_item_add_subtree (valueSignature
, ett_sml_valueSignature
);
684 proto_tree_add_text (valueSignature_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
686 proto_tree_add_item (valueSignature_tree
, hf_sml_valueSignature
, tvb
, *offset
, *data
, ENC_NA
);
693 static void field_parameterTreePath(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
694 proto_item
*parameterTreePath
= NULL
;
695 proto_tree
*parameterTreePath_tree
= NULL
;
697 /*parameterTreePath*/
698 get_length(tvb
, offset
, data
, length
);
699 parameterTreePath
= proto_tree_add_bytes_format (insert_tree
, hf_sml_parameterTreePath
, tvb
, *offset
, *length
+ *data
, NULL
, "path_Entry %s", (*data
== 0)? ": NOT SET" : "");
701 parameterTreePath_tree
= proto_item_add_subtree (parameterTreePath
, ett_sml_parameterTreePath
);
702 proto_tree_add_text (parameterTreePath_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
,plurality(*data
, "octet", "octets"));
704 proto_tree_add_item (parameterTreePath_tree
, hf_sml_parameterTreePath
, tvb
, *offset
, *data
, ENC_NA
);
708 static void field_ObjReqEntry(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
709 proto_item
*object_list_Entry
= NULL
;
710 proto_tree
*object_list_Entry_tree
= NULL
;
712 /*parameterTreePath*/
713 get_length(tvb
, offset
, data
, length
);
714 object_list_Entry
= proto_tree_add_text (insert_tree
, tvb
,*offset
, *length
+ *data
, "object_list_Entry");
715 object_list_Entry_tree
= proto_item_add_subtree (object_list_Entry
, ett_sml_object_list_Entry
);
716 proto_tree_add_text (object_list_Entry_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
,plurality(*data
, "octet", "octets"));
718 proto_tree_add_item (object_list_Entry_tree
, hf_sml_object_list_Entry
, tvb
, *offset
, *data
, ENC_NA
);
722 static void field_regPeriod(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
723 proto_item
*regPeriod
= NULL
;
724 proto_tree
*regPeriod_tree
= NULL
;
726 get_length(tvb
, offset
, data
, length
);
727 regPeriod
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
, "regPeriod");
729 regPeriod_tree
= proto_item_add_subtree (regPeriod
, ett_sml_regPeriod
);
730 proto_tree_add_item (regPeriod_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
732 proto_tree_add_item (regPeriod_tree
, hf_sml_regPeriod
, tvb
, *offset
, *data
, ENC_BIG_ENDIAN
);
736 static void field_rawdata(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
737 proto_item
*rawdata
= NULL
;
738 proto_tree
*rawdata_tree
= NULL
;
741 get_length(tvb
, offset
, data
, length
);
742 rawdata
= proto_tree_add_bytes_format (insert_tree
, hf_sml_rawdata
, tvb
, *offset
, *length
+ *data
, NULL
, "rawdata %s", (*data
== 0)? ": NOT SET" : "");
745 rawdata_tree
= proto_item_add_subtree (rawdata
, ett_sml_rawdata
);
746 proto_tree_add_text (rawdata_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
748 proto_tree_add_item (rawdata_tree
, hf_sml_rawdata
, tvb
, *offset
, *data
, ENC_NA
);
755 static void field_periodSignature(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
756 proto_item
*periodSignature
= NULL
;
757 proto_tree
*periodSignature_tree
= NULL
;
760 get_length(tvb
, offset
, data
, length
);
761 periodSignature
= proto_tree_add_bytes_format (insert_tree
, hf_sml_periodSignature
, tvb
, *offset
, *length
+ *data
, NULL
,"periodSignature %s", (*data
== 0)? ": NOT SET" : "");
764 periodSignature_tree
= proto_item_add_subtree (periodSignature
, ett_sml_periodSignature
);
765 proto_tree_add_text (periodSignature_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
, plurality(*data
, "octet", "octets"));
767 proto_tree_add_item (periodSignature_tree
, hf_sml_periodSignature
, tvb
, *offset
, *data
, ENC_NA
);
774 static void field_actTime(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
775 proto_item
*actTime
= NULL
;
776 proto_tree
*actTime_tree
= NULL
;
778 get_length(tvb
, offset
, data
, length
);
779 actTime
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
, "actTime");
780 actTime_tree
= proto_item_add_subtree (actTime
, ett_sml_actTime
);
781 proto_tree_add_item (actTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
783 proto_tree_add_item(actTime_tree
, hf_sml_actTime
, tvb
, *offset
, *data
, ENC_BIG_ENDIAN
);
787 static void field_valTime(tvbuff_t
*tvb
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
788 proto_item
*valTime
= NULL
;
789 proto_tree
*valTime_tree
= NULL
;
791 get_length(tvb
, offset
, data
, length
);
792 valTime
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
, "valTime");
793 valTime_tree
= proto_item_add_subtree (valTime
, ett_sml_valTime
);
794 proto_tree_add_item (valTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
796 proto_tree_add_item(valTime_tree
, hf_sml_valTime
, tvb
, *offset
, *data
, ENC_BIG_ENDIAN
);
800 static void TupelEntryTree(tvbuff_t
*tvb
, proto_tree
*procParValue_tree
, guint
*offset
){
801 proto_item
*TupelEntry
= NULL
;
802 proto_item
*SML_time
= NULL
;
803 proto_item
*secIndex
= NULL
;
804 proto_item
*unit_pA
= NULL
;
805 proto_item
*scaler_pA
= NULL
;
806 proto_item
*value_pA
= NULL
;
807 proto_item
*unit_mA
= NULL
;
808 proto_item
*scaler_mA
= NULL
;
809 proto_item
*value_mA
= NULL
;
810 proto_item
*unit_R1
= NULL
;
811 proto_item
*scaler_R1
= NULL
;
812 proto_item
*value_R1
= NULL
;
813 proto_item
*unit_R2
= NULL
;
814 proto_item
*scaler_R2
= NULL
;
815 proto_item
*value_R2
= NULL
;
816 proto_item
*unit_R3
= NULL
;
817 proto_item
*scaler_R3
= NULL
;
818 proto_item
*value_R3
= NULL
;
819 proto_item
*unit_R4
= NULL
;
820 proto_item
*scaler_R4
= NULL
;
821 proto_item
*value_R4
= NULL
;
822 proto_item
*signature_pA_R1_R4
= NULL
;
823 proto_item
*signature_mA_R2_R3
= NULL
;
825 proto_tree
*TupelEntry_list
= NULL
;
826 proto_tree
*SML_time_tree
= NULL
;
827 proto_tree
*secIndex_tree
= NULL
;
828 proto_tree
*unit_pA_tree
= NULL
;
829 proto_tree
*scaler_pA_tree
= NULL
;
830 proto_tree
*value_pA_tree
= NULL
;
831 proto_tree
*unit_mA_tree
= NULL
;
832 proto_tree
*scaler_mA_tree
= NULL
;
833 proto_tree
*value_mA_tree
= NULL
;
834 proto_tree
*unit_R1_tree
= NULL
;
835 proto_tree
*scaler_R1_tree
= NULL
;
836 proto_tree
*value_R1_tree
= NULL
;
837 proto_tree
*unit_R2_tree
= NULL
;
838 proto_tree
*scaler_R2_tree
= NULL
;
839 proto_tree
*value_R2_tree
= NULL
;
840 proto_tree
*unit_R3_tree
= NULL
;
841 proto_tree
*scaler_R3_tree
= NULL
;
842 proto_tree
*value_R3_tree
= NULL
;
843 proto_tree
*unit_R4_tree
= NULL
;
844 proto_tree
*scaler_R4_tree
= NULL
;
845 proto_tree
*value_R4_tree
= NULL
;
846 proto_tree
*signature_pA_R1_R4_tree
= NULL
;
847 proto_tree
*signature_mA_R2_R3_tree
= NULL
;
853 TupelEntry
= proto_tree_add_text (procParValue_tree
, tvb
, *offset
, -1, "TupelEntry");
854 TupelEntry_list
= proto_item_add_subtree (TupelEntry
, ett_sml_tupel
);
855 get_length(tvb
, offset
, &data
, &length
);
859 field_serverId(tvb
, TupelEntry_list
, offset
, &data
, &length
);
862 SML_time
= proto_tree_add_text (procParValue_tree
, tvb
, *offset
, -1, "secIndex");
863 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
865 sml_time_type(tvb
, SML_time_tree
, offset
);
866 get_length(tvb
, offset
, &data
, &length
);
867 secIndex
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+ data
, "secIndex");
868 secIndex_tree
= proto_item_add_subtree (secIndex
, ett_sml_secIndex
);
869 proto_tree_add_item (secIndex_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
871 proto_tree_add_item(secIndex_tree
, hf_sml_secIndex
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
873 proto_item_set_end(SML_time
, tvb
, *offset
);
875 /*Sml Status OPTIONAL*/
876 field_status(tvb
, TupelEntry_list
, offset
, &data
, &length
);
879 unit_pA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_pA");
880 unit_pA_tree
= proto_item_add_subtree(unit_pA
, ett_sml_unit_pA
);
881 proto_tree_add_item (unit_pA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
883 proto_tree_add_item (unit_pA_tree
, hf_sml_unit_pA
, tvb
, *offset
, 1, ENC_NA
);
887 scaler_pA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "scaler_pA");
888 scaler_pA_tree
= proto_item_add_subtree(scaler_pA
, ett_sml_scaler_pA
);
889 proto_tree_add_item (scaler_pA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
891 proto_tree_add_item (scaler_pA_tree
, hf_sml_scaler_pA
, tvb
, *offset
, 1, ENC_NA
);
895 get_length(tvb
, offset
, &data
, &length
);
896 value_pA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_pA");
897 value_pA_tree
= proto_item_add_subtree(value_pA
, ett_sml_value_pA
);
898 proto_tree_add_item (value_pA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
900 proto_tree_add_item (value_pA_tree
, hf_sml_value_pA
, tvb
, *offset
, data
, ENC_NA
);
904 unit_R1
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_R1");
905 unit_R1_tree
= proto_item_add_subtree(unit_R1
, ett_sml_unit_R1
);
906 proto_tree_add_item (unit_R1_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
908 proto_tree_add_item (unit_R1_tree
, hf_sml_unit_R1
, tvb
, *offset
, 1, ENC_NA
);
912 scaler_R1
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 1, "scaler_R1");
913 scaler_R1_tree
= proto_item_add_subtree(scaler_R1
, ett_sml_scaler_R1
);
914 proto_tree_add_item (scaler_R1_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
916 proto_tree_add_item (scaler_R1_tree
, hf_sml_scaler_R1
, tvb
, *offset
, 1, ENC_NA
);
920 get_length(tvb
, offset
, &data
, &length
);
921 value_R1
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_R1");
922 value_R1_tree
= proto_item_add_subtree(value_R1
, ett_sml_value_R1
);
923 proto_tree_add_item (value_R1_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
925 proto_tree_add_item (value_R1_tree
, hf_sml_value_R1
, tvb
, *offset
, data
, ENC_NA
);
929 unit_R4
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_R4");
930 unit_R4_tree
= proto_item_add_subtree(unit_R4
, ett_sml_unit_R4
);
931 proto_tree_add_item (unit_R4_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
933 proto_tree_add_item (unit_R4_tree
, hf_sml_unit_R4
, tvb
, *offset
, 1, ENC_NA
);
937 scaler_R4
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "scaler_R4");
938 scaler_R4_tree
= proto_item_add_subtree(scaler_R4
, ett_sml_scaler_R4
);
939 proto_tree_add_item (scaler_R4_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
941 proto_tree_add_item (scaler_R4_tree
, hf_sml_scaler_R4
, tvb
, *offset
, 1, ENC_NA
);
945 get_length(tvb
, offset
, &data
, &length
);
946 value_R4
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_R4");
947 value_R4_tree
= proto_item_add_subtree(value_R4
, ett_sml_value_R4
);
948 proto_tree_add_item (value_R4_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
950 proto_tree_add_item (value_R4_tree
, hf_sml_value_R4
, tvb
, *offset
, data
, ENC_NA
);
953 /*signature_pA_R1_R4*/
954 get_length(tvb
, offset
, &data
, &length
);
955 signature_pA_R1_R4
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "signature_pa_R1_R4");
956 signature_pA_R1_R4_tree
= proto_item_add_subtree(signature_pA_R1_R4
, ett_sml_signature_pA_R1_R4
);
957 proto_tree_add_text (signature_pA_R1_R4_tree
, tvb
, *offset
, length
, "Length: %d %s", data
,plurality(data
, "octet", "octets"));
959 proto_tree_add_item (signature_pA_R1_R4_tree
, hf_sml_signature_pA_R1_R4
, tvb
, *offset
, data
, ENC_NA
);
963 unit_mA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_mA");
964 unit_mA_tree
= proto_item_add_subtree(unit_mA
, ett_sml_unit_mA
);
965 proto_tree_add_item (unit_mA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
967 proto_tree_add_item (unit_mA_tree
, hf_sml_unit_mA
, tvb
, *offset
, 1, ENC_NA
);
971 scaler_mA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "scaler_mA");
972 scaler_mA_tree
= proto_item_add_subtree(scaler_mA
, ett_sml_scaler_mA
);
973 proto_tree_add_item (scaler_mA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
975 proto_tree_add_item (scaler_mA_tree
, hf_sml_scaler_mA
, tvb
, *offset
, 1, ENC_NA
);
979 get_length(tvb
, offset
, &data
, &length
);
980 value_mA
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_mA");
981 value_mA_tree
= proto_item_add_subtree(value_mA
, ett_sml_value_mA
);
982 proto_tree_add_item (value_mA_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
984 proto_tree_add_item (value_mA_tree
, hf_sml_value_mA
, tvb
, *offset
, data
, ENC_NA
);
988 unit_R2
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_R2");
989 unit_R2_tree
= proto_item_add_subtree(unit_R2
, ett_sml_unit_R2
);
990 proto_tree_add_item (unit_R2_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
992 proto_tree_add_item (unit_R2_tree
, hf_sml_unit_R2
, tvb
, *offset
, 1, ENC_NA
);
996 scaler_R2
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "scaler_R2");
997 scaler_R2_tree
= proto_item_add_subtree(scaler_R2
, ett_sml_scaler_R2
);
998 proto_tree_add_item (scaler_R2_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1000 proto_tree_add_item (scaler_R2_tree
, hf_sml_scaler_R2
, tvb
, *offset
, 1, ENC_NA
);
1004 get_length(tvb
, offset
, &data
, &length
);
1005 value_R2
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_R2");
1006 value_R2_tree
= proto_item_add_subtree(value_R2
, ett_sml_value_R2
);
1007 proto_tree_add_item (value_R2_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1009 proto_tree_add_item (value_R2_tree
, hf_sml_value_R2
, tvb
, *offset
, data
, ENC_NA
);
1013 unit_R3
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "unit_R3");
1014 unit_R3_tree
= proto_item_add_subtree(unit_R3
, ett_sml_unit_R3
);
1015 proto_tree_add_item (unit_R3_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1017 proto_tree_add_item (unit_R3_tree
, hf_sml_unit_R3
, tvb
, *offset
, 1, ENC_NA
);
1021 scaler_R3
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, 2, "scaler_R3");
1022 scaler_R3_tree
= proto_item_add_subtree(scaler_R3
, ett_sml_scaler_R3
);
1023 proto_tree_add_item (scaler_R3_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1025 proto_tree_add_item (scaler_R3_tree
, hf_sml_scaler_R3
, tvb
, *offset
, 1, ENC_NA
);
1029 get_length(tvb
, offset
, &data
, &length
);
1030 value_R3
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "value_R3");
1031 value_R3_tree
= proto_item_add_subtree(value_R3
, ett_sml_value_R3
);
1032 proto_tree_add_item (value_R3_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1034 proto_tree_add_item (value_R3_tree
, hf_sml_value_R3
, tvb
, *offset
, data
, ENC_NA
);
1037 /*signature_mA_R2_R3*/
1038 get_length(tvb
, offset
, &data
, &length
);
1039 signature_mA_R2_R3
= proto_tree_add_text (TupelEntry_list
, tvb
, *offset
, length
+data
, "signature_mA_R2_R3");
1040 signature_mA_R2_R3_tree
= proto_item_add_subtree(signature_mA_R2_R3
, ett_sml_signature_mA_R2_R3
);
1041 proto_tree_add_text (signature_mA_R2_R3_tree
, tvb
, *offset
, length
, "Length: %d %s", data
,plurality(data
, "octet", "octets"));
1043 proto_tree_add_item (signature_mA_R2_R3_tree
, hf_sml_signature_mA_R2_R3
, tvb
, *offset
, data
, ENC_NA
);
1046 proto_item_set_end(TupelEntry
, tvb
, *offset
);
1049 static void child_tree(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*insert_tree
, guint
*offset
, guint
*data
, guint
*length
){
1050 proto_item
*parameterName
= NULL
;
1051 proto_item
*procParValue
= NULL
;
1052 proto_item
*child
= NULL
;
1053 proto_item
*procParValuetype
= NULL
;
1054 proto_item
*periodEntry
= NULL
;
1055 proto_item
*SML_time
= NULL
;
1056 proto_item
*procParValueTime
= NULL
;
1057 proto_item
*tree_Entry
= NULL
;
1059 proto_tree
*parameterName_tree
= NULL
;
1060 proto_tree
*procParValue_tree
= NULL
;
1061 proto_tree
*procParValuetype_tree
= NULL
;
1062 proto_tree
*periodEntry_tree
= NULL
;
1063 proto_tree
*SML_time_tree
= NULL
;
1064 proto_tree
*procParValueTime_tree
= NULL
;
1065 proto_tree
*child_list
= NULL
;
1066 proto_tree
*tree_Entry_list
= NULL
;
1073 get_length(tvb
, offset
, data
, length
);
1074 parameterName
= proto_tree_add_text (insert_tree
, tvb
, *offset
, *length
+ *data
,"parameterName");
1075 parameterName_tree
= proto_item_add_subtree (parameterName
, ett_sml_parameterName
);
1076 proto_tree_add_text (parameterName_tree
, tvb
, *offset
, *length
, "Length: %d %s", *data
,plurality(*data
, "octet", "octets"));
1078 proto_tree_add_item (parameterName_tree
, hf_sml_parameterName
, tvb
, *offset
, *data
, ENC_NA
);
1081 /*procParValue OPTIONAL*/
1082 check
= tvb_get_guint8(tvb
, *offset
);
1084 if (check
== OPTIONAL
){
1085 procParValue
= proto_tree_add_item(insert_tree
, hf_sml_procParValue
, tvb
, *offset
, 1, ENC_NA
);
1086 proto_item_append_text(procParValue
, ": NOT SET");
1089 else if (check
== 0x72){
1090 get_length(tvb
, offset
, data
, length
);
1091 procParValue
= proto_tree_add_text(insert_tree
, tvb
, *offset
, -1, "ProcParValue");
1092 procParValue_tree
= proto_item_add_subtree (procParValue
, ett_sml_procParValue
);
1095 /*procParValue CHOOSE*/
1096 procParValuetype
= proto_tree_add_text (procParValue_tree
, tvb
, *offset
, 2, "ProcParValueType");
1097 procParValuetype_tree
= proto_item_add_subtree (procParValuetype
, ett_sml_procParValuetype
);
1098 proto_tree_add_item (procParValuetype_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1100 check
= tvb_get_guint8(tvb
, *offset
);
1101 proto_tree_add_item (procParValuetype_tree
, hf_sml_procParValue
, tvb
, *offset
, 1 ,ENC_NA
);
1107 sml_value(tvb
, procParValue_tree
, offset
, data
, length
);
1112 get_length(tvb
, offset
, data
, length
);
1113 periodEntry
= proto_tree_add_text(procParValue_tree
, tvb
, *offset
, -1, "PeriodEntry List with %d %s", *length
+ *data
, plurality(*length
+ *data
, "element", "elements"));
1114 periodEntry_tree
= proto_item_add_subtree(periodEntry
, ett_sml_periodEntry
);
1118 field_objName(tvb
, periodEntry_tree
, offset
, data
, length
);
1121 field_unit(tvb
, periodEntry_tree
, offset
, data
, length
);
1124 field_scaler(tvb
, periodEntry_tree
, offset
, data
, length
);
1127 sml_value(tvb
, periodEntry_tree
, offset
, data
, length
);
1130 field_valueSignature(tvb
, periodEntry_tree
, offset
, data
, length
);
1132 proto_item_set_end(periodEntry
, tvb
, *offset
);
1137 if (tvb_get_guint8(tvb
, *offset
) == 0xF1 && tvb_get_guint8(tvb
, *offset
+1) == 0x07){
1138 TupelEntryTree(tvb
, procParValue_tree
, offset
);
1141 expert_add_info(pinfo
, NULL
, &ei_sml_tupel_error
);
1147 SML_time
= proto_tree_add_text (procParValue_tree
, tvb
, *offset
, -1, "Time");
1148 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1151 sml_time_type(tvb
, SML_time_tree
, offset
);
1154 get_length(tvb
, offset
, data
, length
);
1155 procParValueTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, *length
+ *data
, "procParValueTime");
1156 procParValueTime_tree
= proto_item_add_subtree (procParValueTime
, ett_sml_procParValueTime
);
1157 proto_tree_add_item (procParValueTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1159 proto_tree_add_item(procParValueTime_tree
, hf_sml_procParValueTime
, tvb
, *offset
, *data
, ENC_BIG_ENDIAN
);
1162 proto_item_set_end(SML_time
, tvb
, *offset
);
1166 expert_add_info(pinfo
, procParValue
, &ei_sml_procParValue_invalid
);
1169 proto_item_set_end(procParValue
, tvb
, *offset
);
1172 expert_add_info(pinfo
, NULL
, &ei_sml_procParValue_errror
);
1176 /*child list OPTIONAL*/
1177 check
= tvb_get_guint8(tvb
, *offset
);
1179 if (check
== OPTIONAL
){
1180 proto_tree_add_text (insert_tree
, tvb
, *offset
, 1, "Child List: NOT SET");
1183 else if ((check
& 0x0F) != 0){
1185 get_length(tvb
, offset
, data
, length
);
1186 child
= proto_tree_add_text(insert_tree
, tvb
, *offset
, -1, "Child List with %d %s", *length
+ *data
, plurality(*length
+ *data
, "element", "elements"));
1187 child_list
= proto_item_add_subtree(child
, ett_sml_child
);
1190 tree_Entry
= proto_tree_add_text (child_list
, tvb
, *offset
, -1, "tree_Entry");
1191 tree_Entry_list
= proto_item_add_subtree(tree_Entry
, ett_sml_tree_Entry
);
1194 child_tree(tvb
, pinfo
,tree_Entry_list
, offset
, data
, length
);
1196 proto_item_set_end(tree_Entry
, tvb
, *offset
);
1197 proto_item_set_end(child
, tvb
, *offset
);
1199 else if ((check
& 0xF0) == SHORT_LIST
|| (check
& 0xF0) == LONG_LIST
){
1200 get_length(tvb
, offset
, data
, length
);
1201 repeat
= *length
+ *data
;
1202 child
= proto_tree_add_text(insert_tree
, tvb
, *offset
, -1, "Child List with %d %s", *length
+ *data
, plurality(*length
+ *data
, "element", "elements"));
1203 child_list
= proto_item_add_subtree(child
, ett_sml_child
);
1205 expert_add_info_format(pinfo
, child
, &ei_sml_invalid_count
, "invalid loop count");
1210 for(i
=0 ; i
< repeat
; i
++){
1211 tree_Entry
= proto_tree_add_text (child_list
, tvb
, *offset
, -1, "tree_Entry");
1212 tree_Entry_list
= proto_item_add_subtree(tree_Entry
, ett_sml_tree_Entry
);
1214 if (tvb_get_guint8(tvb
, *offset
) != 0x73){
1215 expert_add_info_format(pinfo
, tree_Entry
, &ei_sml_invalid_count
, "invalid count of elements in tree_Entry");
1220 child_tree(tvb
, pinfo
, tree_Entry_list
, offset
, data
, length
);
1221 proto_item_set_end(tree_Entry
, tvb
, *offset
);
1223 proto_item_set_end(child
, tvb
, *offset
);
1227 expert_add_info_format(pinfo
, NULL
, &ei_sml_invalid_count
, "invalid count of elements in child List");
1232 static void decode_PublicOpenReq (tvbuff_t
*tvb
, proto_tree
*messagebodytree_list
, guint
*offset
){
1236 /*Codepage OPTIONAL*/
1237 field_codepage (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1240 field_clientId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1243 field_reqFileId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1246 field_serverId(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1249 field_username(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1252 field_password(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1254 /*sml-Version OPTIONAL*/
1255 field_smlVersion(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1258 static void decode_PublicOpenRes (tvbuff_t
*tvb
, proto_tree
*messagebodytree_list
, guint
*offset
){
1259 proto_item
*refTime
= NULL
;
1260 proto_item
*SML_time
= NULL
;
1262 proto_tree
*refTime_tree
= NULL
;
1263 proto_tree
*SML_time_tree
= NULL
;
1268 /*Codepage OPTIONAL*/
1269 field_codepage (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1271 /*clientID OPTIONAL*/
1272 field_clientId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1275 field_reqFileId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1278 field_serverId(tvb
,messagebodytree_list
,offset
, &data
, &length
);
1280 /*RefTime Optional*/
1281 get_length(tvb
, offset
, &data
, &length
);
1284 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "refTime: NOT SET");
1289 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "refTime");
1290 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1293 sml_time_type(tvb
, SML_time_tree
, offset
);
1296 get_length(tvb
, offset
, &data
, &length
);
1297 refTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+data
, "refTime");
1298 refTime_tree
= proto_item_add_subtree (refTime
, ett_sml_refTime
);
1299 proto_tree_add_item (refTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1301 proto_tree_add_item(refTime_tree
, hf_sml_refTime
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
1303 proto_item_set_end(SML_time
,tvb
,*offset
);
1305 /*sml-Version OPTIONAL*/
1306 field_smlVersion(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1309 static gboolean
decode_GetProfile_List_Pack_Req (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
1310 proto_item
*withRawdata
= NULL
;
1311 proto_item
*SML_time
= NULL
;
1312 proto_item
*beginTime
= NULL
;
1313 proto_item
*treepath
= NULL
;
1314 proto_item
*object_list
= NULL
;
1315 proto_item
*endTime
= NULL
;
1316 proto_item
*dasDetails
= NULL
;
1318 proto_tree
*withRawdata_tree
= NULL
;
1319 proto_tree
*SML_time_tree
= NULL
;
1320 proto_tree
*beginTime_tree
= NULL
;
1321 proto_tree
*treepath_list
= NULL
;
1322 proto_tree
*object_list_list
= NULL
;
1323 proto_tree
*endTime_tree
= NULL
;
1324 proto_tree
*dasDetails_list
= NULL
;
1333 field_serverId(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1336 field_username(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1339 field_password(tvb
,messagebodytree_list
, offset
, &data
, &length
);
1341 /*withRawdata OPTIONAL*/
1342 get_length(tvb
, offset
, &data
, &length
);
1343 withRawdata
= proto_tree_add_uint_format (messagebodytree_list
, hf_sml_withRawdata
, tvb
, *offset
, data
+length
, data
+length
, "withRawdata %s", (data
== 0)? ": NOT SET" : "");
1346 withRawdata_tree
= proto_item_add_subtree (withRawdata
, ett_sml_withRawdata
);
1347 proto_tree_add_item (withRawdata_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1349 proto_tree_add_item (withRawdata_tree
, hf_sml_withRawdata
, tvb
, *offset
, 1, ENC_NA
);
1355 /*beginTime OPTIONAL*/
1356 get_length(tvb
, offset
, &data
, &length
);
1359 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "beginTime: NOT SET");
1364 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "beginTime");
1365 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1368 sml_time_type(tvb
, SML_time_tree
, offset
);
1371 get_length(tvb
, offset
, &data
, &length
);
1372 beginTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+ data
, "beginTime");
1373 beginTime_tree
= proto_item_add_subtree (beginTime
, ett_sml_beginTime
);
1374 proto_tree_add_item (beginTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1376 proto_tree_add_item(beginTime_tree
, hf_sml_beginTime
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
1378 proto_item_set_end(SML_time
,tvb
,*offset
);
1381 /*endTime OPTIONAL*/
1382 get_length(tvb
, offset
, &data
, &length
);
1385 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "endTime: NOT SET");
1390 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "endTime");
1391 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1394 sml_time_type(tvb
, SML_time_tree
, offset
);
1397 get_length(tvb
, offset
, &data
, &length
);
1398 endTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+ data
, "endTime");
1399 endTime_tree
= proto_item_add_subtree (endTime
, ett_sml_beginTime
);
1400 proto_tree_add_item (endTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1402 proto_tree_add_item(endTime_tree
, hf_sml_endTime
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
1404 proto_item_set_end(SML_time
,tvb
,*offset
);
1408 get_length(tvb
, offset
, &data
, &length
);
1409 repeat
= (data
+length
);
1410 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "parameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1411 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
1413 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1414 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in Treepath");
1417 else if (repeat
<= 0){
1418 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
1423 for (i
=0; i
< repeat
; i
++) {
1424 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
1426 proto_item_set_end(treepath
, tvb
, *offset
);
1429 if (tvb_get_guint8(tvb
,*offset
) == OPTIONAL
){
1430 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, 1, "object_List: NOT SET");
1434 get_length(tvb
, offset
, &data
, &length
);
1435 repeat
= (data
+length
);
1436 object_list
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "object_List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1437 object_list_list
= proto_item_add_subtree(object_list
, ett_sml_object_list
);
1439 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1440 expert_add_info_format(pinfo
, object_list
, &ei_sml_invalid_count
, "invalid count of elements in object_List");
1443 else if (repeat
<= 0){
1444 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
1450 for (i
=0; i
< repeat
; i
++) {
1451 field_ObjReqEntry(tvb
, object_list_list
, offset
, &data
, &length
);
1453 proto_item_set_end(object_list
, tvb
, *offset
);
1457 check
= tvb_get_guint8(tvb
,*offset
);
1459 if (check
== OPTIONAL
){
1460 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, 1, "dasDetails: NOT SET");
1463 else if ((check
& 0xF0) == LONG_LIST
|| (check
& 0xF0) == SHORT_LIST
){
1464 get_length(tvb
, offset
, &data
, &length
);
1465 dasDetails
= proto_tree_add_text(messagebodytree_list
, tvb
, *offset
, -1, "dasDetails with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1466 dasDetails_list
= proto_item_add_subtree(dasDetails
, ett_sml_dasDetails
);
1469 child_tree(tvb
, pinfo
, dasDetails_list
, offset
, &data
, &length
);
1470 proto_item_set_end(dasDetails
, tvb
, *offset
);
1473 expert_add_info_format(pinfo
, NULL
, &ei_sml_invalid_count
, "invalid count of elements in dasDetails");
1479 static gboolean
decode_GetProfilePackRes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
1480 proto_item
*SML_time
= NULL
;
1481 proto_item
*treepath
= NULL
;
1482 proto_item
*periodList
= NULL
;
1483 proto_item
*period_List_Entry
= NULL
;
1484 proto_item
*headerList
= NULL
;
1485 proto_item
*header_List_Entry
= NULL
;
1486 proto_item
*profileSignature
= NULL
;
1487 proto_item
*valuelist
= NULL
;
1488 proto_item
*value_List_Entry
= NULL
;
1490 proto_tree
*SML_time_tree
= NULL
;
1491 proto_tree
*treepath_list
= NULL
;
1492 proto_tree
*periodList_list
= NULL
;
1493 proto_tree
*period_List_Entry_list
= NULL
;
1494 proto_tree
*headerList_subtree
= NULL
;
1495 proto_tree
*header_List_Entry_list
= NULL
;
1496 proto_tree
*profileSignature_tree
= NULL
;
1497 proto_tree
*valuelist_list
= NULL
;
1498 proto_tree
*value_List_Entry_list
= NULL
;
1508 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1511 get_length(tvb
, offset
, &data
, &length
);
1512 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "actTime List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1513 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1515 sml_time_type(tvb
, SML_time_tree
, offset
);
1516 field_actTime(tvb
, SML_time_tree
, offset
, &data
, &length
);
1517 proto_item_set_end(SML_time
,tvb
,*offset
);
1520 field_regPeriod(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1523 get_length(tvb
, offset
, &data
, &length
);
1524 repeat
= (data
+length
);
1525 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "parameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1526 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
1528 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1529 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in Treepath");
1532 else if (repeat
<= 0){
1533 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
1539 for (i
=0; i
< repeat
; i
++) {
1540 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
1542 proto_item_set_end(treepath
, tvb
, *offset
);
1545 get_length(tvb
, offset
, &data
, &length
);
1546 repeat
= (data
+length
);
1547 headerList
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "header_List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1548 headerList_subtree
= proto_item_add_subtree(headerList
, ett_sml_headerList
);
1550 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1551 expert_add_info_format(pinfo
, headerList
, &ei_sml_invalid_count
, "invalid count of elements in headerlist");
1554 else if (repeat
<= 0){
1555 expert_add_info_format(pinfo
, headerList
, &ei_sml_invalid_count
, "invalid loop count");
1561 for (i
=0; i
< repeat
; i
++) {
1562 get_length(tvb
, offset
, &data
, &length
);
1563 header_List_Entry
= proto_tree_add_text (headerList_subtree
, tvb
, *offset
, -1, "header_List_Entry with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1564 header_List_Entry_list
= proto_item_add_subtree(header_List_Entry
, ett_sml_header_List_Entry
);
1568 field_objName(tvb
, header_List_Entry_list
, offset
, &data
, &length
);
1571 field_unit(tvb
, header_List_Entry_list
, offset
, &data
, &length
);
1574 field_scaler(tvb
, header_List_Entry_list
, offset
, &data
, &length
);
1576 proto_item_set_end(header_List_Entry
, tvb
, *offset
);
1578 proto_item_set_end(headerList
, tvb
, *offset
);
1581 get_length(tvb
, offset
, &data
, &length
);
1582 repeat
= (data
+length
);
1583 periodList
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "period_List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1584 periodList_list
= proto_item_add_subtree(periodList
, ett_sml_periodList
);
1586 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1587 expert_add_info_format(pinfo
, periodList
, &ei_sml_invalid_count
, "invalid count of elements in periodList");
1590 else if (repeat
<= 0){
1591 expert_add_info_format(pinfo
, periodList
, &ei_sml_invalid_count
, "invalid loop count");
1597 for (i
=0; i
< repeat
; i
++) {
1598 get_length(tvb
, offset
, &data
, &length
);
1599 period_List_Entry
= proto_tree_add_text (periodList_list
, tvb
, *offset
, -1, "period_List_Entry with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1600 period_List_Entry_list
= proto_item_add_subtree(period_List_Entry
, ett_sml_period_List_Entry
);
1604 get_length(tvb
, offset
, &data
, &length
);
1605 SML_time
= proto_tree_add_text (period_List_Entry
, tvb
, *offset
, -1, "valTime");
1606 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1608 sml_time_type(tvb
, SML_time_tree
, offset
);
1609 field_valTime(tvb
, SML_time_tree
, offset
, &data
, &length
);
1610 proto_item_set_end(SML_time
,tvb
, *offset
);
1613 field_status(tvb
, period_List_Entry_list
, offset
, &data
, &length
);
1616 get_length(tvb
, offset
, &data
, &length
);
1617 repeat2
= data
+ length
;
1618 valuelist
= proto_tree_add_text (period_List_Entry_list
, tvb
, *offset
, -1, "period_List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1619 valuelist_list
= proto_item_add_subtree(valuelist
, ett_sml_valuelist
);
1621 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1622 expert_add_info_format(pinfo
, valuelist
, &ei_sml_invalid_count
, "invalid count of elements in valueList");
1625 else if (repeat2
<= 0){
1626 expert_add_info_format(pinfo
, valuelist
, &ei_sml_invalid_count
, "invalid loop count");
1632 for (d
=0; d
< repeat2
; d
++) {
1633 get_length(tvb
, offset
, &data
, &length
);
1634 value_List_Entry
= proto_tree_add_text (valuelist_list
, tvb
, *offset
, -1, "value_List_Entry with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1635 value_List_Entry_list
= proto_item_add_subtree(value_List_Entry
, ett_sml_value_List_Entry
);
1639 sml_value(tvb
, value_List_Entry_list
, offset
, &data
, &length
);
1642 field_valueSignature(tvb
, value_List_Entry_list
, offset
, &data
, &length
);
1644 proto_item_set_end(value_List_Entry
, tvb
, *offset
);
1646 proto_item_set_end(valuelist
, tvb
, *offset
);
1648 /*period Signature*/
1649 field_periodSignature(tvb
, period_List_Entry_list
, offset
, &data
, &length
);
1651 proto_item_set_end(period_List_Entry
, tvb
, *offset
);
1653 proto_item_set_end(periodList
,tvb
, *offset
);
1656 field_rawdata(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1658 /*profile Signature*/
1659 get_length(tvb
, offset
, &data
, &length
);
1660 profileSignature
= proto_tree_add_bytes_format (messagebodytree_list
, hf_sml_profileSignature
, tvb
, *offset
, length
+data
, NULL
, "profileSignature %s", (data
== 0)? ": NOT SET" : "");
1663 profileSignature_tree
= proto_item_add_subtree (profileSignature
, ett_sml_profileSignature
);
1664 proto_tree_add_text (profileSignature_tree
, tvb
, *offset
, length
, "Length: %d %s", data
, plurality(data
, "octet", "octets"));
1666 proto_tree_add_item (profileSignature_tree
, hf_sml_profileSignature
, tvb
, *offset
, data
, ENC_NA
);
1675 static gboolean
decode_GetProfileListRes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
1676 proto_item
*SML_time
= NULL
;
1677 proto_item
*treepath
= NULL
;
1678 proto_item
*periodList
= NULL
;
1679 proto_item
*periodList_Entry
= NULL
;
1681 proto_tree
*SML_time_tree
= NULL
;
1682 proto_tree
*treepath_list
= NULL
;
1683 proto_tree
*periodList_list
= NULL
;
1684 proto_tree
*periodList_Entry_list
= NULL
;
1692 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1695 get_length(tvb
, offset
, &data
, &length
);
1696 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "actTime");
1697 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1699 sml_time_type(tvb
, SML_time_tree
, offset
);
1700 field_actTime(tvb
, SML_time_tree
, offset
, &data
, &length
);
1701 proto_item_set_end(SML_time
,tvb
, *offset
);
1704 field_regPeriod(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1707 get_length(tvb
, offset
, &data
, &length
);
1708 repeat
= (data
+length
);
1709 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "parameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1710 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
1712 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1713 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in parameterTreePath");
1716 else if (repeat
<= 0){
1717 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
1723 for (i
=0; i
< repeat
; i
++) {
1724 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
1726 proto_item_set_end(treepath
, tvb
,*offset
);
1728 /*valTime Optional*/
1729 get_length(tvb
, offset
, &data
, &length
);
1732 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "valTime: NOT SET");
1737 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "valTime");
1738 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1741 sml_time_type(tvb
, SML_time_tree
, offset
);
1742 field_valTime(tvb
, SML_time_tree
, offset
, &data
, &length
);
1743 proto_item_set_end(SML_time
,tvb
,*offset
);
1747 field_status(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1750 get_length(tvb
, offset
, &data
, &length
);
1751 repeat
= (data
+length
);
1752 periodList
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "period-List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1753 periodList_list
= proto_item_add_subtree(periodList
, ett_sml_periodList
);
1755 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1756 expert_add_info_format(pinfo
, periodList
, &ei_sml_invalid_count
, "invalid count of elements in periodList");
1759 else if (repeat
<= 0){
1760 expert_add_info_format(pinfo
, periodList
, &ei_sml_invalid_count
, "invalid loop count");
1766 for (i
=0; i
< repeat
; i
++) {
1767 get_length(tvb
, offset
, &data
, &length
);
1768 periodList_Entry
= proto_tree_add_text (periodList_list
, tvb
, *offset
, -1, "PeriodEntry");
1769 periodList_Entry_list
= proto_item_add_subtree(periodList_Entry
, ett_sml_period_List_Entry
);
1773 field_objName(tvb
, periodList_Entry_list
, offset
, &data
, &length
);
1776 field_unit(tvb
, periodList_Entry_list
, offset
, &data
, &length
);
1779 field_scaler(tvb
, periodList_Entry_list
, offset
, &data
, &length
);
1782 sml_value(tvb
, periodList_Entry_list
, offset
, &data
, &length
);
1785 field_valueSignature(tvb
, periodList_Entry_list
, offset
, &data
, &length
);
1787 proto_item_set_end(periodList_Entry
, tvb
, *offset
);
1789 proto_item_set_end(periodList
, tvb
, *offset
);
1792 field_rawdata(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1794 /*period Signature*/
1795 field_periodSignature(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1800 static void decode_GetListReq (tvbuff_t
*tvb
, proto_tree
*messagebodytree_list
, guint
*offset
){
1805 field_clientId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1808 field_serverId(tvb
,messagebodytree_list
,offset
, &data
, &length
);
1811 field_username(tvb
,messagebodytree_list
,offset
, &data
, &length
);
1814 field_password(tvb
,messagebodytree_list
,offset
, &data
, &length
);
1817 field_listName(tvb
,messagebodytree_list
,offset
, &data
, &length
);
1820 static gboolean
decode_GetListRes (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
1821 proto_item
*actSensorTime
= NULL
;
1822 proto_item
*valList
= NULL
;
1823 proto_item
*listSignature
= NULL
;
1824 proto_item
*valtree
= NULL
;
1825 proto_item
*actGatewayTime
= NULL
;
1826 proto_item
*SML_time
;
1828 proto_tree
*actSensorTime_tree
= NULL
;
1829 proto_tree
*valList_list
= NULL
;
1830 proto_tree
*listSignature_tree
= NULL
;
1831 proto_tree
*valtree_list
= NULL
;
1832 proto_tree
*actGatewayTime_tree
= NULL
;
1833 proto_tree
*SML_time_tree
= NULL
;
1840 /*clientID OPTIONAL*/
1841 field_clientId (tvb
, messagebodytree_list
, offset
, &data
, &length
);
1844 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1847 field_listName(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1849 /*actSensorTime OPTIONAL*/
1850 get_length(tvb
, offset
, &data
, &length
);
1853 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "actSensorTime: NOT SET");
1858 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "actSensorTime");
1859 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1862 sml_time_type(tvb
, SML_time_tree
, offset
);
1865 get_length(tvb
, offset
, &data
, &length
);
1866 actSensorTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+ data
, "actSensorTime");
1867 actSensorTime_tree
= proto_item_add_subtree (actSensorTime
, ett_sml_actSensorTime
);
1868 proto_tree_add_item (actSensorTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1870 proto_tree_add_item(actSensorTime_tree
, hf_sml_actSensorTime
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
1872 proto_item_set_end(SML_time
,tvb
,*offset
);
1876 get_length(tvb
, offset
, &data
, &length
);
1877 repeat
= (length
+ data
);
1878 valtree
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "valList with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
1879 valtree_list
= proto_item_add_subtree (valtree
, ett_sml_valtree
);
1881 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
1882 expert_add_info_format(pinfo
, valtree
, &ei_sml_invalid_count
, "invalid count of elements in valList");
1885 else if (repeat
<= 0){
1886 expert_add_info_format(pinfo
, valtree
, &ei_sml_invalid_count
, "invalid loop count");
1892 for (i
=0; i
< repeat
; i
++){
1893 get_length(tvb
, offset
, &data
, &length
);
1894 valList
= proto_tree_add_text (valtree_list
, tvb
, *offset
, -1, "valListEntry");
1895 valList_list
= proto_item_add_subtree (valList
, ett_sml_valList
);
1899 field_objName(tvb
, valList_list
, offset
, &data
, &length
);
1901 /*Sml Status OPTIONAL*/
1902 field_status(tvb
, valList_list
, offset
, &data
, &length
);
1904 /*valTime OPTIONAL*/
1905 get_length(tvb
, offset
, &data
, &length
);
1908 proto_tree_add_text (valList_list
, tvb
, *offset
, length
+ data
, "valTime: NOT SET");
1913 SML_time
= proto_tree_add_text (valList_list
, tvb
, *offset
, -1, "valTime");
1914 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1917 sml_time_type(tvb
, SML_time_tree
, offset
);
1918 field_valTime(tvb
, SML_time_tree
, offset
, &data
, &length
);
1919 proto_item_set_end(SML_time
, tvb
, *offset
);
1923 field_unit(tvb
, valList_list
, offset
, &data
, &length
);
1926 field_scaler(tvb
, valList_list
, offset
, &data
, &length
);
1929 sml_value(tvb
, valList_list
, offset
, &data
, &length
);
1932 field_valueSignature(tvb
, valList_list
, offset
, &data
, &length
);
1934 proto_item_set_end(valList
, tvb
, *offset
);
1936 proto_item_set_end(valtree
, tvb
, *offset
);
1938 /*List Signature OPTIONAL*/
1939 get_length(tvb
, offset
, &data
, &length
);
1940 listSignature
= proto_tree_add_bytes_format (messagebodytree_list
, hf_sml_listSignature
, tvb
, *offset
, length
+data
, NULL
, "ListSignature %s", (data
== 0)? ": NOT SET" : "");
1943 listSignature_tree
= proto_item_add_subtree (listSignature
, ett_sml_listSignature
);
1944 proto_tree_add_text (listSignature_tree
, tvb
, *offset
, length
, "Length: %d %s", data
, plurality(data
, "byte", "bytes"));
1946 proto_tree_add_item (listSignature_tree
, hf_sml_listSignature
, tvb
, *offset
, data
, ENC_NA
);
1952 /*actGatewayTime OPTIONAL*/
1953 get_length(tvb
, offset
, &data
, &length
);
1956 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, length
+ data
, "actGatewayTime: NOT SET");
1961 SML_time
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "actGatewayTime");
1962 SML_time_tree
= proto_item_add_subtree (SML_time
, ett_sml_time
);
1965 sml_time_type(tvb
, SML_time_tree
, offset
);
1967 get_length(tvb
, offset
, &data
, &length
);
1968 actGatewayTime
= proto_tree_add_text (SML_time_tree
, tvb
, *offset
, length
+ data
, "actGatewayTime");
1969 actGatewayTime_tree
= proto_item_add_subtree (actGatewayTime
, ett_sml_actSensorTime
);
1970 proto_tree_add_item (actGatewayTime_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
1972 proto_tree_add_item(actGatewayTime_tree
, hf_sml_actGatewayTime
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
1974 proto_item_set_end(SML_time
,tvb
,*offset
);
1979 static gboolean
decode_GetProcParameterReq(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
1980 proto_item
*treepath
= NULL
;
1981 proto_item
*attribute
= NULL
;
1983 proto_tree
*treepath_list
= NULL
;
1984 proto_tree
*attribute_tree
= NULL
;
1992 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1995 field_username(tvb
, messagebodytree_list
, offset
, &data
, &length
);
1998 field_password(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2001 get_length(tvb
, offset
, &data
, &length
);
2002 repeat
= data
+length
;
2003 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "ParameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2004 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
2006 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2007 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in ParameterTreePath");
2010 else if (repeat
<= 0){
2011 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
2017 for (i
=0; i
< repeat
; i
++) {
2018 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
2020 proto_item_set_end(treepath
, tvb
, *offset
);
2023 get_length(tvb
, offset
, &data
, &length
);
2024 attribute
= proto_tree_add_bytes_format (messagebodytree_list
,hf_sml_attribute
, tvb
, *offset
, length
+data
, NULL
, "attribute %s", (data
== 0)? ": NOT SET" : "");
2027 attribute_tree
= proto_item_add_subtree (attribute
, ett_sml_attribute
);
2028 proto_tree_add_text (attribute_tree
, tvb
, *offset
, length
, "Length: %d %s", data
, plurality(data
, "octet", "octets"));
2030 proto_tree_add_item (attribute_tree
, hf_sml_attribute
, tvb
, *offset
, data
, ENC_NA
);
2039 static gboolean
decode_GetProcParameterRes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
2040 proto_item
*treepath
= NULL
;
2041 proto_item
*parameterTree
=NULL
;
2043 proto_tree
*treepath_list
= NULL
;
2044 proto_tree
*parameterTree_list
= NULL
;
2052 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2055 get_length(tvb
, offset
, &data
, &length
);
2056 repeat
= (data
+length
);
2057 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "parameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2058 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
2060 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2061 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in ParameterTreePath");
2064 else if (repeat
<= 0){
2065 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
2071 for (i
=0; i
< repeat
; i
++) {
2072 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
2074 proto_item_set_end(treepath
, tvb
, *offset
);
2077 get_length(tvb
, offset
, &data
, &length
);
2078 parameterTree
= proto_tree_add_text(messagebodytree_list
, tvb
, *offset
, -1, "parameterTree with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2079 parameterTree_list
= proto_item_add_subtree(parameterTree
, ett_sml_parameterTree
);
2081 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2082 expert_add_info_format(pinfo
, parameterTree
, &ei_sml_invalid_count
, "invalid count of elements in parameterTree");
2088 child_tree(tvb
, pinfo
,parameterTree_list
, offset
, &data
, &length
);
2089 proto_item_set_end(parameterTree
, tvb
, *offset
);
2094 static gboolean
decode_SetProcParameterReq(tvbuff_t
*tvb
, packet_info
*pinfo
,proto_tree
*messagebodytree_list
, guint
*offset
){
2095 proto_item
*treepath
= NULL
;
2096 proto_item
*parameterTree
= NULL
;
2098 proto_tree
*treepath_list
= NULL
;
2099 proto_tree
*parameterTree_list
= NULL
;
2107 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2110 field_username(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2113 field_password(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2116 get_length(tvb
, offset
, &data
, &length
);
2117 repeat
= (data
+length
);
2118 treepath
= proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, -1, "parameterTreePath with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2119 treepath_list
= proto_item_add_subtree(treepath
, ett_sml_treepath
);
2121 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2122 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid count of elements in ParameterTreePath");
2125 else if (repeat
<= 0){
2126 expert_add_info_format(pinfo
, treepath
, &ei_sml_invalid_count
, "invalid loop count");
2132 for (i
=0; i
< repeat
; i
++) {
2133 field_parameterTreePath(tvb
, treepath_list
, offset
, &data
, &length
);
2135 proto_item_set_end(treepath
, tvb
, *offset
);
2138 get_length(tvb
, offset
, &data
, &length
);
2139 parameterTree
= proto_tree_add_text(messagebodytree_list
, tvb
, *offset
, -1, "parameterTree with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2140 parameterTree_list
= proto_item_add_subtree(parameterTree
, ett_sml_parameterTree
);
2142 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2143 expert_add_info_format(pinfo
, parameterTree
, &ei_sml_invalid_count
, "invalid count of elements in parameterTree");
2149 child_tree(tvb
, pinfo
,parameterTree_list
, offset
, &data
, &length
);
2150 proto_item_set_end(parameterTree
, tvb
, *offset
);
2155 static gboolean
decode_AttentionRes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*messagebodytree_list
, guint
*offset
){
2156 proto_item
*attentionNo
= NULL
;
2157 proto_item
*attentionMsg
= NULL
;
2158 proto_item
*attentionDetails
= NULL
;
2160 proto_tree
*attentionNo_tree
= NULL
;
2161 proto_tree
*attentionMsg_tree
= NULL
;
2162 proto_tree
*attentionDetails_list
= NULL
;
2168 field_serverId(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2171 get_length(tvb
, offset
, &data
, &length
);
2172 attentionNo
= proto_tree_add_text (messagebodytree_list
, tvb
,*offset
, length
+data
, "attentionNo");
2173 attentionNo_tree
= proto_item_add_subtree (attentionNo
, ett_sml_attentionNo
);
2174 proto_tree_add_text (attentionNo_tree
, tvb
, *offset
, length
, "Length: %d %s", data
,plurality(data
, "octet", "octets"));
2179 proto_tree_add_item (attentionNo_tree
, hf_sml_attentionNo
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2183 proto_tree_add_text (attentionNo_tree
, tvb
,*offset
, data
, "unknown attentionNo");
2188 get_length(tvb
, offset
, &data
, &length
);
2189 attentionMsg
= proto_tree_add_string_format (messagebodytree_list
, hf_sml_attentionMsg
, tvb
, *offset
, length
+data
, NULL
, "attentionMsg %s", (data
== 0)? ": NOT SET" : "");
2192 attentionMsg_tree
= proto_item_add_subtree (attentionMsg
, ett_sml_attentionMsg
);
2193 proto_tree_add_text (attentionMsg_tree
, tvb
, *offset
, length
, "Length: %d %s", data
, plurality(data
, "octet", "octets"));
2195 proto_tree_add_item (attentionMsg_tree
, hf_sml_attentionMsg
, tvb
, *offset
, data
, ENC_ASCII
| ENC_BIG_ENDIAN
);
2201 /*attentiondetails*/
2202 if (tvb_get_guint8(tvb
,*offset
) == OPTIONAL
){
2203 proto_tree_add_text (messagebodytree_list
, tvb
, *offset
, 1, "attentionDetails: NOT SET");
2207 get_length(tvb
, offset
, &data
, &length
);
2208 attentionDetails
= proto_tree_add_text(messagebodytree_list
, tvb
, *offset
, -1, "attentionDetails with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2209 attentionDetails_list
= proto_item_add_subtree(attentionDetails
, ett_sml_attentionDetails
);
2211 if ((tvb_get_guint8(tvb
,*offset
) & 0xF0) != LONG_LIST
&& (tvb_get_guint8(tvb
,*offset
) & 0xF0) != SHORT_LIST
){
2212 expert_add_info_format(pinfo
, attentionDetails
, &ei_sml_invalid_count
, "invalid count of elements in attentionDetails");
2218 child_tree(tvb
, pinfo
,attentionDetails_list
, offset
, &data
, &length
);
2219 proto_item_set_end(attentionDetails
, tvb
, *offset
);
2225 /*dissect SML-File*/
2226 static void dissect_sml_file(tvbuff_t
*tvb
, packet_info
*pinfo
, gint
*offset
, proto_tree
*sml_tree
){
2227 proto_item
*file
= NULL
;
2228 proto_item
*mainlist
= NULL
;
2229 proto_item
*trans
= NULL
;
2230 proto_item
*groupNo
= NULL
;
2231 proto_item
*abortOnError
= NULL
;
2232 proto_item
*sublist
= NULL
;
2233 proto_item
*messagebody
= NULL
;
2234 proto_item
*crc16
= NULL
;
2235 proto_item
*messagebodytree
= NULL
;
2236 proto_item
*msgend
= NULL
;
2238 proto_tree
*mainlist_list
= NULL
;
2239 proto_tree
*trans_tree
= NULL
;
2240 proto_tree
*groupNo_tree
= NULL
;
2241 proto_tree
*abortOnError_tree
= NULL
;
2242 proto_tree
*sublist_list
= NULL
;
2243 proto_tree
*messagebody_tree
= NULL
;
2244 proto_tree
*crc16_tree
= NULL
;
2245 proto_tree
*messagebodytree_list
= NULL
;
2246 proto_tree
*msgend_tree
= NULL
;
2248 guint16 messagebody_switch
= 0;
2249 guint16 crc_check
= 0;
2250 guint16 crc_ref
= 0;
2253 guint available
= 0;
2254 guint crc_msg_len
= 0;
2255 guint crc_file_len
= 0;
2259 gboolean msg_error
= FALSE
;
2260 gboolean close1
= FALSE
;
2261 gboolean close2
= FALSE
;
2262 gint end_offset
= 0;
2265 start_offset
= *offset
;
2267 end_offset
= tvb_reported_length_remaining(tvb
, *offset
);
2268 if (end_offset
<= 0){
2272 if (tvb_get_ntoh40(tvb
, end_offset
-8) != ESC_SEQ_END
&& pinfo
->can_desegment
){
2273 if (tvb_get_guint8(tvb
, end_offset
-1) != 0){
2274 pinfo
->desegment_offset
= start_offset
;
2275 pinfo
->desegment_len
= DESEGMENT_ONE_MORE_SEGMENT
;
2278 else if (tvb_get_guint8(tvb
, end_offset
-4) != UNSIGNED16
&& tvb_get_guint8(tvb
, end_offset
-3) != UNSIGNED8
){
2279 pinfo
->desegment_offset
= start_offset
;
2280 pinfo
->desegment_len
= DESEGMENT_ONE_MORE_SEGMENT
;
2284 else if (!pinfo
->can_desegment
){
2285 expert_add_info(pinfo
, NULL
, &ei_sml_segment_needed
);
2288 while(!close1
&& !close2
){
2289 if (sml_reassemble
){
2290 file
= proto_tree_add_text(sml_tree
,tvb
, *offset
, -1 , "----SML-File----");
2294 if (tvb_get_ntohl(tvb
, *offset
) == ESC_SEQ
){
2295 crc_file_len
= *offset
;
2297 proto_tree_add_item (sml_tree
, hf_sml_esc
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2301 if (tvb_get_guint8(tvb
, *offset
) == 0x01){
2302 proto_tree_add_item (sml_tree
, hf_sml_version_1
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2306 proto_tree_add_text (sml_tree
, tvb
, *offset
, -1, "SML Version 2 not supported");
2312 crc_msg_len
= *offset
;
2315 get_length(tvb
, offset
, &data
, &length
);
2316 mainlist
= proto_tree_add_text (sml_tree
, tvb
, *offset
, -1, "List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2318 mainlist_list
= proto_item_add_subtree (mainlist
, ett_sml_mainlist
);
2319 if (tvb_get_guint8(tvb
, *offset
) != LIST_6_ELEMENTS
) {
2320 expert_add_info_format(pinfo
, mainlist
, &ei_sml_invalid_count
, "invalid count of elements");
2326 get_length(tvb
, offset
, &data
, &length
);
2327 trans
= proto_tree_add_text (mainlist_list
, tvb
, *offset
, length
+ data
,"Transaction ID");
2328 trans_tree
= proto_item_add_subtree (trans
, ett_sml_trans
);
2329 proto_tree_add_text (trans_tree
, tvb
, *offset
, length
, "Length: %d %s", data
, plurality(data
, "octet", "octets"));
2331 proto_tree_add_item (trans_tree
, hf_sml_transactionId
, tvb
, *offset
, data
, ENC_NA
);
2335 groupNo
= proto_tree_add_text (mainlist_list
, tvb
, *offset
, 2, "Group No");
2336 groupNo_tree
= proto_item_add_subtree (groupNo
, ett_sml_group
);
2337 proto_tree_add_item (groupNo_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
2339 proto_tree_add_item (groupNo_tree
, hf_sml_groupNo
, tvb
, *offset
, 1, ENC_NA
);
2343 abortOnError
= proto_tree_add_text (mainlist_list
, tvb
, *offset
, 2, "Abort on Error");
2344 abortOnError_tree
= proto_item_add_subtree (abortOnError
,ett_sml_abort
);
2345 proto_tree_add_item(abortOnError_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
2347 proto_tree_add_item(abortOnError_tree
, hf_sml_abortOnError
, tvb
, *offset
, 1, ENC_NA
);
2351 sublist
= proto_tree_add_text (mainlist_list
, tvb
, *offset
, -1, "MessageBody");
2352 sublist_list
= proto_item_add_subtree (sublist
, ett_sml_sublist
);
2355 /*Zero Cutting Check*/
2356 get_length(tvb
, offset
, &data
, &length
);
2357 messagebody
= proto_tree_add_text (sublist_list
, tvb
, *offset
, length
+ data
, "Messagetype");
2358 messagebody_tree
= proto_item_add_subtree (messagebody
, ett_sml_mttree
);
2359 proto_tree_add_item (messagebody_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
2366 expert_add_info(pinfo
, messagebody
, &ei_sml_messagetype_unknown
);
2370 messagebody_switch
= tvb_get_ntohs(tvb
, *offset
);
2371 proto_tree_add_item (messagebody_tree
, hf_sml_MessageBody
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2374 /*MessageBody List*/
2375 get_length(tvb
, offset
, &data
, &length
);
2376 messagebodytree
= proto_tree_add_text (sublist_list
, tvb
, *offset
, -1, "List with %d %s", length
+data
, plurality(length
+data
, "element", "elements"));
2377 messagebodytree_list
= proto_item_add_subtree (messagebodytree
, ett_sml_mblist
);
2380 switch (messagebody_switch
){
2382 col_append_str (pinfo
->cinfo
, COL_INFO
, "OpenReq; ");
2383 proto_item_append_text(mainlist
, " [Open Request]");
2384 decode_PublicOpenReq(tvb
, messagebodytree_list
, offset
);
2387 col_append_str (pinfo
->cinfo
, COL_INFO
, "OpenRes; ");
2388 proto_item_append_text(mainlist
, " [Open Response]");
2389 decode_PublicOpenRes(tvb
, messagebodytree_list
, offset
);
2392 col_append_str (pinfo
->cinfo
, COL_INFO
, "CloseReq; ");
2393 proto_item_append_text(mainlist
, " [Close Request]");
2394 field_globalSignature(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2397 col_append_str (pinfo
->cinfo
, COL_INFO
, "CloseRes; ");
2398 proto_item_append_text(mainlist
, " [Close Response]");
2399 field_globalSignature(tvb
, messagebodytree_list
, offset
, &data
, &length
);
2401 case PROFILEPACK_REQ
:
2402 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProfilePackReq; ");
2403 proto_item_append_text(mainlist
, " [GetProfilePack Request]");
2404 msg_error
= decode_GetProfile_List_Pack_Req(tvb
, pinfo
,messagebodytree_list
, offset
);
2406 case PROFILEPACK_RES
:
2407 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProfilePackRes; ");
2408 proto_item_append_text(mainlist
, " [GetProfilePack Response]");
2409 msg_error
= decode_GetProfilePackRes(tvb
, pinfo
,messagebodytree_list
, offset
);
2411 case PROFILELIST_REQ
:
2412 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProfileListReq; ");
2413 proto_item_append_text(mainlist
, " [GetProfileList Request]");
2414 msg_error
= decode_GetProfile_List_Pack_Req(tvb
, pinfo
,messagebodytree_list
, offset
);
2416 case PROFILELIST_RES
:
2417 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProfileListRes; ");
2418 proto_item_append_text(mainlist
, " [GetProfileList Response]");
2419 msg_error
= decode_GetProfileListRes(tvb
, pinfo
,messagebodytree_list
, offset
);
2421 case GETPROCPARAMETER_REQ
:
2422 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProcParameterReq; ");
2423 proto_item_append_text(mainlist
, " [GetProcParameter Request]");
2424 msg_error
= decode_GetProcParameterReq(tvb
, pinfo
,messagebodytree_list
, offset
);
2426 case GETPROCPARAMETER_RES
:
2427 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetProcParameterRes; ");
2428 proto_item_append_text(mainlist
, " [GetProcParameter Response]");
2429 msg_error
= decode_GetProcParameterRes(tvb
, pinfo
,messagebodytree_list
, offset
);
2431 case SETPROCPARAMETER_REQ
:
2432 col_append_str (pinfo
->cinfo
, COL_INFO
, "SetProcParameterReq; ");
2433 proto_item_append_text(mainlist
, " [SetProcParameter Request]");
2434 msg_error
= decode_SetProcParameterReq(tvb
, pinfo
,messagebodytree_list
, offset
);
2437 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetListReq; ");
2438 proto_item_append_text(mainlist
, " [GetList Request]");
2439 decode_GetListReq(tvb
, messagebodytree_list
, offset
);
2442 col_append_str (pinfo
->cinfo
, COL_INFO
, "GetListRes; ");
2443 proto_item_append_text(mainlist
, " [GetList Response]");
2444 msg_error
= decode_GetListRes(tvb
, pinfo
,messagebodytree_list
, offset
);
2447 col_append_str (pinfo
->cinfo
, COL_INFO
, "AttentionRes; ");
2448 proto_item_append_text(mainlist
, " [Attention Response]");
2449 msg_error
= decode_AttentionRes(tvb
, pinfo
,messagebodytree_list
, offset
);
2452 expert_add_info(pinfo
, messagebodytree
, &ei_sml_messagetype_unknown
);
2457 expert_add_info(pinfo
, messagebodytree
, &ei_sml_MessageBody
);
2461 proto_item_set_end(messagebodytree
, tvb
, *offset
);
2462 proto_item_set_end(sublist
, tvb
, *offset
);
2465 get_length(tvb
, offset
, &data
, &length
);
2466 crc16
= proto_tree_add_text (mainlist_list
, tvb
, *offset
, data
+ length
, "CRC");
2467 crc16_tree
= proto_item_add_subtree (crc16
, ett_sml_crc16
);
2469 if(tvb_get_guint8(tvb
, *offset
) != UNSIGNED8
&& tvb_get_guint8(tvb
, *offset
) != UNSIGNED16
){
2470 expert_add_info(pinfo
, crc16
, &ei_sml_crc_error_length
);
2474 proto_tree_add_item (crc16_tree
, hf_sml_datatype
, tvb
, *offset
, 1, ENC_NA
);
2477 proto_tree_add_item (crc16_tree
, hf_sml_crc16
, tvb
, *offset
, data
, ENC_BIG_ENDIAN
);
2480 if (sml_crc_enabled
) {
2481 crc_msg_len
= (*offset
- crc_msg_len
- data
- 1);
2482 crc_check
= crc16_ccitt_tvb_offset(tvb
, (*offset
- crc_msg_len
- data
- 1), crc_msg_len
);
2483 crc_ref
= tvb_get_letohs(tvb
, *offset
-2);
2486 crc_ref
= crc_ref
& 0xFF00;
2489 if (crc_check
== crc_ref
) {
2490 proto_tree_add_text (crc16_tree
, tvb
, *offset
, 0, "[CRC Okay]");
2493 /*(little to big endian convert) to display in correct order*/
2494 crc_check
= ((crc_check
>> 8) & 0xFF) + ((crc_check
<< 8 & 0xFF00));
2495 proto_tree_add_text (crc16_tree
, tvb
, *offset
, 0, "[CRC Bad 0x%X]", crc_check
);
2496 expert_add_info(pinfo
, crc16
, &ei_sml_crc_error
);
2500 proto_tree_add_text (crc16_tree
, tvb
, *offset
, 0, "[CRC validation disabled]");
2504 if (tvb_get_guint8 (tvb
, *offset
) == 0){
2505 proto_tree_add_item (mainlist_list
, hf_sml_endOfSmlMsg
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2509 expert_add_info(pinfo
, NULL
, &ei_sml_endOfSmlMsg
);
2513 proto_item_set_end(mainlist
, tvb
, *offset
);
2515 if (tvb_reported_length_remaining(tvb
, *offset
) > 0){
2516 check
= tvb_get_guint8(tvb
, *offset
);
2518 if (check
== LIST_6_ELEMENTS
){
2521 else if (check
== 0x1b || check
== 0){
2525 else if (sml_reassemble
&& pinfo
->can_desegment
){
2526 pinfo
->desegment_offset
= start_offset
;
2527 pinfo
->desegment_len
= DESEGMENT_ONE_MORE_SEGMENT
;
2539 while (tvb_get_guint8(tvb
, *offset
) == 0){
2545 proto_tree_add_item (sml_tree
, hf_sml_padding
, tvb
, *offset
, length
, ENC_NA
);
2550 if(tvb_get_ntoh40(tvb
, *offset
) != ESC_SEQ_END
){
2551 expert_add_info(pinfo
, NULL
, &ei_sml_esc_error
);
2554 proto_tree_add_item (sml_tree
, hf_sml_esc
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2558 msgend
= proto_tree_add_item (sml_tree
, hf_sml_end
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2559 msgend_tree
= proto_item_add_subtree (msgend
, ett_sml_msgend
);
2561 proto_tree_add_item (msgend_tree
, hf_sml_padding
, tvb
, *offset
, 1, ENC_NA
);
2563 proto_tree_add_item (msgend_tree
, hf_sml_crc16
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2566 if (sml_crc_enabled
&& sml_reassemble
){
2567 crc_file_len
= *offset
- crc_file_len
- 2;
2568 crc_check
= crc16_ccitt_tvb_offset(tvb
,*offset
-crc_file_len
-2, crc_file_len
);
2569 crc_ref
= tvb_get_letohs(tvb
, *offset
-2);
2571 if (crc_check
== crc_ref
){
2572 proto_tree_add_text (msgend_tree
, tvb
, *offset
, 0, "[CRC Okay]");
2575 /*(little to big endian convert) to display in correct order*/
2576 crc_check
= ((crc_check
>> 8) & 0xFF) + ((crc_check
<< 8) & 0xFF00);
2577 proto_tree_add_text (msgend_tree
, tvb
, *offset
, 0, "[CRC Bad 0x%X]", crc_check
);
2578 expert_add_info_format(pinfo
, msgend
, &ei_sml_crc_error
, "CRC error (messages not reassembled ?)");
2582 proto_tree_add_text (msgend_tree
, tvb
, *offset
, 0, "[CRC validation disabled]");
2585 available
= tvb_reported_length_remaining(tvb
, *offset
);
2586 if (available
<= 0){
2590 if (sml_reassemble
){
2591 proto_item_set_end(file
, tvb
, *offset
);
2594 proto_tree_add_text(sml_tree
,tvb
, *offset
, 0 , "---New SML File---");
2602 static void dissect_sml (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
) {
2603 proto_item
*sml_item
= NULL
;
2604 proto_tree
*sml_tree
= NULL
;
2608 /*Check if not SML*/
2609 if (tvb_get_ntohl(tvb
, offset
) != ESC_SEQ
&& tvb_get_guint8(tvb
, offset
) != LIST_6_ELEMENTS
){
2613 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "SML");
2614 col_clear(pinfo
->cinfo
,COL_INFO
);
2616 /* create display subtree for the protocol */
2617 sml_item
= proto_tree_add_item(tree
, proto_sml
, tvb
, 0, -1, ENC_NA
);
2618 sml_tree
= proto_item_add_subtree(sml_item
, ett_sml
);
2619 dissect_sml_file(tvb
, pinfo
, &offset
, sml_tree
);
2622 void proto_register_sml (void) {
2623 module_t
*sml_module
;
2624 expert_module_t
* expert_sml
;
2626 static hf_register_info hf
[] = {
2628 { "Escape", "sml.esc", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2629 { &hf_sml_version_1
,
2630 { "Version 1", "sml.version_1", FT_UINT24
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2631 { &hf_sml_smlVersion
,
2632 { "SML Version", "sml.version", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2634 { "CRC16", "sml.crc", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2635 { &hf_sml_endOfSmlMsg
,
2636 { "End of SML Msg", "sml.end", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2637 { &hf_sml_transactionId
,
2638 { "Transaction ID", "sml.transactionid", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2640 { "GroupNo", "sml.groupno", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2642 { "Datatype", "sml.datatype", FT_UINT8
, BASE_HEX
, VALS (datatype
), 0x0, NULL
, HFILL
}},
2643 { &hf_sml_abortOnError
,
2644 { "Abort On Error", "sml.abort", FT_UINT8
, BASE_HEX
, VALS (sml_abort
), 0x0, NULL
, HFILL
}},
2645 { &hf_sml_MessageBody
,
2646 { "Messagebody", "sml.messagebody", FT_UINT16
, BASE_HEX
, VALS (sml_body
), 0x0, NULL
, HFILL
}},
2648 { "End of Msg", "sml.end", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2650 { "Codepage", "sml.codepage", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2652 { "Client ID", "sml.clientid", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2653 { &hf_sml_reqFileId
,
2654 { "reqFile ID", "sml.reqfileid", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2656 { "server ID", "sml.serverid", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2658 { "Username", "sml.username", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2660 { "Password", "sml.password", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2662 { "List Name", "sml.listname", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2663 { &hf_sml_globalSignature
,
2664 { "Global Signature", "sml.globalsignature", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2666 { "refTime", "sml.reftime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2667 { &hf_sml_actSensorTime
,
2668 { "actSensorTime", "sml.actsensortime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2670 { "Time type", "sml.timetype", FT_UINT8
, BASE_HEX
, VALS (sml_timetypes
), 0x0, NULL
, HFILL
}},
2672 { "objName", "sml.objname", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2674 { "Status", "sml.status", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2676 { "valTime", "sml.valtime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2678 { "unit", "sml.unit", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2680 { "scaler", "sml.scaler", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2682 { "value", "sml.value", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2683 { &hf_sml_valueSignature
,
2684 { "ValueSignature", "sml.valuesignature", FT_BYTES
, BASE_NONE
, NULL
, 0x0,NULL
, HFILL
}},
2685 { &hf_sml_listSignature
,
2686 { "ListSignature", "sml.listsignature", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2687 { &hf_sml_actGatewayTime
,
2688 { "actGatewayTime", "sml.gatewaytime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2689 { &hf_sml_parameterTreePath
,
2690 { "path_Entry", "sml.parametertreepath", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2691 { &hf_sml_attribute
,
2692 { "attribute", "sml.attribute", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2693 { &hf_sml_parameterName
,
2694 { "parameterName", "sml.parametername", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2695 { &hf_sml_procParValue
,
2696 { "procParValue", "sml.procparvalue", FT_UINT8
, BASE_HEX
, VALS(procvalues
), 0x0, NULL
, HFILL
}},
2697 { &hf_sml_procParValueTime
,
2698 { "procParValueTime", "sml.procparvaluetime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2700 { "Padding", "sml.padding", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2702 { "secIndex", "sml.secindex", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2703 { &hf_sml_attentionNo
,
2704 { "attentionNo", "sml.attentionno", FT_UINT16
, BASE_HEX
|BASE_RANGE_STRING
, RVALS(attentionValues
), 0x0, NULL
, HFILL
}},
2705 { &hf_sml_attentionMsg
,
2706 { "attentionMsg", "sml.attentionmsg", FT_STRING
, BASE_NONE
, NULL
, 0x0 , NULL
, HFILL
}},
2707 { &hf_sml_withRawdata
,
2708 { "withRawdata", "sml.withrawdata", FT_UINT8
, BASE_HEX
|BASE_RANGE_STRING
, RVALS(bools
), 0x0 , NULL
, HFILL
}},
2709 { &hf_sml_beginTime
,
2710 { "beginTime", "sml.begintime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2712 { "endTime", "sml.endtime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2714 { "endTime", "sml.acttime", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2715 { &hf_sml_object_list_Entry
,
2716 { "object_list_Entry", "sml.objectentry", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2717 { &hf_sml_regPeriod
,
2718 { "regPeriod", "sml.regperiod", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2720 { "rawdata", "sml.rawdata", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2721 { &hf_sml_periodSignature
,
2722 { "periodSignature", "sml.periodsignature", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2723 { &hf_sml_profileSignature
,
2724 { "profileSignature", "sml.profilesignature", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2725 { &hf_sml_signature_mA_R2_R3
,
2726 { "signature_mA_R2_R3", "sml.signaturema", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2727 { &hf_sml_signature_pA_R1_R4
,
2728 { "signature_pA_R1_R4", "sml.signaturepa", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2730 { "unit_mA", "sml.unitmA", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2732 { "unit_pA", "sml.unitpA", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2734 { "unit_R1", "sml.unitR1", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2736 { "unit_R2", "sml.unitR2", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2738 { "unit_R3", "sml.unitR3", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2740 { "unit_R4", "sml.unitR4", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2741 { &hf_sml_scaler_mA
,
2742 { "scaler_mA", "sml.scalermA", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2743 { &hf_sml_scaler_pA
,
2744 { "scaler_pA", "sml.scalerpA", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2745 { &hf_sml_scaler_R1
,
2746 { "scaler_R1", "sml.scalerR1", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2747 { &hf_sml_scaler_R2
,
2748 { "scaler_R2", "sml.scalerR2", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2749 { &hf_sml_scaler_R3
,
2750 { "scaler_R3", "sml.scalerR3", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2751 { &hf_sml_scaler_R4
,
2752 { "scaler_R4", "sml.scalerR4", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2754 { "value_mA", "sml.valuemA", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2756 { "value_pA", "sml.valuepA", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2758 { "value_R1", "sml.valueR1", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2760 { "value_R2", "sml.valueR2", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2762 { "value_R3", "sml.valueR3", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2764 { "value_R4", "sml.valueR4", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}}
2767 /* Setup protocol subtree array */
2768 static gint
*ett
[] = {
2785 &ett_sml_smlVersion
,
2788 &ett_sml_globalSignature
,
2790 &ett_sml_actSensorTime
,
2801 &ett_sml_valueSignature
,
2803 &ett_sml_listSignature
,
2804 &ett_sml_actGatewayTime
,
2806 &ett_sml_parameterTreePath
,
2808 &ett_sml_parameterTree
,
2809 &ett_sml_parameterName
,
2811 &ett_sml_periodEntry
,
2812 &ett_sml_procParValueTime
,
2813 &ett_sml_procParValuetype
,
2814 &ett_sml_procParValue
,
2819 &ett_sml_attentionNo
,
2820 &ett_sml_attentionMsg
,
2821 &ett_sml_withRawdata
,
2824 &ett_sml_object_list
,
2825 &ett_sml_object_list_Entry
,
2829 &ett_sml_periodSignature
,
2830 &ett_sml_period_List_Entry
,
2831 &ett_sml_periodList
,
2832 &ett_sml_header_List_Entry
,
2833 &ett_sml_profileSignature
,
2835 &ett_sml_headerList
,
2836 &ett_sml_value_List_Entry
,
2837 &ett_sml_signature_mA_R2_R3
,
2838 &ett_sml_signature_pA_R1_R4
,
2857 &ett_sml_tree_Entry
,
2858 &ett_sml_dasDetails
,
2859 &ett_sml_attentionDetails
2862 static ei_register_info ei
[] = {
2863 { &ei_sml_tupel_error
, { "sml.tupel_error_", PI_PROTOCOL
, PI_ERROR
, "error in Tupel", EXPFILL
}},
2864 { &ei_sml_procParValue_invalid
, { "sml.procparvalue.invalid", PI_PROTOCOL
, PI_WARN
, "invalid procParValue", EXPFILL
}},
2865 { &ei_sml_procParValue_errror
, { "sml.procparvalue.error", PI_PROTOCOL
, PI_ERROR
, "error in procParValue", EXPFILL
}},
2866 { &ei_sml_invalid_count
, { "sml.invalid_count", PI_PROTOCOL
, PI_ERROR
, "invalid loop count", EXPFILL
}},
2867 { &ei_sml_segment_needed
, { "sml.segment_needed", PI_REASSEMBLE
, PI_NOTE
, "probably segment needed", EXPFILL
}},
2868 { &ei_sml_messagetype_unknown
, { "sml.messagetype.unknown", PI_PROTOCOL
, PI_ERROR
, "unknown Messagetype", EXPFILL
}},
2869 { &ei_sml_MessageBody
, { "sml.messagebody.error", PI_PROTOCOL
, PI_ERROR
, "Error in MessageBody", EXPFILL
}},
2870 { &ei_sml_crc_error_length
, { "sml.crc.length_error", PI_PROTOCOL
, PI_ERROR
, "CRC length error", EXPFILL
}},
2871 { &ei_sml_crc_error
, { "sml.crc.error", PI_CHECKSUM
, PI_WARN
, "CRC error", EXPFILL
}},
2872 { &ei_sml_endOfSmlMsg
, { "sml.end.not_zero", PI_PROTOCOL
, PI_ERROR
, "MsgEnd not 0x00", EXPFILL
}},
2873 { &ei_sml_esc_error
, { "sml.esc.error", PI_PROTOCOL
, PI_ERROR
, "escapesequence error", EXPFILL
}},
2876 proto_sml
= proto_register_protocol("Smart Message Language","SML", "sml");
2877 sml_module
= prefs_register_protocol(proto_sml
, proto_reg_handoff_sml
);
2879 prefs_register_bool_preference (sml_module
, "reassemble", "Enable reassemble", "Enable reassembling (default is enabled)", &sml_reassemble
);
2880 prefs_register_bool_preference (sml_module
, "crc", "Enable crc calculation", "Enable crc (default is disabled)", &sml_crc_enabled
);
2881 prefs_register_uint_preference(sml_module
, "tcp.port", "SML TCP Port", "Set the TCP port for SML (Default is 0), recommended port is 7259", 10, &tcp_port_pref
);
2882 prefs_register_uint_preference(sml_module
, "udp.port", "SML UDP Port", "Set the UDP port for SML (Default is 0), recommended port is 7259", 10, &udp_port_pref
);
2884 proto_register_field_array(proto_sml
, hf
, array_length(hf
));
2885 proto_register_subtree_array(ett
, array_length(ett
));
2886 expert_sml
= expert_register_protocol(proto_sml
);
2887 expert_register_field_array(expert_sml
, ei
, array_length(ei
));
2890 void proto_reg_handoff_sml(void) {
2891 static gboolean initialized
= FALSE
;
2892 static int old_tcp_port
;
2893 static int old_udp_port
;
2894 static dissector_handle_t sml_handle
;
2897 sml_handle
= create_dissector_handle(dissect_sml
, proto_sml
);
2900 dissector_delete_uint("tcp.port", old_tcp_port
, sml_handle
);
2901 dissector_delete_uint("udp.port", old_udp_port
, sml_handle
);
2903 old_tcp_port
= tcp_port_pref
;
2904 old_udp_port
= udp_port_pref
;
2906 dissector_add_uint("tcp.port", tcp_port_pref
, sml_handle
);
2907 dissector_add_uint("udp.port", udp_port_pref
, sml_handle
);
2911 * Editor modelines - http://www.wireshark.org/tools/modelines.html
2916 * indent-tabs-mode: t
2919 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2920 * :indentSize=8:tabSize=8:noTabs=false: