Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-smpp.c
blob9daedd3d30f16a6e24ba1dfac30711da002ad61b
1 /* packet-smpp.c
2 * Routines for Short Message Peer to Peer dissection
3 * Copyright 2001, Tom Uijldert.
5 * Data Coding Scheme decoding for GSM (SMS and CBS),
6 * provided by Olivier Biot.
8 * Dissection of multiple SMPP PDUs within one packet
9 * provided by Chris Wilson.
11 * Statistics support using Stats Tree API
12 * provided by Abhik Sarkar
14 * Support for SMPP 5.0
15 * introduced by Abhik Sarkar
17 * Support for Huawei SMPP+ extensions
18 * introduced by Xu Bo and enhanced by Abhik Sarkar
20 * Enhanced error code handling
21 * provided by Stipe Tolj from Kannel.
23 * Refer to the AUTHORS file or the AUTHORS section in the man page
24 * for contacting the author(s) of this file.
26 * Wireshark - Network traffic analyzer
27 * By Gerald Combs <gerald@wireshark.org>
28 * Copyright 1998 Gerald Combs
30 * SPDX-License-Identifier: GPL-2.0-or-later
32 * ----------
34 * Dissector of an SMPP (Short Message Peer to Peer) PDU, as defined by the
35 * SMS forum (www.smsforum.net) in "SMPP protocol specification v3.4"
36 * (document version: 12-Oct-1999 Issue 1.2)
39 #include "config.h"
42 #include <epan/packet.h>
43 #include <epan/expert.h>
44 #include <epan/exceptions.h>
45 #include <epan/stats_tree.h>
46 #include <epan/prefs.h>
47 #include <epan/exported_pdu.h>
48 #include <epan/conversation.h>
49 #include <epan/proto_data.h>
50 #include <wsutil/time_util.h>
51 #include "packet-tcp.h"
52 #include "packet-tls.h"
53 #include "packet-smpp.h"
54 #include <epan/strutil.h>
56 #define SMPP_FIXED_HEADER_LENGTH 16
57 #define SMPP_MIN_LENGTH SMPP_FIXED_HEADER_LENGTH
59 /* Forward declarations */
60 void proto_register_smpp(void);
61 void proto_reg_handoff_smpp(void);
63 static int exported_pdu_tap = -1;
66 * Initialize the protocol and registered fields
68 * Fixed header section
70 static int proto_smpp;
72 static int st_smpp_ops = -1;
73 static int st_smpp_req = -1;
74 static int st_smpp_res = -1;
75 static int st_smpp_res_status = -1;
77 static int hf_smpp_command_id;
78 static int hf_smpp_command_request;
79 static int hf_smpp_command_response;
80 static int hf_smpp_command_length;
81 static int hf_smpp_command_status;
82 static int hf_smpp_sequence_number;
85 * Fixed body section
87 static int hf_smpp_system_id;
88 static int hf_smpp_password;
89 static int hf_smpp_system_type;
90 static int hf_smpp_interface_version;
91 static int hf_smpp_addr_ton;
92 static int hf_smpp_addr_npi;
93 static int hf_smpp_address_range;
94 static int hf_smpp_service_type;
95 static int hf_smpp_source_addr_ton;
96 static int hf_smpp_source_addr_npi;
97 static int hf_smpp_source_addr;
98 static int hf_smpp_dest_addr_ton;
99 static int hf_smpp_dest_addr_npi;
100 static int hf_smpp_destination_addr;
101 static int hf_smpp_esm_submit_msg_mode;
102 static int hf_smpp_esm_submit_msg_type;
103 static int hf_smpp_esm_submit_features;
104 static int hf_smpp_protocol_id;
105 static int hf_smpp_priority_flag;
106 static int hf_smpp_schedule_delivery_time;
107 static int hf_smpp_schedule_delivery_time_r;
108 static int hf_smpp_validity_period;
109 static int hf_smpp_validity_period_r;
110 static int hf_smpp_regdel_receipt;
111 static int hf_smpp_regdel_acks;
112 static int hf_smpp_regdel_notif;
113 static int hf_smpp_replace_if_present_flag;
114 static int hf_smpp_data_coding;
115 static int hf_smpp_sm_default_msg_id;
116 static int hf_smpp_sm_length;
117 static int hf_smpp_short_message;
118 static int hf_smpp_short_message_bin;
119 static int hf_smpp_message_id;
120 static int hf_smpp_dlist;
121 static int hf_smpp_dlist_resp;
122 static int hf_smpp_dl_name;
123 static int hf_smpp_final_date;
124 static int hf_smpp_final_date_r;
125 static int hf_smpp_message_state;
126 static int hf_smpp_error_code;
127 static int hf_smpp_error_status_code;
128 static int hf_smpp_esme_addr_ton;
129 static int hf_smpp_esme_addr_npi;
130 static int hf_smpp_esme_addr;
133 * Optional parameter section
135 static int hf_smpp_opt_params;
136 static int hf_smpp_opt_param;
137 static int hf_smpp_opt_param_tag;
138 static int hf_smpp_opt_param_len;
139 static int hf_smpp_vendor_op;
140 static int hf_smpp_reserved_op;
142 static int hf_smpp_dest_addr_subunit;
143 static int hf_smpp_dest_network_type;
144 static int hf_smpp_dest_bearer_type;
145 static int hf_smpp_dest_telematics_id;
146 static int hf_smpp_source_addr_subunit;
147 static int hf_smpp_source_network_type;
148 static int hf_smpp_source_bearer_type;
149 static int hf_smpp_source_telematics_id;
150 static int hf_smpp_qos_time_to_live;
151 static int hf_smpp_payload_type;
152 static int hf_smpp_additional_status_info_text;
153 static int hf_smpp_receipted_message_id;
154 static int hf_smpp_msg_wait_ind;
155 static int hf_smpp_msg_wait_type;
156 static int hf_smpp_privacy_indicator;
157 static int hf_smpp_source_subaddress;
158 static int hf_smpp_dest_subaddress;
159 static int hf_smpp_user_message_reference;
160 static int hf_smpp_user_response_code;
161 static int hf_smpp_source_port;
162 static int hf_smpp_destination_port;
163 static int hf_smpp_sar_msg_ref_num;
164 static int hf_smpp_language_indicator;
165 static int hf_smpp_sar_total_segments;
166 static int hf_smpp_sar_segment_seqnum;
167 static int hf_smpp_SC_interface_version;
168 static int hf_smpp_callback_num_pres;
169 static int hf_smpp_callback_num_scrn;
170 static int hf_smpp_callback_num_atag;
171 static int hf_smpp_number_of_messages;
172 static int hf_smpp_callback_num;
173 static int hf_smpp_dpf_result;
174 static int hf_smpp_set_dpf;
175 static int hf_smpp_ms_availability_status;
176 static int hf_smpp_network_error_type;
177 static int hf_smpp_network_error_code;
178 static int hf_smpp_message_payload;
179 static int hf_smpp_delivery_failure_reason;
180 static int hf_smpp_more_messages_to_send;
181 static int hf_smpp_ussd_service_op;
182 static int hf_smpp_display_time;
183 static int hf_smpp_sms_signal;
184 static int hf_smpp_ms_validity;
185 static int hf_smpp_alert_on_message_delivery_null;
186 static int hf_smpp_alert_on_message_delivery_type;
187 static int hf_smpp_its_reply_type;
188 static int hf_smpp_its_session_number;
189 static int hf_smpp_its_session_sequence;
190 static int hf_smpp_its_session_ind;
192 /* Optional Parameters introduced in SMPP 5.0 */
193 static int hf_smpp_congestion_state;
194 static int hf_smpp_billing_identification;
195 static int hf_smpp_dest_addr_np_country;
196 static int hf_smpp_dest_addr_np_information;
197 static int hf_smpp_dest_addr_np_resolution;
198 static int hf_smpp_source_network_id;
199 static int hf_smpp_source_node_id;
200 static int hf_smpp_dest_network_id;
201 static int hf_smpp_dest_node_id;
202 /* Optional Parameters for Cell Broadcast Operations */
203 static int hf_smpp_broadcast_channel_indicator;
204 static int hf_smpp_broadcast_content_type_nw;
205 static int hf_smpp_broadcast_content_type_type;
206 static int hf_smpp_broadcast_content_type_info;
207 static int hf_smpp_broadcast_message_class;
208 static int hf_smpp_broadcast_rep_num;
209 static int hf_smpp_broadcast_frequency_interval_unit;
210 static int hf_smpp_broadcast_frequency_interval_value;
211 static int hf_smpp_broadcast_area_identifier;
212 static int hf_smpp_broadcast_area_identifier_format;
213 static int hf_smpp_broadcast_error_status;
214 static int hf_smpp_broadcast_area_success;
215 static int hf_smpp_broadcast_end_time;
216 static int hf_smpp_broadcast_end_time_r;
217 static int hf_smpp_broadcast_service_group;
220 * Data Coding Scheme section
222 static int hf_smpp_dcs_sms_coding_group;
223 static int hf_smpp_dcs_reserved;
224 static int hf_smpp_dcs_charset;
225 static int hf_smpp_dcs_class;
226 static int hf_smpp_dcs_wait_ind;
227 static int hf_smpp_dcs_reserved2;
228 static int hf_smpp_dcs_wait_type;
231 * Huawei SMPP+ extensions
233 static int hf_huawei_smpp_smsc_addr;
234 static int hf_huawei_smpp_msc_addr_noa;
235 static int hf_huawei_smpp_msc_addr_npi;
236 static int hf_huawei_smpp_msc_addr;
237 static int hf_huawei_smpp_mo_mt_flag;
238 static int hf_huawei_smpp_length_auth;
239 static int hf_huawei_smpp_sm_id;
240 static int hf_huawei_smpp_service_id;
241 static int hf_huawei_smpp_operation_result;
242 static int hf_huawei_smpp_notify_mode;
243 static int hf_huawei_smpp_delivery_result;
245 static expert_field ei_smpp_message_payload_duplicate;
247 /* Initialize the subtree pointers */
248 static int ett_smpp;
249 static int ett_dlist;
250 static int ett_dlist_resp;
251 static int ett_opt_params;
252 static int ett_opt_param;
253 static int ett_dcs;
255 static dissector_handle_t smpp_handle;
257 /* Reassemble SMPP TCP segments */
258 static bool reassemble_over_tcp = true;
259 static bool smpp_gsm7_unpacked = true;
261 typedef enum {
262 DECODE_AS_DEFAULT = 0,
263 DECODE_AS_ASCII = 1,
264 DECODE_AS_OCTET = 2, /* 8-bit binary */
265 DECODE_AS_ISO_8859_1 = 3,
266 DECODE_AS_ISO_8859_5 = 6,
267 DECODE_AS_ISO_8859_8 = 7,
268 DECODE_AS_UCS2 = 8,
269 DECODE_AS_KSC5601 = 14, /* Korean, EUC-KR as in ANSI 637 */
270 DECODE_AS_GSM7 = 241, /* One of many GSM DCS values that means GSM7 */
271 } SMPP_DCS_Type;
273 /* ENC_NA is the same as ENC_ASCII, so use an artificial value to mean
274 * "treat this as 8-bit binary / FT_BYTES, not a string."
276 #define DO_NOT_DECODE UINT_MAX
278 /* Default preference whether to decode the SMS over SMPP when DCS = 0 */
279 static int smpp_decode_dcs_0_sms = DO_NOT_DECODE;
281 /* Tap */
282 static int smpp_tap;
284 #define SMPP_COMMAND_ID_GENERIC_NACK 0x00000000
285 #define SMPP_COMMAND_ID_BIND_RECEIVER 0x00000001
286 #define SMPP_COMMAND_ID_BIND_TRANSMITTER 0x00000002
287 #define SMPP_COMMAND_ID_QUERY_SM 0x00000003
288 #define SMPP_COMMAND_ID_SUBMIT_SM 0x00000004
289 #define SMPP_COMMAND_ID_DELIVER_SM 0x00000005
290 #define SMPP_COMMAND_ID_UNBIND 0x00000006
291 #define SMPP_COMMAND_ID_REPLACE_SM 0x00000007
292 #define SMPP_COMMAND_ID_CANCEL_SM 0x00000008
293 #define SMPP_COMMAND_ID_BIND_TRANSCEIVER 0x00000009
294 #define SMPP_COMMAND_ID_OUTBIND 0x0000000B
295 #define SMPP_COMMAND_ID_ENQUIRE_LINK 0x00000015
296 #define SMPP_COMMAND_ID_SUBMIT_MULTI 0x00000021
297 #define SMPP_COMMAND_ID_ALERT_NOTIFICATION 0x00000102
298 #define SMPP_COMMAND_ID_DATA_SM 0x00000103
299 /* Introduced in SMPP 5.0 */
300 #define SMPP_COMMAND_ID_BROADCAST_SM 0x00000111
301 #define SMPP_COMMAND_ID_QUERY_BROADCAST_SM 0x00000112
302 #define SMPP_COMMAND_ID_CANCEL_BROADCAST_SM 0x00000113
303 /* Huawei SMPP+ extensions */
304 #define SMPP_COMMAND_ID_HUAWEI_AUTH_ACC 0x01000001
305 #define SMPP_COMMAND_ID_HUAWEI_SM_RESULT_NOTIFY 0X01000002
308 #define SMPP_COMMAND_ID_RESPONSE_MASK 0x80000000
310 #define SMPP_UDHI_MASK 0x40
313 * Value-arrays for field-contents
315 static const value_string vals_command_id[] = { /* Operation */
316 { SMPP_COMMAND_ID_BIND_RECEIVER, "Bind_receiver" },
317 { SMPP_COMMAND_ID_BIND_TRANSMITTER, "Bind_transmitter" },
318 { SMPP_COMMAND_ID_QUERY_SM, "Query_sm" },
319 { SMPP_COMMAND_ID_SUBMIT_SM, "Submit_sm" },
320 { SMPP_COMMAND_ID_DELIVER_SM, "Deliver_sm" },
321 { SMPP_COMMAND_ID_UNBIND, "Unbind" },
322 { SMPP_COMMAND_ID_REPLACE_SM, "Replace_sm" },
323 { SMPP_COMMAND_ID_CANCEL_SM, "Cancel_sm" },
324 { SMPP_COMMAND_ID_BIND_TRANSCEIVER, "Bind_transceiver" },
325 { SMPP_COMMAND_ID_OUTBIND, "Outbind" },
326 { SMPP_COMMAND_ID_ENQUIRE_LINK, "Enquire_link" },
327 { SMPP_COMMAND_ID_SUBMIT_MULTI, "Submit_multi" },
328 { SMPP_COMMAND_ID_ALERT_NOTIFICATION, "Alert_notification" },
329 { SMPP_COMMAND_ID_DATA_SM, "Data_sm" },
330 { SMPP_COMMAND_ID_BROADCAST_SM, "Broadcast_sm" },
331 { SMPP_COMMAND_ID_QUERY_BROADCAST_SM, "Query_broadcast_sm" },
332 { SMPP_COMMAND_ID_CANCEL_BROADCAST_SM, "Cancel_broadcast_sm" },
333 { SMPP_COMMAND_ID_HUAWEI_AUTH_ACC, "Auth_acc" },
334 { SMPP_COMMAND_ID_HUAWEI_SM_RESULT_NOTIFY, "Sm_result_notify" },
336 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_GENERIC_NACK, "Generic_nack" },
337 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_BIND_RECEIVER, "Bind_receiver - resp" },
338 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_BIND_TRANSMITTER, "Bind_transmitter - resp" },
339 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_QUERY_SM, "Query_sm - resp" },
340 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_SUBMIT_SM, "Submit_sm - resp" },
341 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_DELIVER_SM, "Deliver_sm - resp" },
342 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_UNBIND, "Unbind - resp" },
343 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_REPLACE_SM, "Replace_sm - resp" },
344 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_CANCEL_SM, "Cancel_sm - resp" },
345 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_BIND_TRANSCEIVER, "Bind_transceiver - resp" },
346 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_ENQUIRE_LINK, "Enquire_link - resp" },
347 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_SUBMIT_MULTI, "Submit_multi - resp" },
348 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_DATA_SM, "Data_sm - resp" },
349 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_BROADCAST_SM, "Broadcast_sm - resp" },
350 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_QUERY_BROADCAST_SM, "Query_broadcast_sm - resp" },
351 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_CANCEL_BROADCAST_SM, "Cancel_broadcast_sm - resp" },
352 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_HUAWEI_AUTH_ACC, "Auth_acc - resp" },
353 { SMPP_COMMAND_ID_RESPONSE_MASK|SMPP_COMMAND_ID_HUAWEI_SM_RESULT_NOTIFY, "Sm_result_notify - resp" },
354 { 0, NULL }
357 static const range_string rvals_command_status[] = { /* Status */
358 { 0x00000000, 0x00000000, "Ok" },
359 { 0x00000001, 0x00000001, "Message length is invalid" },
360 { 0x00000002, 0x00000002, "Command length is invalid" },
361 { 0x00000003, 0x00000003, "Invalid command ID" },
362 { 0x00000004, 0x00000004, "Incorrect BIND status for given command" },
363 { 0x00000005, 0x00000005, "ESME already in bound state" },
364 { 0x00000006, 0x00000006, "Invalid priority flag" },
365 { 0x00000007, 0x00000007, "Invalid registered delivery flag" },
366 { 0x00000008, 0x00000008, "System error" },
367 { 0x00000009, 0x00000009, "[Reserved]" },
368 { 0x0000000A, 0x0000000A, "Invalid source address" },
369 { 0x0000000B, 0x0000000B, "Invalid destination address" },
370 { 0x0000000C, 0x0000000C, "Message ID is invalid" },
371 { 0x0000000D, 0x0000000D, "Bind failed" },
372 { 0x0000000E, 0x0000000E, "Invalid password" },
373 { 0x0000000F, 0x0000000F, "Invalid system ID" },
374 { 0x00000010, 0x00000010, "[Reserved]" },
375 { 0x00000011, 0x00000011, "Cancel SM failed" },
376 { 0x00000012, 0x00000012, "[Reserved]" },
377 { 0x00000013, 0x00000013, "Replace SM failed" },
378 { 0x00000014, 0x00000014, "Message queue full" },
379 { 0x00000015, 0x00000015, "Invalid service type" },
380 { 0x00000016, 0x00000032, "[Reserved]" },
381 { 0x00000033, 0x00000033, "Invalid number of destinations" },
382 { 0x00000034, 0x00000034, "Invalid distribution list name" },
383 { 0x00000035, 0x0000003F, "[Reserved]" },
384 { 0x00000040, 0x00000040, "Destination flag is invalid (submit_multi)" },
385 { 0x00000041, 0x00000041, "[Reserved]" },
386 { 0x00000042, 0x00000042, "Invalid 'submit with replace' request" },
387 { 0x00000043, 0x00000043, "Invalid esm_class field data" },
388 { 0x00000044, 0x00000044, "Cannot submit to distribution list" },
389 { 0x00000045, 0x00000045, "submit_sm or submit_multi failed" },
390 { 0x00000046, 0x00000047, "[Reserved]" },
391 { 0x00000048, 0x00000048, "Invalid source address TON" },
392 { 0x00000049, 0x00000049, "Invalid source address NPI" },
393 { 0x00000050, 0x00000050, "Invalid destination address TON" },
394 { 0x00000051, 0x00000051, "Invalid destination address NPI" },
395 { 0x00000052, 0x00000052, "[Reserved]" },
396 { 0x00000053, 0x00000053, "Invalid system_type field" },
397 { 0x00000054, 0x00000054, "Invalid replace_if_present flag" },
398 { 0x00000055, 0x00000055, "Invalid number of messages" },
399 { 0x00000056, 0x00000057, "[Reserved]" },
400 { 0x00000058, 0x00000058, "Throttling error (ESME exceeded allowed message limits)" },
401 { 0x00000059, 0x00000060, "[Reserved]" },
402 { 0x00000061, 0x00000061, "Invalid scheduled delivery time" },
403 { 0x00000062, 0x00000062, "Invalid message validity period (expiry time)" },
404 { 0x00000063, 0x00000063, "Predefined message invalid or not found" },
405 { 0x00000064, 0x00000064, "ESME receiver temporary app error code" },
406 { 0x00000065, 0x00000065, "ESME receiver permanent app error code" },
407 { 0x00000066, 0x00000066, "ESME receiver reject message error code" },
408 { 0x00000067, 0x00000067, "query_sm request failed" },
409 { 0x00000068, 0x000000BF, "[Reserved]" },
410 { 0x000000C0, 0x000000C0, "Error in the optional part of the PDU body" },
411 { 0x000000C1, 0x000000C1, "Optional parameter not allowed" },
412 { 0x000000C2, 0x000000C2, "Invalid parameter length" },
413 { 0x000000C3, 0x000000C3, "Expected optional parameter missing" },
414 { 0x000000C4, 0x000000C4, "Invalid optional parameter value" },
415 { 0x000000C5, 0x000000FD, "[Reserved]" },
416 { 0x000000FE, 0x000000FE, "(Transaction) Delivery failure (used for data_sm_resp)" },
417 { 0x000000FF, 0x000000FF, "Unknown error" },
418 /* Introduced in SMPP 5.0 */
419 { 0x00000100, 0x00000100, "ESME Not authorised to use specified service_type." },
420 { 0x00000101, 0x00000101, "ESME Prohibited from using specified operation."},
421 { 0x00000102, 0x00000102, "Specified service_type is unavailable." },
422 { 0x00000103, 0x00000103, "Specified service_type is denied." },
423 { 0x00000104, 0x00000104, "Invalid Data Coding Scheme." },
424 { 0x00000105, 0x00000105, "Source Address Sub unit is Invalid." },
425 { 0x00000106, 0x00000106, "Destination Address Sub unit is Invalid." },
426 { 0x00000107, 0x00000107, "Broadcast Frequency Interval is invalid." },
427 { 0x00000108, 0x00000108, "Broadcast Alias Name is invalid." },
428 { 0x00000109, 0x00000109, "Broadcast Area Format is invalid." },
429 { 0x0000010A, 0x0000010A, "Number of Broadcast Areas is invalid." },
430 { 0x0000010B, 0x0000010B, "Broadcast Content Type is invalid." },
431 { 0x0000010C, 0x0000010C, "Broadcast Message Class is invalid." },
432 { 0x0000010D, 0x0000010D, "broadcast_sm operation failed." },
433 { 0x0000010E, 0x0000010E, "query_broadcast_sm operation failed." },
434 { 0x0000010F, 0x0000010F, "cancel_broadcast_sm operation failed." },
435 { 0x00000110, 0x00000110, "Number of Repeated Broadcasts is invalid." },
436 { 0x00000111, 0x00000111, "Broadcast Service Group is invalid." },
437 { 0x00000112, 0x00000112, "Broadcast Channel Indicator is invalid." },
438 { 0x00000400, 0x000004FF, "[Vendor-specific Error]" },
439 { 0x00000500, 0xFFFFFFFF, "[Reserved]" },
440 { 0, 0, NULL }
443 static const value_string vals_tlv_tags[] = {
444 { 0x0005, "dest_addr_subunit" },
445 { 0x0006, "dest_network_type" },
446 { 0x0007, "dest_bearer_type" },
447 { 0x0008, "dest_telematics_id" },
448 { 0x000D, "source_addr_subunit" },
449 { 0x000E, "source_network_type" },
450 { 0x000F, "source_bearer_type" },
451 { 0x0010, "source_telematics_id" },
452 { 0x0017, "qos_time_to_live" },
453 { 0x0019, "payload_type" },
454 { 0x001D, "additional_status_info_text" },
455 { 0x001E, "receipted_message_id" },
456 { 0x0030, "ms_msg_wait_facilities" },
457 { 0x0201, "privacy_indicator" },
458 { 0x0202, "source_subaddress" },
459 { 0x0203, "dest_subaddress" },
460 { 0x0204, "user_message_reference" },
461 { 0x0205, "user_response_code" },
462 { 0x020A, "source_port" },
463 { 0x020B, "dest_port" },
464 { 0x020C, "sar_msg_ref_num" },
465 { 0x020D, "language_indicator" },
466 { 0x020E, "sar_total_segments" },
467 { 0x020F, "sar_segment_seqnum" },
468 { 0x0210, "sc_interface_version" },
469 { 0x0302, "callback_num_pres_ind" },
470 { 0x0303, "callback_num_atag" },
471 { 0x0304, "number_of_messages" },
472 { 0x0381, "callback_num" },
473 { 0x0420, "dpf_result" },
474 { 0x0421, "set_dpf" },
475 { 0x0422, "ms_availability_status" },
476 { 0x0423, "network_error_code" },
477 { 0x0424, "message_payload" },
478 { 0x0425, "delivery_failure_reason" },
479 { 0x0426, "more_messages_to_send" },
480 { 0x0427, "message_state" },
481 { 0x0428, "congestion_state" },
482 { 0x0501, "ussd_service_op" },
483 { 0x0600, "broadcast_channel_indicator" },
484 { 0x0601, "broadcast_content_type" },
485 { 0x0602, "broadcast_content_type_info" },
486 { 0x0603, "broadcast_message_class" },
487 { 0x0604, "broadcast_rep_num" },
488 { 0x0605, "broadcast_frequency_interval" },
489 { 0x0606, "broadcast_area_identifier" },
490 { 0x0607, "broadcast_error_status" },
491 { 0x0608, "broadcast_area_success" },
492 { 0x0609, "broadcast_end_time" },
493 { 0x060A, "broadcast_service_group" },
494 { 0x060B, "billing_identification" },
495 { 0x060D, "source_network_id" },
496 { 0x060E, "dest_network_id" },
497 { 0x060F, "source_node_id" },
498 { 0x0610, "dest_node_id" },
499 { 0x0611, "dest_addr_np_resolution" },
500 { 0x0612, "dest_addr_np_information" },
501 { 0x0613, "dest_addr_np_country" },
502 { 0x1201, "display_time" },
503 { 0x1203, "sms_signal" },
504 { 0x1204, "ms_validity" },
505 { 0x130C, "alert_on_message_delivery" },
506 { 0x1380, "its_reply_type" },
507 { 0x1383, "its_session_info" },
508 { 0, NULL }
511 static const value_string vals_addr_ton[] = {
512 { 0, "Unknown" },
513 { 1, "International" },
514 { 2, "National" },
515 { 3, "Network specific" },
516 { 4, "Subscriber number" },
517 { 5, "Alphanumeric" },
518 { 6, "Abbreviated" },
519 { 0, NULL }
522 static const value_string vals_addr_npi[] = {
523 { 0, "Unknown" },
524 { 1, "ISDN (E163/E164)" },
525 { 3, "Data (X.121)" },
526 { 4, "Telex (F.69)" },
527 { 6, "Land mobile (E.212)" },
528 { 8, "National" },
529 { 9, "Private" },
530 { 10, "ERMES" },
531 { 14, "Internet (IP)" },
532 { 18, "WAP client Id" },
533 { 0, NULL }
536 static const value_string vals_esm_submit_msg_mode[] = {
537 { 0x0, "Default SMSC mode" },
538 { 0x1, "Datagram mode" },
539 { 0x2, "Forward mode" },
540 { 0x3, "Store and forward mode" },
541 { 0, NULL }
544 static const value_string vals_esm_submit_msg_type[] = {
545 { 0x0, "Default message type" },
546 { 0x1, "Short message contains SMSC Delivery Receipt" },
547 { 0x2, "Short message contains (E)SME delivery acknowledgement" },
548 { 0x3, "Reserved" },
549 { 0x4, "Short message contains (E)SME manual/user acknowledgement" },
550 { 0x5, "Reserved" },
551 { 0x6, "Short message contains conversation abort" },
552 { 0x7, "Reserved" },
553 { 0x8, "Short message contains intermediate delivery notification" },
554 { 0, NULL }
557 static const value_string vals_esm_submit_features[] = {
558 { 0x0, "No specific features selected" },
559 { 0x1, "UDHI indicator" },
560 { 0x2, "Reply path" },
561 { 0x3, "UDHI and reply path" },
562 { 0, NULL }
565 static const value_string vals_priority_flag[] = {
566 { 0, "GSM: None ANSI-136: Bulk IS-95: Normal" },
567 { 1, "GSM: priority ANSI-136: Normal IS-95: Interactive" },
568 { 2, "GSM: priority ANSI-136: Urgent IS-95: Urgent" },
569 { 3, "GSM: priority ANSI-136: Very Urgent IS-95: Emergency" },
570 { 0, NULL }
573 static const value_string vals_regdel_receipt[] = {
574 { 0x0, "No SMSC delivery receipt requested" },
575 { 0x1, "Delivery receipt requested (for success or failure)" },
576 { 0x2, "Delivery receipt requested (for failure)" },
577 { 0x3, "Reserved in version <= 3.4; Delivery receipt requested (for success) in 5.0" },
578 { 0, NULL }
581 static const value_string vals_regdel_acks[] = {
582 { 0x0, "No recipient SME acknowledgement requested" },
583 { 0x1, "SME delivery acknowledgement requested" },
584 { 0x2, "SME manual/user acknowledgement requested" },
585 { 0x3, "Both delivery and manual/user acknowledgement requested" },
586 { 0, NULL }
589 static const value_string vals_regdel_notif[] = {
590 { 0x0, "No intermediate notification requested" },
591 { 0x1, "Intermediate notification requested" },
592 { 0, NULL }
595 static const value_string vals_replace_if_present_flag[] = {
596 { 0x0, "Don't replace" },
597 { 0x1, "Replace" },
598 { 0, NULL }
601 static const range_string rvals_data_coding[] = {
602 { 0, 0, "SMSC default alphabet" },
603 { 1, 1, "IA5 (CCITT T.50)/ASCII (ANSI X3.4)" },
604 { 2, 2, "Octet unspecified (8-bit binary)" },
605 { 3, 3, "Latin 1 (ISO-8859-1)" },
606 { 4, 4, "Octet unspecified (8-bit binary)" },
607 { 5, 5, "JIS (X 0208-1990)" },
608 { 6, 6, "Cyrillic (ISO-8859-5)" },
609 { 7, 7, "Latin/Hebrew (ISO-8859-8)" },
610 { 8, 8, "UCS2 (ISO/IEC-10646)" },
611 { 9, 9, "Pictogram Encoding" },
612 { 10, 10, "ISO-2022-JP (Music codes)" },
613 { 11, 12, "Reserved" },
614 { 13, 13, "Extended Kanji JIS (X 0212-1990)" },
615 { 14, 14, "KS C 5601" },
616 { 15, 0xBF, "Reserved" },
617 { 0xC0, 0xEF, "GSM MWI control - see [GSM 03.38]" },
618 { 0xF0, 0xFF, "GSM message class control - see [GSM 03.38]" },
619 { 0, 0, NULL }
622 static const value_string vals_message_state[] = {
623 { 1, "ENROUTE" },
624 { 2, "DELIVERED" },
625 { 3, "EXPIRED" },
626 { 4, "DELETED" },
627 { 5, "UNDELIVERABLE" },
628 { 6, "ACCEPTED" },
629 { 7, "UNKNOWN" },
630 { 8, "REJECTED" },
631 { 0, NULL }
634 static const value_string vals_addr_subunit[] = {
635 { 0, "Unknown -default-" },
636 { 1, "MS Display" },
637 { 2, "Mobile equipment" },
638 { 3, "Smart card 1" },
639 { 4, "External unit 1" },
640 { 0, NULL }
643 static const value_string vals_network_type[] = {
644 { 0, "Unknown" },
645 { 1, "GSM" },
646 { 2, "ANSI-136/TDMA" },
647 { 3, "IS-95/CDMA" },
648 { 4, "PDC" },
649 { 5, "PHS" },
650 { 6, "iDEN" },
651 { 7, "AMPS" },
652 { 8, "Paging network" },
653 { 0, NULL }
656 static const value_string vals_bearer_type[] = {
657 { 0, "Unknown" },
658 { 1, "SMS" },
659 { 2, "Circuit Switched Data (CSD)" },
660 { 3, "Packet data" },
661 { 4, "USSD" },
662 { 5, "CDPD" },
663 { 6, "DataTAC" },
664 { 7, "FLEX/ReFLEX" },
665 { 8, "Cell Broadcast" },
666 { 0, NULL }
669 static const value_string vals_payload_type[] = {
670 { 0, "Default" },
671 { 1, "WCMP message" },
672 { 0, NULL }
675 static const value_string vals_privacy_indicator[] = {
676 { 0, "Not restricted -default-" },
677 { 1, "Restricted" },
678 { 2, "Confidential" },
679 { 3, "Secret" },
680 { 0, NULL }
683 static const value_string vals_language_indicator[] = {
684 { 0, "Unspecified -default-" },
685 { 1, "english" },
686 { 2, "french" },
687 { 3, "spanish" },
688 { 4, "german" },
689 { 5, "portuguese" },
690 { 0, NULL }
693 static const value_string vals_display_time[] = {
694 { 0, "Temporary" },
695 { 1, "Default -default-" },
696 { 2, "Invoke" },
697 { 0, NULL }
700 static const value_string vals_ms_validity[] = {
701 { 0, "Store indefinitely -default-" },
702 { 1, "Power down" },
703 { 2, "SID based registration area" },
704 { 3, "Display only" },
705 { 0, NULL }
708 static const value_string vals_dpf_result[] = {
709 { 0, "DPF not set" },
710 { 1, "DPF set" },
711 { 0, NULL }
714 static const value_string vals_set_dpf[] = {
715 { 0, "Not requested (Set DPF for delivery failure)" },
716 { 1, "Requested (Set DPF for delivery failure)" },
717 { 0, NULL }
720 static const value_string vals_ms_availability_status[] = {
721 { 0, "Available -default-" },
722 { 1, "Denied" },
723 { 2, "Unavailable" },
724 { 0, NULL }
727 static const value_string vals_delivery_failure_reason[] = {
728 { 0, "Destination unavailable" },
729 { 1, "Destination address invalid" },
730 { 2, "Permanent network error" },
731 { 3, "Temporary network error" },
732 { 0, NULL }
735 static const value_string vals_more_messages_to_send[] = {
736 { 0, "No more messages" },
737 { 1, "More messages -default-" },
738 { 0, NULL }
741 static const value_string vals_its_reply_type[] = {
742 { 0, "Digit" },
743 { 1, "Number" },
744 { 2, "Telephone no." },
745 { 3, "Password" },
746 { 4, "Character line" },
747 { 5, "Menu" },
748 { 6, "Date" },
749 { 7, "Time" },
750 { 8, "Continue" },
751 { 0, NULL }
754 static const value_string vals_ussd_service_op[] = {
755 { 0, "PSSD indication" },
756 { 1, "PSSR indication" },
757 { 2, "USSR request" },
758 { 3, "USSN request" },
759 { 16, "PSSD response" },
760 { 17, "PSSR response" },
761 { 18, "USSR confirm" },
762 { 19, "USSN confirm" },
763 { 0, NULL }
766 static const value_string vals_msg_wait_ind[] = {
767 { 0, "Set indication inactive" },
768 { 1, "Set indication active" },
769 { 0, NULL }
772 static const value_string vals_msg_wait_type[] = {
773 { 0, "Voicemail message waiting" },
774 { 1, "Fax message waiting" },
775 { 2, "Electronic mail message waiting" },
776 { 3, "Other message waiting" },
777 { 0, NULL }
780 static const value_string vals_callback_num_pres[] = {
781 { 0, "Presentation allowed" },
782 { 1, "Presentation restricted" },
783 { 2, "Number not available" },
784 { 3, "[Reserved]" },
785 { 0, NULL }
788 static const value_string vals_callback_num_scrn[] = {
789 { 0, "User provided, not screened" },
790 { 1, "User provided, verified and passed" },
791 { 2, "User provided, verified and failed" },
792 { 3, "Network provided" },
793 { 0, NULL }
796 static const value_string vals_network_error_type[] = {
797 { 1, "ANSI-136 (Access Denied Reason)" },
798 { 2, "IS-95 (Access Denied Reason)" },
799 { 3, "GSM" },
800 { 4, "[Reserved] in <= 3.4; ANSI 136 Cause Code in 5.0" },
801 { 5, "[Reserved] in <= 3.4; IS 95 Cause Code in 5.0" },
802 { 6, "[Reserved] in <= 3.4; ANSI-41 Error in 5.0" },
803 { 7, "[Reserved] in <= 3.4; SMPP Error in 5.0" },
804 { 8, "[Reserved] in <= 3.4; Message Center Specific in 5.0" },
805 { 0, NULL }
808 static const value_string vals_its_session_ind[] = {
809 { 0, "End of session indicator inactive" },
810 { 1, "End of session indicator active" },
811 { 0, NULL }
814 /* Data Coding Scheme: see 3GPP TS 23.040 and 3GPP TS 23.038.
815 * Note values below 0x0C are not used in SMPP. */
816 static const value_string vals_dcs_sms_coding_group[] = {
817 #if 0
818 { 0x00, "SMS DCS: General Data Coding indication - Uncompressed text, no message class" },
819 { 0x01, "SMS DCS: General Data Coding indication - Uncompressed text" },
820 { 0x02, "SMS DCS: General Data Coding indication - Compressed text, no message class" },
821 { 0x03, "SMS DCS: General Data Coding indication - Compressed text" },
822 { 0x04, "SMS DCS: Message Marked for Automatic Deletion - Uncompressed text, no message class" },
823 { 0x05, "SMS DCS: Message Marked for Automatic Deletion - Uncompressed text" },
824 { 0x06, "SMS DCS: Message Marked for Automatic Deletion - Compressed text, no message class" },
825 { 0x07, "SMS DCS: Message Marked for Automatic Deletion - Compressed text" },
826 { 0x08, "SMS DCS: Reserved" },
827 { 0x09, "SMS DCS: Reserved" },
828 { 0x0A, "SMS DCS: Reserved" },
829 { 0x0B, "SMS DCS: Reserved" },
830 #endif
831 { 0x0C, "SMS DCS: Message Waiting Indication - Discard Message" },
832 { 0x0D, "SMS DCS: Message Waiting Indication - Store Message (GSM 7-bit default alphabet)" },
833 { 0x0E, "SMS DCS: Message Waiting Indication - Store Message (UCS-2 character set)" },
834 { 0x0F, "SMS DCS: Data coding / message class" },
835 { 0x00, NULL }
838 static const value_string vals_dcs_charset[] = {
839 { 0x00, "GSM 7-bit default alphabet" },
840 { 0x01, "8-bit data" },
841 { 0x00, NULL }
844 static const value_string vals_dcs_class[] = {
845 { 0x00, "Class 0" },
846 { 0x01, "Class 1 - ME specific" },
847 { 0x02, "Class 2 - (U)SIM specific" },
848 { 0x03, "Class 3 - TE specific" },
849 { 0x00, NULL }
852 static const value_string vals_alert_on_message_delivery[] = {
853 { 0x00, "Use mobile default alert (Default)" },
854 { 0x01, "Use low-priority alert" },
855 { 0x02, "Use medium-priority alert" },
856 { 0x03, "Use high-priority alert" },
857 { 0x00, NULL }
860 static const range_string vals_congestion_state[] = {
861 {0, 0, "Idle"},
862 {1, 29, "Low Load"},
863 {30, 49, "Medium Load"},
864 {50, 79, "High Load"},
865 {80, 89, "Optimum Load"}, /*Specs says 80-90, but that is probably a mistake */
866 {90, 99, "Nearing Congestion"},
867 {100, 100, "Congested / Maximum Load"},
868 { 0, 0, NULL }
871 static const range_string vals_broadcast_channel_indicator[] = {
872 {0, 0, "Basic Broadcast Channel (Default)"},
873 {1, 1, "Extended Broadcast Channel"},
874 {2, 255, "[Reserved]"},
875 { 0, 0, NULL }
878 static const value_string vals_broadcast_message_class[] = {
879 {0, "No Class Specified (default)"},
880 {1, "Class 1 (User Defined)"},
881 {2, "Class 2 (User Defined)"},
882 {3, "Class 3 (Terminal Equipment)"},
883 {0, NULL }
886 static const range_string vals_broadcast_area_success[] = {
887 {0, 100, "%"},
888 {101, 254, "[Reserved]"},
889 {255, 255, "Information not available"},
890 { 0, 0, NULL }
893 static const value_string vals_broadcast_content_type_nw[] = {
894 {0, "Generic"},
895 {1, "GSM [23041]"},
896 {2, "TDMA [IS824][ANSI-41]"},
897 {3, "CDMA [IS824][IS637]"},
898 {0, NULL }
901 static const value_string vals_broadcast_content_type_type[] = {
902 {0x0000, "[System Service] Index"},
903 {0x0001, "[System Service] Emergency Broadcasts"},
904 {0x0002, "[System Service] IRDB Download"},
905 {0x0010, "[News Service] News Flashes"},
906 {0x0011, "[News Service] General News (Local)"},
907 {0x0012, "[News Service] General News (Regional)"},
908 {0x0013, "[News Service] General News (National)"},
909 {0x0014, "[News Service] General News (International)"},
910 {0x0015, "[News Service] Business/Financial News (Local)"},
911 {0x0016, "[News Service] Business/Financial News (Regional)"},
912 {0x0017, "[News Service] Business/Financial News (National)"},
913 {0x0018, "[News Service] Business/Financial News (International)"},
914 {0x0019, "[News Service] Sports News (Local)"},
915 {0x001A, "[News Service] Sports News (Regional)"},
916 {0x001B, "[News Service] Sports News (National)"},
917 {0x001C, "[News Service] Sports News (International)"},
918 {0x001D, "[News Service] Entertainment News (Local)"},
919 {0x001E, "[News Service] Entertainment News (Regional)"},
920 {0x001F, "[News Service] Entertainment News (National)"},
921 {0x0020, "[News Service] Entertainment News (International)"},
922 {0x0021, "[Subscriber Information Services] Medical/Health/Hospitals"},
923 {0x0022, "[Subscriber Information Services] Doctors"},
924 {0x0023, "[Subscriber Information Services] Pharmacy"},
925 {0x0030, "[Subscriber Information Services] Local Traffic/Road Reports"},
926 {0x0031, "[Subscriber Information Services] Long Distance Traffic/Road Reports"},
927 {0x0032, "[Subscriber Information Services] Taxis"},
928 {0x0033, "[Subscriber Information Services] Weather"},
929 {0x0034, "[Subscriber Information Services] Local Airport Flight Schedules"},
930 {0x0035, "[Subscriber Information Services] Restaurants"},
931 {0x0036, "[Subscriber Information Services] Lodgings"},
932 {0x0037, "[Subscriber Information Services] Retail Directory"},
933 {0x0038, "[Subscriber Information Services] Advertisements"},
934 {0x0039, "[Subscriber Information Services] Stock Quotes"},
935 {0x0040, "[Subscriber Information Services] Employment Opportunities"},
936 {0x0041, "[Subscriber Information Services] Technology News"},
937 {0x0070, "[Carrier Information Services] District (Base Station Info)"},
938 {0x0071, "[Carrier Information Services] Network Information"},
939 {0x0080, "[Subscriber Care Services] Operator Services"},
940 {0x0081, "[Subscriber Care Services] Directory Enquiries (National)"},
941 {0x0082, "[Subscriber Care Services] Directory Enquiries (International)"},
942 {0x0083, "[Subscriber Care Services] Customer Care (National)"},
943 {0x0084, "[Subscriber Care Services] Customer Care (International)"},
944 {0x0085, "[Subscriber Care Services] Local Date/Time/Time Zone"},
945 {0x0100, "[Multi Category Services] Multi Category Services"},
946 {0x0000, NULL }
949 static const value_string vals_broadcast_frequency_interval_unit[] = {
950 {0x00, "As frequently as possible"},
951 {0x08, "seconds"},
952 {0x09, "minutes"},
953 {0x0A, "hours"},
954 {0x0B, "days"},
955 {0x0C, "weeks"},
956 {0x0D, "months"},
957 {0x0E, "years"},
958 {0x00, NULL }
961 static const value_string vals_dest_addr_np_resolution[] = {
962 {0x00, "query has not been performed (default)"},
963 {0x01, "query has been performed, number not ported"},
964 {0x02, "query has been performed, number ported"},
965 {0x00, NULL }
968 static const range_string vals_broadcast_area_identifier_format[] = {
969 {0, 0, "Alias / Name"},
970 {1, 1, "Ellipsoid Arc"},
971 {2, 2, "Polygon"},
972 {3, 255, "[Reserved]"},
973 {0, 0, NULL }
976 /* Huawei SMPP+ extensions */
977 static const value_string vals_mo_mt_flag[] = {
978 { 0x01, "MO" },
979 { 0x02, "MT" },
980 { 0x03, "Reserved" },
981 { 0x00, NULL }
984 static const value_string vals_operation_result[] = {
985 { 0x00, "Successful" },
986 { 0x01, "Protocol is not supported" },
987 { 0x0a, "Others" },
988 { 0x0b, "MO account does not exist" },
989 { 0x0c, "MT account does not exist" },
990 { 0x0d, "MO account state is abnormal" },
991 { 0x0e, "MT account state is abnormal" },
992 { 0x0f, "MO account balance is not enough" },
993 { 0x10, "MT account balance is not enough" },
994 { 0x11, "MO VAS is not supported" },
995 { 0x12, "MT VAS is not supported" },
996 { 0x13, "MO user is post-paid user and checked success" },
997 { 0x14, "MT user is post-paid user and checked success" },
998 { 0x15, "MO post-paid user status is incorrect" },
999 { 0x16, "MT post-paid user status is incorrect" },
1000 { 0x17, "MO post-paid user account balance is not sufficient" },
1001 { 0x18, "MT post-paid user account balance is not sufficient" },
1002 { 0x19, "MO post-paid user value-added services are not supported" },
1003 { 0x1a, "MT post-paid user value-added services are not supported" },
1004 { 0x00, NULL }
1007 static const value_string vals_notify_mode[] = {
1008 { 0x01, "Deliver the report when it's successful or failed" },
1009 { 0x02, "Deliver the report only when it's failed" },
1010 { 0x03, "Deliver the report only when it's successful" },
1011 { 0x04, "Never deliver the report" },
1012 { 0x00, NULL }
1015 static const value_string vals_delivery_result[] = {
1016 { 0x00, "Successful" },
1017 { 0x01, "Unsuccessful" },
1018 { 0x00, NULL }
1021 static const value_string vals_msc_addr_noa [] = {
1022 { 0x00, "Spare" },
1023 { 0x01, "Subscriber number" },
1024 { 0x02, "Unknown" },
1025 { 0x03, "National number" },
1026 { 0x04, "International" },
1027 { 0x00, NULL }
1030 static const value_string vals_msc_addr_npi [] = {
1031 { 0x00, "Spare" },
1032 { 0x01, "ISDN (Telephony) numbering plan (Recommendation E.164)" },
1033 { 0x02, "Spare" },
1034 { 0x03, "Data numbering plan (Recommendation X.121) (national use)" },
1035 { 0x04, "Telex numbering plan (Recommendation F.69) (national use)" },
1036 { 0x05, "Reserved for national use" },
1037 { 0x06, "Reserved for national use" },
1038 { 0x07, "Spare" },
1039 { 0x00, NULL }
1042 static int * const regdel_fields[] = {
1043 &hf_smpp_regdel_receipt,
1044 &hf_smpp_regdel_acks,
1045 &hf_smpp_regdel_notif,
1046 NULL
1049 static int * const submit_msg_fields[] = {
1050 &hf_smpp_esm_submit_msg_mode,
1051 &hf_smpp_esm_submit_msg_type,
1052 &hf_smpp_esm_submit_features,
1053 NULL
1056 static dissector_handle_t gsm_sms_handle;
1058 static smpp_data_t *
1059 get_smpp_data(packet_info *pinfo)
1061 smpp_data_t *smpp_data = NULL;
1063 smpp_data = (smpp_data_t*)p_get_proto_data(pinfo->pool, pinfo, proto_smpp, 0);
1064 if (!smpp_data) {
1065 smpp_data = wmem_new0(pinfo->pool, smpp_data_t);
1066 p_add_proto_data(pinfo->pool, pinfo, proto_smpp, 0, smpp_data);
1069 return smpp_data;
1073 * For Stats Tree
1075 static void
1076 smpp_stats_tree_init(stats_tree* st)
1078 st_smpp_ops = stats_tree_create_node(st, "SMPP Operations", 0, STAT_DT_INT, true);
1079 st_smpp_req = stats_tree_create_node(st, "SMPP Requests", st_smpp_ops, STAT_DT_INT, true);
1080 st_smpp_res = stats_tree_create_node(st, "SMPP Responses", st_smpp_ops, STAT_DT_INT, true);
1081 st_smpp_res_status = stats_tree_create_node(st, "SMPP Response Status", 0, STAT_DT_INT, true);
1085 static tap_packet_status
1086 smpp_stats_tree_per_packet(stats_tree *st, /* st as it was passed to us */
1087 packet_info *pinfo _U_,
1088 epan_dissect_t *edt _U_,
1089 const void *p,
1090 tap_flags_t flags _U_) /* Used for getting SMPP command_id values */
1092 const smpp_tap_rec_t* tap_rec = (const smpp_tap_rec_t*)p;
1094 tick_stat_node(st, "SMPP Operations", 0, true);
1096 if ((tap_rec->command_id & SMPP_COMMAND_ID_RESPONSE_MASK) == SMPP_COMMAND_ID_RESPONSE_MASK) /* Response */
1098 tick_stat_node(st, "SMPP Responses", st_smpp_ops, true);
1099 tick_stat_node(st, val_to_str(tap_rec->command_id, vals_command_id, "Unknown 0x%08x"), st_smpp_res, false);
1101 tick_stat_node(st, "SMPP Response Status", 0, true);
1102 tick_stat_node(st, rval_to_str(tap_rec->command_status, rvals_command_status, "Unknown 0x%08x"), st_smpp_res_status, false);
1105 else /* Request */
1107 tick_stat_node(st, "SMPP Requests", st_smpp_ops, true);
1108 tick_stat_node(st, val_to_str(tap_rec->command_id, vals_command_id, "Unknown 0x%08x"), st_smpp_req, false);
1111 return TAP_PACKET_REDRAW;
1115 * SMPP equivalent of mktime() (3). Convert date to standard 'time_t' format
1117 * \param datestr The SMPP-formatted date to convert
1118 * \param secs Returns the 'time_t' equivalent
1119 * \param nsecs Returns the additional nano-seconds
1121 * \return Whether time is specified relative (true) or absolute (false)
1122 * If invalid abs time: return *secs = (time_t)(-1) and *nsecs=0
1125 /* XXX: This function needs better error checking and handling */
1127 static bool
1128 smpp_mktime(const char *datestr, time_t *secs, int *nsecs)
1130 struct tm r_time;
1131 time_t t_diff;
1132 bool relative = (datestr[15] == 'R') ? true : false;
1134 r_time.tm_year = 10 * (datestr[0] - '0') + (datestr[1] - '0');
1136 * Y2K rollover date as recommended in appendix C
1138 if (r_time.tm_year < 38)
1139 r_time.tm_year += 100;
1140 r_time.tm_mon = 10 * (datestr[2] - '0') + (datestr[3] - '0');
1141 r_time.tm_mon--;
1142 r_time.tm_mday = 10 * (datestr[4] - '0') + (datestr[5] - '0');
1143 r_time.tm_hour = 10 * (datestr[6] - '0') + (datestr[7] - '0');
1144 r_time.tm_min = 10 * (datestr[8] - '0') + (datestr[9] - '0');
1145 r_time.tm_sec = 10 * (datestr[10] - '0') + (datestr[11] - '0');
1146 r_time.tm_isdst = -1;
1148 if (relative == false) {
1149 *secs = mktime_utc(&r_time);
1150 *nsecs = 0;
1151 if (*secs == (time_t)(-1)) {
1152 return relative;
1154 *nsecs = (datestr[12] - '0') * 100000000;
1156 t_diff = (10 * (datestr[13] - '0') + (datestr[14] - '0')) * 900;
1157 if (datestr[15] == '-')
1158 /* Represented time is behind UTC, shift it forward to UTC */
1159 *secs += t_diff;
1160 else if (datestr[15] == '+')
1161 /* Represented time is ahead of UTC, shift it backward to UTC */
1162 *secs -= t_diff;
1163 } else {
1164 *secs = r_time.tm_sec + 60 *
1165 (r_time.tm_min + 60 *
1166 (r_time.tm_hour + 24 *
1167 r_time.tm_mday));
1168 *nsecs = 0;
1171 return relative;
1175 * Scanning routines to add standard types (byte, int, string...) to the
1176 * protocol tree.
1178 * \param tree The protocol tree to add to
1179 * \param tvb Buffer containing the data
1180 * \param field Actual field whose value needs displaying
1181 * \param offset Location of field in buffer, returns location of
1182 * next field
1184 static void
1185 smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
1187 unsigned len;
1189 len = tvb_strsize(tvb, *offset);
1190 if (len > 1) {
1191 proto_tree_add_item(tree, field, tvb, *offset, len, ENC_NA);
1193 (*offset) += len;
1196 static const char *
1197 smpp_handle_string_return(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int field, int *offset)
1199 int len;
1200 const char* str = (const char *)tvb_get_stringz_enc(pinfo->pool, tvb, *offset, &len, ENC_ASCII);
1202 if (len > 0)
1203 proto_tree_add_string(tree, field, tvb, *offset, len, str);
1205 (*offset) += len;
1206 return str;
1209 static void
1210 smpp_handle_string_z(proto_tree *tree, tvbuff_t *tvb, int field, int *offset,
1211 const char *null_string)
1213 int len;
1215 len = tvb_strsize(tvb, *offset);
1216 if (len > 1) {
1217 proto_tree_add_item(tree, field, tvb, *offset, len, ENC_NA);
1218 } else {
1219 proto_tree_add_string(tree, field, tvb, *offset, len, null_string);
1221 (*offset) += len;
1224 static void
1225 smpp_handle_time(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
1226 int field, int field_R, int *offset)
1228 char *strval;
1229 int len;
1230 nstime_t tmptime;
1232 strval = (char *) tvb_get_stringz_enc(pinfo->pool, tvb, *offset, &len, ENC_ASCII);
1233 if (*strval)
1235 if (len >= 16)
1237 if (smpp_mktime(strval, &tmptime.secs, &tmptime.nsecs))
1238 proto_tree_add_time(tree, field_R, tvb, *offset, len, &tmptime);
1239 else
1240 proto_tree_add_time(tree, field, tvb, *offset, len, &tmptime);
1242 else
1244 tmptime.secs = 0;
1245 tmptime.nsecs = 0;
1246 proto_tree_add_time_format_value(tree, field_R, tvb, *offset, len, &tmptime, "%s", strval);
1249 *offset += len;
1253 * Scanning routine to handle the destination-list of 'submit_multi'
1255 * \param tree The protocol tree to add to
1256 * \param tvb Buffer containing the data
1257 * \param offset Location of field in buffer, returns location of
1258 * next field
1260 static void
1261 smpp_handle_dlist(proto_tree *tree, tvbuff_t *tvb, int *offset)
1263 uint8_t entries;
1264 int tmpoff = *offset;
1265 proto_tree *sub_tree = NULL;
1266 uint8_t dest_flag;
1268 if ((entries = tvb_get_uint8(tvb, tmpoff++))) {
1269 proto_item *pi;
1270 pi = proto_tree_add_item(tree, hf_smpp_dlist, tvb, *offset, 1, ENC_NA);
1271 sub_tree = proto_item_add_subtree(pi, ett_dlist);
1273 while (entries--)
1275 dest_flag = tvb_get_uint8(tvb, tmpoff++);
1276 if (dest_flag == 1) /* SME address */
1278 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_ton, tvb, tmpoff, 1, ENC_NA);
1279 tmpoff += 1;
1280 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_npi, tvb, tmpoff, 1, ENC_NA);
1281 tmpoff += 1;
1282 smpp_handle_string(sub_tree,tvb,hf_smpp_destination_addr,&tmpoff);
1284 else /* Distribution list */
1286 smpp_handle_string(sub_tree, tvb, hf_smpp_dl_name, &tmpoff);
1289 *offset = tmpoff;
1293 * Scanning routine to handle the destination result list
1294 * of 'submit_multi_resp'
1296 * \param tree The protocol tree to add to
1297 * \param tvb Buffer containing the data
1298 * \param offset Location of field in buffer, returns location of
1299 * next field
1301 static void
1302 smpp_handle_dlist_resp(proto_tree *tree, tvbuff_t *tvb, int *offset)
1304 uint8_t entries;
1305 int tmpoff = *offset;
1306 proto_tree *sub_tree = NULL;
1308 if ((entries = tvb_get_uint8(tvb, tmpoff++))) {
1309 proto_item *pi;
1310 pi = proto_tree_add_item(tree, hf_smpp_dlist_resp,
1311 tvb, *offset, 1, ENC_NA);
1312 sub_tree = proto_item_add_subtree(pi, ett_dlist_resp);
1314 while (entries--)
1316 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_ton, tvb, tmpoff, 1, ENC_NA);
1317 tmpoff += 1;
1318 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_npi, tvb, tmpoff, 1, ENC_NA);
1319 tmpoff += 1;
1320 smpp_handle_string(sub_tree,tvb,hf_smpp_destination_addr,&tmpoff);
1321 proto_tree_add_item(sub_tree, hf_smpp_error_status_code, tvb, tmpoff, 4, ENC_BIG_ENDIAN);
1322 tmpoff += 4;
1324 *offset = tmpoff;
1328 * Scanning routine to handle all optional parameters of SMPP-operations.
1329 * The parameters have the format Tag Length Value (TLV), with a 2-byte tag
1330 * and 2-byte length.
1332 * \param tree The protocol tree to add to
1333 * \param tvb Buffer containing the data
1334 * \param offset Location of field in buffer, returns location of
1335 * next field
1337 static void
1338 smpp_handle_tlv(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *offset, tvbuff_t **tvb_msg)
1340 proto_tree *tlvs_tree = NULL;
1341 proto_item *pi;
1342 smpp_data_t *smpp_data;
1343 uint16_t source_port = 0, dest_port = 0, sm_id = 0;
1344 uint8_t frags = 0, frag = 0;
1345 bool source_port_found = false, dest_port_found = false;
1346 bool sm_id_found = false;
1348 if (tvb_reported_length_remaining(tvb, *offset) >= 1) {
1349 pi = proto_tree_add_item(tree, hf_smpp_opt_params,
1350 tvb, *offset, -1, ENC_NA);
1351 tlvs_tree = proto_item_add_subtree(pi, ett_opt_params);
1354 while (tvb_reported_length_remaining(tvb, *offset) >= 1)
1356 proto_item *sub_tree;
1357 uint16_t tag;
1358 uint16_t length;
1360 tag = tvb_get_ntohs(tvb, *offset);
1361 length = tvb_get_ntohs(tvb, (*offset+2));
1363 pi = proto_tree_add_none_format(tlvs_tree, hf_smpp_opt_param, tvb,
1364 *offset, length+4,
1365 "Optional parameter: %s (0x%04x)",
1366 val_to_str(tag, vals_tlv_tags, "0x%04x"), tag);
1367 sub_tree = proto_item_add_subtree(pi, ett_opt_param);
1368 proto_tree_add_uint(sub_tree,hf_smpp_opt_param_tag,tvb,*offset,2,tag);
1369 proto_tree_add_uint(sub_tree,hf_smpp_opt_param_len,tvb,*offset+2,2,length);
1371 *offset += 4;
1373 switch (tag) {
1374 case 0x0005: /* dest_addr_subunit */
1375 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_subunit, tvb, *offset, 1, ENC_NA);
1376 (*offset) += 1;
1377 break;
1378 case 0x0006: /* dest_network_type */
1379 proto_tree_add_item(sub_tree, hf_smpp_dest_network_type, tvb, *offset, 1, ENC_NA);
1380 (*offset) += 1;
1381 break;
1382 case 0x0007: /* dest_bearer_type */
1383 proto_tree_add_item(sub_tree, hf_smpp_dest_bearer_type, tvb, *offset, 1, ENC_NA);
1384 (*offset) += 1;
1385 break;
1386 case 0x0008: /* dest_telematics_id */
1387 proto_tree_add_item(sub_tree, hf_smpp_dest_telematics_id, tvb, *offset, 2, ENC_BIG_ENDIAN);
1388 (*offset) += 2;
1389 break;
1390 case 0x000D: /* source_addr_subunit */
1391 proto_tree_add_item(sub_tree, hf_smpp_source_addr_subunit, tvb, *offset, 1, ENC_NA);
1392 (*offset) += 1;
1393 break;
1394 case 0x000E: /* source_network_type */
1395 proto_tree_add_item(sub_tree, hf_smpp_source_network_type, tvb, *offset, 1, ENC_NA);
1396 (*offset) += 1;
1397 break;
1398 case 0x000F: /* source_bearer_type */
1399 proto_tree_add_item(sub_tree, hf_smpp_source_bearer_type, tvb, *offset, 1, ENC_NA);
1400 (*offset) += 1;
1401 break;
1402 case 0x0010: /* source_telematics_id */
1403 proto_tree_add_item(sub_tree, hf_smpp_source_telematics_id, tvb, *offset, 1, ENC_NA);
1404 (*offset) += 1;
1405 break;
1406 case 0x0017: /* qos_time_to_live */
1407 proto_tree_add_item(sub_tree, hf_smpp_qos_time_to_live, tvb, *offset, 4, ENC_BIG_ENDIAN);
1408 (*offset) += 4;
1409 break;
1410 case 0x0019: /* payload_type */
1411 proto_tree_add_item(sub_tree, hf_smpp_payload_type, tvb, *offset, 1, ENC_NA);
1412 (*offset) += 1;
1413 break;
1414 case 0x001D: /* additional_status_info_text */
1415 if (length)
1416 proto_tree_add_item(sub_tree, hf_smpp_additional_status_info_text,
1417 tvb, *offset, length, ENC_NA | ENC_ASCII);
1418 (*offset) += length;
1419 break;
1420 case 0x001E: /* receipted_message_id */
1421 if (length)
1422 proto_tree_add_item(sub_tree, hf_smpp_receipted_message_id,
1423 tvb, *offset, length, ENC_NA | ENC_ASCII);
1424 (*offset) += length;
1425 break;
1426 case 0x0030: { /* ms_msg_wait_facilities */
1427 static int * const fields[] = {
1428 &hf_smpp_msg_wait_ind,
1429 &hf_smpp_msg_wait_type,
1430 NULL
1434 proto_tree_add_bitmask_list(sub_tree, tvb, *offset, 1, fields, ENC_NA);
1435 (*offset)++;
1437 break;
1438 case 0x0201: /* privacy_indicator */
1439 proto_tree_add_item(sub_tree, hf_smpp_privacy_indicator, tvb, *offset, 1, ENC_NA);
1440 (*offset) += 1;
1441 break;
1442 case 0x0202: /* source_subaddress */
1443 if (length) {
1444 proto_tree_add_item(sub_tree, hf_smpp_source_subaddress,
1445 tvb, *offset, length, ENC_NA);
1446 (*offset) += length;
1448 break;
1449 case 0x0203: /* dest_subaddress */
1450 if (length) {
1451 proto_tree_add_item(sub_tree, hf_smpp_dest_subaddress,
1452 tvb, *offset, length, ENC_NA);
1453 (*offset) += length;
1455 break;
1456 case 0x0204: /* user_message_reference */
1457 proto_tree_add_item(sub_tree, hf_smpp_user_message_reference, tvb, *offset, 2, ENC_BIG_ENDIAN);
1458 (*offset) += 2;
1459 break;
1460 case 0x0205: /* user_response_code */
1461 proto_tree_add_item(sub_tree, hf_smpp_user_response_code, tvb, *offset, 1, ENC_NA);
1462 (*offset) += 1;
1463 break;
1464 case 0x020A: /* source_port */
1465 proto_tree_add_item(sub_tree, hf_smpp_source_port, tvb, *offset, 2, ENC_BIG_ENDIAN);
1466 source_port = tvb_get_ntohs(tvb, *offset);
1467 source_port_found = true;
1468 (*offset) += 2;
1469 break;
1470 case 0x020B: /* destination_port */
1471 proto_tree_add_item(sub_tree, hf_smpp_destination_port, tvb, *offset, 2, ENC_BIG_ENDIAN);
1472 dest_port = tvb_get_ntohs(tvb, *offset);
1473 dest_port_found = true;
1474 (*offset) += 2;
1475 break;
1476 case 0x020C: /* sar_msg_ref_num */
1477 proto_tree_add_item(sub_tree, hf_smpp_sar_msg_ref_num, tvb, *offset, 2, ENC_BIG_ENDIAN);
1478 sm_id = tvb_get_ntohs(tvb, *offset);
1479 sm_id_found = true;
1480 (*offset) += 2;
1481 break;
1482 case 0x020D: /* language_indicator */
1483 proto_tree_add_item(sub_tree, hf_smpp_language_indicator, tvb, *offset, 1, ENC_NA);
1484 (*offset) += 1;
1485 break;
1486 case 0x020E: /* sar_total_segments */
1487 proto_tree_add_item(sub_tree, hf_smpp_sar_total_segments, tvb, *offset, 1, ENC_NA);
1488 frags = tvb_get_uint8(tvb, *offset);
1489 (*offset) += 1;
1490 break;
1491 case 0x020F: /* sar_segment_seqnum */
1492 proto_tree_add_item(sub_tree, hf_smpp_sar_segment_seqnum, tvb, *offset, 1, ENC_NA);
1493 frag = tvb_get_uint8(tvb, *offset);
1494 (*offset) += 1;
1495 break;
1496 case 0x0210: /* SC_interface_version */
1497 proto_tree_add_item(sub_tree, hf_smpp_SC_interface_version, tvb, *offset, 1, ENC_NA);
1498 (*offset) += 1;
1499 break;
1500 case 0x0302: { /* callback_num_pres_ind */
1502 static int * const fields[] = {
1503 &hf_smpp_callback_num_pres,
1504 &hf_smpp_callback_num_scrn,
1505 NULL
1508 proto_tree_add_bitmask_list(sub_tree, tvb, *offset, 1, fields, ENC_NA);
1509 (*offset)++;
1511 break;
1512 case 0x0303: /* callback_num_atag */
1513 if (length)
1514 proto_tree_add_item(sub_tree, hf_smpp_callback_num_atag,
1515 tvb, *offset, length, ENC_NA);
1516 (*offset) += length;
1517 break;
1518 case 0x0304: /* number_of_messages */
1519 proto_tree_add_item(sub_tree, hf_smpp_number_of_messages, tvb, *offset, 1, ENC_NA);
1520 (*offset) += 1;
1521 break;
1522 case 0x0381: /* callback_num */
1523 if (length)
1524 proto_tree_add_item(sub_tree, hf_smpp_callback_num,
1525 tvb, *offset, length, ENC_NA);
1526 (*offset) += length;
1527 break;
1528 case 0x0420: /* dpf_result */
1529 proto_tree_add_item(sub_tree, hf_smpp_dpf_result, tvb, *offset, 1, ENC_NA);
1530 (*offset) += 1;
1531 break;
1532 case 0x0421: /* set_dpf */
1533 proto_tree_add_item(sub_tree, hf_smpp_set_dpf, tvb, *offset, 1, ENC_NA);
1534 (*offset) += 1;
1535 break;
1536 case 0x0422: /* ms_availability_status */
1537 proto_tree_add_item(sub_tree, hf_smpp_ms_availability_status, tvb, *offset, 1, ENC_NA);
1538 (*offset) += 1;
1539 break;
1540 case 0x0423: /* network_error_code */
1541 proto_tree_add_item(sub_tree, hf_smpp_network_error_type, tvb, *offset, 1, ENC_NA);
1542 (*offset) += 1;
1543 proto_tree_add_item(sub_tree, hf_smpp_network_error_code, tvb, *offset, 2, ENC_BIG_ENDIAN);
1544 (*offset) += 2;
1545 break;
1546 case 0x0424: /* message_payload */
1547 if (length) {
1548 pi = proto_tree_add_item(sub_tree, hf_smpp_message_payload,
1549 tvb, *offset, length, ENC_NA);
1550 if (tvb_msg) {
1551 if (*tvb_msg != NULL) {
1552 expert_add_info(pinfo, pi, &ei_smpp_message_payload_duplicate);
1554 *tvb_msg = tvb_new_subset_length(tvb, *offset, length);
1557 (*offset) += length;
1558 break;
1559 case 0x0425: /* delivery_failure_reason */
1560 proto_tree_add_item(sub_tree, hf_smpp_delivery_failure_reason, tvb, *offset, 1, ENC_NA);
1561 (*offset) += 1;
1562 break;
1563 case 0x0426: /* more_messages_to_send */
1564 proto_tree_add_item(sub_tree, hf_smpp_more_messages_to_send, tvb, *offset, 1, ENC_NA);
1565 (*offset) += 1;
1566 break;
1567 case 0x0427: /* message_state */
1568 proto_tree_add_item(sub_tree, hf_smpp_message_state, tvb, *offset, 1, ENC_NA);
1569 (*offset) += 1;
1570 break;
1571 case 0x0428: /* congestion_state */
1572 proto_tree_add_item(sub_tree, hf_smpp_congestion_state, tvb, *offset, 1, ENC_NA);
1573 (*offset) += 1;
1574 break;
1575 case 0x0501: /* ussd_service_op */
1576 proto_tree_add_item(sub_tree, hf_smpp_ussd_service_op, tvb, *offset, 1, ENC_NA);
1577 (*offset) += 1;
1578 break;
1579 case 0x0600: /* broadcast_channel_indicator */
1580 proto_tree_add_item(sub_tree, hf_smpp_broadcast_channel_indicator, tvb, *offset, 1, ENC_NA);
1581 (*offset) += 1;
1582 break;
1583 case 0x0601: /* broadcast_content_type */
1584 proto_tree_add_item(sub_tree, hf_smpp_broadcast_content_type_nw, tvb, *offset, 1, ENC_NA);
1585 (*offset) += 1;
1586 proto_tree_add_item(sub_tree, hf_smpp_broadcast_content_type_type, tvb, *offset, 2, ENC_BIG_ENDIAN);
1587 (*offset) += 2;
1588 break;
1589 case 0x0602: /* broadcast_content_type_info */
1590 if (length)
1591 proto_tree_add_item(sub_tree, hf_smpp_broadcast_content_type_info,
1592 tvb, *offset, length, ENC_NA);
1593 (*offset) += length;
1594 break;
1595 case 0x0603: /* broadcast_message_class */
1596 proto_tree_add_item(sub_tree, hf_smpp_broadcast_message_class, tvb, *offset, 1, ENC_NA);
1597 (*offset) += 1;
1598 break;
1599 case 0x0604: /* broadcast_rep_num */
1600 proto_tree_add_item(sub_tree, hf_smpp_broadcast_rep_num, tvb, *offset, 1, ENC_NA);
1601 (*offset) += 1;
1602 break;
1603 case 0x0605: /* broadcast_frequency_interval */
1604 proto_tree_add_item(sub_tree, hf_smpp_broadcast_frequency_interval_unit, tvb, *offset, 1, ENC_NA);
1605 (*offset) += 1;
1606 proto_tree_add_item(sub_tree, hf_smpp_broadcast_frequency_interval_value, tvb, *offset, 2, ENC_BIG_ENDIAN);
1607 (*offset) += 2;
1608 break;
1609 case 0x0606: /* broadcast_area_identifier */
1610 proto_tree_add_item(sub_tree, hf_smpp_broadcast_area_identifier_format, tvb, *offset, 1, ENC_NA);
1611 proto_tree_add_item(sub_tree, hf_smpp_broadcast_area_identifier,
1612 tvb, *offset, length, ENC_NA);
1613 (*offset) += length;
1614 break;
1615 case 0x0607: /* broadcast_error_status */
1616 proto_tree_add_item(sub_tree, hf_smpp_broadcast_error_status, tvb, *offset, 4, ENC_BIG_ENDIAN);
1617 (*offset) += 4;
1618 break;
1619 case 0x0608: /* broadcast_area_success */
1620 proto_tree_add_item(sub_tree, hf_smpp_broadcast_area_success, tvb, *offset, 1, ENC_NA);
1621 (*offset) += 1;
1622 break;
1623 case 0x0609: /* broadcast_end_time */
1624 smpp_handle_time(sub_tree, tvb, pinfo, hf_smpp_broadcast_end_time,
1625 hf_smpp_broadcast_end_time_r, offset);
1626 break;
1627 case 0x060A: /* broadcast_service_group */
1628 if (length)
1629 proto_tree_add_item(sub_tree, hf_smpp_broadcast_service_group,
1630 tvb, *offset, length, ENC_NA);
1631 (*offset) += length;
1632 break;
1633 case 0x060B: /* billing_identification */
1634 if (length)
1635 proto_tree_add_item(sub_tree, hf_smpp_billing_identification,
1636 tvb, *offset, length, ENC_NA);
1637 (*offset) += length;
1638 break;
1639 /* 0x060C is skipped in the specs for some reason :-? */
1640 case 0x060D: /* source_network_id */
1641 if (length)
1642 proto_tree_add_item(sub_tree, hf_smpp_source_network_id,
1643 tvb, *offset, length, ENC_NA|ENC_ASCII);
1644 (*offset) += length;
1645 break;
1646 case 0x060E: /* dest_network_id */
1647 if (length)
1648 proto_tree_add_item(sub_tree, hf_smpp_dest_network_id,
1649 tvb, *offset, length, ENC_NA | ENC_ASCII);
1650 (*offset) += length;
1651 break;
1652 case 0x060F: /* source_node_id */
1653 if (length)
1654 proto_tree_add_item(sub_tree, hf_smpp_source_node_id,
1655 tvb, *offset, length, ENC_NA);
1656 (*offset) += length;
1657 break;
1658 case 0x0610: /* dest_node_id */
1659 if (length)
1660 proto_tree_add_item(sub_tree, hf_smpp_dest_node_id,
1661 tvb, *offset, length, ENC_NA);
1662 (*offset) += length;
1663 break;
1664 case 0x0611: /* dest_addr_np_resolution */
1665 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_np_resolution, tvb, *offset, 1, ENC_NA);
1666 (*offset) += 1;
1667 break;
1668 case 0x0612: /* dest_addr_np_information */
1669 if (length)
1670 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_np_information,
1671 tvb, *offset, length, ENC_NA);
1672 (*offset) += length;
1673 break;
1674 case 0x0613: /* dest_addr_np_country */
1675 /* TODO : Fetch values from packet-e164? */
1676 if (length)
1677 proto_tree_add_item(sub_tree, hf_smpp_dest_addr_np_country,
1678 tvb, *offset, length, ENC_NA);
1679 (*offset) += length;
1680 break;
1681 case 0x1201: /* display_time */
1682 proto_tree_add_item(sub_tree, hf_smpp_display_time, tvb, *offset, 1, ENC_NA);
1683 (*offset) += 1;
1684 break;
1685 case 0x1203: /* sms_signal */
1686 proto_tree_add_item(sub_tree, hf_smpp_sms_signal, tvb, *offset, 2, ENC_BIG_ENDIAN);
1687 (*offset) += 2;
1688 /*! \todo Fill as per TIA/EIA-136-710-A */
1689 break;
1690 case 0x1204: /* ms_validity */
1691 proto_tree_add_item(sub_tree, hf_smpp_ms_validity, tvb, *offset, 1, ENC_NA);
1692 (*offset) += 1;
1693 break;
1694 case 0x130C: /* alert_on_message_delivery */
1695 if (length == 0) {
1696 proto_tree_add_item(sub_tree,
1697 hf_smpp_alert_on_message_delivery_null,
1698 tvb, *offset, length, ENC_NA);
1699 } else {
1700 proto_tree_add_item(sub_tree, hf_smpp_alert_on_message_delivery_type, tvb, *offset, 1, ENC_NA);
1701 (*offset) += 1;
1703 break;
1704 case 0x1380: /* its_reply_type */
1705 proto_tree_add_item(sub_tree, hf_smpp_its_reply_type, tvb, *offset, 1, ENC_NA);
1706 (*offset) += 1;
1707 break;
1708 case 0x1383: { /* its_session_info */
1710 static int * const fields[] = {
1711 &hf_smpp_its_session_sequence,
1712 &hf_smpp_its_session_ind,
1713 NULL
1716 proto_tree_add_item(sub_tree, hf_smpp_its_session_number, tvb, *offset, 1, ENC_NA);
1717 (*offset) += 1;
1718 proto_tree_add_bitmask_list(sub_tree, tvb, *offset, 1, fields, ENC_NA);
1719 (*offset) += 1;
1721 break;
1723 default:
1724 /* TODO : Hopefully to be implemented soon - handle vendor specific TLVs
1725 * from a dictionary before treating them as unknown! */
1726 if ((tag >= 0x1400) && (tag <= 0x3FFF)) {
1727 proto_tree_add_item(sub_tree, hf_smpp_vendor_op, tvb,
1728 *offset, length, ENC_NA);
1729 } else {
1730 proto_tree_add_item(sub_tree, hf_smpp_reserved_op, tvb,
1731 *offset, length, ENC_NA);
1734 if (length > 0) {
1735 char *str;
1736 str = tvb_bytes_to_str(NULL, tvb,*offset,length);
1737 proto_item_append_text(sub_tree,": %s", str);
1738 wmem_free(NULL, str);
1741 (*offset) += length;
1742 break;
1746 if (source_port_found && dest_port_found) {
1747 smpp_data = get_smpp_data(pinfo);
1748 if (smpp_data->udh_fields == NULL) {
1749 smpp_data->udh_fields = wmem_new0(pinfo->pool, gsm_sms_udh_fields_t);
1751 smpp_data->udh_fields->port_src = source_port;
1752 smpp_data->udh_fields->port_dst = dest_port;
1755 if (sm_id_found && frags && frag) {
1756 /* frags and frag must be at least 1 */
1757 smpp_data = get_smpp_data(pinfo);
1758 if (smpp_data->udh_fields == NULL) {
1759 smpp_data->udh_fields = wmem_new0(pinfo->pool, gsm_sms_udh_fields_t);
1761 smpp_data->udh_fields->sm_id = sm_id;
1762 smpp_data->udh_fields->frags = frags;
1763 smpp_data->udh_fields->frag = frag;
1767 void
1768 smpp_handle_dcs(proto_tree *tree, tvbuff_t *tvb, int *offset, unsigned *encoding)
1770 uint32_t val;
1771 uint8_t dataCoding;
1772 int off = *offset;
1773 proto_tree *subtree;
1774 proto_item *pi;
1776 /* SMPP Data Coding Scheme */
1777 pi = proto_tree_add_item_ret_uint(tree, hf_smpp_data_coding, tvb, off, 1, ENC_NA, &val);
1779 if (val & 0xC0) {
1781 /* GSM SMS Data Coding Scheme */
1782 subtree = proto_item_add_subtree(pi, ett_dcs);
1784 if ((val & 0xF0) == 0xF0) {
1785 static int * const gsm_msg_control_fields[] = {
1786 &hf_smpp_dcs_sms_coding_group,
1787 &hf_smpp_dcs_reserved,
1788 &hf_smpp_dcs_charset,
1789 &hf_smpp_dcs_class,
1790 NULL
1793 proto_tree_add_bitmask_list(subtree, tvb, off, 1, gsm_msg_control_fields, ENC_NA);
1794 if ((val & 0x04) == 0x04) {
1795 dataCoding = DECODE_AS_OCTET;
1796 } else {
1797 dataCoding = DECODE_AS_GSM7;
1799 } else {
1800 static int * const gsm_mwi_control_fields[] = {
1801 &hf_smpp_dcs_sms_coding_group,
1802 &hf_smpp_dcs_wait_ind,
1803 &hf_smpp_dcs_reserved2,
1804 &hf_smpp_dcs_wait_type,
1805 NULL
1808 proto_tree_add_bitmask_list(subtree, tvb, off, 1, gsm_mwi_control_fields, ENC_NA);
1809 if ((val & 0xF0) == 0xE0) {
1810 dataCoding = DECODE_AS_UCS2;
1811 } else {
1812 dataCoding = DECODE_AS_GSM7;
1815 } else {
1816 dataCoding = val;
1818 if (encoding != NULL) {
1819 switch (dataCoding)
1821 case DECODE_AS_DEFAULT:
1822 *encoding = smpp_decode_dcs_0_sms;
1823 break;
1824 case DECODE_AS_ASCII:
1825 *encoding = ENC_ASCII;
1826 break;
1827 case DECODE_AS_OCTET:
1828 *encoding = DO_NOT_DECODE;
1829 break;
1830 case DECODE_AS_ISO_8859_1:
1831 *encoding = ENC_ISO_8859_1;
1832 break;
1833 case DECODE_AS_ISO_8859_5:
1834 *encoding = ENC_ISO_8859_5;
1835 break;
1836 case DECODE_AS_ISO_8859_8:
1837 *encoding = ENC_ISO_8859_8;
1838 break;
1839 case DECODE_AS_UCS2:
1840 *encoding = ENC_UCS_2|ENC_BIG_ENDIAN;
1841 break;
1842 case DECODE_AS_KSC5601:
1843 *encoding = ENC_EUC_KR;
1844 break;
1845 case DECODE_AS_GSM7:
1846 *encoding = smpp_gsm7_unpacked ? ENC_3GPP_TS_23_038_7BITS_UNPACKED :
1847 ENC_3GPP_TS_23_038_7BITS_PACKED;
1848 break;
1849 default:
1850 /* XXX: Support decoding unknown values according to the pref? */
1851 *encoding = DO_NOT_DECODE;
1852 break;
1856 (*offset)++;
1859 static void
1860 smpp_handle_msg(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, const char *src_str, const char *dst_str)
1862 smpp_data_t *smpp_data;
1863 address save_src, save_dst;
1864 unsigned encoding;
1865 int udh_offset = 0;
1866 int length;
1868 smpp_data = get_smpp_data(pinfo);
1869 encoding = smpp_data->encoding;
1871 length = tvb_reported_length(tvb);
1873 if (smpp_data->udhi) /* UDHI indicator present */
1875 udh_offset = tvb_get_uint8(tvb, 0) + 1;
1878 if (smpp_data->udhi || smpp_data->udh_fields) {
1879 /* Save original addresses */
1880 copy_address_shallow(&save_src, &pinfo->src);
1881 copy_address_shallow(&save_dst, &pinfo->dst);
1882 /* Set SMPP source and destination address */
1883 set_address(&(pinfo->src), AT_STRINGZ, 1+(int)strlen(src_str), src_str);
1884 set_address(&(pinfo->dst), AT_STRINGZ, 1+(int)strlen(dst_str), dst_str);
1885 call_dissector_with_data(gsm_sms_handle, tvb, pinfo, proto_tree_get_parent_tree(tree), smpp_data);
1886 /* Restore original addresses */
1887 copy_address_shallow(&pinfo->src, &save_src);
1888 copy_address_shallow(&pinfo->dst, &save_dst);
1891 if (smpp_data->encoding != DO_NOT_DECODE) {
1892 if (smpp_data->encoding == ENC_3GPP_TS_23_038_7BITS_PACKED && smpp_data->udhi) {
1893 /* SMPP only has the number of octets of the payload, but when
1894 * packed 7-bit GSM alphabet is used with a UDH, there are fill
1895 * bits after the UDH to align the SM start with a septet boundary.
1896 * Calculate the fill bits after the UDH as well as the number of
1897 * septets that could fit in the bytes. (In certain circumstances
1898 * there are two possible numbers of septets that would require
1899 * a certain number of octets. This is part of why packet 7-bit
1900 * GSM alphabet is not usually used in SMPP, but there are reports
1901 * of some servers out there.)
1903 uint8_t fill_bits = 6 - ((udh_offset - 1) * 8) % 7;
1904 int septets = ((length - udh_offset) * 8 - fill_bits) / 7;
1905 proto_tree_add_ts_23_038_7bits_packed_item(tree, hf_smpp_short_message, tvb, udh_offset * 8 + fill_bits, septets);
1906 } else {
1907 proto_tree_add_item(tree, hf_smpp_short_message, tvb,
1908 udh_offset, length-udh_offset, encoding);
1914 * The next set of routines handle the different operations, associated
1915 * with SMPP.
1917 static void
1918 bind_receiver(proto_tree *tree, tvbuff_t *tvb, int offset)
1920 smpp_handle_string(tree, tvb, hf_smpp_system_id, &offset);
1921 smpp_handle_string(tree, tvb, hf_smpp_password, &offset);
1922 smpp_handle_string(tree, tvb, hf_smpp_system_type, &offset);
1923 proto_tree_add_item(tree, hf_smpp_interface_version, tvb, offset, 1, ENC_NA);
1924 offset += 1;
1925 proto_tree_add_item(tree, hf_smpp_addr_ton, tvb, offset, 1, ENC_NA);
1926 offset += 1;
1927 proto_tree_add_item(tree, hf_smpp_addr_npi, tvb, offset, 1, ENC_NA);
1928 offset += 1;
1929 smpp_handle_string_z(tree, tvb, hf_smpp_address_range, &offset, "NULL");
1932 static void
1933 query_sm(proto_tree *tree, tvbuff_t *tvb, int offset)
1935 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
1936 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
1937 offset += 1;
1938 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
1939 offset += 1;
1940 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
1943 static void
1944 outbind(proto_tree *tree, tvbuff_t *tvb, int offset)
1946 smpp_handle_string(tree, tvb, hf_smpp_system_id, &offset);
1947 smpp_handle_string(tree, tvb, hf_smpp_password, &offset);
1950 static void
1951 submit_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1953 tvbuff_t *tvb_msg = NULL;
1954 smpp_data_t *smpp_data;
1955 uint32_t length;
1956 const char *src_str = NULL;
1957 const char *dst_str = NULL;
1958 nstime_t zero_time = NSTIME_INIT_ZERO;
1960 smpp_data = get_smpp_data(pinfo);
1962 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
1963 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
1964 offset += 1;
1965 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
1966 offset += 1;
1967 src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
1968 proto_tree_add_item(tree, hf_smpp_dest_addr_ton, tvb, offset, 1, ENC_NA);
1969 offset += 1;
1970 proto_tree_add_item(tree, hf_smpp_dest_addr_npi, tvb, offset, 1, ENC_NA);
1971 offset += 1;
1972 dst_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_destination_addr, &offset);
1974 smpp_data->udhi = tvb_get_uint8(tvb, offset) & SMPP_UDHI_MASK;
1975 proto_tree_add_bitmask_list(tree, tvb, offset, 1, submit_msg_fields, ENC_NA);
1976 offset++;
1978 proto_tree_add_item(tree, hf_smpp_protocol_id, tvb, offset, 1, ENC_NA);
1979 offset += 1;
1980 proto_tree_add_item(tree, hf_smpp_priority_flag, tvb, offset, 1, ENC_NA);
1981 offset += 1;
1982 if (tvb_get_uint8(tvb,offset)) {
1983 smpp_handle_time(tree, tvb, pinfo, hf_smpp_schedule_delivery_time,
1984 hf_smpp_schedule_delivery_time_r, &offset);
1985 } else { /* Time = NULL means Immediate delivery */
1986 proto_tree_add_time_format_value(tree, hf_smpp_schedule_delivery_time_r, tvb, offset++, 1, &zero_time, "Immediate delivery");
1988 if (tvb_get_uint8(tvb,offset)) {
1989 smpp_handle_time(tree, tvb, pinfo, hf_smpp_validity_period,
1990 hf_smpp_validity_period_r, &offset);
1991 } else { /* Time = NULL means SMSC default validity */
1992 proto_tree_add_time_format_value(tree, hf_smpp_validity_period_r, tvb, offset++, 1, &zero_time, "SMSC default validity period");
1995 proto_tree_add_bitmask_list(tree, tvb, offset, 1, regdel_fields, ENC_NA);
1996 offset++;
1997 proto_tree_add_item(tree, hf_smpp_replace_if_present_flag, tvb, offset, 1, ENC_NA);
1998 offset += 1;
1999 smpp_handle_dcs(tree, tvb, &offset, &smpp_data->encoding);
2000 proto_tree_add_item(tree, hf_smpp_sm_default_msg_id, tvb, offset, 1, ENC_NA);
2001 offset += 1;
2002 proto_tree_add_item_ret_uint(tree, hf_smpp_sm_length, tvb, offset++, 1, ENC_NA, &length);
2003 if (length)
2005 proto_tree_add_item(tree, hf_smpp_short_message_bin,
2006 tvb, offset, length, ENC_NA);
2007 tvb_msg = tvb_new_subset_length(tvb, offset, length);
2008 offset += length;
2010 /* Get rid of SMPP text string addresses */
2011 smpp_handle_tlv(tree, tvb, pinfo, &offset, &tvb_msg);
2013 if (tvb_msg) {
2014 smpp_handle_msg(tree, tvb_msg, pinfo, src_str, dst_str);
2018 static void
2019 replace_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2021 tvbuff_t *tvb_msg = NULL;
2022 smpp_data_t *smpp_data;
2023 uint32_t length;
2024 const char *src_str = NULL;
2025 nstime_t zero_time = NSTIME_INIT_ZERO;
2027 smpp_data = get_smpp_data(pinfo);
2029 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2030 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2031 offset += 1;
2032 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2033 offset += 1;
2034 src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
2035 if (tvb_get_uint8(tvb,offset)) {
2036 smpp_handle_time(tree, tvb, pinfo, hf_smpp_schedule_delivery_time,
2037 hf_smpp_schedule_delivery_time_r, &offset);
2038 } else { /* Time = NULL */
2039 proto_tree_add_time_format_value(tree, hf_smpp_schedule_delivery_time_r, tvb, offset++, 1, &zero_time, "Keep initial delivery time setting");
2041 if (tvb_get_uint8(tvb,offset)) {
2042 smpp_handle_time(tree, tvb, pinfo, hf_smpp_validity_period,
2043 hf_smpp_validity_period_r, &offset);
2044 } else { /* Time = NULL */
2045 proto_tree_add_time_format_value(tree, hf_smpp_validity_period_r, tvb, offset++, 1,&zero_time, "Keep initial validity period setting");
2047 proto_tree_add_bitmask_list(tree, tvb, offset, 1, regdel_fields, ENC_NA);
2048 offset++;
2049 proto_tree_add_item(tree, hf_smpp_sm_default_msg_id, tvb, offset, 1, ENC_NA);
2050 offset += 1;
2051 proto_tree_add_item_ret_uint(tree, hf_smpp_sm_length, tvb, offset++, 1, ENC_NA, &length);
2052 /* XXX: replace_sm does not contain a DCS element, so theoretically
2053 * the encoding must be the same as the previously submitted message
2054 * with the same message ID. We don't track that, though, so just assume
2055 * default.
2057 smpp_data->encoding = smpp_decode_dcs_0_sms;
2058 if (length) {
2059 proto_tree_add_item(tree, hf_smpp_short_message_bin,
2060 tvb, offset, length, ENC_NA);
2061 tvb_msg = tvb_new_subset_length(tvb, offset, length);
2063 offset += length;
2064 smpp_handle_tlv(tree, tvb, pinfo, &offset, &tvb_msg);
2065 if (tvb_msg) {
2066 smpp_handle_msg(tree, tvb_msg, pinfo, src_str, "");
2070 static void
2071 cancel_sm(proto_tree *tree, tvbuff_t *tvb, int offset)
2073 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
2074 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2075 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2076 offset += 1;
2077 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2078 offset += 1;
2079 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2080 proto_tree_add_item(tree, hf_smpp_dest_addr_ton, tvb, offset, 1, ENC_NA);
2081 offset += 1;
2082 proto_tree_add_item(tree, hf_smpp_dest_addr_npi, tvb, offset, 1, ENC_NA);
2083 offset += 1;
2084 smpp_handle_string(tree, tvb, hf_smpp_destination_addr, &offset);
2087 static void
2088 submit_multi(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2090 tvbuff_t *tvb_msg = NULL;
2091 smpp_data_t *smpp_data;
2092 uint32_t length;
2093 const char *src_str = NULL;
2094 nstime_t zero_time = NSTIME_INIT_ZERO;
2096 smpp_data = get_smpp_data(pinfo);
2098 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
2099 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2100 offset += 1;
2101 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2102 offset += 1;
2103 src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
2105 smpp_handle_dlist(tree, tvb, &offset);
2107 smpp_data->udhi = tvb_get_uint8(tvb, offset) & SMPP_UDHI_MASK;
2108 proto_tree_add_bitmask_list(tree, tvb, offset, 1, submit_msg_fields, ENC_NA);
2109 offset++;
2110 proto_tree_add_item(tree, hf_smpp_protocol_id, tvb, offset, 1, ENC_NA);
2111 offset += 1;
2112 proto_tree_add_item(tree, hf_smpp_priority_flag, tvb, offset, 1, ENC_NA);
2113 offset += 1;
2114 if (tvb_get_uint8(tvb,offset)) {
2115 smpp_handle_time(tree, tvb, pinfo, hf_smpp_schedule_delivery_time,
2116 hf_smpp_schedule_delivery_time_r, &offset);
2117 } else { /* Time = NULL means Immediate delivery */
2118 proto_tree_add_time_format_value(tree, hf_smpp_schedule_delivery_time_r, tvb, offset++, 1, &zero_time, "Immediate delivery");
2120 if (tvb_get_uint8(tvb,offset)) {
2121 smpp_handle_time(tree, tvb, pinfo, hf_smpp_validity_period, hf_smpp_validity_period_r, &offset);
2122 } else { /* Time = NULL means SMSC default validity */
2123 proto_tree_add_time_format_value(tree, hf_smpp_schedule_delivery_time_r, tvb, offset++, 1, &zero_time, "SMSC default validity period");
2125 proto_tree_add_bitmask_list(tree, tvb, offset, 1, regdel_fields, ENC_NA);
2126 offset++;
2127 proto_tree_add_item(tree, hf_smpp_replace_if_present_flag, tvb, offset, 1, ENC_NA);
2128 offset += 1;
2129 smpp_handle_dcs(tree, tvb, &offset, &smpp_data->encoding);
2130 proto_tree_add_item(tree, hf_smpp_sm_default_msg_id, tvb, offset, 1, ENC_NA);
2131 offset += 1;
2132 proto_tree_add_item_ret_uint(tree, hf_smpp_sm_length, tvb, offset++, 1, ENC_NA, &length);
2133 if (length) {
2134 proto_tree_add_item(tree, hf_smpp_short_message_bin,
2135 tvb, offset, length, ENC_NA);
2136 tvb_msg = tvb_new_subset_length(tvb, offset, length);
2138 offset += length;
2139 smpp_handle_tlv(tree, tvb, pinfo, &offset, &tvb_msg);
2140 if (tvb_msg) {
2141 /* submit_multi can have many destinations; for reassembly purposes
2142 * use the null address, like a broadcast.
2144 smpp_handle_msg(tree, tvb_msg, pinfo, src_str, "");
2148 static void
2149 alert_notification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2151 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2152 offset += 1;
2153 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2154 offset += 1;
2155 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2156 proto_tree_add_item(tree, hf_smpp_esme_addr_ton, tvb, offset, 1, ENC_NA);
2157 offset += 1;
2158 proto_tree_add_item(tree, hf_smpp_esme_addr_npi, tvb, offset, 1, ENC_NA);
2159 offset += 1;
2160 smpp_handle_string(tree, tvb, hf_smpp_esme_addr, &offset);
2161 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2164 static void
2165 data_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2167 tvbuff_t *tvb_msg = NULL;
2168 smpp_data_t *smpp_data;
2169 const char *src_str = NULL;
2170 const char *dst_str = NULL;
2172 smpp_data = get_smpp_data(pinfo);
2174 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
2175 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2176 offset += 1;
2177 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2178 offset += 1;
2179 src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
2180 proto_tree_add_item(tree, hf_smpp_dest_addr_ton, tvb, offset, 1, ENC_NA);
2181 offset += 1;
2182 proto_tree_add_item(tree, hf_smpp_dest_addr_npi, tvb, offset, 1, ENC_NA);
2183 offset += 1;
2184 dst_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_destination_addr, &offset);
2185 smpp_data->udhi = tvb_get_uint8(tvb, offset) & SMPP_UDHI_MASK;
2186 proto_tree_add_bitmask_list(tree, tvb, offset, 1, submit_msg_fields, ENC_NA);
2187 offset++;
2188 proto_tree_add_bitmask_list(tree, tvb, offset, 1, regdel_fields, ENC_NA);
2189 offset++;
2190 smpp_handle_dcs(tree, tvb, &offset, &smpp_data->encoding);
2191 smpp_handle_tlv(tree, tvb, pinfo, &offset, &tvb_msg);
2192 if (tvb_msg) {
2193 smpp_handle_msg(tree, tvb_msg, pinfo, src_str, dst_str);
2198 * Request operations introduced in the SMPP 5.0
2200 static void
2201 broadcast_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2203 nstime_t zero_time = NSTIME_INIT_ZERO;
2204 tvbuff_t *tvb_msg = NULL;
2205 smpp_data_t *smpp_data;
2206 const char *src_str = NULL;
2208 smpp_data = get_smpp_data(pinfo);
2210 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
2211 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2212 offset += 1;
2213 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2214 offset += 1;
2215 src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
2216 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2217 proto_tree_add_item(tree, hf_smpp_priority_flag, tvb, offset, 1, ENC_NA);
2218 offset += 1;
2219 if (tvb_get_uint8(tvb,offset)) {
2220 smpp_handle_time(tree, tvb, pinfo, hf_smpp_schedule_delivery_time,
2221 hf_smpp_schedule_delivery_time_r, &offset);
2222 } else { /* Time = NULL means Immediate delivery */
2223 proto_tree_add_time_format_value(tree, hf_smpp_schedule_delivery_time_r, tvb, offset++, 1, &zero_time, "Immediate delivery");
2225 if (tvb_get_uint8(tvb,offset)) {
2226 smpp_handle_time(tree, tvb, pinfo, hf_smpp_validity_period, hf_smpp_validity_period_r, &offset);
2227 } else { /* Time = NULL means SMSC default validity */
2228 proto_tree_add_time_format_value(tree, hf_smpp_validity_period_r, tvb, offset++, 1, &zero_time, "SMSC default validity period");
2230 proto_tree_add_item(tree, hf_smpp_replace_if_present_flag, tvb, offset, 1, ENC_NA);
2231 offset += 1;
2232 smpp_handle_dcs(tree, tvb, &offset, &smpp_data->encoding);
2233 proto_tree_add_item(tree, hf_smpp_sm_default_msg_id, tvb, offset, 1, ENC_NA);
2234 offset += 1;
2235 smpp_handle_tlv(tree, tvb, pinfo, &offset, &tvb_msg);
2236 if (tvb_msg) {
2237 smpp_handle_msg(tree, tvb_msg, pinfo, src_str, "");
2241 static void
2242 query_broadcast_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2244 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2245 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2246 offset += 1;
2247 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2248 offset += 1;
2249 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2250 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2253 static void
2254 cancel_broadcast_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2256 smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
2257 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2258 proto_tree_add_item(tree, hf_smpp_source_addr_ton, tvb, offset, 1, ENC_NA);
2259 offset += 1;
2260 proto_tree_add_item(tree, hf_smpp_source_addr_npi, tvb, offset, 1, ENC_NA);
2261 offset += 1;
2262 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2263 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2267 * The next set of routines handle the different operation-responses,
2268 * associated with SMPP.
2270 static void
2271 bind_receiver_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2273 smpp_handle_string(tree, tvb, hf_smpp_system_id, &offset);
2274 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2277 static void
2278 query_sm_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2280 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2281 smpp_handle_time(tree, tvb, pinfo, hf_smpp_final_date,
2282 hf_smpp_final_date_r, &offset);
2283 proto_tree_add_item(tree, hf_smpp_message_state, tvb, offset, 1, ENC_NA);
2284 offset += 1;
2285 proto_tree_add_item(tree, hf_smpp_error_code, tvb, offset, 1, ENC_NA);
2286 offset += 1;
2289 static void
2290 submit_sm_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2292 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2293 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2296 static void
2297 submit_multi_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2299 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2300 smpp_handle_dlist_resp(tree, tvb, &offset);
2301 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2304 static void
2305 data_sm_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2307 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2308 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2311 static void
2312 query_broadcast_sm_resp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
2314 smpp_handle_string(tree, tvb, hf_smpp_message_id, &offset);
2315 smpp_handle_tlv(tree, tvb, pinfo, &offset, NULL);
2318 /* Huawei SMPP+ extensions */
2319 static void
2320 huawei_auth_acc(proto_tree *tree, tvbuff_t *tvb, int offset)
2322 uint32_t version;
2324 proto_tree_add_item_ret_uint(tree, hf_smpp_error_code, tvb, offset, 1, ENC_NA, &version);
2325 offset += 1;
2326 smpp_handle_string(tree, tvb, hf_huawei_smpp_smsc_addr, &offset);
2327 if ( version == '3' ) {
2328 proto_tree_add_item(tree, hf_huawei_smpp_msc_addr_noa, tvb, offset, 1, ENC_NA);
2329 offset += 1;
2330 proto_tree_add_item(tree, hf_huawei_smpp_msc_addr_npi, tvb, offset, 1, ENC_NA);
2331 offset += 1;
2332 smpp_handle_string(tree, tvb, hf_huawei_smpp_msc_addr, &offset);
2334 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2335 smpp_handle_string(tree, tvb, hf_smpp_destination_addr, &offset);
2336 proto_tree_add_item(tree, hf_huawei_smpp_mo_mt_flag, tvb, offset, 1, ENC_NA);
2337 offset += 1;
2338 smpp_handle_string(tree, tvb, hf_huawei_smpp_sm_id, &offset);
2339 proto_tree_add_item(tree, hf_huawei_smpp_length_auth, tvb, offset, 4, ENC_BIG_ENDIAN);
2340 offset += 4;
2341 proto_tree_add_item(tree, hf_huawei_smpp_service_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2344 static void
2345 huawei_auth_acc_resp(proto_tree *tree, tvbuff_t *tvb, int offset)
2347 proto_tree_add_item(tree, hf_huawei_smpp_operation_result, tvb, offset, 4, ENC_BIG_ENDIAN);
2348 offset += 4;
2349 proto_tree_add_item(tree, hf_huawei_smpp_notify_mode, tvb, offset, 1, ENC_NA);
2352 static void
2353 huawei_sm_result_notify(proto_tree *tree, tvbuff_t *tvb, int offset)
2355 uint32_t version;
2357 proto_tree_add_item_ret_uint(tree, hf_smpp_error_code, tvb, offset, 1, ENC_NA, &version);
2358 offset += 1;
2359 smpp_handle_string(tree, tvb, hf_huawei_smpp_smsc_addr, &offset);
2361 if ( version == '3' ) {
2362 proto_tree_add_item(tree, hf_huawei_smpp_msc_addr_noa, tvb, offset, 1, ENC_NA);
2363 offset += 1;
2364 proto_tree_add_item(tree, hf_huawei_smpp_msc_addr_npi, tvb, offset, 1, ENC_NA);
2365 offset += 1;
2366 smpp_handle_string(tree, tvb, hf_huawei_smpp_msc_addr, &offset);
2369 smpp_handle_string(tree, tvb, hf_smpp_source_addr, &offset);
2370 smpp_handle_string(tree, tvb, hf_smpp_destination_addr, &offset);
2371 proto_tree_add_item(tree, hf_huawei_smpp_mo_mt_flag, tvb, offset, 1, ENC_NA);
2372 offset += 1;
2373 smpp_handle_string(tree, tvb, hf_huawei_smpp_sm_id, &offset);
2374 proto_tree_add_item(tree, hf_huawei_smpp_length_auth, tvb, offset, 4, ENC_BIG_ENDIAN);
2375 offset += 4;
2376 proto_tree_add_item(tree, hf_huawei_smpp_delivery_result, tvb, offset, 4, ENC_BIG_ENDIAN);
2377 offset += 4;
2378 proto_tree_add_item(tree, hf_huawei_smpp_service_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2381 static void
2382 huawei_sm_result_notify_resp(proto_tree *tree, tvbuff_t *tvb, int offset)
2384 proto_tree_add_item(tree, hf_huawei_smpp_delivery_result, tvb, offset, 4, ENC_BIG_ENDIAN);
2387 static bool
2388 test_smpp(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
2390 uint32_t command_id; /* SMPP command */
2391 uint32_t command_status; /* Status code */
2392 uint32_t command_length; /* length of PDU */
2394 if (tvb_reported_length_remaining(tvb, offset) < SMPP_MIN_LENGTH || /* Mandatory header */
2395 tvb_captured_length_remaining(tvb, offset) < 12)
2396 return false;
2397 command_length = tvb_get_ntohl(tvb, offset);
2398 if (command_length > 64 * 1024 || command_length < SMPP_MIN_LENGTH)
2399 return false;
2400 command_id = tvb_get_ntohl(tvb, offset + 4); /* Only known commands */
2401 if (try_val_to_str(command_id, vals_command_id) == NULL)
2402 return false;
2403 command_status = tvb_get_ntohl(tvb, offset + 8); /* ..with known status */
2404 if (try_rval_to_str(command_status, rvals_command_status) == NULL)
2405 return false;
2407 return true;
2410 static unsigned
2411 get_smpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
2413 return tvb_get_ntohl(tvb, offset);
2416 static void
2417 export_smpp_pdu(packet_info *pinfo, tvbuff_t *tvb)
2419 exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "smpp", EXP_PDU_TAG_DISSECTOR_NAME);
2421 exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
2422 exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
2423 exp_pdu_data->pdu_tvb = tvb;
2425 tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
2428 /* Dissect a single SMPP PDU contained within "tvb". */
2429 static int
2430 dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2432 int offset = 0; /* Offset within tvbuff */
2433 unsigned command_length; /* length of PDU */
2434 unsigned command_id; /* SMPP command */
2435 unsigned command_status; /* Status code */
2436 unsigned sequence_number; /* ...of command */
2437 smpp_tap_rec_t *tap_rec; /* Tap record */
2438 const char *command_str;
2439 const char *command_status_str = NULL;
2440 /* Set up structures needed to add the protocol subtree and manage it */
2441 proto_item *ti;
2442 proto_tree *smpp_tree;
2445 * Safety: don't even try to dissect the PDU
2446 * when the mandatory header isn't present.
2448 if (tvb_reported_length(tvb) < SMPP_MIN_LENGTH)
2449 return 0;
2450 command_length = tvb_get_ntohl(tvb, offset);
2451 offset += 4;
2452 command_id = tvb_get_ntohl(tvb, offset);
2453 command_str = val_to_str(command_id, vals_command_id,
2454 "(Unknown SMPP Operation 0x%08X)");
2455 offset += 4;
2456 command_status = tvb_get_ntohl(tvb, offset);
2457 if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
2458 /* PDU is a response. */
2459 command_status_str = rval_to_str(command_status, rvals_command_status, "Unknown (0x%08x)");
2461 offset += 4;
2462 sequence_number = tvb_get_ntohl(tvb, offset);
2464 if (have_tap_listener(exported_pdu_tap)){
2465 export_smpp_pdu(pinfo,tvb);
2469 * Update the protocol column.
2471 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMPP");
2472 col_clear(pinfo->cinfo, COL_INFO);
2475 * Create display subtree for the protocol
2477 ti = proto_tree_add_item (tree, proto_smpp, tvb, 0, tvb_captured_length(tvb), ENC_NA);
2478 smpp_tree = proto_item_add_subtree (ti, ett_smpp);
2481 * Make entries in the Info column on the summary display
2483 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", command_str);
2486 * Display command status of responses in Info column
2488 if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
2489 col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", command_status_str);
2493 * Set the fence before dissecting the PDU because if the PDU is invalid it
2494 * may throw an exception and the next PDU will clear the info about the
2495 * current PDU
2497 col_set_fence(pinfo->cinfo, COL_INFO);
2500 * Dissect the PDU
2504 * Create display subtree for the PDU
2506 proto_tree_add_uint(smpp_tree, hf_smpp_command_length, tvb, 0, 4, command_length);
2507 if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
2508 ti = proto_tree_add_boolean(smpp_tree, hf_smpp_command_response, tvb, 4, 4, true);
2510 else {
2511 ti = proto_tree_add_boolean(smpp_tree, hf_smpp_command_request, tvb, 4, 4, true);
2513 proto_item_set_generated(ti);
2514 proto_tree_add_uint(smpp_tree, hf_smpp_command_id, tvb, 4, 4, command_id);
2515 proto_item_append_text(smpp_tree, ", Command: %s", command_str);
2518 * Status is only meaningful with responses
2520 if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
2521 proto_tree_add_uint(smpp_tree, hf_smpp_command_status, tvb, 8, 4, command_status);
2522 proto_item_append_text (smpp_tree, ", Status: \"%s\"", command_status_str);
2524 proto_tree_add_uint(smpp_tree, hf_smpp_sequence_number, tvb, 12, 4, sequence_number);
2525 proto_item_append_text(smpp_tree, ", Seq: %u, Len: %u", sequence_number, command_length);
2527 if (command_length <= tvb_reported_length(tvb))
2529 if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK)
2531 switch (command_id & (~SMPP_COMMAND_ID_RESPONSE_MASK)) {
2533 * All of these only have a fixed header
2535 case SMPP_COMMAND_ID_GENERIC_NACK:
2536 case SMPP_COMMAND_ID_UNBIND:
2537 case SMPP_COMMAND_ID_REPLACE_SM:
2538 case SMPP_COMMAND_ID_CANCEL_SM:
2539 case SMPP_COMMAND_ID_ENQUIRE_LINK:
2540 case SMPP_COMMAND_ID_CANCEL_BROADCAST_SM:
2541 break;
2542 /* FIXME: The body of the response PDUs are only
2543 * only dissected if the request was successful.
2544 * However, in SMPP 5.0 some responses might
2545 * contain body to provide additional information
2546 * about the error. This needs to be handled.
2548 case SMPP_COMMAND_ID_BIND_RECEIVER:
2549 case SMPP_COMMAND_ID_BIND_TRANSMITTER:
2550 case SMPP_COMMAND_ID_BIND_TRANSCEIVER:
2551 if (!command_status)
2552 bind_receiver_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2553 break;
2554 case SMPP_COMMAND_ID_QUERY_SM:
2555 if (!command_status)
2556 query_sm_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2557 break;
2558 case SMPP_COMMAND_ID_SUBMIT_SM:
2559 case SMPP_COMMAND_ID_DELIVER_SM:
2560 case SMPP_COMMAND_ID_BROADCAST_SM:
2561 if (!command_status)
2562 submit_sm_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2563 break;
2564 case SMPP_COMMAND_ID_SUBMIT_MULTI:
2565 if (!command_status)
2566 submit_multi_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2567 break;
2568 case SMPP_COMMAND_ID_DATA_SM:
2569 if (!command_status)
2570 data_sm_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2571 break;
2572 case SMPP_COMMAND_ID_QUERY_BROADCAST_SM:
2573 if (!command_status)
2574 query_broadcast_sm_resp(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2575 break;
2576 case SMPP_COMMAND_ID_HUAWEI_AUTH_ACC:
2577 if (!command_status)
2578 huawei_auth_acc_resp(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2579 break;
2580 case SMPP_COMMAND_ID_HUAWEI_SM_RESULT_NOTIFY:
2581 if (!command_status)
2582 huawei_sm_result_notify_resp(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2583 break;
2584 default:
2585 break;
2586 } /* switch (command_id & 0x7FFFFFFF) */
2588 else
2590 switch (command_id) {
2591 case SMPP_COMMAND_ID_BIND_RECEIVER:
2592 case SMPP_COMMAND_ID_BIND_TRANSMITTER:
2593 case SMPP_COMMAND_ID_BIND_TRANSCEIVER:
2594 bind_receiver(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2595 break;
2596 case SMPP_COMMAND_ID_QUERY_SM:
2597 query_sm(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2598 break;
2599 case SMPP_COMMAND_ID_SUBMIT_SM:
2600 case SMPP_COMMAND_ID_DELIVER_SM:
2601 submit_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2602 break;
2603 case SMPP_COMMAND_ID_UNBIND:
2604 case SMPP_COMMAND_ID_ENQUIRE_LINK:
2605 break;
2606 case SMPP_COMMAND_ID_REPLACE_SM:
2607 replace_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2608 break;
2609 case SMPP_COMMAND_ID_CANCEL_SM:
2610 cancel_sm(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2611 break;
2612 case SMPP_COMMAND_ID_OUTBIND:
2613 outbind(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2614 break;
2615 case SMPP_COMMAND_ID_SUBMIT_MULTI:
2616 submit_multi(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2617 break;
2618 case SMPP_COMMAND_ID_ALERT_NOTIFICATION:
2619 alert_notification(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2620 break;
2621 case SMPP_COMMAND_ID_DATA_SM:
2622 data_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2623 break;
2624 case SMPP_COMMAND_ID_BROADCAST_SM:
2625 broadcast_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2626 break;
2627 case SMPP_COMMAND_ID_QUERY_BROADCAST_SM:
2628 query_broadcast_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2629 break;
2630 case SMPP_COMMAND_ID_CANCEL_BROADCAST_SM:
2631 cancel_broadcast_sm(smpp_tree, tvb, pinfo, SMPP_FIXED_HEADER_LENGTH);
2632 break;
2633 case SMPP_COMMAND_ID_HUAWEI_AUTH_ACC:
2634 huawei_auth_acc(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2635 break;
2636 case SMPP_COMMAND_ID_HUAWEI_SM_RESULT_NOTIFY:
2637 huawei_sm_result_notify(smpp_tree, tvb, SMPP_FIXED_HEADER_LENGTH);
2638 break;
2639 default:
2640 break;
2641 } /* switch (command_id) */
2646 /* Queue packet for Tap */
2647 tap_rec = wmem_new0(pinfo->pool, smpp_tap_rec_t);
2648 tap_rec->command_id = command_id;
2649 tap_rec->command_status = command_status;
2650 tap_queue_packet(smpp_tap, pinfo, tap_rec);
2652 return tvb_captured_length(tvb);
2655 static int
2656 dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2658 if (pinfo->ptype == PT_TCP) { /* are we running on top of TCP */
2659 if (!test_smpp(pinfo, tvb, 0, data)) {
2660 return 0;
2662 tcp_dissect_pdus(tvb, pinfo, tree,
2663 reassemble_over_tcp, /* Do we try to reassemble */
2664 SMPP_FIXED_HEADER_LENGTH, /* Length of fixed header */
2665 /* XXX: We only use the first 4 bytes for the length, do we
2666 * really need to pass in the entire fixed header? */
2667 get_smpp_pdu_len, /* Function returning PDU len */
2668 dissect_smpp_pdu, data); /* PDU dissector */
2670 else { /* no? probably X.25 */
2671 uint32_t offset = 0;
2672 while (tvb_reported_length_remaining(tvb, offset) > 0) {
2673 uint16_t pdu_len = tvb_get_ntohl(tvb, offset);
2674 int pdu_real_len = tvb_captured_length_remaining(tvb, offset);
2675 tvbuff_t *pdu_tvb;
2677 if (pdu_len < 1)
2678 return offset;
2680 if (pdu_real_len <= 0)
2681 return offset;
2682 if (pdu_real_len > pdu_len)
2683 pdu_real_len = pdu_len;
2684 pdu_tvb = tvb_new_subset_length_caplen(tvb, offset, pdu_real_len, pdu_len);
2685 dissect_smpp_pdu(pdu_tvb, pinfo, tree, data);
2686 offset += pdu_len;
2690 return tvb_captured_length(tvb);
2694 * A 'heuristic dissector' that attemtps to establish whether we have
2695 * a genuine SMPP PDU here.
2696 * Only works when:
2697 * at least the fixed header is there
2698 * it has a correct overall PDU length
2699 * it is a 'well-known' operation
2700 * has a 'well-known' or 'reserved' status
2702 static bool
2703 dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2705 uint32_t command_id; /* SMPP command */
2707 conversation_t* conversation;
2709 if (!test_smpp(pinfo, tvb, 0, data)) {
2710 return false;
2713 // Test a few extra bytes in the heuristic dissector, past the
2714 // minimum fixed header length, to reduce false positives.
2716 command_id = tvb_get_ntohl(tvb, 4);
2717 //Check for specific values in commands (to avoid false positives)
2718 switch (command_id)
2720 case SMPP_COMMAND_ID_ALERT_NOTIFICATION:
2722 uint8_t ton, npi;
2724 if (tvb_reported_length(tvb) < 19)
2725 return false;
2726 ton = tvb_get_uint8(tvb, 16);
2727 if (try_val_to_str(ton, vals_addr_ton) == NULL)
2728 return false;
2730 npi = tvb_get_uint8(tvb, 17);
2731 if (try_val_to_str(npi, vals_addr_npi) == NULL)
2732 return false;
2734 //address must be NULL-terminated string of up to 65 ascii characters
2735 int end = tvb_find_uint8(tvb, 18, -1, 0);
2736 if ((end <= 0) || (end > 65))
2737 return false;
2739 if (!tvb_ascii_isprint(tvb, 18, end - 18))
2740 return false;
2742 break;
2745 /* This is called on TCP or X.25, both of which are endpoint types.
2746 * Set the conversation so we can handle TCP segmentation. */
2747 conversation = find_or_create_conversation(pinfo);
2748 conversation_set_dissector(conversation, smpp_handle);
2750 dissect_smpp(tvb, pinfo, tree, data);
2751 return true;
2754 static void
2755 smpp_fmt_version(char *result, uint32_t revision)
2757 snprintf(result, ITEM_LABEL_LENGTH, "%u.%u", (uint8_t)((revision & 0xF0) >> 4), (uint8_t)(revision & 0x0F));
2760 /* Register the protocol with Wireshark */
2761 void
2762 proto_register_smpp(void)
2764 module_t *smpp_module; /* Preferences for SMPP */
2765 expert_module_t *expert_smpp;
2767 /* Setup list of header fields */
2768 static hf_register_info hf[] = {
2769 { &hf_smpp_command_length,
2770 { "Length", "smpp.command_length",
2771 FT_UINT32, BASE_DEC, NULL, 0x00,
2772 "Total length of the SMPP PDU.",
2773 HFILL
2776 { &hf_smpp_command_id,
2777 { "Operation", "smpp.command_id",
2778 FT_UINT32, BASE_HEX, VALS(vals_command_id), 0x00,
2779 "Defines the SMPP PDU.",
2780 HFILL
2783 { &hf_smpp_command_request,
2784 { "Request", "smpp.request",
2785 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
2786 "true if this is a SMPP request.",
2787 HFILL
2790 { &hf_smpp_command_response,
2791 { "Response", "smpp.response",
2792 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
2793 "true if this is a SMPP response.",
2794 HFILL
2797 { &hf_smpp_command_status,
2798 { "Result", "smpp.command_status",
2799 FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(rvals_command_status), 0x00,
2800 "Indicates success or failure of the SMPP request.",
2801 HFILL
2804 { &hf_smpp_sequence_number,
2805 { "Sequence #", "smpp.sequence_number",
2806 FT_UINT32, BASE_DEC, NULL, 0x00,
2807 "A number to correlate requests with responses.",
2808 HFILL
2811 { &hf_smpp_system_id,
2812 { "System ID", "smpp.system_id",
2813 FT_STRING, BASE_NONE, NULL, 0x00,
2814 "Identifies a system.",
2815 HFILL
2818 { &hf_smpp_password,
2819 { "Password", "smpp.password",
2820 FT_STRING, BASE_NONE, NULL, 0x00,
2821 "Password used for authentication.",
2822 HFILL
2825 { &hf_smpp_system_type,
2826 { "System type", "smpp.system_type",
2827 FT_STRING, BASE_NONE, NULL, 0x00,
2828 "Categorizes the system.",
2829 HFILL
2832 { &hf_smpp_interface_version,
2833 { "Version (if)", "smpp.interface_version",
2834 FT_UINT8, BASE_CUSTOM, CF_FUNC(smpp_fmt_version), 0x00,
2835 "Version of SMPP interface supported.",
2836 HFILL
2839 { &hf_smpp_service_type,
2840 { "Service type", "smpp.service_type",
2841 FT_STRING, BASE_NONE, NULL, 0x00,
2842 "SMS application service associated with the message.",
2843 HFILL
2846 { &hf_smpp_addr_ton,
2847 { "Type of number", "smpp.addr_ton",
2848 FT_UINT8, BASE_HEX, VALS(vals_addr_ton), 0x00,
2849 "Indicates the type of number, given in the address.",
2850 HFILL
2853 { &hf_smpp_source_addr_ton,
2854 { "Type of number (originator)", "smpp.source_addr_ton",
2855 FT_UINT8, BASE_HEX, VALS(vals_addr_ton), 0x00,
2856 "Indicates originator type of number, given in the address.",
2857 HFILL
2860 { &hf_smpp_dest_addr_ton,
2861 { "Type of number (recipient)", "smpp.dest_addr_ton",
2862 FT_UINT8, BASE_HEX, VALS(vals_addr_ton), 0x00,
2863 "Indicates recipient type of number, given in the address.",
2864 HFILL
2867 { &hf_smpp_addr_npi,
2868 { "Numbering plan indicator", "smpp.addr_npi",
2869 FT_UINT8, BASE_HEX, VALS(vals_addr_npi), 0x00,
2870 "Gives the numbering plan this address belongs to.",
2871 HFILL
2874 { &hf_smpp_source_addr_npi,
2875 { "Numbering plan indicator (originator)", "smpp.source_addr_npi",
2876 FT_UINT8, BASE_HEX, VALS(vals_addr_npi), 0x00,
2877 "Gives originator numbering plan this address belongs to.",
2878 HFILL
2881 { &hf_smpp_dest_addr_npi,
2882 { "Numbering plan indicator (recipient)", "smpp.dest_addr_npi",
2883 FT_UINT8, BASE_HEX, VALS(vals_addr_npi), 0x00,
2884 "Gives recipient numbering plan this address belongs to.",
2885 HFILL
2888 { &hf_smpp_address_range,
2889 { "Address", "smpp.address_range",
2890 FT_STRING, BASE_NONE, NULL, 0x00,
2891 "Given address or address range.",
2892 HFILL
2895 { &hf_smpp_source_addr,
2896 { "Originator address", "smpp.source_addr",
2897 FT_STRING, BASE_NONE, NULL, 0x00,
2898 "Address of SME originating this message.",
2899 HFILL
2902 { &hf_smpp_destination_addr,
2903 { "Recipient address", "smpp.destination_addr",
2904 FT_STRING, BASE_NONE, NULL, 0x00,
2905 "Address of SME receiving this message.",
2906 HFILL
2909 { &hf_smpp_esm_submit_msg_mode,
2910 { "Messaging mode", "smpp.esm.submit.msg_mode",
2911 FT_UINT8, BASE_HEX, VALS(vals_esm_submit_msg_mode), 0x03,
2912 "Mode attribute for this message.",
2913 HFILL
2916 { &hf_smpp_esm_submit_msg_type,
2917 { "Message type", "smpp.esm.submit.msg_type",
2918 FT_UINT8, BASE_HEX, VALS(vals_esm_submit_msg_type), 0x3C,
2919 "Type attribute for this message.",
2920 HFILL
2923 { &hf_smpp_esm_submit_features,
2924 { "GSM features", "smpp.esm.submit.features",
2925 FT_UINT8, BASE_HEX, VALS(vals_esm_submit_features), 0xC0,
2926 "GSM network specific features.",
2927 HFILL
2930 /*! \todo Get proper values from GSM-spec. */
2931 { &hf_smpp_protocol_id,
2932 { "Protocol id.", "smpp.protocol_id",
2933 FT_UINT8, BASE_HEX, NULL, 0x00,
2934 "Protocol identifier according GSM 03.40.",
2935 HFILL
2938 { &hf_smpp_priority_flag,
2939 { "Priority level", "smpp.priority_flag",
2940 FT_UINT8, BASE_HEX, VALS(vals_priority_flag), 0x00,
2941 "The priority level of the short message.",
2942 HFILL
2945 { &hf_smpp_schedule_delivery_time,
2946 { "Scheduled delivery time", "smpp.schedule_delivery_time",
2947 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00,
2948 "Scheduled time for delivery of short message.",
2949 HFILL
2952 { &hf_smpp_schedule_delivery_time_r,
2953 { "Scheduled delivery time", "smpp.schedule_delivery_time_r",
2954 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
2955 "Scheduled time for delivery of short message.",
2956 HFILL
2959 { &hf_smpp_validity_period,
2960 { "Validity period", "smpp.validity_period",
2961 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00,
2962 "Validity period of this message.",
2963 HFILL
2966 { &hf_smpp_validity_period_r,
2967 { "Validity period", "smpp.validity_period_r",
2968 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
2969 "Validity period of this message.",
2970 HFILL
2973 { &hf_smpp_regdel_receipt,
2974 { "Delivery receipt", "smpp.regdel.receipt",
2975 FT_UINT8, BASE_HEX, VALS(vals_regdel_receipt), 0x03,
2976 "SMSC delivery receipt request.",
2977 HFILL
2980 { &hf_smpp_regdel_acks,
2981 { "Message type", "smpp.regdel.acks",
2982 FT_UINT8, BASE_HEX, VALS(vals_regdel_acks), 0x0C,
2983 "SME acknowledgement request.",
2984 HFILL
2987 { &hf_smpp_regdel_notif,
2988 { "Intermediate notif", "smpp.regdel.notif",
2989 FT_UINT8, BASE_HEX, VALS(vals_regdel_notif), 0x10,
2990 "Intermediate notification request.",
2991 HFILL
2994 { &hf_smpp_replace_if_present_flag,
2995 { "Replace", "smpp.replace_if_present_flag",
2996 FT_UINT8, BASE_HEX, VALS(vals_replace_if_present_flag), 0x01,
2997 "Replace the short message with this one or not.",
2998 HFILL
3001 { &hf_smpp_data_coding,
3002 { "Data coding", "smpp.data_coding",
3003 FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(rvals_data_coding), 0x00,
3004 "Defines the encoding scheme of the message.",
3005 HFILL
3008 { &hf_smpp_sm_default_msg_id,
3009 { "Predefined message", "smpp.sm_default_msg_id",
3010 FT_UINT8, BASE_DEC, NULL, 0x00,
3011 "Index of a predefined ('canned') short message.",
3012 HFILL
3015 { &hf_smpp_sm_length,
3016 { "Message length", "smpp.sm_length",
3017 FT_UINT8, BASE_DEC, NULL, 0x00,
3018 "Length of the message content.",
3019 HFILL
3022 { &hf_smpp_short_message,
3023 { "Message", "smpp.message_text",
3024 FT_STRING, BASE_NONE, NULL, 0x00,
3025 "The actual message or data.",
3026 HFILL
3029 { &hf_smpp_short_message_bin,
3030 { "Message bytes", "smpp.message",
3031 FT_BYTES, BASE_NONE, NULL, 0x00,
3032 "The actual message bytes.",
3033 HFILL
3036 { &hf_smpp_message_id,
3037 { "Message id.", "smpp.message_id",
3038 FT_STRING, BASE_NONE, NULL, 0x00,
3039 "Identifier of the submitted short message.",
3040 HFILL
3043 { &hf_smpp_dlist,
3044 { "Destination list", "smpp.dlist",
3045 FT_NONE, BASE_NONE, NULL, 0x00,
3046 "The list of destinations for a short message.",
3047 HFILL
3050 { &hf_smpp_dlist_resp,
3051 { "Unsuccessful delivery list", "smpp.dlist_resp",
3052 FT_NONE, BASE_NONE, NULL, 0x00,
3053 "The list of unsuccessful deliveries to destinations.",
3054 HFILL
3057 { &hf_smpp_dl_name,
3058 { "Distr. list name", "smpp.dl_name",
3059 FT_STRING, BASE_NONE, NULL, 0x00,
3060 "The name of the distribution list.",
3061 HFILL
3064 { &hf_smpp_final_date,
3065 { "Final date", "smpp.final_date",
3066 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00,
3067 "Date-time when the queried message reached a final state.",
3068 HFILL
3071 { &hf_smpp_final_date_r,
3072 { "Final date", "smpp.final_date_r",
3073 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3074 "Date-time when the queried message reached a final state.",
3075 HFILL
3078 { &hf_smpp_message_state,
3079 { "Message state", "smpp.message_state",
3080 FT_UINT8, BASE_DEC, VALS(vals_message_state), 0x00,
3081 "Specifies the status of the queried short message.",
3082 HFILL
3085 { &hf_smpp_error_code,
3086 { "Error code", "smpp.error_code",
3087 FT_UINT8, BASE_DEC, NULL, 0x00,
3088 "Network specific error code defining reason for failure.",
3089 HFILL
3092 { &hf_smpp_error_status_code,
3093 { "Status", "smpp.error_status_code",
3094 FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(rvals_command_status), 0x00,
3095 "Indicates success/failure of request for this address.",
3096 HFILL
3099 { &hf_smpp_esme_addr_ton,
3100 { "Type of number (ESME)", "smpp.esme_addr_ton",
3101 FT_UINT8, BASE_HEX, VALS(vals_addr_ton), 0x00,
3102 "Indicates recipient type of number, given in the address.",
3103 HFILL
3106 { &hf_smpp_esme_addr_npi,
3107 { "Numbering plan indicator (ESME)", "smpp.esme_addr_npi",
3108 FT_UINT8, BASE_HEX, VALS(vals_addr_npi), 0x00,
3109 "Gives the numbering plan this address belongs to.",
3110 HFILL
3113 { &hf_smpp_esme_addr,
3114 { "ESME address", "smpp.esme_addr",
3115 FT_STRING, BASE_NONE, NULL, 0x00,
3116 "Address of ESME originating this message.",
3117 HFILL
3120 { &hf_smpp_dest_addr_subunit,
3121 { "Subunit destination", "smpp.dest_addr_subunit",
3122 FT_UINT8, BASE_HEX, VALS(vals_addr_subunit), 0x00,
3123 "Subunit address within mobile to route message to.",
3124 HFILL
3127 { &hf_smpp_source_addr_subunit,
3128 { "Subunit origin", "smpp.source_addr_subunit",
3129 FT_UINT8, BASE_HEX, VALS(vals_addr_subunit), 0x00,
3130 "Subunit address within mobile that generated the message.",
3131 HFILL
3134 { &hf_smpp_dest_network_type,
3135 { "Destination network", "smpp.dest_network_type",
3136 FT_UINT8, BASE_HEX, VALS(vals_network_type), 0x00,
3137 "Network associated with the destination address.",
3138 HFILL
3141 { &hf_smpp_source_network_type,
3142 { "Originator network", "smpp.source_network_type",
3143 FT_UINT8, BASE_HEX, VALS(vals_network_type), 0x00,
3144 "Network associated with the originator address.",
3145 HFILL
3148 { &hf_smpp_dest_bearer_type,
3149 { "Destination bearer", "smpp.dest_bearer_type",
3150 FT_UINT8, BASE_HEX, VALS(vals_bearer_type), 0x00,
3151 "Desired bearer for delivery of message.",
3152 HFILL
3155 { &hf_smpp_source_bearer_type,
3156 { "Originator bearer", "smpp.source_bearer_type",
3157 FT_UINT8, BASE_HEX, VALS(vals_bearer_type), 0x00,
3158 "Bearer over which the message originated.",
3159 HFILL
3162 { &hf_smpp_dest_telematics_id,
3163 { "Telematic interworking (dest)", "smpp.dest_telematics_id",
3164 FT_UINT16, BASE_HEX, NULL, 0x00,
3165 "Telematic interworking to be used for message delivery.",
3166 HFILL
3169 { &hf_smpp_source_telematics_id,
3170 { "Telematic interworking (orig)", "smpp.source_telematics_id",
3171 FT_UINT8, BASE_HEX, NULL, 0x00,
3172 "Telematic interworking used for message submission.",
3173 HFILL
3176 { &hf_smpp_qos_time_to_live,
3177 { "Validity period", "smpp.qos_time_to_live",
3178 FT_UINT32, BASE_DEC, NULL, 0x00,
3179 "Number of seconds to retain message before expiry.",
3180 HFILL
3183 { &hf_smpp_payload_type,
3184 { "Payload", "smpp.payload_type",
3185 FT_UINT8, BASE_DEC, VALS(vals_payload_type), 0x00,
3186 "PDU type contained in the message payload.",
3187 HFILL
3190 { &hf_smpp_additional_status_info_text,
3191 { "Information", "smpp.additional_status_info_text",
3192 FT_STRING, BASE_NONE, NULL, 0x00,
3193 "Description of the meaning of a response PDU.",
3194 HFILL
3197 { &hf_smpp_receipted_message_id,
3198 { "SMSC identifier", "smpp.receipted_message_id",
3199 FT_STRING, BASE_NONE, NULL, 0x00,
3200 "SMSC handle of the message being received.",
3201 HFILL
3204 { &hf_smpp_privacy_indicator,
3205 { "Privacy indicator", "smpp.privacy_indicator",
3206 FT_UINT8, BASE_DEC, VALS(vals_privacy_indicator), 0x00,
3207 "Indicates the privacy level of the message.",
3208 HFILL
3211 { &hf_smpp_source_subaddress,
3212 { "Source Subaddress", "smpp.source_subaddress",
3213 FT_BYTES, BASE_NONE, NULL, 0x00,
3214 NULL,
3215 HFILL
3218 { &hf_smpp_dest_subaddress,
3219 { "Destination Subaddress", "smpp.dest_subaddress",
3220 FT_BYTES, BASE_NONE, NULL, 0x00,
3221 NULL,
3222 HFILL
3225 { &hf_smpp_user_message_reference,
3226 { "Message reference", "smpp.user_message_reference",
3227 FT_UINT16, BASE_HEX, NULL, 0x00,
3228 "Reference to the message, assigned by the user.",
3229 HFILL
3232 { &hf_smpp_user_response_code,
3233 { "Application response code", "smpp.user_response_code",
3234 FT_UINT8, BASE_HEX, NULL, 0x00,
3235 "A response code set by the user.",
3236 HFILL
3239 { &hf_smpp_language_indicator,
3240 { "Language", "smpp.language_indicator",
3241 FT_UINT8, BASE_DEC, VALS(vals_language_indicator), 0x00,
3242 "Indicates the language of the short message.",
3243 HFILL
3246 { &hf_smpp_source_port,
3247 { "Source port", "smpp.source_port",
3248 FT_UINT16, BASE_HEX, NULL, 0x00,
3249 "Application port associated with the source of the message.",
3250 HFILL
3253 { &hf_smpp_destination_port,
3254 { "Destination port", "smpp.destination_port",
3255 FT_UINT16, BASE_HEX, NULL, 0x00,
3256 "Application port associated with the destination of the message.",
3257 HFILL
3260 { &hf_smpp_sar_msg_ref_num,
3261 { "SAR reference number", "smpp.sar_msg_ref_num",
3262 FT_UINT16, BASE_DEC, NULL, 0x00,
3263 "Reference number for a concatenated short message.",
3264 HFILL
3267 { &hf_smpp_sar_total_segments,
3268 { "SAR size", "smpp.sar_total_segments",
3269 FT_UINT16, BASE_DEC, NULL, 0x00,
3270 "Number of segments of a concatenated short message.",
3271 HFILL
3274 { &hf_smpp_sar_segment_seqnum,
3275 { "SAR sequence number", "smpp.sar_segment_seqnum",
3276 FT_UINT8, BASE_DEC, NULL, 0x00,
3277 "Segment number within a concatenated short message.",
3278 HFILL
3281 { &hf_smpp_display_time,
3282 { "Display time", "smpp.display_time",
3283 FT_UINT8, BASE_DEC, VALS(vals_display_time), 0x00,
3284 "Associates a display time with the message on the handset.",
3285 HFILL
3288 { &hf_smpp_sms_signal,
3289 { "SMS signal", "smpp.sms_signal",
3290 FT_UINT16, BASE_HEX, NULL, 0x00,
3291 "Alert the user according to the information contained within this information element.",
3292 HFILL
3295 { &hf_smpp_ms_validity,
3296 { "Validity info", "smpp.ms_validity",
3297 FT_UINT8, BASE_DEC, VALS(vals_ms_validity), 0x00,
3298 "Associates validity info with the message on the handset.",
3299 HFILL
3302 { &hf_smpp_dpf_result,
3303 { "Delivery pending set?", "smpp.dpf_result",
3304 FT_UINT8, BASE_DEC, VALS(vals_dpf_result), 0x00,
3305 "Indicates whether Delivery Pending Flag was set.",
3306 HFILL
3309 { &hf_smpp_set_dpf,
3310 { "Request DPF set", "smpp.set_dpf",
3311 FT_UINT8, BASE_DEC, VALS(vals_set_dpf), 0x00,
3312 "Request to set the DPF for certain failure scenario's.",
3313 HFILL
3316 { &hf_smpp_ms_availability_status,
3317 { "Availability status", "smpp.ms_availability_status",
3318 FT_UINT8, BASE_DEC, VALS(vals_ms_availability_status), 0x00,
3319 "Indicates the availability state of the handset.",
3320 HFILL
3323 { &hf_smpp_delivery_failure_reason,
3324 { "Delivery failure reason", "smpp.delivery_failure_reason",
3325 FT_UINT8, BASE_DEC, VALS(vals_delivery_failure_reason), 0x00,
3326 "Indicates the reason for a failed delivery attempt.",
3327 HFILL
3330 { &hf_smpp_more_messages_to_send,
3331 { "More messages?", "smpp.more_messages_to_send",
3332 FT_UINT8, BASE_DEC, VALS(vals_more_messages_to_send), 0x00,
3333 "Indicates more messages pending for the same destination.",
3334 HFILL
3337 { &hf_smpp_number_of_messages,
3338 { "Number of messages", "smpp.number_of_messages",
3339 FT_UINT8, BASE_DEC, NULL, 0x00,
3340 "Indicates number of messages stored in a mailbox.",
3341 HFILL
3344 { &hf_smpp_its_reply_type,
3345 { "Reply method", "smpp.its_reply_type",
3346 FT_UINT8, BASE_DEC, VALS(vals_its_reply_type), 0x00,
3347 "Indicates the handset reply method on message receipt.",
3348 HFILL
3351 { &hf_smpp_ussd_service_op,
3352 { "USSD service operation", "smpp.ussd_service_op",
3353 FT_UINT8, BASE_DEC, VALS(vals_ussd_service_op), 0x00,
3354 "Indicates the USSD service operation.",
3355 HFILL
3358 { &hf_smpp_vendor_op,
3359 { "Value", "smpp.vendor_op",
3360 FT_BYTES, BASE_NONE|BASE_ALLOW_ZERO, NULL, 0x00,
3361 "A supplied optional parameter specific to an SMSC-vendor.",
3362 HFILL
3365 { &hf_smpp_reserved_op,
3366 { "Value", "smpp.reserved_op",
3367 FT_BYTES, BASE_NONE|BASE_ALLOW_ZERO, NULL, 0x00,
3368 "An optional parameter that is reserved in this version.",
3369 HFILL
3372 { &hf_smpp_msg_wait_ind,
3373 { "Indication", "smpp.msg_wait.ind",
3374 FT_UINT8, BASE_HEX, VALS(vals_msg_wait_ind), 0x80,
3375 "Indicates to the handset that a message is waiting.",
3376 HFILL
3379 { &hf_smpp_msg_wait_type,
3380 { "Type", "smpp.msg_wait.type",
3381 FT_UINT8, BASE_HEX, VALS(vals_msg_wait_type), 0x03,
3382 "Indicates type of message that is waiting.",
3383 HFILL
3386 { &hf_smpp_SC_interface_version,
3387 { "SMSC-supported version", "smpp.SC_interface_version",
3388 FT_UINT8, BASE_CUSTOM, CF_FUNC(smpp_fmt_version), 0x00,
3389 "Version of SMPP interface supported by the SMSC.",
3390 HFILL
3393 { &hf_smpp_callback_num_pres,
3394 { "Presentation", "smpp.callback_num.pres",
3395 FT_UINT8, BASE_HEX, VALS(vals_callback_num_pres), 0x0C,
3396 "Controls the presentation indication.",
3397 HFILL
3400 { &hf_smpp_callback_num_scrn,
3401 { "Screening", "smpp.callback_num.scrn",
3402 FT_UINT8, BASE_HEX, VALS(vals_callback_num_scrn), 0x03,
3403 "Controls screening of the callback-number.",
3404 HFILL
3407 { &hf_smpp_callback_num_atag,
3408 { "Callback number - alphanumeric display tag",
3409 "smpp.callback_num_atag",
3410 FT_NONE, BASE_NONE, NULL, 0x00,
3411 "Associates an alphanumeric display with call back number.",
3412 HFILL
3415 { &hf_smpp_callback_num,
3416 { "Callback number", "smpp.callback_num",
3417 FT_NONE, BASE_NONE, NULL, 0x00,
3418 "Associates a call back number with the message.",
3419 HFILL
3422 { &hf_smpp_network_error_type,
3423 { "Error type", "smpp.network_error.type",
3424 FT_UINT8, BASE_DEC, VALS(vals_network_error_type), 0x00,
3425 "Indicates the network type.",
3426 HFILL
3429 { &hf_smpp_network_error_code,
3430 { "Error code", "smpp.network_error.code",
3431 FT_UINT16, BASE_HEX, NULL, 0x00,
3432 "Gives the actual network error code.",
3433 HFILL
3436 { &hf_smpp_message_payload,
3437 { "Payload", "smpp.message_payload",
3438 FT_BYTES, BASE_NONE, NULL, 0x00,
3439 "Short message user data.",
3440 HFILL
3443 { &hf_smpp_alert_on_message_delivery_null,
3444 { "Alert on delivery", "smpp.alert_on_message_delivery_null",
3445 FT_NONE, BASE_NONE, NULL, 0x00,
3446 "Instructs the handset to alert user on message delivery.",
3447 HFILL
3450 { &hf_smpp_alert_on_message_delivery_type,
3451 { "Alert on delivery", "smpp.alert_on_message_delivery_type",
3452 FT_UINT8, BASE_DEC, VALS(vals_alert_on_message_delivery), 0x00,
3453 "Instructs the handset to alert user on message delivery.",
3454 HFILL
3457 { &hf_smpp_its_session_number,
3458 { "Session number", "smpp.its_session.number",
3459 FT_UINT8, BASE_DEC, NULL, 0x00,
3460 "Session number of interactive teleservice.",
3461 HFILL
3464 { &hf_smpp_its_session_sequence,
3465 { "Sequence number", "smpp.its_session.sequence",
3466 FT_UINT8, BASE_HEX, NULL, 0xFE,
3467 "Sequence number of the dialogue unit.",
3468 HFILL
3471 { &hf_smpp_its_session_ind,
3472 { "Session indicator", "smpp.its_session.ind",
3473 FT_UINT8, BASE_HEX, VALS(vals_its_session_ind), 0x01,
3474 "Indicates whether this message is end of conversation.",
3475 HFILL
3478 { &hf_smpp_opt_params,
3479 { "Optional parameters", "smpp.opt_params",
3480 FT_NONE, BASE_NONE, NULL, 0x00,
3481 "The list of optional parameters in this operation.",
3482 HFILL
3485 { &hf_smpp_opt_param,
3486 { "Optional parameter", "smpp.opt_param",
3487 FT_NONE, BASE_NONE, NULL, 0x00,
3488 NULL,
3489 HFILL
3492 { &hf_smpp_opt_param_tag,
3493 { "Tag", "smpp.opt_param_tag",
3494 FT_UINT16, BASE_HEX, NULL, 0x00,
3495 "Optional parameter identifier tag",
3496 HFILL
3499 { &hf_smpp_opt_param_len,
3500 { "Length", "smpp.opt_param_len",
3501 FT_UINT16, BASE_DEC, NULL, 0x00,
3502 "Optional parameter length",
3503 HFILL
3508 * Data Coding Scheme
3510 { &hf_smpp_dcs_sms_coding_group,
3511 { "DCS Coding Group for SMS", "smpp.dcs.sms_coding_group",
3512 FT_UINT8, BASE_HEX, VALS(vals_dcs_sms_coding_group), 0xF0,
3513 "Data Coding Scheme coding group for GSM Short Message Service.",
3514 HFILL
3517 { &hf_smpp_dcs_reserved,
3518 { "Reserved (should be zero)", "smpp.dcs.reserved",
3519 FT_UINT8, BASE_DEC, NULL, 0x08,
3520 NULL, HFILL
3523 { &hf_smpp_dcs_charset,
3524 { "DCS Character set", "smpp.dcs.charset",
3525 FT_UINT8, BASE_HEX, VALS(vals_dcs_charset), 0x04,
3526 "Specifies the character set used in the message.", HFILL
3529 { &hf_smpp_dcs_class,
3530 { "DCS Message class", "smpp.dcs.class",
3531 FT_UINT8, BASE_HEX, VALS(vals_dcs_class), 0x03,
3532 "Specifies the message class.", HFILL
3535 { &hf_smpp_dcs_wait_ind,
3536 { "Indication", "smpp.dcs.wait_ind",
3537 FT_UINT8, BASE_HEX, VALS(vals_msg_wait_ind), 0x08,
3538 "Indicates to the handset that a message is waiting.",
3539 HFILL
3542 { &hf_smpp_dcs_reserved2,
3543 { "Reserved (should be zero)", "smpp.dcs.reserved",
3544 FT_UINT8, BASE_DEC, NULL, 0x04,
3545 NULL, HFILL
3548 { &hf_smpp_dcs_wait_type,
3549 { "Type", "smpp.dcs.wait_type",
3550 FT_UINT8, BASE_HEX, VALS(vals_msg_wait_type), 0x03,
3551 "Indicates type of message that is waiting.",
3552 HFILL
3555 /* Changes in SMPP 5.0 */
3556 { &hf_smpp_congestion_state,
3557 { "Congestion State", "smpp.congestion_state",
3558 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(vals_congestion_state), 0x00,
3559 "Congestion info between ESME and MC for flow control/cong. control", HFILL
3562 { &hf_smpp_billing_identification,
3563 { "Billing Identification", "smpp.billing_id",
3564 FT_BYTES, BASE_NONE, NULL, 0x00,
3565 "Billing identification info", HFILL
3568 { &hf_smpp_dest_addr_np_country,
3569 { "Destination Country Code", "smpp.dest_addr_np_country",
3570 FT_BYTES, BASE_NONE, NULL, 0x00,
3571 "Destination Country Code (E.164 Region Code)", HFILL
3574 { &hf_smpp_dest_addr_np_information,
3575 { "Number Portability information", "smpp.dest_addr_np_info",
3576 FT_BYTES, BASE_NONE, NULL, 0x00,
3577 NULL, HFILL
3580 { &hf_smpp_dest_addr_np_resolution,
3581 { "Number Portability query information", "smpp.dest_addr_np_resolution",
3582 FT_UINT8, BASE_DEC, VALS(vals_dest_addr_np_resolution), 0x00,
3583 "Number Portability query information - method used to resolve number", HFILL
3586 { &hf_smpp_source_network_id,
3587 { "Source Network ID", "smpp.source_network_id",
3588 FT_STRING, BASE_NONE, NULL, 0x00,
3589 "Unique ID for a network or ESME operator", HFILL
3592 { &hf_smpp_source_node_id,
3593 { "Source Node ID", "smpp.source_node_id",
3594 FT_BYTES, BASE_NONE, NULL, 0x00,
3595 "Unique ID for a ESME or MC node", HFILL
3598 { &hf_smpp_dest_network_id,
3599 { "Destination Network ID", "smpp.dest_network_id",
3600 FT_STRING, BASE_NONE, NULL, 0x00,
3601 "Unique ID for a network or ESME operator", HFILL
3604 { &hf_smpp_dest_node_id,
3605 { "Destination Node ID", "smpp.dest_node_id",
3606 FT_BYTES, BASE_NONE, NULL, 0x00,
3607 "Unique ID for a ESME or MC node", HFILL
3610 { &hf_smpp_broadcast_channel_indicator,
3611 { "Cell Broadcast channel", "smpp.broadcast_channel_indicator",
3612 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(vals_broadcast_channel_indicator), 0x00,
3613 NULL, HFILL
3616 { &hf_smpp_broadcast_content_type_nw,
3617 { "Broadcast Content Type - Network Tag", "smpp.broadcast_content_type.nw",
3618 FT_UINT8, BASE_DEC, VALS(vals_broadcast_content_type_nw), 0x00,
3619 "Cell Broadcast content type", HFILL
3622 { &hf_smpp_broadcast_content_type_type,
3623 { "Broadcast Content Type - Content Type", "smpp.broadcast_content_type.type",
3624 FT_UINT16, BASE_HEX, VALS(vals_broadcast_content_type_type), 0x00,
3625 "Cell Broadcast content type", HFILL
3628 { &hf_smpp_broadcast_content_type_info,
3629 { "Broadcast Content Type Info", "smpp.broadcast_content_type.info",
3630 FT_BYTES, BASE_NONE, NULL, 0x00,
3631 "Cell Broadcast content type Info", HFILL
3634 { &hf_smpp_broadcast_message_class,
3635 { "Broadcast Message Class", "smpp.broadcast_message_class",
3636 FT_UINT8, BASE_HEX, VALS(vals_broadcast_message_class), 0x00,
3637 "Cell Broadcast Message Class", HFILL
3640 { &hf_smpp_broadcast_rep_num,
3641 { "Broadcast Message - Number of repetitions requested", "smpp.broadcast_rep_num",
3642 FT_UINT16, BASE_DEC, NULL, 0x00,
3643 "Cell Broadcast Message - Number of repetitions requested", HFILL
3646 { &hf_smpp_broadcast_frequency_interval_unit,
3647 { "Broadcast Message - frequency interval - Unit", "smpp.broadcast_frequency_interval.unit",
3648 FT_UINT8, BASE_HEX, VALS(vals_broadcast_frequency_interval_unit), 0x00,
3649 "Cell Broadcast Message - frequency interval at which broadcast must be repeated", HFILL
3652 { &hf_smpp_broadcast_frequency_interval_value,
3653 { "Broadcast Message - frequency interval - Unit", "smpp.broadcast_frequency_interval.value",
3654 FT_UINT16, BASE_DEC, NULL, 0x00,
3655 "Cell Broadcast Message - frequency interval at which broadcast must be repeated", HFILL
3658 { &hf_smpp_broadcast_area_identifier,
3659 { "Broadcast Message - Area Identifier", "smpp.broadcast_area_identifier",
3660 FT_BYTES, BASE_NONE, NULL, 0x00,
3661 "Cell Broadcast Message - Area Identifier", HFILL
3664 { &hf_smpp_broadcast_area_identifier_format,
3665 { "Broadcast Message - Area Identifier Format", "smpp.broadcast_area_identifier.format",
3666 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(vals_broadcast_area_identifier_format), 0x00,
3667 "Cell Broadcast Message - Area Identifier Format", HFILL
3670 { &hf_smpp_broadcast_error_status,
3671 { "Broadcast Message - Error Status", "smpp.broadcast_error_status",
3672 FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(rvals_command_status), 0x00,
3673 "Cell Broadcast Message - Error Status", HFILL
3676 { &hf_smpp_broadcast_area_success,
3677 { "Broadcast Message - Area Success", "smpp.broadcast_area_success",
3678 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(vals_broadcast_area_success), 0x00,
3679 "Cell Broadcast Message - success rate indicator (ratio) - No. of BTS which accepted Message:Total BTS", HFILL
3682 { &hf_smpp_broadcast_end_time,
3683 { "Broadcast Message - End Time", "smpp.broadcast_end_time",
3684 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00,
3685 "Cell Broadcast Message - Date and time at which MC set the state of the message to terminated", HFILL
3688 { &hf_smpp_broadcast_end_time_r,
3689 { "Broadcast Message - End Time", "smpp.broadcast_end_time_r",
3690 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
3691 "Cell Broadcast Message - Date and time at which MC set the state of the message to terminated", HFILL
3694 { &hf_smpp_broadcast_service_group,
3695 { "Broadcast Message - Service Group", "smpp.broadcast_service_group",
3696 FT_BYTES, BASE_NONE, NULL, 0x00,
3697 "Cell Broadcast Message - Service Group", HFILL
3700 /* Huawei SMPP+ extensions */
3701 { &hf_huawei_smpp_smsc_addr,
3702 { "SMPP+: GT of SMSC", "smpp.smsc_addr",
3703 FT_STRING, BASE_NONE, NULL, 0x00,
3704 NULL, HFILL
3707 { &hf_huawei_smpp_msc_addr_noa,
3708 { "SMPP+: NOA of MSC address", "smpp.msc_addr_noa",
3709 FT_UINT8, BASE_DEC, VALS(vals_msc_addr_noa), 0x00,
3710 "SMPP+: Indicates the TON of MSC address", HFILL
3713 { &hf_huawei_smpp_msc_addr_npi,
3714 { "SMPP+: NPI of MSC address", "smpp.msc_addr_npi",
3715 FT_UINT8, BASE_DEC, VALS(vals_msc_addr_npi), 0x00,
3716 "SMPP+: Indicates the NPI of MSC address", HFILL
3719 { &hf_huawei_smpp_msc_addr,
3720 { "SMPP+: GT of MSC", "smpp.msc_addr",
3721 FT_STRING, BASE_NONE, NULL, 0x00,
3722 NULL, HFILL
3725 { &hf_huawei_smpp_mo_mt_flag,
3726 { "SMPP+: Charge for MO or MT", "smpp.mo_mt_flag",
3727 FT_UINT8, BASE_DEC, VALS(vals_mo_mt_flag), 0x00,
3728 "SMPP+: Indicates the Charge side of MO or MT", HFILL
3731 { &hf_huawei_smpp_sm_id,
3732 { "SMPP+: Unique SM ID", "smpp.sm_id",
3733 FT_STRING, BASE_NONE, NULL, 0x00,
3734 "SMPP+: Unique SM ID which is generated by SMSC", HFILL
3737 { &hf_huawei_smpp_length_auth,
3738 { "SMPP+: Length of SMS", "smpp.length_auth",
3739 FT_UINT32, BASE_DEC, NULL, 0x00,
3740 "SMPP+: Indicates the Length of SMS", HFILL
3743 { &hf_huawei_smpp_service_id,
3744 { "SMPP+: Service ID of SMSC", "smpp.service_id",
3745 FT_UINT32, BASE_DEC, NULL, 0x00,
3746 "SMPP+: Indicates the Service ID of SMSC", HFILL
3749 { &hf_huawei_smpp_operation_result,
3750 { "SMPP+: Authentication result of SCP", "smpp.operation_result",
3751 FT_UINT32, BASE_DEC, VALS(vals_operation_result), 0x00,
3752 "SMPP+: Indicates the Authentication result of SCP", HFILL
3755 { &hf_huawei_smpp_notify_mode,
3756 { "SMPP+: SMS notify mode", "smpp.notify_mode",
3757 FT_UINT8, BASE_DEC, VALS(vals_notify_mode), 0x00,
3758 "SMPP+: Indicates the SMS notify mode", HFILL
3761 { &hf_huawei_smpp_delivery_result,
3762 { "SMPP+: Delivery result of SMS", "smpp.delivery_result",
3763 FT_UINT32, BASE_DEC, VALS(vals_delivery_result), 0x00,
3764 "SMPP+: Indicates the Delivery result of SMS", HFILL
3769 /* Setup protocol subtree array */
3770 static int *ett[] = {
3771 &ett_smpp,
3772 &ett_dlist,
3773 &ett_dlist_resp,
3774 &ett_opt_params,
3775 &ett_opt_param,
3776 &ett_dcs,
3779 static ei_register_info ei[] = {
3780 { &ei_smpp_message_payload_duplicate,
3781 { "smpp.message_payload.duplicate", PI_PROTOCOL, PI_WARN,
3782 "short_message field and message_payload TLV can only appear once in total",
3783 EXPFILL }
3787 /* Encoding used to decode the SMS over SMPP when DCS is 0 */
3788 static const enum_val_t smpp_dcs_0_sms_decode_options[] = {
3789 { "none", "None", DO_NOT_DECODE },
3790 { "ascii", "ASCII", ENC_ASCII },
3791 { "gsm7", "GSM 7-bit", ENC_3GPP_TS_23_038_7BITS_UNPACKED },
3792 { "gsm7-packed", "GSM 7-bit (packed)", ENC_3GPP_TS_23_038_7BITS_PACKED },
3793 { "iso-8859-1", "ISO-8859-1", ENC_ISO_8859_1 },
3794 { "iso-8859-5", "ISO-8859-5", ENC_ISO_8859_5 },
3795 { "iso-8859-8", "ISO-8859-8", ENC_ISO_8859_8 },
3796 { "ucs2", "UCS2", ENC_UCS_2|ENC_BIG_ENDIAN },
3797 { "ks-c-5601", "KS C 5601 (Korean)", ENC_EUC_KR },
3798 { NULL, NULL, 0 }
3801 /* Register the protocol name and description */
3802 proto_smpp = proto_register_protocol("Short Message Peer to Peer",
3803 "SMPP", "smpp");
3805 /* Required function calls to register header fields and subtrees used */
3806 proto_register_field_array(proto_smpp, hf, array_length(hf));
3807 proto_register_subtree_array(ett, array_length(ett));
3809 expert_smpp = expert_register_protocol(proto_smpp);
3810 expert_register_field_array(expert_smpp, ei, array_length(ei));
3812 /* Allow other dissectors to find this one by name. */
3813 smpp_handle = register_dissector("smpp", dissect_smpp, proto_smpp);
3815 /* Register for tapping */
3816 smpp_tap = register_tap("smpp");
3818 /* Preferences */
3819 smpp_module = prefs_register_protocol (proto_smpp, NULL);
3820 prefs_register_bool_preference (smpp_module,
3821 "reassemble_smpp_over_tcp",
3822 "Reassemble SMPP over TCP messages spanning multiple TCP segments",
3823 "Whether the SMPP dissector should reassemble messages spanning multiple TCP segments."
3824 " To use this option, you must also enable "
3825 "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
3826 &reassemble_over_tcp);
3827 prefs_register_enum_preference(smpp_module, "decode_sms_over_smpp",
3828 "Decode DCS 0 SMS as",
3829 "Whether to decode the SMS contents when DCS is equal to 0 (zero).",
3830 &smpp_decode_dcs_0_sms, smpp_dcs_0_sms_decode_options, false);
3831 prefs_register_bool_preference(smpp_module, "gsm7_unpacked",
3832 "GSM 7-bit alphabet unpacked",
3833 "When the DCS indicates that the encoding is the GSM 7-bit "
3834 "alphabet, whether to decode it as unpacked (one character "
3835 "per octet) instead of packed.",
3836 &smpp_gsm7_unpacked);
3839 void
3840 proto_reg_handoff_smpp(void)
3843 * SMPP can be spoken on any port under TCP or X.25
3844 * ...how *do* we do that under X.25?
3846 * We can register the heuristic SMPP dissector with X.25, for one
3847 * thing. We don't currently have any mechanism to allow the user
3848 * to specify that a given X.25 circuit is to be dissected as SMPP,
3849 * however.
3851 dissector_add_for_decode_as_with_preference("tcp.port", smpp_handle);
3852 ssl_dissector_add(0, smpp_handle);
3853 heur_dissector_add("tcp", dissect_smpp_heur, "SMPP over TCP Heuristics", "smpp_tcp", proto_smpp, HEURISTIC_ENABLE);
3854 heur_dissector_add("tls", dissect_smpp_heur, "SMPP over TLS Heuristics", "smpp_tls", proto_smpp, HEURISTIC_ENABLE);
3855 heur_dissector_add("x.25", dissect_smpp_heur, "SMPP over X.25 Heuristics", "smpp_x25", proto_smpp, HEURISTIC_ENABLE);
3857 /* Required for call_dissector() */
3858 gsm_sms_handle = find_dissector_add_dependency("gsm_sms_ud", proto_smpp);
3859 DISSECTOR_ASSERT(gsm_sms_handle);
3861 /* Tapping setup */
3862 stats_tree_cfg *st_config = stats_tree_register("smpp","smpp_commands", "SM_PP Operations", 0,
3863 smpp_stats_tree_per_packet, smpp_stats_tree_init, NULL);
3864 stats_tree_set_group(st_config, REGISTER_TELEPHONY_GROUP_UNSORTED);
3866 exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7);
3870 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3872 * Local variables:
3873 * c-basic-offset: 4
3874 * tab-width: 8
3875 * indent-tabs-mode: nil
3876 * End:
3878 * vi: set shiftwidth=4 tabstop=8 expandtab:
3879 * :indentSize=4:tabSize=8:noTabs=true: