epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-sapms.c
blob8bb122caee9510ec118cb4929c72c6ad9c4db0f6
1 /* packet-sapms.c
2 * Routines for SAP MS (Message Server) dissection
3 * Copyright 2022, Martin Gallo <martin.gallo [AT] gmail.com>
4 * Code contributed by SecureAuth Corp.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 * This is a simple dissector for the SAP MS protocol.
16 * Some details and example requests can be found in pysap's documentation: https://pysap.readthedocs.io/en/latest/protocols/SAPMS.html.
19 #include <config.h>
21 #include <epan/packet.h>
22 #include <epan/prefs.h>
23 #include <epan/expert.h>
24 #include <wsutil/wmem/wmem.h>
27 /* Define default ports. The right range should be 36NN and 39NN, but as port numbers are proprietary and not
28 * IANA assigned, we leave only the ones corresponding to the instance 00.
30 #define SAPMS_PORT_RANGE "3600,3900"
32 /* MS Domain values */
33 static const value_string sapms_domain_vals[] = {
34 { 0x00, "ABAP" },
35 { 0x01, "J2EE" },
36 { 0x02, "JSTARTUP" },
37 /* NULL */
38 { 0, NULL }
42 /* MS Flag values */
43 static const value_string sapms_flag_vals[] = {
44 { 1, "MS_ONE_WAY" },
45 { 2, "MS_REQUEST" },
46 { 3, "MS_REPLY" },
47 { 4, "MS_ADMIN" },
48 /* NULL */
49 { 0, NULL }
52 /* MS IFlag values */
53 static const value_string sapms_iflag_vals[] = {
54 { 1, "MS_SEND_NAME" },
55 { 2, "MS_SEND_TYPE" },
56 { 3, "MS_LOGIN" },
57 { 4, "MS_LOGOUT" },
58 { 5, "MS_ADM_OPCODES" },
59 { 6, "MS_MOD_MSGTYPES" },
60 { 7, "MS_SEND_TYPE_ONCE" },
61 { 8, "MS_LOGIN_2" },
62 { 9, "MS_MOD_STATE" },
63 { 10, "MS_J2EE_LOGIN" },
64 { 12, "MS_J2EE_SEND_TO_CLUSTERID" },
65 { 13, "MS_J2EE_SEND_BROADCAST" },
66 { 14, "MS_SEND_TYPE_ACK" },
67 { 15, "MS_J2EE_LOGIN_2" },
68 { 16, "MS_SEND_SERVICE" },
69 { 17, "MS_J2EE_LOGIN_3" },
70 { 18, "MS_J2EE_LOGIN_4" },
71 /* NULL */
72 { 0, NULL }
75 /* MS Error number values */
76 static const value_string sapms_errorno_vals[] = {
77 { 0, "MSERECONNECTION" },
78 { 1, "MSENISELWRITE" },
79 { 2, "MSENISELREAD" },
80 { 3, "MSENIQUEUE" },
81 { 4, "MSENILAYER" },
82 { 71, "MSETESTSOFTSHUTDOWN" },
83 { 72, "MSENOTINIT" },
84 { 73, "MSEALREADYINIT" },
85 { 74, "MSEINVHDL" },
86 { 75, "MSEWRONGSERVER" },
87 { 76, "MSEMOREDATA" },
88 { 77, "MSESNDTYPEFAILED" },
89 { 78, "MSEDUPKEY" },
90 { 79, "MSESOFTSHUTDOWN" },
91 { 81, "MSENOMEM" },
92 { 82, "MSEHEADERINCOMPLETE" },
93 { 83, "MSETYPESNOTALLOWED" },
94 { 84, "MSEACCESSDENIED" },
95 { 85, "MSEWRITEINCOMPLETE" },
96 { 86, "MSEREADINCOMPLETE" },
97 { 87, "MSEADMIN" },
98 { 88, "MSESOCKTOOLARGE" },
99 { 89, "MSENOSLOTFREE" },
100 { 90, "MSESHUTDOWN" },
101 { 91, "MSEREPLYTOOLARGE" },
102 { 92, "MSEWRONGVERSION" },
103 { 93, "MSEMSGDESTROYED" },
104 { 94, "MSENOTUNIQUE" },
105 { 95, "MSEPARTNERUNKNOWN" },
106 { 96, "MSEPARTNERDIED" },
107 { 97, "MSEWRONGTYPE" },
108 { 98, "MSEWRONGNAME" },
109 { 99, "MSEWAKEUP" },
110 { 100, "MSENOTFOUND" },
111 { 101, "MSEINVAL" },
112 { 102, "MSENOMSG" },
113 { 103, "MSEINTERN" },
114 /* NULL */
115 { 0, NULL }
118 /* MS Adm Message Types values */
119 static const value_string sapms_adm_msgtype_vals[] = {
120 { 1, "ADM_REQUEST" },
121 { 2, "ADM_REPLY" },
122 /* NULL */
123 { 0, NULL }
126 /* MS Adm Record Opcode values */
127 static const value_string sapms_adm_record_opcode_vals[] = {
128 { 0x00, "AD_GENERAL" },
129 { 0x01, "AD_PROFILE" },
130 { 0x02, "AD_WPSTAT" },
131 { 0x03, "AD_QUEUE" },
132 { 0x04, "AD_STARTSTOP" },
133 { 0x05, "AD_WPCONF" },
134 { 0x06, "AD_USRLST" },
135 { 0x07, "AD_WPKILL" },
136 { 0x08, "AD_TIMEINFO" },
137 { 0x09, "AD_TM_RECONNECT" },
138 { 0x0a, "AD_ALRT_GET_STATE" },
139 { 0x0b, "AD_ALRT_OPERATION" },
140 { 0x0c, "AD_ALRT_SET_PARAM" },
141 { 0x0d, "AD_DB_RECONNECT" },
142 { 0x0e, "AD_ECHO" },
143 { 0x0f, "AD_MSGSERVER" },
144 { 0x10, "AD_WPCONF2" },
145 { 0x11, "AD_GENERAL2" },
146 { 0x12, "AD_SET_LIST_PARAM" },
147 { 0x13, "AD_DUMP_STATUS" },
148 { 0x14, "AD_RZL" },
149 { 0x15, "AD_RZL_STRG" },
150 { 0x16, "AD_COUNT_WPS" },
151 { 0x17, "AD_QUEUE2" },
152 { 0x19, "AD_EM" },
153 { 0x1a, "AD_ES" },
154 { 0x1b, "AD_SHUTDOWN_STATE" },
155 { 0x1c, "AD_SHUTDOWN_INFO" },
156 { 0x1d, "AD_SHUTDOWN_ERROR" },
157 { 0x1f, "AD_DISPLACE" },
158 { 0x20, "AD_GET_TIMETAB" },
159 { 0x21, "AD_SET_TIMETAB" },
160 { 0x28, "AD_MSBUF" },
161 { 0x29, "AD_ARFC_NOREQ" },
162 { 0x2a, "AD_ENQID_INFO" },
163 { 0x2b, "AD_DEL_USER" },
164 { 0x2c, "AD_SPO_ADM" },
165 { 0x2d, "AD_NTAB_SYNC" },
166 { 0x2e, "AD_SHARED_PARAMETER" },
167 { 0x2f, "AD_RESET_TRACE" },
168 { 0x30, "AD_RESET_USR02" },
169 { 0x31, "AD_WALL_CREATE" },
170 { 0x32, "AD_WALL_DELETE" },
171 { 0x33, "AD_WALL_MODIFY" },
172 { 0x34, "AD_SERVER_STATE" },
173 { 0x3c, "AD_SELFIDENT" },
174 { 0x3d, "AD_DP_TRACE_CHANGE" },
175 { 0x3e, "AD_DP_DUMP_NIHDL" },
176 { 0x3f, "AD_DP_CALL_DELAYED" },
177 { 0x40, "AD_GW_ADM" },
178 { 0x41, "AD_DP_WAKEUP_MODE" },
179 { 0x42, "AD_VMC_SYS_EVENT" },
180 { 0x43, "AD_SHARED_PARAM_ALL_WPS" },
181 { 0x44, "AD_SECSESSION_UPDATE" },
182 { 0x45, "AD_SECSESSION_TERMINATE" },
183 { 0x46, "AD_ASRF_REQUEST" },
184 { 0x47, "AD_GET_NILIST" },
185 { 0x48, "AD_LOAD_INFO" },
186 { 0x49, "AD_TEST" },
187 { 0x4a, "AD_HANDLE_ACL" },
188 { 0x4b, "AD_PROFILE2" },
189 { 0x4c, "AD_RSCP_ASYNC" },
190 { 0x4d, "AD_BATCH_INFO" },
191 { 0x4e, "AD_SOFT_CANCEL" },
192 { 0x55, "AD_SYNC_LOAD_FMT" },
193 { 0x56, "AD_GET_NILIST_PORT" },
194 /* NULL */
195 { 0x00, NULL }
198 /* MS Adm AD_RZL_STRG Type values */
199 static const value_string sapms_adm_rzl_strg_type_vals[] = {
200 { 10, "STRG_TYPE_READALL" },
201 { 11, "STRG_TYPE_READALL_I" },
202 { 12, "STRG_TYPE_READALL_C" },
203 { 13, "STRG_TYPE_READALL_LC" },
204 { 15, "STRG_TYPE_READALL_OFFSET_I" },
205 { 16, "STRG_TYPE_READALL_OFFSET_C" },
206 { 17, "STRG_TYPE_READALL_OFFSET_LC" },
207 { 20, "STRG_TYPE_READALL_OFFSET" },
208 { 21, "STRG_TYPE_READ_I" },
209 { 22, "STRG_TYPE_READ_C" },
210 { 23, "STRG_TYPE_READ_LC" },
211 { 31, "STRG_TYPE_WRITE_I" },
212 { 32, "STRG_TYPE_WRITE_C" },
213 { 33, "STRG_TYPE_WRITE_LC" },
214 { 41, "STRG_TYPE_DEL_I" },
215 { 42, "STRG_TYPE_DEL_C" },
216 { 43, "STRG_TYPE_DEL_LC" },
217 { 51, "STRG_TYPE_CREATE_I" },
218 { 52, "STRG_TYPE_CREATE_C" },
219 { 53, "STRG_TYPE_CREATE_LC" },
220 { 90, "STRG_TYPE_DUMP" },
221 /* NULL */
222 { 0, NULL }
225 /* MS OP Code values */
226 static const value_string sapms_opcode_vals[] = {
227 { 0, "MS_DP_ADM" },
228 { 1, "MS_SERVER_CHG" },
229 { 2, "MS_SERVER_ADD" },
230 { 3, "MS_SERVER_SUB" },
231 { 4, "MS_SERVER_MOD" },
232 { 5, "MS_SERVER_LST" },
233 { 6, "MS_CHANGE_IP" },
234 { 7, "MS_SET_SECURITY_KEY" },
235 { 8, "MS_GET_SECURITY_KEY" },
236 { 9, "MS_GET_SECURITY_KEY2" },
237 { 10, "MS_GET_HWID" },
238 { 11, "MS_INCRE_TRACE" },
239 { 12, "MS_DECRE_TRACE" },
240 { 13, "MS_RESET_TRACE" },
241 { 14, "MS_ACT_STATISTIC" },
242 { 15, "MS_DEACT_STATISTIC" },
243 { 16, "MS_RESET_STATISTIC" },
244 { 17, "MS_GET_STATISTIC" },
245 { 18, "MS_DUMP_NIBUFFER" },
246 { 19, "MS_RESET_NIBUFFER" },
247 { 20, "MS_OPEN_REQ_LST" },
248 { 21, "MS_SERVER_INFO" },
249 { 22, "MS_SERVER_LIST" },
250 { 23, "MS_SERVER_ENTRY" },
251 { 24, "MS_DOMAIN_INFO" },
252 { 25, "MS_DOMAIN_LIST" },
253 { 26, "MS_DOMAIN_ENTRY" },
254 { 27, "MS_MAP_URL_TO_ADDR" },
255 { 28, "MS_GET_CODEPAGE" },
256 { 29, "MS_SOFT_SHUTDOWN" },
257 { 30, "MS_DUMP_INFO" },
258 { 31, "MS_FILE_RELOAD" },
259 { 32, "MS_RESET_DOMAIN_CONN" },
260 { 33, "MS_NOOP" },
261 { 34, "MS_SET_TXT" },
262 { 35, "MS_GET_TXT" },
263 { 36, "MS_COUNTER_CREATE" },
264 { 37, "MS_COUNTER_DELETE" },
265 { 38, "MS_COUNTER_INCREMENT" },
266 { 39, "MS_COUNTER_DECREMENT" },
267 { 40, "MS_COUNTER_REGISTER" },
268 { 41, "MS_COUNTER_GET" },
269 { 42, "MS_COUNTER_LST" },
270 { 43, "MS_SET_LOGON" },
271 { 44, "MS_GET_LOGON" },
272 { 45, "MS_DEL_LOGON" },
273 { 46, "MS_SERVER_DISC" },
274 { 47, "MS_SERVER_SHUTDOWN" },
275 { 48, "MS_SERVER_SOFT_SHUTDOWN" },
276 { 49, "MS_J2EE_CLUSTERNODE_CHG" },
277 { 50, "MS_J2EE_CLUSTERNODE_ADD" },
278 { 51, "MS_J2EE_CLUSTERNODE_SUB" },
279 { 52, "MS_J2EE_CLUSTERNODE_MOD" },
280 { 53, "MS_J2EE_CLUSTERNODE_LST" },
281 { 54, "MS_J2EE_SERVICE_REG" },
282 { 55, "MS_J2EE_SERVICE_UNREG" },
283 { 56, "MS_J2EE_SERVICE_LST" },
284 { 57, "MS_J2EE_SERVICE_ADD" },
285 { 58, "MS_J2EE_SERVICE_SUB" },
286 { 59, "MS_J2EE_SERVICE_MOD" },
287 { 60, "MS_J2EE_MOD_STATE" },
288 { 61, "MS_J2EE_SERVICE_GET" },
289 { 62, "MS_J2EE_SERVICE_REG2" },
290 { 63, "MS_NITRACE_SETGET" },
291 { 64, "MS_SERVER_LONG_LIST" },
292 { 65, "MS_J2EE_DEBUG_ENABLE" },
293 { 66, "MS_J2EE_DEBUG_DISABLE" },
294 { 67, "MS_SET_PROPERTY" },
295 { 68, "MS_GET_PROPERTY" },
296 { 69, "MS_DEL_PROPERTY" },
297 { 70, "MS_IP_PORT_TO_NAME" },
298 { 71, "MS_CHECK_ACL" },
299 { 72, "MS_LICENSE_SRV" },
300 { 74, "MS_SERVER_TEST_SOFT_SHUTDOWN" },
301 { 75, "MS_J2EE_RECONNECT_P1" },
302 { 76, "MS_J2EE_RECONNECT_P2" },
303 /* NULL */
304 { 0, NULL },
307 /* MS OP Code Error values */
308 static const value_string sapms_opcode_error_vals[] = {
309 { 0, "MSOP_OK" },
310 { 1, "MSOP_UNKNOWN_OPCODE" },
311 { 2, "MSOP_NOMEM" },
312 { 3, "MSOP_SECURITY_KEY_NOTSET" },
313 { 4, "MSOP_UNKNOWN_CLIENT" },
314 { 5, "MSOP_ACCESS_DENIED" },
315 { 6, "MSOP_REQUEST_REQUIRED" },
316 { 7, "MSOP_NAME_REQUIRED" },
317 { 8, "MSOP_GET_HWID_FAILED" },
318 { 9, "MSOP_SEND_FAILED" },
319 { 10, "MSOP_UNKNOWN_DOMAIN" },
320 { 11, "MSOP_UNKNOWN_SERVER" },
321 { 12, "MSOP_NO_DOMAIN_SERVER" },
322 { 13, "MSOP_INVALID_URL" },
323 { 14, "MSOP_UNKNOWN_DUMP_REQ" },
324 { 15, "MSOP_FILENOTFOUND" },
325 { 16, "MSOP_UNKNOWN_RELOAD_REQ" },
326 { 17, "MSOP_FILENOTDEFINED" },
327 { 18, "MSOP_CONVERT_FAILED" },
328 { 19, "MSOP_NOTSET" },
329 { 20, "MSOP_COUNTER_EXCEEDED" },
330 { 21, "MSOP_COUNTER_NOTFOUND" },
331 { 22, "MSOP_COUNTER_DELETED" },
332 { 23, "MSOP_COUNTER_EXISTS" },
333 { 24, "MSOP_EINVAL" },
334 { 25, "MSOP_NO_J2EE_CLUSTERNODE" },
335 { 26, "MSOP_UNKNOWN_PROPERTY" },
336 { 27, "MSOP_UNKNOWN_VERSION" },
337 { 28, "MSOP_ICTERROR" },
338 { 29, "MSOP_KERNEL_INCOMPATIBLE" },
339 { 30, "MSOP_NIACLCREATE_FAILED" },
340 { 31, "MSOP_NIACLSYNTAX_ERROR" },
341 /* NULL */
342 { 0, NULL },
345 /* MS Set/Get Property ID values */
346 static const value_string sapms_property_id_vals[] = {
347 { 1, "MS_PROPERTY_TEXT" },
348 { 2, "MS_PROPERTY_VHOST" },
349 { 3, "MS_PROPERTY_IPADR" },
350 { 4, "MS_PROPERTY_PARAM" },
351 { 5, "MS_PROPERTY_SERVICE" },
352 { 6, "MS_PROPERTY_DELALT" },
353 { 7, "Release information" },
354 /* NULL */
355 { 0, NULL },
358 /* MS Dump Info Dump values */
359 static const value_string sapms_dump_command_vals[] = {
360 { 1, "MS_DUMP_MSADM" },
361 { 2, "MS_DUMP_CON" },
362 { 3, "MS_DUMP_PARAMS" },
363 { 4, "MS_DUMP_ALL_CLIENTS" },
364 { 5, "MS_DUMP_ALL_SERVER" },
365 { 6, "MS_DUMP_ALL_DOMAIN" },
366 { 7, "MS_DUMP_DOMAIN_CONN" },
367 { 8, "MS_DUMP_RELEASE" },
368 { 9, "MS_DUMP_SIZEOF" },
369 { 10, "MS_DUMP_FIADM" },
370 { 11, "MS_DUMP_FICON" },
371 { 12, "MS_DUMP_COUNTER" },
372 { 13, "MS_DUMP_STATISTIC" },
373 { 14, "MS_DUMP_NIBUF" },
374 { 15, "MS_DUMP_URLMAP" },
375 { 16, "MS_DUMP_URLPREFIX" },
376 { 17, "MS_DUMP_URLHANDLER" },
377 { 18, "MS_DUMP_NOSERVER" },
378 { 19, "MS_DUMP_ACLINFO" },
379 { 20, "MS_DUMP_PERMISSION_TABLE" },
380 { 21, "MS_DUMP_J2EE_CLUSTER_STAT" },
381 { 22, "MS_DUMP_ACL_FILE_EXT" },
382 { 23, "MS_DUMP_ACL_FILE_INT" },
383 { 24, "MS_DUMP_ACL_FILE_ADMIN" },
384 { 25, "MS_DUMP_ACL_FILE_EXTBND" },
385 { 26, "MS_DUMP_ACL_FILE_HTTP" },
386 { 27, "MS_DUMP_ACL_FILE_HTTPS" },
387 /* NULL */
388 { 0, NULL },
391 /* MS Reload file values */
392 static const value_string sapms_file_reload_vals[] = {
393 { 1, "MS_RELOAD_CLIENT_TAB" },
394 { 2, "MS_RELOAD_SERVER_TAB" },
395 { 3, "MS_RELOAD_DOMAIN_TAB" },
396 { 4, "MS_RELOAD_URLMAP" },
397 { 5, "MS_RELOAD_URLPREFIX" },
398 { 6, "MS_RELOAD_ACL_INFO" },
399 { 7, "MS_RELOAD_PERMISSION_TABLE" },
400 { 8, "MS_RELOAD_STOC" },
401 { 9, "MS_RELOAD_ACL_FILE_EXT" },
402 { 10, "MS_RELOAD_ACL_FILE_INT" },
403 { 11, "MS_RELOAD_ACL_FILE_ADMIN" },
404 { 12, "MS_RELOAD_ACL_FILE_EXTBND" },
405 { 13, "MS_RELOAD_ACL_FILE_HTTP" },
406 { 14, "MS_RELOAD_ACL_FILE_HTTPS" },
407 /* NULL */
408 { 0, NULL }
412 /* MS Logon Type values */
413 static const value_string sapms_logon_type_vals[] = {
414 { 0, "MS_LOGON_DIAG_LB" },
415 { 1, "MS_LOGON_DIAG_LBS" },
416 { 2, "MS_LOGON_DIAG" },
417 { 3, "MS_LOGON_DIAGS" },
418 { 4, "MS_LOGON_RFC" },
419 { 5, "MS_LOGON_RFCS" },
420 { 6, "MS_LOGON_HTTP" },
421 { 7, "MS_LOGON_HTTPS" },
422 { 8, "MS_LOGON_FTP" },
423 { 9, "MS_LOGON_SMTP" },
424 { 10, "MS_LOGON_NNTP" },
425 { 11, "MS_LOGON_DIAG_E" },
426 { 12, "MS_LOGON_DIAGS_E" },
427 { 13, "MS_LOGON_RFC_E" },
428 { 14, "MS_LOGON_RFCS_E" },
429 { 15, "MS_LOGON_HTTP_E" },
430 { 16, "MS_LOGON_HTTPS_E" },
431 { 17, "MS_LOGON_FTP_E" },
432 { 18, "MS_LOGON_SMTP_E" },
433 { 19, "MS_LOGON_NNTP_E" },
434 { 20, "MS_LOGON_J2EE" },
435 { 21, "MS_LOGON_J2EES" },
436 { 22, "MS_LOGON_J2EE_E" },
437 { 23, "MS_LOGON_J2EES_E" },
438 { 24, "MS_LOGON_P4" },
439 { 25, "MS_LOGON_P4S" },
440 { 26, "MS_LOGON_IIOP" },
441 { 27, "MS_LOGON_IIOPS" },
442 { 28, "MS_LOGON_SDM" },
443 { 29, "MS_LOGON_TELNET" },
444 { 30, "MS_LOGON_DEBUG" },
445 { 31, "MS_LOGON_DPROXY" },
446 { 32, "MS_LOGON_P4HTTP" },
447 { 33, "MS_LOGON_HTTPRI" },
448 { 34, "MS_LOGON_HTTPSRI" },
449 { 35, "MS_LOGON_J2EERI" },
450 { 36, "MS_LOGON_J2EESRI" },
451 { 37, "MS_LOGON_TRXNS" },
452 /* NULL */
453 { 0, NULL }
457 /* MS Client Status values */
458 static const value_string sapms_server_lst_status_vals[] = {
459 { 0, "MS_STATE_UNKNOWN" },
460 { 1, "ACTIVE" },
461 { 2, "INACTIVE" },
462 { 3, "MS_STATE_SHUTDOWN" },
463 { 4, "MS_STATE_STOP" },
464 { 5, "MS_STATE_STARTING" },
465 { 6, "MS_STATE_INIT" },
466 /* NULL */
467 { 0, NULL }
471 /* Message Type values */
472 #define SAPMS_MSG_TYPE_DIA 0x01
473 #define SAPMS_MSG_TYPE_UPD 0x02
474 #define SAPMS_MSG_TYPE_ENQ 0x04
475 #define SAPMS_MSG_TYPE_BTC 0x08
476 #define SAPMS_MSG_TYPE_SPO 0x10
477 #define SAPMS_MSG_TYPE_UP2 0x20
478 #define SAPMS_MSG_TYPE_ATP 0x40
479 #define SAPMS_MSG_TYPE_ICM 0x80
481 static int proto_sapms;
483 static int hf_sapms_eyecatcher;
484 static int hf_sapms_version;
485 static int hf_sapms_errorno;
486 static int hf_sapms_toname;
487 static int hf_sapms_msgtypes;
488 static int hf_sapms_msgtypes_dia;
489 static int hf_sapms_msgtypes_upd;
490 static int hf_sapms_msgtypes_enq;
491 static int hf_sapms_msgtypes_btc;
492 static int hf_sapms_msgtypes_spo;
493 static int hf_sapms_msgtypes_up2;
494 static int hf_sapms_msgtypes_atp;
495 static int hf_sapms_msgtypes_icm;
496 static int hf_sapms_domain;
497 static int hf_sapms_reserved;
498 static int hf_sapms_key;
499 static int hf_sapms_flag;
500 static int hf_sapms_iflag;
501 static int hf_sapms_fromname;
502 static int hf_sapms_diagport;
504 static int hf_sapms_dp_adm_dp_version;
506 static int hf_sapms_adm_eyecatcher;
507 static int hf_sapms_adm_version;
508 static int hf_sapms_adm_msgtype;
509 static int hf_sapms_adm_recsize;
510 static int hf_sapms_adm_recno;
512 static int hf_sapms_adm_record;
513 static int hf_sapms_adm_record_opcode;
514 static int hf_sapms_adm_record_serial_number;
515 static int hf_sapms_adm_record_executed;
516 static int hf_sapms_adm_record_errorno;
517 static int hf_sapms_adm_record_value;
519 static int hf_sapms_adm_parameter;
521 static int hf_sapms_adm_rzl_strg_type;
522 static int hf_sapms_adm_rzl_strg_name;
523 static int hf_sapms_adm_rzl_strg_value;
524 static int hf_sapms_adm_rzl_strg_value_integer;
525 static int hf_sapms_adm_rzl_strg_uptime;
526 static int hf_sapms_adm_rzl_strg_delay;
527 static int hf_sapms_adm_rzl_strg_users;
528 static int hf_sapms_adm_rzl_strg_quality;
530 static int hf_sapms_opcode;
531 static int hf_sapms_opcode_error;
532 static int hf_sapms_opcode_version;
533 static int hf_sapms_opcode_charset;
534 static int hf_sapms_opcode_value;
536 static int hf_sapms_property_client;
537 static int hf_sapms_property_id;
538 static int hf_sapms_property_value;
540 static int hf_sapms_property_vhost_logon;
541 static int hf_sapms_property_vhost_length;
542 static int hf_sapms_property_vhost_value;
544 static int hf_sapms_property_ip_address;
545 static int hf_sapms_property_ip_address6;
547 static int hf_sapms_property_param_name_length;
548 static int hf_sapms_property_param_name_value;
549 static int hf_sapms_property_param_value_length;
550 static int hf_sapms_property_param_value_value;
552 static int hf_sapms_property_service_number;
553 static int hf_sapms_property_service_value;
555 static int hf_sapms_property_release;
556 static int hf_sapms_property_release_patchno;
557 static int hf_sapms_property_release_supplvl;
558 static int hf_sapms_property_release_platform;
561 static int hf_sapms_text_name;
562 static int hf_sapms_text_length;
563 static int hf_sapms_text_value;
565 static int hf_sapms_counter_uuid;
566 static int hf_sapms_counter_count;
567 static int hf_sapms_counter_no;
569 static int hf_sapms_change_ip_address;
570 static int hf_sapms_change_ip_address6;
572 static int hf_sapms_security_name;
573 static int hf_sapms_security_key;
574 static int hf_sapms_security_port;
575 static int hf_sapms_security_address;
576 static int hf_sapms_security_address6;
578 static int hf_sapms_file_reload;
579 static int hf_sapms_file_filler;
581 static int hf_sapms_logon_type;
582 static int hf_sapms_logon_port;
583 static int hf_sapms_logon_address;
584 static int hf_sapms_logon_name_length;
585 static int hf_sapms_logon_name;
586 static int hf_sapms_logon_prot_length;
587 static int hf_sapms_logon_prot;
588 static int hf_sapms_logon_host_length;
589 static int hf_sapms_logon_host;
590 static int hf_sapms_logon_misc_length;
591 static int hf_sapms_logon_misc;
592 static int hf_sapms_logon_address6_length;
593 static int hf_sapms_logon_address6;
594 static int hf_sapms_logon_end;
596 static int hf_sapms_shutdown_reason_length;
597 static int hf_sapms_shutdown_reason;
599 static int hf_sapms_ip_to_name_address4;
600 static int hf_sapms_ip_to_name_address6;
601 static int hf_sapms_ip_to_name_port;
602 static int hf_sapms_ip_to_name_length;
603 static int hf_sapms_ip_to_name;
605 static int hf_sapms_check_acl_error_code;
606 static int hf_sapms_check_acl_acl;
608 static int hf_sapms_codepage;
610 static int hf_sapms_dump_dest;
611 static int hf_sapms_dump_filler;
612 static int hf_sapms_dump_index;
613 static int hf_sapms_dump_command;
614 static int hf_sapms_dump_name;
616 static int hf_sapms_server_lst_client;
617 static int hf_sapms_server_lst_name;
618 static int hf_sapms_server_lst_host;
619 static int hf_sapms_server_lst_service;
620 static int hf_sapms_server_lst_msgtypes;
621 static int hf_sapms_server_lst_msgtypes_dia;
622 static int hf_sapms_server_lst_msgtypes_upd;
623 static int hf_sapms_server_lst_msgtypes_enq;
624 static int hf_sapms_server_lst_msgtypes_btc;
625 static int hf_sapms_server_lst_msgtypes_spo;
626 static int hf_sapms_server_lst_msgtypes_up2;
627 static int hf_sapms_server_lst_msgtypes_atp;
628 static int hf_sapms_server_lst_msgtypes_icm;
629 static int hf_sapms_server_lst_hostaddr;
630 static int hf_sapms_server_lst_hostaddrv4;
631 static int hf_sapms_server_lst_servno;
632 static int hf_sapms_server_lst_status;
633 static int hf_sapms_server_lst_nitrc;
634 static int hf_sapms_server_lst_sys_service;
636 static int ett_sapms;
638 /* Expert info */
639 static expert_field ei_sapms_adm_opcode_partial;
640 static expert_field ei_sapms_opcode_partial;
641 static expert_field ei_sapms_unknown_version;
642 static expert_field ei_sapms_client_invalid_offset;
643 static expert_field ei_sapms_client_invalid_length;
644 static expert_field ei_sapms_text_invalid_length;
645 static expert_field ei_sapms_ip_invalid_length;
647 /* Global port preference */
648 static range_t *global_sapms_port_range;
650 /* Global highlight preference */
651 static bool global_sapms_highlight_items = true;
653 /* Protocol handle */
654 static dissector_handle_t sapms_handle;
656 void proto_reg_handoff_sapms(void);
657 void proto_register_sapms(void);
660 static void
661 dissect_sapms_adm_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, uint32_t length){
663 proto_item *record = NULL, *value = NULL;
664 proto_tree *record_tree = NULL, *value_tree = NULL;
665 uint8_t adm_opcode;
667 while (length>=104){
669 record = proto_tree_add_item(tree, hf_sapms_adm_record, tvb, offset, 104, ENC_NA);
670 record_tree = proto_item_add_subtree(record, ett_sapms);
672 adm_opcode = tvb_get_uint8(tvb, offset);
673 proto_tree_add_item(record_tree, hf_sapms_adm_record_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
674 proto_item_append_text(record_tree, ", Adm Opcode=%s", val_to_str_const(adm_opcode, sapms_adm_record_opcode_vals, "Unknown"));
675 offset+=1;
676 length-=1;
678 proto_tree_add_item(record_tree, hf_sapms_adm_record_serial_number, tvb, offset, 1, ENC_BIG_ENDIAN);
679 offset+=1;
680 length-=1;
681 proto_tree_add_item(record_tree, hf_sapms_adm_record_executed, tvb, offset, 1, ENC_BIG_ENDIAN);
682 offset+=1;
683 length-=1;
684 proto_tree_add_item(record_tree, hf_sapms_adm_record_errorno, tvb, offset, 1, ENC_BIG_ENDIAN);
685 offset+=1;
686 length-=1;
688 /* Dissect the value in function of the opcode */
689 switch (adm_opcode){
690 case 0x01: /* AD_PROFILE */
691 case 0x2e:{ /* AD_SHARED_PARAMETER */
692 proto_tree_add_item(record_tree, hf_sapms_adm_parameter, tvb, offset, 100, ENC_ASCII|ENC_NA);
693 offset+=100;
694 length-=100;
695 break;
697 case 0x15:{ /* AD_RZL_STRG */
698 uint8_t strg_type = 0;
699 strg_type = tvb_get_uint8(tvb, offset);
700 proto_tree_add_item(record_tree, hf_sapms_adm_rzl_strg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
701 offset+=1;
702 length-=1;
703 offset+=3; /* Skip 3 bytes */
704 length-=3;
705 proto_tree_add_item(record_tree, hf_sapms_adm_rzl_strg_name, tvb, offset, 20, ENC_ASCII|ENC_NA);
706 offset+=20;
707 length-=20;
709 value = proto_tree_add_item(record_tree, hf_sapms_adm_rzl_strg_value, tvb, offset, 40, ENC_ASCII|ENC_NA);
710 value_tree = proto_item_add_subtree(value, ett_sapms);
711 switch (strg_type){
712 case 11: /* STRG_TYPE_READALL_I */
713 case 15: /* STRG_TYPE_READALL_OFFSET_I */
714 case 21: /* STRG_TYPE_READ_I */
715 case 31: /* STRG_TYPE_WRITE_I */
716 case 41: /* STRG_TYPE_DEL_I */
717 case 51:{ /* STRG_TYPE_CREATE_I */
718 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_uptime, tvb, offset, 4, ENC_BIG_ENDIAN);
719 offset+=4;
720 length-=4;
721 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
722 offset+=4;
723 length-=4;
724 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
725 offset+=4;
726 length-=4;
727 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
728 offset+=4;
729 length-=4;
730 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_users, tvb, offset, 4, ENC_BIG_ENDIAN);
731 offset+=4;
732 length-=4;
733 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_quality, tvb, offset, 4, ENC_BIG_ENDIAN);
734 offset+=4;
735 length-=4;
736 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
737 offset+=4;
738 length-=4;
739 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
740 offset+=4;
741 length-=4;
742 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
743 offset+=4;
744 length-=4;
745 proto_tree_add_item(value_tree, hf_sapms_adm_rzl_strg_value_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
746 offset+=4;
747 length-=4;
748 break;
750 default:{
751 offset+=40;
752 length-=40;
753 break;
757 offset+=36;
758 length-=36; /* Skip the last 36 bytes */
759 break;
761 default:{
762 proto_tree_add_item(record_tree, hf_sapms_adm_record_value, tvb, offset, 100, ENC_NA);
763 offset+=100;
764 length-=100;
765 if (global_sapms_highlight_items){
766 expert_add_info_format(pinfo, record_tree, &ei_sapms_adm_opcode_partial, "The ADM opcode is dissected partially (0x%.2x)", adm_opcode);
768 break;
776 static int
777 dissect_sapms_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, uint8_t opcode_version){
778 proto_item *client = NULL, *msg_types = NULL;
779 proto_tree *client_tree = NULL, *msg_types_tree = NULL;
780 struct e_in6_addr address_ipv6;
781 uint32_t address_ipv4 = 0;
782 int client_length = 0, client_length_remaining = 0;
784 /* Chose the client length according to the version number */
785 if (opcode_version == 0x01){ /* This version was seen in the older releases (6.40) */
786 client_length = 67;
787 } else if (opcode_version == 0x02){ /* This version was seen in the older releases (6.40) */
788 client_length = 115;
789 } else if (opcode_version == 0x03){
790 client_length = 150;
791 } else if (opcode_version == 0x04){ /* Version 4 was seen in releases >7.0 */
792 client_length = 160;
793 } else { /* Default to version 4 */
794 client_length = 160;
795 if (global_sapms_highlight_items){
796 expert_add_info_format(pinfo, tree, &ei_sapms_unknown_version, "This version has not been seen, dissection of this packet could be wrong for this version (0x%.2x)", opcode_version);
800 client_length_remaining = tvb_reported_length_remaining(tvb, offset);
801 if (client_length_remaining < 0){
802 expert_add_info(pinfo, tree, &ei_sapms_client_invalid_offset);
803 return 0;
805 if (client_length_remaining < client_length){
806 expert_add_info_format(pinfo, tree, &ei_sapms_client_invalid_length, "Invalid client length (expected=%d, actual=%d)", client_length, client_length_remaining);
807 return (client_length_remaining);
810 /* Add the client tree */
811 client = proto_tree_add_item(tree, hf_sapms_server_lst_client, tvb, offset, client_length, ENC_NA);
812 client_tree = proto_item_add_subtree(client, ett_sapms);
814 /* Client name field */
815 if (opcode_version==0x01){
816 proto_tree_add_item(client_tree, hf_sapms_server_lst_name, tvb, offset, 20, ENC_ASCII|ENC_NA);
817 offset+=20;
818 } else {
819 proto_tree_add_item(client_tree, hf_sapms_server_lst_name, tvb, offset, 40, ENC_ASCII|ENC_NA);
820 offset+=40;
823 /* Host field (version 1 is 20 bytes, 2 is 32 bytes and version 3/4 is 64 bytes) */
824 if (opcode_version==0x01){
825 proto_tree_add_item(client_tree, hf_sapms_server_lst_host, tvb, offset, 20, ENC_ASCII|ENC_NA);
826 offset+=20;
827 } else if (opcode_version==0x02){
828 proto_tree_add_item(client_tree, hf_sapms_server_lst_host, tvb, offset, 32, ENC_ASCII|ENC_NA);
829 offset+=32;
830 } else {
831 proto_tree_add_item(client_tree, hf_sapms_server_lst_host, tvb, offset, 64, ENC_ASCII|ENC_NA);
832 offset+=64;
834 /* Service field */
835 proto_tree_add_item(client_tree, hf_sapms_server_lst_service, tvb, offset, 20, ENC_ASCII|ENC_NA);
836 offset+=20;
838 /* Message type flags */
839 msg_types = proto_tree_add_item(client_tree, hf_sapms_server_lst_msgtypes, tvb, offset, 1, ENC_BIG_ENDIAN);
840 msg_types_tree = proto_item_add_subtree(msg_types, ett_sapms);
841 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_dia, tvb, offset, 1, ENC_BIG_ENDIAN);
842 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_upd, tvb, offset, 1, ENC_BIG_ENDIAN);
843 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_enq, tvb, offset, 1, ENC_BIG_ENDIAN);
844 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_btc, tvb, offset, 1, ENC_BIG_ENDIAN);
845 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_spo, tvb, offset, 1, ENC_BIG_ENDIAN);
846 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_up2, tvb, offset, 1, ENC_BIG_ENDIAN);
847 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_atp, tvb, offset, 1, ENC_BIG_ENDIAN);
848 proto_tree_add_item(msg_types_tree, hf_sapms_server_lst_msgtypes_icm, tvb, offset, 1, ENC_BIG_ENDIAN);
849 offset+=1;
851 /* Add the IPv6 address (only for version 3/4) */
852 if (opcode_version >= 0x03){
853 tvb_get_ipv6(tvb, offset, &address_ipv6);
854 proto_tree_add_ipv6(client_tree, hf_sapms_server_lst_hostaddr, tvb, offset, 16, &address_ipv6);
855 offset+=16;
858 /* Add the IPv4 address */
859 address_ipv4 = tvb_get_ipv4(tvb, offset);
860 proto_tree_add_ipv4(client_tree, hf_sapms_server_lst_hostaddrv4, tvb, offset, 4, address_ipv4);
861 offset+=4;
863 /* Service Number field */
864 proto_tree_add_item(client_tree, hf_sapms_server_lst_servno, tvb, offset, 2, ENC_BIG_ENDIAN);
865 offset+=2;
867 /* Other fields only on version 2/3/4 */
868 if (opcode_version >= 0x02){
869 proto_tree_add_item(client_tree, hf_sapms_server_lst_status, tvb, offset, 1, ENC_BIG_ENDIAN);
870 offset+=1;
871 proto_tree_add_item(client_tree, hf_sapms_server_lst_nitrc, tvb, offset, 1, ENC_BIG_ENDIAN);
872 offset+=1;
875 /* Add the Sys Server field (only for v4) */
876 if (opcode_version == 0x04){
877 proto_tree_add_item(client_tree, hf_sapms_server_lst_sys_service, tvb, offset, 4, ENC_BIG_ENDIAN);
880 /* Return the client length according to the version */
881 return (client_length);
885 static void
886 dissect_sapms_counter(tvbuff_t *tvb, proto_tree *tree, uint32_t offset){
887 proto_tree_add_item(tree, hf_sapms_counter_uuid, tvb, offset, 40, ENC_ASCII|ENC_NA);
888 offset+=40;
889 proto_tree_add_item(tree, hf_sapms_counter_count, tvb, offset, 4, ENC_BIG_ENDIAN);
890 offset+=4;
891 proto_tree_add_item(tree, hf_sapms_counter_no, tvb, offset, 4, ENC_BIG_ENDIAN);
894 static void
895 dissect_sapms_property(tvbuff_t *tvb, proto_tree *tree, uint32_t offset){
896 uint32_t property_id = 0;
897 proto_item *value = NULL;
898 proto_tree *value_tree = NULL;
900 proto_tree_add_item(tree, hf_sapms_property_client, tvb, offset, 40, ENC_ASCII|ENC_NA);
901 offset+=40;
903 property_id = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
904 proto_tree_add_item(tree, hf_sapms_property_id, tvb, offset, 4, ENC_BIG_ENDIAN);
905 offset+=4;
907 /* Check if the property item has a value */
908 if (!tvb_offset_exists(tvb, offset)){
909 return;
912 value = proto_tree_add_item(tree, hf_sapms_property_value, tvb, offset, -1, ENC_NA);
913 value_tree = proto_item_add_subtree(value, ett_sapms);
915 switch (property_id){
917 case 0x02:{ /* MS_PROPERTY_VHOST */
918 uint16_t vhost_length = 0;
920 proto_tree_add_item(value_tree, hf_sapms_property_vhost_logon, tvb, offset, 2, ENC_BIG_ENDIAN);
921 offset+=2;
923 offset += 12; /* Padding */
925 vhost_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
926 proto_tree_add_item(value_tree, hf_sapms_property_vhost_length, tvb, offset, 2, ENC_BIG_ENDIAN);
927 offset+=2;
929 if (vhost_length > 0) {
930 proto_tree_add_item(value_tree, hf_sapms_property_vhost_value, tvb, offset, vhost_length, ENC_ASCII|ENC_NA);
932 break;
934 case 0x03:{ /* MS_PROPERTY_IPADR */
935 proto_tree_add_item(value_tree, hf_sapms_property_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN);
936 offset+=4;
937 proto_tree_add_item(value_tree, hf_sapms_property_ip_address6, tvb, offset, 16, ENC_NA);
938 break;
940 case 0x04:{ /* MS_PROPERTY_PARAM */
941 uint32_t param_length = 0;
942 uint16_t value_length = 0;
944 param_length = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
945 proto_tree_add_item(value_tree, hf_sapms_property_param_name_length, tvb, offset, 4, ENC_BIG_ENDIAN);
946 offset+=4;
947 if (param_length > 0){
948 proto_tree_add_item(value_tree, hf_sapms_property_param_name_value, tvb, offset, param_length, ENC_ASCII|ENC_NA);
949 offset+=param_length;
951 offset += 100 - param_length; /* Padding */
952 offset += 2; /* Padding */
954 value_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
955 proto_tree_add_item(value_tree, hf_sapms_property_param_value_length, tvb, offset, 2, ENC_BIG_ENDIAN);
956 offset+=2;
957 if (param_length > 0){
958 proto_tree_add_item(value_tree, hf_sapms_property_param_value_value, tvb, offset, value_length, ENC_ASCII|ENC_NA);
960 break;
962 case 0x05:{ /* MS_PROPERTY_SERVICE */
963 proto_tree_add_item(value_tree, hf_sapms_property_service_number, tvb, offset, 2, ENC_BIG_ENDIAN);
964 offset+=2;
965 proto_tree_add_item(value_tree, hf_sapms_property_service_value, tvb, offset, 1, ENC_BIG_ENDIAN);
966 break;
968 case 0x07:{ /* Release Information */
969 proto_tree_add_item(value_tree, hf_sapms_property_release, tvb, offset, 10, ENC_ASCII|ENC_NA);
970 offset+=10;
971 proto_tree_add_item(value_tree, hf_sapms_property_release_patchno, tvb, offset, 4, ENC_BIG_ENDIAN);
972 offset+=4;
973 proto_tree_add_item(value_tree, hf_sapms_property_release_supplvl, tvb, offset, 4, ENC_BIG_ENDIAN);
974 offset+=4;
975 proto_tree_add_item(value_tree, hf_sapms_property_release_platform, tvb, offset, 4, ENC_BIG_ENDIAN);
976 break;
981 static void
982 dissect_sapms_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, uint8_t flag, uint8_t opcode, uint8_t opcode_version, uint32_t length){
983 int client_length = 0;
985 switch (opcode){
986 case 0x00:{ /* MS_DP_ADM */
987 tvb_get_uint8(tvb, offset);
988 proto_tree_add_item(tree, hf_sapms_dp_adm_dp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
989 break;
991 case 0x02: /* MS_SERVER_ADD */
992 case 0x03: /* MS_SERVER_SUB */
993 case 0x04:{ /* MS_SERVER_MOD */
994 dissect_sapms_client(tvb, pinfo, tree, offset, opcode_version);
995 break;
997 case 0x05:{ /* MS_SERVER_LST */
998 if (flag == 0x03){ /* If it's a reply (flag=MS_REPLY) */
999 while (tvb_reported_length_remaining(tvb, offset) > 0){
1000 client_length = dissect_sapms_client(tvb, pinfo, tree, offset, opcode_version);
1001 offset += client_length;
1004 break;
1006 case 0x06:{ /* MS_CHANGE_IP */
1007 proto_tree_add_item(tree, hf_sapms_change_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN);
1008 offset+=4;
1010 if (opcode_version >= 0x02){
1011 proto_tree_add_item(tree, hf_sapms_change_ip_address6, tvb, offset, 16, ENC_NA);
1013 break;
1015 case 0x07: /* MS_SET_SECURITY_KEY */
1016 case 0x08:{ /* MS_GET_SECURITY_KEY */
1017 proto_tree_add_item(tree, hf_sapms_security_name, tvb, offset, 40, ENC_ASCII|ENC_NA);
1018 offset+=40;
1019 proto_tree_add_item(tree, hf_sapms_security_key, tvb, offset, 256, ENC_ASCII|ENC_NA);
1020 break;
1022 case 0x09:{ /* MS_GET_SECURITY_KEY2 */
1023 uint32_t address_ipv4;
1024 struct e_in6_addr address_ipv6;
1026 address_ipv4 = tvb_get_ipv4(tvb, offset);
1027 proto_tree_add_ipv4(tree, hf_sapms_security_address, tvb, offset, 4, address_ipv4);
1028 offset+=4;
1029 proto_tree_add_item(tree, hf_sapms_security_port, tvb, offset, 2, ENC_BIG_ENDIAN);
1030 offset+=2;
1031 proto_tree_add_item(tree, hf_sapms_security_key, tvb, offset, 256, ENC_ASCII|ENC_NA);
1032 offset+=256;
1033 tvb_get_ipv6(tvb, offset, &address_ipv6);
1034 proto_tree_add_ipv6(tree, hf_sapms_security_address6, tvb, offset, 16, &address_ipv6);
1035 break;
1037 case 0x0a:{ /* MS_GET_HWID */
1038 proto_tree_add_none_format(tree, hf_sapms_opcode_value, tvb, offset, length, "Hardware ID: %s", tvb_get_string_enc(pinfo->pool, tvb, offset, length, ENC_ASCII));
1039 break;
1041 case 0x11:{ /* MS_GET_STATISTIC */
1042 /* XXX: Fill fields for statistics */
1043 break;
1045 case 0x1C:{ /* MS_GET_CODEPAGE */
1046 if (flag == 0x03) {
1047 proto_tree_add_item(tree, hf_sapms_codepage, tvb, offset, 4, ENC_BIG_ENDIAN);
1049 break;
1051 case 0x1E:{ /* MS_DUMP_INFO */
1053 if (flag == 0x02) { /* If it's a request (flag=MS_REQUEST) */
1054 proto_tree_add_item(tree, hf_sapms_dump_dest, tvb, offset, 1, ENC_BIG_ENDIAN);
1055 offset+=1;
1056 proto_tree_add_item(tree, hf_sapms_dump_filler, tvb, offset, 3, ENC_NA);
1057 offset+=3;
1058 proto_tree_add_item(tree, hf_sapms_dump_index, tvb, offset, 2, ENC_BIG_ENDIAN);
1059 offset+=2;
1060 proto_tree_add_item(tree, hf_sapms_dump_command, tvb, offset, 2, ENC_BIG_ENDIAN);
1061 offset+=2;
1062 if (length>=48) {
1063 proto_tree_add_item(tree, hf_sapms_dump_name, tvb, offset, 40, ENC_ASCII|ENC_NA);
1066 } else if (flag == 0x03) { /* If it's a reply (flag=MS_REPLY) */
1067 uint32_t string_length = 0;
1068 length = tvb_strsize(tvb, offset);
1069 /* Add each string in a different item */
1070 while (length>1) {
1071 string_length = tvb_find_line_end(tvb, offset, -1, NULL, false);
1072 if (string_length>0) {
1073 proto_tree_add_none_format(tree, hf_sapms_opcode_value, tvb, offset, string_length, "%s", tvb_get_string_enc(pinfo->pool, tvb, offset, string_length, ENC_ASCII));
1074 offset+=string_length; length-=string_length;
1076 offset+=1;
1077 length-=1;
1080 break;
1082 case 0x1f:{ /* MS_FILE_RELOAD */
1083 proto_tree_add_item(tree, hf_sapms_file_reload, tvb, offset, 1, ENC_BIG_ENDIAN);
1084 offset+=1;
1085 proto_tree_add_item(tree, hf_sapms_file_filler, tvb, offset, 3, ENC_NA);
1086 break;
1088 case 0x22: /* MS_SET_TXT */
1089 case 0x23:{ /* MS_GET_TXT */
1090 uint32_t text_length = 0;
1092 proto_tree_add_item(tree, hf_sapms_text_name, tvb, offset, 40, ENC_ASCII|ENC_NA);
1093 offset+=40;
1094 length-=40;
1095 text_length = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1096 proto_tree_add_item(tree, hf_sapms_text_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1097 offset+=4;
1098 length-=4;
1099 /* Check length */
1100 if (text_length != length ){
1101 expert_add_info_format(pinfo, tree, &ei_sapms_text_invalid_length, "Invalid text length (expected=%d, actual=%d)", text_length, length);
1103 proto_tree_add_item(tree, hf_sapms_text_value, tvb, offset, length, ENC_ASCII|ENC_NA);
1104 break;
1106 case 0x24: /* MS_COUNTER_CREATE */
1107 case 0x25: /* MS_COUNTER_DELETE */
1108 case 0x26: /* MS_COUNTER_INCREMENT */
1109 case 0x27: /* MS_COUNTER_DECREMENT */
1110 case 0x28: /* MS_COUNTER_REGISTER */
1111 case 0x29:{ /* MS_COUNTER_GET */
1112 if (tvb_reported_length_remaining(tvb, offset) >= 48){
1113 dissect_sapms_counter(tvb, tree, offset);
1115 break;
1117 case 0x2a:{ /* MS_COUNTER_LST */
1118 while (tvb_reported_length_remaining(tvb, offset) >= 48){
1119 dissect_sapms_counter(tvb, tree, offset);
1120 offset+=48;
1122 break;
1124 case 0x2b: /* MS_SET_LOGON */
1125 case 0x2c: /* MS_GET_LOGON */
1126 case 0x2d:{ /* MS_DEL_LOGON */
1127 uint16_t name_length = 0, prot_length = 0, host_length = 0, misc_length = 0, address6_length = 0;
1128 uint32_t address_ipv4;
1129 struct e_in6_addr address_ipv6;
1131 proto_tree_add_item(tree, hf_sapms_logon_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1132 offset+=2;
1133 length-=2;
1134 proto_tree_add_item(tree, hf_sapms_logon_port, tvb, offset, 2, ENC_BIG_ENDIAN);
1135 offset+=2;
1136 length-=2;
1138 address_ipv4 = tvb_get_ipv4(tvb, offset);
1139 proto_tree_add_ipv4(tree, hf_sapms_logon_address, tvb, offset, 4, address_ipv4);
1140 offset+=4;
1141 length-=4;
1143 name_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1144 proto_tree_add_item(tree, hf_sapms_logon_name_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1145 offset+=2;
1146 length-=2;
1147 if (name_length > 0 && length >= name_length){
1148 proto_tree_add_item(tree, hf_sapms_logon_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
1149 offset+=name_length;
1150 length-=name_length;
1153 prot_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1154 proto_tree_add_item(tree, hf_sapms_logon_prot_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1155 offset+=2;
1156 length-=2;
1157 if (prot_length > 0 && length >= prot_length){
1158 proto_tree_add_item(tree, hf_sapms_logon_prot, tvb, offset, prot_length, ENC_ASCII|ENC_NA);
1159 offset+=prot_length;
1160 length-=prot_length;
1163 host_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1164 proto_tree_add_item(tree, hf_sapms_logon_host_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1165 offset+=2;
1166 length-=2;
1167 if (host_length > 0 && length >= host_length){
1168 proto_tree_add_item(tree, hf_sapms_logon_host, tvb, offset, host_length, ENC_ASCII|ENC_NA);
1169 offset+=host_length;
1170 length-=host_length;
1173 misc_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1174 proto_tree_add_item(tree, hf_sapms_logon_misc_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1175 offset+=2;
1176 length-=2;
1177 if (misc_length > 0 && length >= misc_length){
1178 proto_tree_add_item(tree, hf_sapms_logon_misc, tvb, offset, misc_length, ENC_ASCII|ENC_NA);
1179 offset+=misc_length;
1180 length-=misc_length;
1183 address6_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1184 proto_tree_add_item(tree, hf_sapms_logon_address6_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1185 offset+=2;
1186 length-=2;
1187 if ((address6_length == 16) && (length >= (address6_length + (uint32_t)4))){
1188 tvb_get_ipv6(tvb, offset, &address_ipv6);
1189 proto_tree_add_ipv6(tree, hf_sapms_logon_address6, tvb, offset, 16, &address_ipv6);
1190 offset+=16;
1191 proto_tree_add_item(tree, hf_sapms_logon_end, tvb, offset, 4, ENC_BIG_ENDIAN);
1193 } else { /* Add expert info if wrong IPv6 address length */
1194 expert_add_info_format(pinfo, tree, &ei_sapms_ip_invalid_length, "Invalid IPv6 address length (%d) or data", address6_length);
1197 break;
1199 case 0x2e: /* MS_SERVER_DISC */
1200 case 0x2f: /* MS_SERVER_SHUTDOWN */
1201 case 0x30: /* MS_SERVER_SOFT_SHUTDOWN */
1202 case 0x4a:{ /* MS_SERVER_TEST_SOFT_SHUTDOWN */
1203 uint16_t reason_length = 0;
1205 client_length = dissect_sapms_client(tvb, pinfo, tree, offset, opcode_version);
1206 offset += client_length;
1207 length -= client_length;
1208 reason_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1209 proto_tree_add_item(tree, hf_sapms_shutdown_reason_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1210 offset+=2;
1211 length-=2;
1213 if (reason_length > 0 && length > 0){
1214 reason_length = length < reason_length? length : reason_length;
1215 proto_tree_add_item(tree, hf_sapms_shutdown_reason, tvb, offset, reason_length, ENC_ASCII|ENC_NA);
1217 break;
1219 case 0x43: /* MS_SET_PROPERTY */
1220 case 0x44: /* MS_GET_PROPERTY */
1221 case 0x45:{ /* MS_DEL_PROPERTY */
1222 dissect_sapms_property(tvb, tree, offset);
1223 break;
1225 case 0x46:{ /* MS_IP_PORT_TO_NAME */
1226 uint32_t name_length = 0;
1228 if (opcode_version == 0x01){
1229 uint32_t address_ipv4 = tvb_get_ipv4(tvb, offset);
1230 proto_tree_add_ipv4(tree, hf_sapms_ip_to_name_address4, tvb, offset, 4, address_ipv4);
1231 offset+=4;
1232 length-=4;
1233 } else if (opcode_version == 0x02){
1234 struct e_in6_addr address_ipv6;
1235 tvb_get_ipv6(tvb, offset, &address_ipv6);
1236 proto_tree_add_ipv6(tree, hf_sapms_ip_to_name_address6, tvb, offset, 16, &address_ipv6);
1237 offset+=16;
1238 length-=16;
1241 proto_tree_add_item(tree, hf_sapms_ip_to_name_port, tvb, offset, 2, ENC_BIG_ENDIAN);
1242 offset+=2;
1243 length-=2;
1245 name_length = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1246 proto_tree_add_item(tree, hf_sapms_ip_to_name_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1247 offset+=4;
1248 length-=4;
1249 if (name_length > 0 && length >= name_length){
1250 proto_tree_add_item(tree, hf_sapms_ip_to_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
1253 break;
1255 case 0x47:{ /* MS_CHECK_ACL */
1256 uint32_t string_length = 0;
1257 proto_tree_add_item(tree, hf_sapms_check_acl_error_code, tvb, offset, 2, ENC_BIG_ENDIAN);
1258 offset+=2;
1259 length-=2;
1260 string_length = tvb_strnlen(tvb, offset, length) + 1;
1261 proto_tree_add_item(tree, hf_sapms_check_acl_acl, tvb, offset, string_length, ENC_ASCII|ENC_NA);
1262 offset+=string_length;
1263 length-=string_length;
1264 string_length = tvb_strnlen(tvb, offset, length) + 1;
1265 proto_tree_add_item(tree, hf_sapms_check_acl_acl, tvb, offset, string_length, ENC_ASCII|ENC_NA);
1266 break;
1268 default:{
1269 if (global_sapms_highlight_items){
1270 expert_add_info_format(pinfo, tree, &ei_sapms_opcode_partial, "The opcode is dissected partially (0x%.2x)", opcode);
1272 break;
1280 static int
1281 dissect_sapms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1283 uint32_t offset = 0;
1284 proto_item *ti = NULL, *oi = NULL, *msg_types = NULL;
1285 proto_tree *sapms_tree = NULL, *sapms_opcode_tree = NULL, *msg_types_tree = NULL;
1287 /* Add the protocol to the column */
1288 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAPMS");
1289 /* Clear out stuff in the info column */
1290 col_clear(pinfo->cinfo,COL_INFO);
1292 /* Add the main sapms subtree */
1293 ti = proto_tree_add_item(tree, proto_sapms, tvb, 0, -1, ENC_NA);
1294 sapms_tree = proto_item_add_subtree(ti, ett_sapms);
1296 /* Check for the eye catcher string */
1297 if (tvb_strneql(tvb, offset, "**MESSAGE**\00", 12) == 0){
1298 int remaining_length = 0;
1299 uint8_t flag=0, iflag = 0, opcode = 0, opcode_version = 0;
1301 proto_tree_add_item(sapms_tree, hf_sapms_eyecatcher, tvb, offset, 12, ENC_ASCII|ENC_NA);
1302 offset+=12;
1303 proto_tree_add_item(sapms_tree, hf_sapms_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1304 offset+=1;
1305 proto_tree_add_item(sapms_tree, hf_sapms_errorno, tvb, offset, 1, ENC_BIG_ENDIAN);
1306 offset+=1;
1307 proto_tree_add_item(sapms_tree, hf_sapms_toname, tvb, offset, 40, ENC_ASCII|ENC_NA);
1308 offset+=40;
1309 msg_types = proto_tree_add_item(sapms_tree, hf_sapms_msgtypes, tvb, offset, 1, ENC_BIG_ENDIAN);
1310 msg_types_tree = proto_item_add_subtree(msg_types, ett_sapms);
1311 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_dia, tvb, offset, 1, ENC_BIG_ENDIAN);
1312 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_upd, tvb, offset, 1, ENC_BIG_ENDIAN);
1313 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_enq, tvb, offset, 1, ENC_BIG_ENDIAN);
1314 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_btc, tvb, offset, 1, ENC_BIG_ENDIAN);
1315 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_spo, tvb, offset, 1, ENC_BIG_ENDIAN);
1316 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_up2, tvb, offset, 1, ENC_BIG_ENDIAN);
1317 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_atp, tvb, offset, 1, ENC_BIG_ENDIAN);
1318 proto_tree_add_item(msg_types_tree, hf_sapms_msgtypes_icm, tvb, offset, 1, ENC_BIG_ENDIAN);
1319 offset+=1;
1320 proto_tree_add_item(sapms_tree, hf_sapms_reserved, tvb, offset, 1, ENC_NA);
1321 offset+=1;
1322 proto_tree_add_item(sapms_tree, hf_sapms_domain, tvb, offset, 1, ENC_BIG_ENDIAN);
1323 offset+=1;
1324 proto_tree_add_item(sapms_tree, hf_sapms_reserved, tvb, offset, 1, ENC_NA);
1325 offset+=1;
1326 proto_tree_add_item(sapms_tree, hf_sapms_key, tvb, offset, 8, ENC_NA);
1327 offset+=8;
1329 flag = tvb_get_uint8(tvb, offset);
1330 proto_tree_add_item(sapms_tree, hf_sapms_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1331 offset+=1;
1332 proto_item_append_text(sapms_tree, ", Flag=%s", val_to_str_const(flag, sapms_flag_vals, "Unknown"));
1334 iflag = tvb_get_uint8(tvb, offset);
1335 proto_tree_add_item(sapms_tree, hf_sapms_iflag, tvb, offset, 1, ENC_BIG_ENDIAN);
1336 offset+=1;
1337 proto_item_append_text(sapms_tree, ", IFlag=%s", val_to_str_const(iflag, sapms_iflag_vals, "Unknown"));
1339 col_append_fstr(pinfo->cinfo, COL_INFO, "Flag=%s,IFlag=%s", val_to_str_const(flag, sapms_flag_vals, "Unknown"), val_to_str_const(iflag, sapms_iflag_vals, "Unknown"));
1341 proto_tree_add_item(sapms_tree, hf_sapms_fromname, tvb, offset, 40, ENC_ASCII|ENC_NA);
1342 offset+=40;
1344 if (flag == 0x00 && iflag == 0x00){ /* For MS_REQUEST+MS_LOGIN_2 it's the diag port */
1345 proto_tree_add_item(sapms_tree, hf_sapms_diagport, tvb, offset, 2, ENC_BIG_ENDIAN);
1346 offset+=2;
1347 } else {
1348 offset+=2; /* Skip 2 bytes */
1351 if (!tvb_offset_exists(tvb, offset)){
1352 return 0;
1355 /* The remaining of the packet is dissected based on the flag */
1356 switch (iflag){
1358 /* MS_SEND_NAME or unknown (forwarded messages) */
1359 case 0x00: /* MS_UNKNOWN */
1360 case 0x01: /* MS_SEND_NAME */
1361 case 0x02: /* MS_SEND_TYPE */
1362 case 0x07:{ /* MS_SEND_TYPE_ONCE */
1363 opcode = tvb_get_uint8(tvb, offset);
1364 proto_tree_add_item(sapms_tree, hf_sapms_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1365 offset+=1;
1366 proto_tree_add_item(sapms_tree, hf_sapms_opcode_error, tvb, offset, 1, ENC_BIG_ENDIAN);
1367 offset+=1;
1368 opcode_version = tvb_get_uint8(tvb, offset);
1369 proto_tree_add_item(sapms_tree, hf_sapms_opcode_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1370 offset+=1;
1371 proto_tree_add_item(sapms_tree, hf_sapms_opcode_charset, tvb, offset, 1, ENC_BIG_ENDIAN);
1372 offset+=1;
1374 proto_item_append_text(sapms_tree, ", Opcode=%s", val_to_str_const(opcode, sapms_opcode_vals, "Unknown"));
1375 col_append_fstr(pinfo->cinfo, COL_INFO, ", Opcode=%s", val_to_str_const(opcode, sapms_opcode_vals, "Unknown"));
1377 /* Add the opcode value subtree */
1378 remaining_length = tvb_reported_length_remaining(tvb, offset);
1379 if (remaining_length > 0){
1380 oi = proto_tree_add_item(sapms_tree, hf_sapms_opcode_value, tvb, offset, remaining_length, ENC_NA);
1381 sapms_opcode_tree = proto_item_add_subtree(oi, ett_sapms);
1382 dissect_sapms_opcode(tvb, pinfo, sapms_opcode_tree, offset, flag, opcode, opcode_version, remaining_length);
1384 break;
1386 } case 0x05:{ /* MS_ADM_OPCODES */
1387 proto_tree_add_item(sapms_tree, hf_sapms_adm_eyecatcher, tvb, offset, 12, ENC_ASCII|ENC_NA);
1388 offset+=12;
1389 proto_tree_add_item(sapms_tree, hf_sapms_adm_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1390 offset+=1;
1391 proto_tree_add_item(sapms_tree, hf_sapms_adm_msgtype, tvb, offset, 1, ENC_BIG_ENDIAN);
1392 offset+=1;
1393 proto_tree_add_item(sapms_tree, hf_sapms_adm_recsize, tvb, offset, 11, ENC_ASCII|ENC_NA);
1394 offset+=11;
1395 proto_tree_add_item(sapms_tree, hf_sapms_adm_recno, tvb, offset, 11, ENC_ASCII|ENC_NA);
1396 offset+=11;
1398 /* Add the records subtree */
1399 remaining_length = tvb_reported_length_remaining(tvb, offset);
1400 if (remaining_length > 0){
1401 dissect_sapms_adm_record(tvb, pinfo, sapms_tree, offset, remaining_length);
1403 break;
1409 return tvb_reported_length(tvb);
1412 void
1413 proto_register_sapms(void)
1415 static hf_register_info hf[] = {
1416 /* General Header fields */
1417 { &hf_sapms_eyecatcher,
1418 { "Eye Catcher", "sapms.eyecatcher", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1419 { &hf_sapms_version,
1420 { "Version", "sapms.version", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1421 { &hf_sapms_errorno,
1422 { "Error Number", "sapms.errorno", FT_UINT8, BASE_HEX, VALS(sapms_errorno_vals), 0x0, NULL, HFILL }},
1423 { &hf_sapms_toname,
1424 { "To Name", "sapms.toname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1425 { &hf_sapms_msgtypes,
1426 { "Message Type", "sapms.msgtype", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1427 { &hf_sapms_msgtypes_dia,
1428 { "DIA", "sapms.msgtype.dia", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_DIA, NULL, HFILL }},
1429 { &hf_sapms_msgtypes_upd,
1430 { "UPD", "sapms.msgtype.upd", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_UPD, NULL, HFILL }},
1431 { &hf_sapms_msgtypes_enq,
1432 { "ENQ", "sapms.msgtype.enq", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ENQ, NULL, HFILL }},
1433 { &hf_sapms_msgtypes_btc,
1434 { "BTC", "sapms.msgtype.btc", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_BTC, NULL, HFILL }},
1435 { &hf_sapms_msgtypes_spo,
1436 { "SPO", "sapms.msgtype.spo", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_SPO, NULL, HFILL }},
1437 { &hf_sapms_msgtypes_up2,
1438 { "UP2", "sapms.msgtype.up2", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_UP2, NULL, HFILL }},
1439 { &hf_sapms_msgtypes_atp,
1440 { "ATP", "sapms.msgtype.atp", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ATP, NULL, HFILL }},
1441 { &hf_sapms_msgtypes_icm,
1442 { "ICM", "sapms.msgtype.icm", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ICM, NULL, HFILL }},
1443 { &hf_sapms_domain,
1444 { "Domain", "sapms.domain", FT_UINT8, BASE_HEX, VALS(sapms_domain_vals), 0x0, NULL, HFILL }},
1445 { &hf_sapms_reserved,
1446 { "Reserved", "sapms.reserved", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1447 { &hf_sapms_key,
1448 { "Key", "sapms.key", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1449 { &hf_sapms_flag,
1450 { "Flag", "sapms.flag", FT_UINT8, BASE_HEX, VALS(sapms_flag_vals), 0x0, NULL, HFILL }},
1451 { &hf_sapms_iflag,
1452 { "IFlag", "sapms.iflag", FT_UINT8, BASE_HEX, VALS(sapms_iflag_vals), 0x0, NULL, HFILL }},
1453 { &hf_sapms_fromname,
1454 { "From Name", "sapms.fromname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1455 { &hf_sapms_diagport,
1456 { "Diag Port", "sapms.diag_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1458 /* MS_DP_ADM fields */
1459 { &hf_sapms_dp_adm_dp_version,
1460 { "Dispatcher Version", "sapms.dp_adm.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1462 /* ADM Message fields */
1463 { &hf_sapms_adm_eyecatcher,
1464 { "Adm Eye Catcher", "sapms.adm.eyecatcher", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1465 { &hf_sapms_adm_version,
1466 { "Adm Version", "sapms.adm.version", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1467 { &hf_sapms_adm_msgtype,
1468 { "Adm Message Type", "sapms.adm.msgtype", FT_UINT8, BASE_HEX, VALS(sapms_adm_msgtype_vals), 0x0, NULL, HFILL }},
1469 { &hf_sapms_adm_recsize,
1470 { "Adm Record Size", "sapms.adm.recsize", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1471 { &hf_sapms_adm_recno,
1472 { "Adm Records Number", "sapms.adm.recno", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1474 { &hf_sapms_adm_record,
1475 { "Adm Record", "sapms.adm.records", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1476 { &hf_sapms_adm_record_opcode,
1477 { "Adm Record Opcode", "sapms.adm.record.opcode", FT_UINT8, BASE_HEX, VALS(sapms_adm_record_opcode_vals), 0x0, NULL, HFILL }},
1478 { &hf_sapms_adm_record_serial_number,
1479 { "Adm Record Serial Number", "sapms.adm.record.serial_number", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1480 { &hf_sapms_adm_record_executed,
1481 { "Adm Record Executed", "sapms.adm.record.executed", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1482 { &hf_sapms_adm_record_errorno,
1483 { "Adm Record Error Number", "sapms.adm.record.errorno", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1484 { &hf_sapms_adm_record_value,
1485 { "Adm Record Value", "sapms.adm.record.value", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1487 { &hf_sapms_adm_parameter,
1488 { "Adm Profile Parameter", "sapms.adm.parameter", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1490 { &hf_sapms_adm_rzl_strg_type,
1491 { "Adm RZL String Type", "sapms.adm.rzl_strg.type", FT_UINT8, BASE_HEX, VALS(sapms_adm_rzl_strg_type_vals), 0x0, NULL, HFILL }},
1492 { &hf_sapms_adm_rzl_strg_name,
1493 { "Adm RZL String Name", "sapms.adm.rzl_strg.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1494 { &hf_sapms_adm_rzl_strg_value,
1495 { "Adm RZL String Value", "sapms.adm.rzl_strg.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1496 { &hf_sapms_adm_rzl_strg_value_integer,
1497 { "Adm RZL String Integer Value", "sapms.adm.rzl_strg.integer", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1498 { &hf_sapms_adm_rzl_strg_uptime,
1499 { "Adm RZL String Uptime", "sapms.adm.rzl_strg.uptime", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1500 { &hf_sapms_adm_rzl_strg_delay,
1501 { "Adm RZL String Delay", "sapms.adm.rzl_strg.delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1502 { &hf_sapms_adm_rzl_strg_users,
1503 { "Adm RZL String Users", "sapms.adm.rzl_strg.users", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1504 { &hf_sapms_adm_rzl_strg_quality,
1505 { "Adm RZL String Quality", "sapms.adm.rzl_strg.quality", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1507 /* OPCODE fields */
1508 { &hf_sapms_opcode,
1509 { "Opcode", "sapms.opcode", FT_UINT8, BASE_HEX, VALS(sapms_opcode_vals), 0x0, NULL, HFILL }},
1510 { &hf_sapms_opcode_error,
1511 { "Opcode Error", "sapms.opcode.error", FT_UINT8, BASE_HEX, VALS(sapms_opcode_error_vals), 0x0, NULL, HFILL }},
1512 { &hf_sapms_opcode_version,
1513 { "Opcode Version", "sapms.opcode.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1514 { &hf_sapms_opcode_charset,
1515 { "Opcode Character Set", "sapms.opcode.charset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1516 { &hf_sapms_opcode_value,
1517 { "Opcode Value", "sapms.opcode.value", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1519 /* MS_SET/GET/DEL_PROPERTY opcode fields */
1520 { &hf_sapms_property_client,
1521 { "Property Client", "sapms.property.client", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1522 { &hf_sapms_property_id,
1523 { "Property ID", "sapms.property.id", FT_UINT32, BASE_DEC, VALS(sapms_property_id_vals), 0x0, NULL, HFILL }},
1525 { &hf_sapms_property_value,
1526 { "Property", "sapms.property.value", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1528 { &hf_sapms_property_vhost_logon,
1529 { "Property VHost Logon", "sapms.property.vhost.logon", FT_UINT16, BASE_DEC, VALS(sapms_logon_type_vals), 0x0, NULL, HFILL }},
1530 { &hf_sapms_property_vhost_length,
1531 { "Property VHost Length", "sapms.property.vhost.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1532 { &hf_sapms_property_vhost_value,
1533 { "Property VHost Value", "sapms.property.vhost.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1535 { &hf_sapms_property_ip_address,
1536 { "Property IP Address v4", "sapms.property.ipaddr4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1537 { &hf_sapms_property_ip_address6,
1538 { "Property IP Address v6", "sapms.property.ipaddr6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1540 { &hf_sapms_property_param_name_length,
1541 { "Property Parameter Name Length", "sapms.property.param.name_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1542 { &hf_sapms_property_param_name_value,
1543 { "Property Parameter Name", "sapms.property.param.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1544 { &hf_sapms_property_param_value_length,
1545 { "Property Parameter Value Length", "sapms.property.param.value_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1546 { &hf_sapms_property_param_value_value,
1547 { "Property Parameter Value", "sapms.property.param.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1549 { &hf_sapms_property_service_number,
1550 { "Property Service Number", "sapms.property.service.number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1551 { &hf_sapms_property_service_value,
1552 { "Property Service Value", "sapms.property.service.value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1553 { &hf_sapms_property_release,
1554 { "Property Release", "sapms.property.release", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1555 { &hf_sapms_property_release_patchno,
1556 { "Property Patch Number", "sapms.property.patchno", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1557 { &hf_sapms_property_release_supplvl,
1558 { "Property Support Level", "sapms.property.supplvl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1559 { &hf_sapms_property_release_platform,
1560 { "Property Platform", "sapms.property.platform", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1562 /* MS_GET_CODEPAGE */
1563 { &hf_sapms_codepage,
1564 { "Codepage", "sapms.codepage", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1566 /* MS_DUMP fields */
1567 { &hf_sapms_dump_dest,
1568 { "Dump Dest", "sapms.dump.dest", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1569 { &hf_sapms_dump_filler,
1570 { "Dump Filler", "sapms.dump.filler", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1571 { &hf_sapms_dump_index,
1572 { "Dump Index", "sapms.dump.index", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1573 { &hf_sapms_dump_command,
1574 { "Dump Command", "sapms.dump.command", FT_UINT16, BASE_HEX, VALS(sapms_dump_command_vals), 0x0, NULL, HFILL }},
1575 { &hf_sapms_dump_name,
1576 { "Dump Name", "sapms.dump.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1578 /* MS_SERVER_LIST fields */
1579 { &hf_sapms_server_lst_client,
1580 { "Client", "sapms.serverlst.client", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1581 { &hf_sapms_server_lst_name,
1582 { "Client Name", "sapms.serverlst.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1583 { &hf_sapms_server_lst_host,
1584 { "Host", "sapms.serverlst.host", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1585 { &hf_sapms_server_lst_service,
1586 { "Service", "sapms.serverlst.service", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1587 { &hf_sapms_server_lst_msgtypes,
1588 { "Message Types", "sapms.serverlst.msgtypes", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1589 { &hf_sapms_server_lst_msgtypes_dia,
1590 { "DIA", "sapms.serverlst.msgtype.dia", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_DIA, NULL, HFILL }},
1591 { &hf_sapms_server_lst_msgtypes_upd,
1592 { "UPD", "sapms.serverlst.msgtype.upd", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_UPD, NULL, HFILL }},
1593 { &hf_sapms_server_lst_msgtypes_enq,
1594 { "ENQ", "sapms.serverlst.msgtype.enq", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ENQ, NULL, HFILL }},
1595 { &hf_sapms_server_lst_msgtypes_btc,
1596 { "BTC", "sapms.serverlst.msgtype.btc", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_BTC, NULL, HFILL }},
1597 { &hf_sapms_server_lst_msgtypes_spo,
1598 { "SPO", "sapms.serverlst.msgtype.spo", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_SPO, NULL, HFILL }},
1599 { &hf_sapms_server_lst_msgtypes_up2,
1600 { "UP2", "sapms.serverlst.msgtype.up2", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_UP2, NULL, HFILL }},
1601 { &hf_sapms_server_lst_msgtypes_atp,
1602 { "ATP", "sapms.serverlst.msgtype.atp", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ATP, NULL, HFILL }},
1603 { &hf_sapms_server_lst_msgtypes_icm,
1604 { "ICM", "sapms.serverlst.msgtype.icm", FT_BOOLEAN, 8, NULL, SAPMS_MSG_TYPE_ICM, NULL, HFILL }},
1605 { &hf_sapms_server_lst_hostaddr,
1606 { "Host Address v6", "sapms.serverlst.hostaddr", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1607 { &hf_sapms_server_lst_hostaddrv4,
1608 { "Host Address v4", "sapms.serverlst.hostaddr4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1609 { &hf_sapms_server_lst_servno,
1610 { "Service Number", "sapms.serverlst.servno", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1611 { &hf_sapms_server_lst_status,
1612 { "Status", "sapms.serverlst.status", FT_UINT8, BASE_HEX, VALS(sapms_server_lst_status_vals), 0x0, NULL, HFILL }},
1613 { &hf_sapms_server_lst_nitrc,
1614 { "NI Trace", "sapms.serverlst.nitrc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1615 { &hf_sapms_server_lst_sys_service,
1616 { "Sys Service", "sapms.serverlst.sysservice", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1618 /* MS_SET_SECURITY_KEY, MS_GET_SECURITY_KEY and MS_GET_SECURITY_KEY2 fields */
1619 { &hf_sapms_security_name,
1620 { "Security Name", "sapms.security.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1621 { &hf_sapms_security_key,
1622 { "Security Key", "sapms.security.key", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1623 { &hf_sapms_security_port,
1624 { "Security Port", "sapms.security.port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1625 { &hf_sapms_security_address,
1626 { "Security Address v4", "sapms.security.addr", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1627 { &hf_sapms_security_address6,
1628 { "Security Address v6", "sapms.security.addr6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1630 /* MS_SET_TEXT, MS_GET_TEXT */
1631 { &hf_sapms_text_name,
1632 { "Text Name", "sapms.text.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1633 { &hf_sapms_text_length,
1634 { "Text Length", "sapms.text.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1635 { &hf_sapms_text_value,
1636 { "Text Value", "sapms.text.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1638 /* COUNTER fields */
1639 { &hf_sapms_counter_uuid,
1640 { "Counter UUID", "sapms.counter.uuid", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1641 { &hf_sapms_counter_count,
1642 { "Counter Count", "sapms.counter.count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1643 { &hf_sapms_counter_no,
1644 { "Counter Number", "sapms.counter.no", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1646 /* CHANGE_IP fields */
1647 { &hf_sapms_change_ip_address,
1648 { "Change IP Address IPv4", "sapms.change.addr", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1649 { &hf_sapms_change_ip_address6,
1650 { "Change IP Address IPv6", "sapms.change.addr6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1652 /* FILE RELOAD fields */
1653 { &hf_sapms_file_reload,
1654 { "File Reload Name", "sapms.filereload.name", FT_UINT8, BASE_HEX, VALS(sapms_file_reload_vals), 0x0, NULL, HFILL }},
1655 { &hf_sapms_file_filler,
1656 { "File Reload Filler", "sapms.filereload.filler", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1658 /* MS_GET_LOGON, MS_SET_LOGON and MS_DEL_LOGON fields */
1659 { &hf_sapms_logon_type,
1660 { "Logon Type", "sapms.logon.type", FT_UINT16, BASE_HEX, VALS(sapms_logon_type_vals), 0x0, NULL, HFILL }},
1661 { &hf_sapms_logon_port,
1662 { "Logon Port", "sapms.logon.port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1663 { &hf_sapms_logon_address,
1664 { "Logon Address IPv4", "sapms.logon.addr", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1665 { &hf_sapms_logon_name_length,
1666 { "Logon Name Length", "sapms.logon.name_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1667 { &hf_sapms_logon_name,
1668 { "Logon Name", "sapms.logon.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1669 { &hf_sapms_logon_prot_length,
1670 { "Logon Protocol Length", "sapms.logon.prot_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1671 { &hf_sapms_logon_prot,
1672 { "Logon Protocol", "sapms.logon.prot", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1673 { &hf_sapms_logon_host_length,
1674 { "Logon Host Length", "sapms.logon.host_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1675 { &hf_sapms_logon_host,
1676 { "Logon Host", "sapms.logon.host", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1677 { &hf_sapms_logon_misc_length,
1678 { "Logon Misc Length", "sapms.logon.misc_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1679 { &hf_sapms_logon_misc,
1680 { "Logon Misc", "sapms.logon.misc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1681 { &hf_sapms_logon_address6_length,
1682 { "Logon Address IPv6 Length", "sapms.logon.addr6_length", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1683 { &hf_sapms_logon_address6,
1684 { "Logon Address IPv6", "sapms.logon.address6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1685 { &hf_sapms_logon_end,
1686 { "Logon Address End", "sapms.logon.end", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1688 { &hf_sapms_shutdown_reason_length,
1689 { "Shutdown Reason Length", "sapms.shutdown.reason_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1690 { &hf_sapms_shutdown_reason,
1691 { "Shutdown Reason", "sapms.shutdown.reason", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1693 /* MS_IP_PORT_TO_NAME fields */
1694 { &hf_sapms_ip_to_name_address4,
1695 { "IP to Name Address IPv4", "sapms.ip_to_name.addr4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1696 { &hf_sapms_ip_to_name_address6,
1697 { "IP to Name Address IPv6", "sapms.ip_to_name.addr6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1698 { &hf_sapms_ip_to_name_port,
1699 { "IP to Name Port", "sapms.ip_to_name.port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1700 { &hf_sapms_ip_to_name_length,
1701 { "IP to Name Length", "sapms.ip_to_name.name_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1702 { &hf_sapms_ip_to_name,
1703 { "IP to Name", "sapms.ip_to_name.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1705 /* MS_CHECK_ACL fields */
1706 { &hf_sapms_check_acl_error_code,
1707 { "Check ACL Error Code", "sapms.check_acl.error_code", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1708 { &hf_sapms_check_acl_acl,
1709 { "Check ACL Entry", "sapms.check_acl.acl", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1712 /* Setup protocol subtree array */
1713 static int *ett[] = {
1714 &ett_sapms
1717 /* Register the expert info */
1718 static ei_register_info ei[] = {
1719 { &ei_sapms_adm_opcode_partial, { "sapms.adm.record.opcode.unknown", PI_UNDECODED, PI_WARN, "The ADM opcode is dissected partially", EXPFILL }},
1720 { &ei_sapms_opcode_partial, { "sapms.opcode.unknown", PI_UNDECODED, PI_WARN, "The opcode is dissected partially", EXPFILL }},
1721 { &ei_sapms_unknown_version, { "sapms.serverlst.unknown", PI_UNDECODED, PI_WARN, "This version has not been seen, dissection of this packet could be wrong for this version", EXPFILL }},
1722 { &ei_sapms_client_invalid_offset, { "sapms.serverlst.offset.invalid", PI_MALFORMED, PI_WARN, "Invalid offset", EXPFILL }},
1723 { &ei_sapms_client_invalid_length, { "sapms.serverlst.length.invalid", PI_MALFORMED, PI_WARN, "Invalid client length", EXPFILL }},
1724 { &ei_sapms_text_invalid_length, { "sapms.text.length.invalid", PI_MALFORMED, PI_WARN, "Invalid text length", EXPFILL }},
1725 { &ei_sapms_ip_invalid_length, { "sapms.logon.address6.invalid", PI_MALFORMED, PI_WARN, "Invalid IPv6 address length or data", EXPFILL }},
1728 module_t *sapms_module;
1729 expert_module_t* sapms_expert;
1731 /* Register the protocol */
1732 proto_sapms = proto_register_protocol("SAP Message Server Protocol", "SAPMS", "sapms");
1734 register_dissector("sapms", dissect_sapms, proto_sapms);
1736 proto_register_field_array(proto_sapms, hf, array_length(hf));
1737 proto_register_subtree_array(ett, array_length(ett));
1739 sapms_expert = expert_register_protocol(proto_sapms);
1740 expert_register_field_array(sapms_expert, ei, array_length(ei));
1742 /* Register the preferences */
1743 sapms_module = prefs_register_protocol(proto_sapms, proto_reg_handoff_sapms);
1745 range_convert_str(wmem_epan_scope(), &global_sapms_port_range, SAPMS_PORT_RANGE, MAX_TCP_PORT);
1746 prefs_register_range_preference(sapms_module, "tcp_ports", "SAP MS Protocol TCP port numbers", "Port numbers used for SAP MS Protocol (default " SAPMS_PORT_RANGE ")", &global_sapms_port_range, MAX_TCP_PORT);
1748 prefs_register_bool_preference(sapms_module, "highlight_unknown_items", "Highlight unknown SAP MS messages", "Whether the SAP MS Protocol dissector should highlight unknown MS messages (might be noise and generate a lot of expert warnings)", &global_sapms_highlight_items);
1753 * Helpers for dealing with the port range
1755 static void range_delete_callback (uint32_t port, void *ptr _U_)
1757 dissector_delete_uint("sapni.port", port, sapms_handle);
1760 static void range_add_callback (uint32_t port, void *ptr _U_)
1762 dissector_add_uint("sapni.port", port, sapms_handle);
1766 * Register Hand off for the SAP MS Protocol
1768 void
1769 proto_reg_handoff_sapms(void)
1771 static range_t *sapms_port_range;
1772 static bool initialized = false;
1774 if (!initialized) {
1775 sapms_handle = create_dissector_handle(dissect_sapms, proto_sapms);
1776 initialized = true;
1777 } else {
1778 range_foreach(sapms_port_range, range_delete_callback, NULL);
1779 wmem_free(wmem_epan_scope(), sapms_port_range);
1782 sapms_port_range = range_copy(wmem_epan_scope(), global_sapms_port_range);
1783 range_foreach(sapms_port_range, range_add_callback, NULL);
1787 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1789 * Local variables:
1790 * c-basic-offset: 8
1791 * tab-width: 8
1792 * indent-tabs-mode: t
1793 * End:
1795 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1796 * :indentSize=8:tabSize=8:noTabs=false: