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