2 * Routines for Universal Computer Protocol dissection
3 * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 * Dissector of a UCP (Universal Computer Protocol) PDU, as defined for the
13 * ERMES paging system in ETS 300 133-3 (2nd final draft, September 1997,
15 * Includes the extension of EMI-UCP interface
16 * (V4.0, May 2001, www.advox.se/download/protocols/EMI_UCP.pdf)
18 * Support for statistics using the Stats Tree API added by
19 * Abhik Sarkar <sarkar.abhik@gmail.com>
27 #include <epan/packet.h>
28 #include <epan/prefs.h>
29 #include <epan/expert.h>
30 #include <epan/stats_tree.h>
31 #include <epan/charsets.h>
33 #include <wsutil/strtoi.h>
35 #include "packet-tcp.h"
37 void proto_register_ucp(void);
38 void proto_reg_handoff_ucp(void);
41 typedef struct _ucp_tap_rec_t
{
42 unsigned message_type
; /* 0 = Operation; 1 = Result */
43 unsigned operation
; /* Operation Type */
44 unsigned result
; /* 0 = Success; Non 0 = Error Code */
48 static bool ucp_desegment
= true;
50 /* STX + TRN(2 num. char.) + / + LEN(5 num. char.) + / + 'O'/'R' + / + OT(2 num. char.) + / */
51 #define UCP_HEADER_SIZE 15
54 * Convert ASCII-hex character to binary equivalent. No checks, assume
55 * is valid hex character.
57 #define AHex2Bin(n) (((n) & 0x40) ? ((n) & 0x0F) + 9 : ((n) & 0x0F))
59 #define UCP_STX 0x02 /* Start of UCP PDU */
60 #define UCP_ETX 0x03 /* End of UCP PDU */
62 #define UCP_MALFORMED -1 /* Not a valid PDU */
63 #define UCP_INV_CHK -2 /* Incorrect checksum */
65 #define UCP_TRN_OFFSET 1
66 #define UCP_LEN_OFFSET 4
67 #define UCP_O_R_OFFSET 10 /* Location of O/R field */
68 #define UCP_OT_OFFSET 12 /* Location of OT field */
70 #define UCP_TRN_LEN 2 /* Length of TRN-field */
71 #define UCP_LEN_LEN 5 /* Length of LEN-field */
72 #define UCP_O_R_LEN 1 /* Length of O/R-field */
73 #define UCP_OT_LEN 2 /* Length of OT-field */
76 static dissector_handle_t ucp_handle
;
79 * Initialize the protocol and registered fields
81 * Header (fixed) section
85 static int hf_ucp_hdr_TRN
;
86 static int hf_ucp_hdr_LEN
;
87 static int hf_ucp_hdr_O_R
;
88 static int hf_ucp_hdr_OT
;
93 static int st_ucp_messages
= -1;
94 static int st_ucp_ops
= -1;
95 static int st_ucp_res
= -1;
96 static int st_ucp_results
= -1;
97 static int st_ucp_results_pos
= -1;
98 static int st_ucp_results_neg
= -1;
100 static const char st_str_ucp
[] = "UCP Messages";
101 static const char st_str_ops
[] = "Operations";
102 static const char st_str_res
[] = "Results";
103 static const char st_str_ucp_res
[] = "UCP Results Acks/Nacks";
104 static const char st_str_pos
[] = "Positive";
105 static const char st_str_neg
[] = "Negative";
108 * Data (variable) section
110 static int hf_ucp_oper_section
;
111 static int hf_ucp_parm_AdC
;
112 static int hf_ucp_parm_OAdC
;
113 static int hf_ucp_parm_DAdC
;
114 static int hf_ucp_parm_AC
;
115 static int hf_ucp_parm_OAC
;
116 static int hf_ucp_parm_BAS
;
117 static int hf_ucp_parm_LAR
;
118 static int hf_ucp_parm_LAC
;
119 static int hf_ucp_parm_L1R
;
120 static int hf_ucp_parm_L1P
;
121 static int hf_ucp_parm_L3R
;
122 static int hf_ucp_parm_L3P
;
123 static int hf_ucp_parm_LCR
;
124 static int hf_ucp_parm_LUR
;
125 static int hf_ucp_parm_LRR
;
126 static int hf_ucp_parm_RT
;
127 static int hf_ucp_parm_NoN
;
128 static int hf_ucp_parm_NoA
;
129 static int hf_ucp_parm_NoB
;
130 static int hf_ucp_parm_NAC
;
131 static int hf_ucp_parm_PNC
;
132 static int hf_ucp_parm_AMsg
;
133 static int hf_ucp_parm_LNo
;
134 static int hf_ucp_parm_LST
;
135 static int hf_ucp_parm_TNo
;
136 static int hf_ucp_parm_CS
;
137 static int hf_ucp_parm_PID
;
138 static int hf_ucp_parm_NPL
;
139 static int hf_ucp_parm_GA
;
140 static int hf_ucp_parm_RP
;
141 static int hf_ucp_parm_LRP
;
142 static int hf_ucp_parm_PR
;
143 static int hf_ucp_parm_LPR
;
144 static int hf_ucp_parm_UM
;
145 static int hf_ucp_parm_LUM
;
146 static int hf_ucp_parm_RC
;
147 static int hf_ucp_parm_LRC
;
148 static int hf_ucp_parm_NRq
;
149 static int hf_ucp_parm_GAdC
;
150 static int hf_ucp_parm_A_D
;
151 static int hf_ucp_parm_CT
;
152 static int hf_ucp_parm_AAC
;
153 static int hf_ucp_parm_MNo
;
154 static int hf_ucp_parm_R_T
;
155 static int hf_ucp_parm_IVR5x
;
156 static int hf_ucp_parm_REQ_OT
;
157 static int hf_ucp_parm_SSTAT
;
158 static int hf_ucp_parm_LMN
;
159 static int hf_ucp_parm_NMESS
;
160 static int hf_ucp_parm_NAdC
;
161 static int hf_ucp_parm_NT
;
162 static int hf_ucp_parm_NPID
;
163 static int hf_ucp_parm_LRq
;
164 static int hf_ucp_parm_LRAd
;
165 static int hf_ucp_parm_LPID
;
166 static int hf_ucp_parm_DD
;
167 static int hf_ucp_parm_DDT
;
168 static int hf_ucp_parm_STx
;
169 static int hf_ucp_parm_ST
;
170 static int hf_ucp_parm_SP
;
171 static int hf_ucp_parm_VP
;
172 static int hf_ucp_parm_RPID
;
173 static int hf_ucp_parm_SCTS
;
174 static int hf_ucp_parm_Dst
;
175 static int hf_ucp_parm_Rsn
;
176 static int hf_ucp_parm_DSCTS
;
177 static int hf_ucp_parm_MT
;
178 static int hf_ucp_parm_NB
;
179 static int hf_ucp_data_section
;
180 static int hf_ucp_parm_MMS
;
181 static int hf_ucp_parm_DCs
;
182 static int hf_ucp_parm_MCLs
;
183 static int hf_ucp_parm_RPI
;
184 static int hf_ucp_parm_CPg
;
185 static int hf_ucp_parm_RPLy
;
186 static int hf_ucp_parm_OTOA
;
187 static int hf_ucp_parm_HPLMN
;
188 static int hf_ucp_parm_RES4
;
189 static int hf_ucp_parm_RES5
;
190 static int hf_ucp_parm_OTON
;
191 static int hf_ucp_parm_ONPI
;
192 static int hf_ucp_parm_STYP0
;
193 static int hf_ucp_parm_STYP1
;
194 static int hf_ucp_parm_ACK
;
195 static int hf_ucp_parm_PWD
;
196 static int hf_ucp_parm_NPWD
;
197 static int hf_ucp_parm_VERS
;
198 static int hf_ucp_parm_LAdC
;
199 static int hf_ucp_parm_LTON
;
200 static int hf_ucp_parm_LNPI
;
201 static int hf_ucp_parm_OPID
;
202 static int hf_ucp_parm_RES1
;
203 static int hf_ucp_parm_RES2
;
204 static int hf_ucp_parm_MVP
;
205 static int hf_ucp_parm_EC
;
206 static int hf_ucp_parm_SM
;
207 static int hf_ucp_not_subscribed
;
208 static int hf_ucp_ga_roaming
;
209 static int hf_ucp_call_barring
;
210 static int hf_ucp_deferred_delivery
;
211 static int hf_ucp_diversion
;
213 static int hf_ucp_parm_XSer
;
214 static int hf_xser_service
;
215 static int hf_xser_length
;
216 static int hf_xser_data
;
218 /* Initialize the subtree pointers */
223 static expert_field ei_ucp_stx_missing
;
224 static expert_field ei_ucp_intstring_invalid
;
225 static expert_field ei_ucp_hexstring_invalid
;
226 static expert_field ei_ucp_short_data
;
232 * Value-arrays for certain field-contents
234 static const value_string vals_hdr_O_R
[] = {
235 { 'O', "Operation" },
240 static const value_string vals_hdr_OT
[] = { /* Operation type */
243 { 2, "Call input (multiple address)" },
244 { 3, "Call input (supplementary services included)" },
245 { 4, "Address list information" },
246 { 5, "Change address list" },
247 { 6, "Advice of accumulated charges" },
248 { 7, "Password management" },
249 { 8, "Legitimisation code management" },
250 { 9, "Standard text information" },
251 { 10, "Change standard text" },
252 { 11, "Request roaming information" },
253 { 12, "Change roaming information" },
254 { 13, "Roaming reset" },
255 { 14, "Message retrieval" },
256 { 15, "Request call barring" },
257 { 16, "Cancel call barring" },
258 { 17, "Request call diversion" },
259 { 18, "Cancel call diversion" },
260 { 19, "Request deferred delivery" },
261 { 20, "Cancel deferred delivery" },
262 { 21, "All features reset" },
263 { 22, "Call input (with specific character set)" },
264 { 23, "UCP version status request" },
265 { 24, "Mobile subscriber feature status request" },
266 { 30, "SMS message transfer" },
268 { 32, "(proprietary)" },
269 { 34, "(proprietary)" },
270 { 36, "(proprietary)" },
271 { 38, "(proprietary)" },
272 { 40, "(proprietary)" },
273 { 41, "(proprietary)" },
274 { 42, "(proprietary)" },
275 { 43, "(proprietary)" },
276 { 44, "(proprietary)" },
277 { 45, "(proprietary)" },
278 { 51, "Submit short message" },
279 { 52, "Deliver short message" },
280 { 53, "Deliver notification" },
281 { 54, "Modify message" },
282 { 55, "Inquiry message" },
283 { 56, "Delete message" },
284 { 57, "Inquiry response message" },
285 { 58, "Delete response message" },
286 { 60, "Session management" },
287 { 61, "List management" },
288 { 95, "(proprietary)" },
289 { 96, "(proprietary)" },
290 { 97, "(proprietary)" },
291 { 98, "(proprietary)" },
292 { 99, "(proprietary)" },
295 static value_string_ext vals_hdr_OT_ext
= VALUE_STRING_EXT_INIT(vals_hdr_OT
);
297 static const value_string vals_parm_EC
[] = { /* Error code */
298 { 1, "Checksum error" },
299 { 2, "Syntax error" },
300 { 3, "Operation not supported by system" },
301 { 4, "Operation not allowed" },
302 { 5, "Call barring active" },
303 { 6, "AdC invalid" },
304 { 7, "Authentication failure" },
305 { 8, "Legitimisation code for all calls, failure" },
306 { 9, "GA not valid" },
307 { 10, "Repetition not allowed" },
308 { 11, "Legitimisation code for repetition, failure" },
309 { 12, "Priority call not allowed" },
310 { 13, "Legitimisation code for priority call, failure" },
311 { 14, "Urgent message not allowed" },
312 { 15, "Legitimisation code for urgent message, failure" },
313 { 16, "Reverse charging not allowed" },
314 { 17, "Legitimisation code for rev. charging, failure" },
315 { 18, "Deferred delivery not allowed" },
316 { 19, "New AC not valid" },
317 { 20, "New legitimisation code not valid" },
318 { 21, "Standard text not valid" },
319 { 22, "Time period not valid" },
320 { 23, "Message type not supported by system" },
321 { 24, "Message too long" },
322 { 25, "Requested standard text not valid" },
323 { 26, "Message type not valid for the pager type" },
324 { 27, "Message not found in SMSC" },
325 { 28, "Invalid character set" },
326 { 30, "Subscriber hang-up" },
327 { 31, "Fax group not supported" },
328 { 32, "Fax message type not supported" },
329 { 33, "Address already in list (60-series)" },
330 { 34, "Address not in list (60-series)" },
331 { 35, "List full, cannot add address to list (60-series)" },
332 { 36, "RPID already in use" },
333 { 37, "Delivery in progress" },
334 { 38, "Message forwarded" },
335 { 50, "Low network status" },
336 { 51, "Legitimisation code for standard text, failure" },
337 { 53, "Operation partially successful" },
338 { 54, "Operation not successful" },
339 { 55, "System error" },
340 { 57, "AdC already a member of GAdC address list" },
341 { 58, "AdC not a member of GAdC address list" },
342 { 59, "Requested standard text list invalid" },
343 { 61, "Not controller of GAdC address list" },
344 { 62, "Standard text too large" },
345 { 63, "Not owner of standard text list" },
346 { 64, "Address list full" },
347 { 65, "GAdC invalid" },
348 { 66, "Operation restricted to mobile subscribers" },
349 { 68, "Invalid AdC type" },
350 { 69, "Cannot add AdC to GAdC address list" },
351 { 90, "(proprietary error code)" },
352 { 91, "(proprietary error code)" },
353 { 92, "(proprietary error code)" },
354 { 93, "(proprietary error code)" },
355 { 94, "(proprietary error code)" },
356 { 95, "(proprietary error code)" },
357 { 96, "(proprietary error code)" },
358 { 97, "(proprietary error code)" },
359 { 98, "(proprietary error code)" },
360 { 99, "(proprietary error code)" },
363 static value_string_ext vals_parm_EC_ext
= VALUE_STRING_EXT_INIT(vals_parm_EC
);
365 static const value_string vals_parm_NRq
[] = {
366 { '0', "NAdC not used" },
367 { '1', "NAdC used" },
371 static const value_string vals_parm_NT
[] = {
372 { '0', "Default value" },
373 { '1', "Delivery notification" },
374 { '2', "Non-delivery notification" },
375 { '3', "Delivery and Non-delivery notification" },
376 { '4', "Buffered message notification" },
377 { '5', "Buffered and Delivery notification" },
378 { '6', "Buffered and Non-delivery notification" },
379 { '7', "All notifications" },
383 static const value_string vals_parm_PID
[] = {
384 { 100, "Mobile station" },
385 { 122, "Fax Group 3" },
387 { 138, "Menu over PSTN" },
388 { 139, "PC appl. over PSTN (E.164)" },
389 { 339, "PC appl. over X.25 (X.121)" },
390 { 439, "PC appl. over ISDN (E.164)" },
391 { 539, "PC appl. over TCP/IP" },
392 { 639, "PC appl. via abbreviated number" },
396 static const value_string vals_parm_LRq
[] = {
397 { '0', "LRAd not used" },
398 { '1', "LRAd used" },
402 static const value_string vals_parm_DD
[] = {
403 { '0', "DDT not used" },
408 static const value_string vals_parm_Dst
[] = {
409 { '0', "delivered" },
410 { '1', "buffered (see Rsn)" },
411 { '2', "not delivered (see Rsn)" },
415 static const value_string vals_parm_Rsn
[] = {
416 { 0, "Unknown subscriber" },
417 { 1, "Service temporary not available" },
418 { 2, "Service temporary not available" },
419 { 3, "Service temporary not available" },
420 { 4, "Service temporary not available" },
421 { 5, "Service temporary not available" },
422 { 6, "Service temporary not available" },
423 { 7, "Service temporary not available" },
424 { 8, "Service temporary not available" },
425 { 9, "Illegal error code" },
426 { 10, "Network time-out" },
427 { 100, "Facility not supported" },
428 { 101, "Unknown subscriber" },
429 { 102, "Facility not provided" },
430 { 103, "Call barred" },
431 { 104, "Operation barred" },
432 { 105, "SC congestion" },
433 { 106, "Facility not supported" },
434 { 107, "Absent subscriber" },
435 { 108, "Delivery fail" },
436 { 109, "Sc congestion" },
437 { 110, "Protocol error" },
438 { 111, "MS not equipped" },
439 { 112, "Unknown SC" },
440 { 113, "SC congestion" },
441 { 114, "Illegal MS" },
442 { 115, "MS nota subscriber" },
443 { 116, "Error in MS" },
444 { 117, "SMS lower layer not provisioned" },
445 { 118, "System fail" },
446 { 119, "PLMN system failure" },
447 { 120, "HLR system failure" },
448 { 121, "VLR system failure" },
449 { 122, "Previous VLR system failure" },
450 { 123, "Controlling MSC system failure" },
451 { 124, "VMSC system failure" },
452 { 125, "EIR system failure" },
453 { 126, "System failure" },
454 { 127, "Unexpected data value" },
455 { 200, "Error in address service centre" },
456 { 201, "Invalid absolute validity period" },
457 { 202, "Short message exceeds maximum" },
458 { 203, "Unable to unpack GSM message" },
459 { 204, "Unable to convert to IRA alphabet" },
460 { 205, "Invalid validity period format" },
461 { 206, "Invalid destination address" },
462 { 207, "Duplicate message submit" },
463 { 208, "Invalid message type indicator" },
466 static value_string_ext vals_parm_Rsn_ext
= VALUE_STRING_EXT_INIT(vals_parm_Rsn
);
468 static const value_string vals_parm_MT
[] = {
469 { '2', "Numeric message" },
470 { '3', "Alphanumeric message" },
471 { '4', "Transparent data" },
475 static const value_string vals_parm_DCs
[] = {
476 { '0', "default alphabet" },
477 { '1', "User defined data (8 bit)" },
481 static const value_string vals_parm_MCLs
[] = {
482 { '0', "message class 0" },
483 { '1', "message class 1" },
484 { '2', "message class 2" },
485 { '3', "message class 3" },
489 static const value_string vals_parm_RPI
[] = {
495 static const value_string vals_parm_ACK
[] = {
501 static const value_string vals_parm_RP
[] = {
502 { '1', "Repetition requested" },
506 static const value_string vals_parm_UM
[] = {
507 { '1', "Urgent message" },
511 static const value_string vals_parm_RC
[] = {
512 { '1', "Reverse charging request" },
516 static const value_string vals_parm_OTOA
[] = {
517 { 1139, "The OAdC is set to NPI telephone and TON international" },
518 { 5039, "The OAdC contains an alphanumeric address" },
522 static const value_string vals_parm_OTON
[] = {
523 { '1', "International number" },
524 { '2', "National number" },
525 { '6', "Abbreviated number (short number alias)" },
529 static const value_string vals_parm_ONPI
[] = {
530 { '1', "E.164 address" },
531 { '3', "X.121 address" },
532 { '5', "Private -TCP/IP or abbreviated number- address" },
536 static const value_string vals_parm_STYP0
[] = {
537 { '1', "open session" },
539 { '3', "change password" },
540 { '4', "open provisioning session" },
542 { '6', "change provisioning password" },
546 static const value_string vals_parm_STYP1
[] = {
547 { '1', "add item to mo-list" },
548 { '2', "remove item from mo-list" },
549 { '3', "verify item mo-list" },
550 { '4', "add item to mt-list" },
551 { '5', "remove item from mt-list" },
552 { '6', "verify item mt-list" },
556 static const value_string vals_parm_OPID
[] = {
557 { 0, "Mobile station" },
558 { 39, "PC application" },
562 static const value_string vals_parm_BAS
[] = {
567 static const value_string vals_parm_LAR
[] = {
568 { '1', "Leg. code for all calls requested" },
572 static const value_string vals_parm_L1R
[] = {
573 { '1', "Leg. code for priority 1 requested" },
577 static const value_string vals_parm_L3R
[] = {
578 { '1', "Leg. code for priority 3 requested" },
582 static const value_string vals_parm_LCR
[] = {
583 { '1', "Leg. code for reverse charging requested" },
587 static const value_string vals_parm_LUR
[] = {
588 { '1', "Leg. code for urgent message requested" },
592 static const value_string vals_parm_LRR
[] = {
593 { '1', "Leg. code for repetition requested" },
597 static const value_string vals_parm_RT
[] = {
598 { '1', "Tone only" },
600 { '3', "Alphanumeric" },
601 { '4', "Transparent data" },
605 static const value_string vals_parm_PNC
[] = {
607 { 'I', "Input PNC" },
611 static const value_string vals_parm_A_D
[] = {
617 static const value_string vals_parm_R_T
[] = {
618 { 'R', "Retrieval Ok" },
619 { 'T', "Retransmit on radio channel" },
623 static const value_string vals_parm_REQ_OT
[] = {
624 { 'S', "Send used operation types" },
625 { 'N', "Don't send used operation types" },
629 static const value_string vals_parm_SSTAT
[] = {
630 { '0', "All services" },
631 { '1', "All in the moment active services" },
632 { '2', "Call diversion" },
633 { '3', "Roaming information status" },
634 { '4', "Call barring status" },
635 { '5', "Deferred delivery status" },
636 { '6', "Number of stored messages" },
640 static const value_string vals_xser_service
[] = {
642 { 1, "GSM UDH information" },
643 { 2, "GSM DCS information" },
644 { 3, "[Message Type] TDMA information exchange" },
645 { 4, "[Message Reference] TDMA information exchange" },
646 { 5, "[Privacy Indicator] TDMA information exchange" },
647 { 6, "[Urgency Indicator] TDMA information exchange" },
648 { 7, "[Acknowledgement Request] TDMA information exchange" },
649 { 8, "[Message Updating] TDMA information exchange" },
650 { 9, "[Call Back Number] TDMA information exchange" },
651 { 10, "[Response Code] TDMA information exchange" },
652 { 11, "[Teleservice ID] TDMA information exchange" },
653 { 12, "Billing identifier" },
654 { 13, "Single shot indicator" },
655 { 14, "Originator TON" },
656 { 15, "Originator NPI" },
657 { 16, "Recipient TON" },
658 { 17, "Recipient NPI" },
659 { 18, "Message Original Submission Time" },
660 { 19, "Destination Network Type" },
663 static value_string_ext vals_xser_service_ext
= VALUE_STRING_EXT_INIT(vals_xser_service
);
667 ucp_stats_tree_init(stats_tree
* st
)
669 st_ucp_messages
= stats_tree_create_node(st
, st_str_ucp
, 0, STAT_DT_INT
, true);
670 st_ucp_ops
= stats_tree_create_node(st
, st_str_ops
, st_ucp_messages
, STAT_DT_INT
, true);
671 st_ucp_res
= stats_tree_create_node(st
, st_str_res
, st_ucp_messages
, STAT_DT_INT
, true);
672 st_ucp_results
= stats_tree_create_node(st
, st_str_ucp_res
, 0, STAT_DT_INT
, true);
673 st_ucp_results_pos
= stats_tree_create_node(st
, st_str_pos
, st_ucp_results
, STAT_DT_INT
, true);
674 st_ucp_results_neg
= stats_tree_create_node(st
, st_str_neg
, st_ucp_results
, STAT_DT_INT
, true);
677 static tap_packet_status
678 ucp_stats_tree_per_packet(stats_tree
*st
, /* st as it was passed to us */
679 packet_info
*pinfo _U_
,
680 epan_dissect_t
*edt _U_
,
682 tap_flags_t flags _U_
) /* Used for getting UCP stats */
684 const ucp_tap_rec_t
*tap_rec
= (const ucp_tap_rec_t
*)p
;
686 tick_stat_node(st
, st_str_ucp
, 0, true);
688 if (tap_rec
->message_type
== 0) /* Operation */
690 tick_stat_node(st
, st_str_ops
, st_ucp_messages
, true);
691 tick_stat_node(st
, val_to_str_ext(tap_rec
->operation
, &vals_hdr_OT_ext
,
692 "Unknown OT: %d"), st_ucp_ops
, false);
696 tick_stat_node(st
, st_str_res
, st_ucp_messages
, true);
697 tick_stat_node(st
, val_to_str_ext(tap_rec
->operation
, &vals_hdr_OT_ext
,
698 "Unknown OT: %d"), st_ucp_res
, false);
700 tick_stat_node(st
, st_str_ucp_res
, 0, true);
702 if (tap_rec
->result
== 0) /* Positive Result */
704 tick_stat_node(st
, st_str_pos
, st_ucp_results
, false);
706 else /* Negative Result */
708 tick_stat_node(st
, st_str_neg
, st_ucp_results
, true);
709 tick_stat_node(st
, val_to_str_ext(tap_rec
->result
, &vals_parm_EC_ext
,
710 "Unknown EC: %d"), st_ucp_results_neg
, false);
714 return TAP_PACKET_REDRAW
;
718 * Checks whether the PDU looks a bit like UCP and checks the checksum
720 * Note: check_ucp is called only with a buffer of at least LEN+2 bytes.
721 * IOW: The buffer should contain a complete UCP PDU [STX ... ETX]
723 * \param tvb The buffer with PDU-data
724 * \param endpkt Returns pointer, indicating the end of the PDU
726 * \return The state of this PDU
729 * UCP_INV_CHK Nice packet, but checksum doesn't add up...
732 check_ucp(tvbuff_t
*tvb
, int *endpkt
)
735 unsigned checksum
= 0;
739 length
= tvb_find_uint8(tvb
, offset
, -1, UCP_ETX
);
741 *endpkt
= tvb_reported_length_remaining(tvb
, offset
);
742 return UCP_MALFORMED
;
744 for (; offset
< (unsigned) (length
- 2); offset
++)
745 checksum
+= tvb_get_uint8(tvb
, offset
);
747 tmp
= tvb_get_uint8(tvb
, offset
++);
748 pkt_check
= AHex2Bin(tmp
);
749 tmp
= tvb_get_uint8(tvb
, offset
++);
750 pkt_check
= 16 * pkt_check
+ AHex2Bin(tmp
);
751 *endpkt
= offset
+ 1;
752 if (checksum
== (unsigned) pkt_check
)
759 * UCP equivalent of mktime() (3). Convert date to standard 'time_t' format
761 * \param len The length of datestr
762 * \param datestr The UCP-formatted date to convert
764 * \return The date in standard 'time_t' format.
767 ucp_mktime(const int len
, const char *datestr
)
771 r_time
.tm_mday
= (10 * (datestr
[0] - '0') + (datestr
[1] - '0'));
774 r_time
.tm_mon
= (10 * (datestr
[2] - '0') + (datestr
[3] - '0')) - 1;
779 r_time
.tm_year
= (10 * (datestr
[4] - '0') + (datestr
[5] - '0'));
782 if (r_time
.tm_year
< 90)
783 r_time
.tm_year
+= 100;
786 r_time
.tm_hour
= (10 * (datestr
[6] - '0') + (datestr
[7] - '0'));
791 r_time
.tm_min
= (10 * (datestr
[8] - '0') + (datestr
[9] - '0'));
796 r_time
.tm_sec
= (10 * (datestr
[10] - '0') + (datestr
[11] - '0'));
800 r_time
.tm_isdst
= -1;
802 return mktime(&r_time
);
806 * Scanning routines to add standard types (byte, int, string, data)
807 * to the protocol-tree. Each field is separated with a slash ('/').
809 * \param tree The protocol tree to add to
810 * \param tvb Buffer containing the data
811 * \param field The actual field, whose value needs displaying
812 * \param offset Location of field within the buffer, returns location
817 ucp_handle_string(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
819 proto_item
*ti
= NULL
;
822 idx
= tvb_find_uint8(tvb
, *offset
, -1, '/');
824 /* Force the appropriate exception to be thrown. */
825 len
= tvb_captured_length_remaining(tvb
, *offset
);
826 tvb_ensure_bytes_exist(tvb
, *offset
, len
+ 1);
830 ti
= proto_tree_add_item(tree
, field
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
833 *offset
+= 1; /* skip terminating '/' */
838 ucp_handle_IRAstring(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
841 wmem_strbuf_t
*strbuf
;
846 idx
= tvb_find_uint8(tvb
, *offset
, -1, '/');
848 /* Force the appropriate exception to be thrown. */
849 len
= tvb_captured_length_remaining(tvb
, *offset
);
850 tvb_ensure_bytes_exist(tvb
, *offset
, len
+ 1);
854 bytes
= g_byte_array_sized_new(len
);
855 if (tvb_get_string_bytes(tvb
, *offset
, len
, ENC_ASCII
|ENC_STR_HEX
|ENC_SEP_NONE
, bytes
, &tmpoff
)) {
856 strval
= get_ts_23_038_7bits_string_unpacked(wmem_packet_scope(), bytes
->data
, bytes
->len
);
858 strbuf
= wmem_strbuf_new(wmem_packet_scope(), strval
);
859 while ((tmpoff
+ 1) < idx
) {
860 wmem_strbuf_append_unichar_repl(strbuf
);
862 if ((tmpoff
+ 1) >= idx
) break;
863 bytes
= g_byte_array_set_size(bytes
, 0);
864 if (tvb_get_string_bytes(tvb
, tmpoff
, idx
-tmpoff
, ENC_ASCII
|ENC_STR_HEX
|ENC_SEP_NONE
, bytes
, &tmpoff
)) {
865 strval
= get_ts_23_038_7bits_string_unpacked(wmem_packet_scope(), bytes
->data
, bytes
->len
);
866 wmem_strbuf_append(strbuf
, strval
);
870 /* Odd string length, which is impossible and indicates an error. */
871 wmem_strbuf_append_unichar_repl(strbuf
);
873 g_byte_array_free(bytes
, true);
875 proto_tree_add_string(tree
, field
, tvb
, *offset
,
876 len
, wmem_strbuf_finalize(strbuf
));
880 *offset
+= 1; /* skip terminating '/' */
884 ucp_handle_byte(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
888 if ((intval
= tvb_get_uint8(tvb
, (*offset
)++)) != '/') {
889 proto_tree_add_uint(tree
, field
, tvb
, *offset
- 1, 1, intval
);
896 ucp_handle_int(proto_tree
*tree
, packet_info
* pinfo
, tvbuff_t
*tvb
, int field
, int *offset
)
904 idx
= tvb_find_uint8(tvb
, *offset
, -1, '/');
906 /* Force the appropriate exception to be thrown. */
907 len
= tvb_captured_length_remaining(tvb
, *offset
);
908 tvb_ensure_bytes_exist(tvb
, *offset
, len
+ 1);
911 strval
= tvb_get_string_enc(wmem_packet_scope(), tvb
, *offset
, len
, ENC_ASCII
);
913 intval_valid
= ws_strtou32(strval
, NULL
, &intval
);
914 pi
= proto_tree_add_uint(tree
, field
, tvb
, *offset
, len
, intval
);
916 expert_add_info_format(pinfo
, pi
, &ei_ucp_intstring_invalid
,
917 "Invalid integer string: %s", strval
);
921 *offset
+= 1; /* skip terminating '/' */
926 ucp_handle_time(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
933 idx
= tvb_find_uint8(tvb
, *offset
, -1, '/');
935 /* Force the appropriate exception to be thrown. */
936 len
= tvb_captured_length_remaining(tvb
, *offset
);
937 tvb_ensure_bytes_exist(tvb
, *offset
, len
+ 1);
940 strval
= tvb_get_string_enc(wmem_packet_scope(), tvb
, *offset
, len
, ENC_ASCII
);
942 tval
= ucp_mktime(len
, strval
);
945 proto_tree_add_time(tree
, field
, tvb
, *offset
, len
, &tmptime
);
949 *offset
+= 1; /* skip terminating '/' */
953 ucp_handle_data(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
955 int tmpoff
= *offset
;
957 while (tvb_get_uint8(tvb
, tmpoff
++) != '/')
959 if ((tmpoff
- *offset
) > 1)
960 proto_tree_add_item(tree
, field
, tvb
, *offset
,
961 tmpoff
- *offset
- 1, ENC_NA
);
966 ucp_handle_data_string(proto_tree
*tree
, tvbuff_t
*tvb
, int field
, int *offset
)
968 int tmpoff
= *offset
;
970 while (tvb_get_uint8(tvb
, tmpoff
++) != '/')
972 if ((tmpoff
- *offset
) > 1)
973 proto_tree_add_item(tree
, field
, tvb
, *offset
,
974 tmpoff
- *offset
- 1, ENC_ASCII
|ENC_NA
);
979 * Handle the data-field within the UCP-message, according the Message Type
981 * - 2 Numeric message
982 * - 3 Alphanumeric message
983 * - 4 Transparent (binary) data
984 * - 5 Standard text handling
985 * - 6 Alphanumeric message in specified character set
987 * \param tree The protocol tree to add to
988 * \param tvb Buffer containing the data
989 * \param offset Location of field within the buffer, returns location
993 ucp_handle_mt(proto_tree
*tree
, packet_info
* pinfo
, tvbuff_t
*tvb
, int *offset
)
997 intval
= ucp_handle_byte(tree
, tvb
, hf_ucp_parm_MT
, offset
);
999 case '1': /* Tone only, no data */
1001 case '4': /* TMsg, no of bits */
1002 ucp_handle_string(tree
, tvb
, hf_ucp_parm_NB
, offset
);
1003 /* fall through here for the data piece */
1006 ucp_handle_data(tree
, tvb
, hf_ucp_data_section
, offset
);
1009 ucp_handle_IRAstring(tree
, tvb
, hf_ucp_parm_AMsg
, offset
);
1012 ucp_handle_byte(tree
, tvb
, hf_ucp_parm_PNC
, offset
);
1013 ucp_handle_string(tree
, tvb
, hf_ucp_parm_LNo
, offset
);
1014 ucp_handle_string(tree
, tvb
, hf_ucp_parm_LST
, offset
);
1015 ucp_handle_string(tree
, tvb
, hf_ucp_parm_TNo
, offset
);
1018 ucp_handle_data(tree
, tvb
, hf_ucp_data_section
, offset
);
1019 ucp_handle_int(tree
, pinfo
, tvb
, hf_ucp_parm_CS
, offset
);
1022 break; /* No data so ? */
1027 * Handle the data within the 'Extended services' field. Each field having the
1028 * format TTLLDD..., TT being the type of service, LL giving the length of the
1029 * field, DD... containing the actual data
1031 * \param tree The protocol tree to add to
1032 * \param tvb Buffer containing the extended services data
1035 ucp_handle_XSer(proto_tree
*tree
, tvbuff_t
*tvb
)
1042 while ((intval
= tvb_get_uint8(tvb
, offset
)) != '/') {
1043 service
= AHex2Bin(intval
);
1044 intval
= tvb_get_uint8(tvb
, offset
+1);
1045 service
= service
* 16 + AHex2Bin(intval
);
1046 intval
= tvb_get_uint8(tvb
, offset
+2);
1047 len
= AHex2Bin(intval
);
1048 intval
= tvb_get_uint8(tvb
, offset
+3);
1049 len
= len
* 16 + AHex2Bin(intval
);
1050 proto_tree_add_uint(tree
, hf_xser_service
, tvb
, offset
, 2, service
);
1051 proto_tree_add_uint(tree
, hf_xser_length
, tvb
, offset
+2, 2, len
);
1052 proto_tree_add_item(tree
, hf_xser_data
, tvb
, offset
+4, len
*2, ENC_ASCII
);
1053 offset
+= 4 + (2 * len
);
1058 ucp_handle_alphanum_OAdC(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, int field
, int *offset
)
1060 proto_item
*ti
= NULL
;
1062 char *strval
= NULL
;
1066 idx
= tvb_find_uint8(tvb
, *offset
, -1, '/');
1068 /* Force the appropriate exception to be thrown. */
1069 len
= tvb_captured_length_remaining(tvb
, *offset
);
1070 tvb_ensure_bytes_exist(tvb
, *offset
, len
+ 1);
1072 len
= idx
- *offset
;
1077 *offset
+= 1; /* skip terminating '/' */
1081 bytes
= g_byte_array_sized_new(len
);
1082 if (tvb_get_string_bytes(tvb
, *offset
, len
, ENC_ASCII
|ENC_STR_HEX
|ENC_SEP_NONE
, bytes
, &tmpoff
)) {
1083 /* If this returns true, there's at least one byte */
1084 unsigned addrlength
= bytes
->data
[0]; // expected number of semi-octets/nibbles
1085 unsigned numdigocts
= (addrlength
+ 1) / 2;
1086 int no_of_chars
= (addrlength
<< 2) / 7;
1087 if (bytes
->len
< numdigocts
+ 1) {
1088 // Short data (there needs to be room for the addrlength byte plus
1089 // the string, with no NULL termination)
1090 proto_tree_add_expert(tree
, pinfo
, &ei_ucp_short_data
, tvb
, *offset
, len
);
1091 no_of_chars
= ((bytes
->len
- 1) << 3) / 7;
1093 strval
= get_ts_23_038_7bits_string_packed(pinfo
->pool
, &bytes
->data
[1], 0, no_of_chars
);
1095 g_byte_array_free(bytes
, true);
1096 ti
= proto_tree_add_string(tree
, field
, tvb
, *offset
,
1098 if (tmpoff
< *offset
+ len
) {
1099 /* We didn't consume all the bytes, so either a failed conversion
1100 * from ASCII hex bytes, or an odd number of bytes.
1102 expert_add_info(pinfo
, ti
, &ei_ucp_hexstring_invalid
);
1106 *offset
+= 1; /* skip terminating '/' */
1111 /* Next definitions are just a convenient shorthand to make the coding a
1112 * bit more readable instead of summing up all these parameters.
1114 #define UcpHandleString(field) ucp_handle_string(tree, tvb, (field), &offset)
1116 #define UcpHandleIRAString(field) \
1117 ucp_handle_IRAstring(tree, tvb, (field), &offset)
1119 #define UcpHandleByte(field) ucp_handle_byte(tree, tvb, (field), &offset)
1121 #define UcpHandleInt(field) ucp_handle_int(tree, pinfo, tvb, (field), &offset)
1123 #define UcpHandleTime(field) ucp_handle_time(tree, tvb, (field), &offset)
1125 #define UcpHandleData(field) ucp_handle_data(tree, tvb, (field), &offset)
1127 #define UcpHandleDataString(field)\
1128 ucp_handle_data_string(tree, tvb, (field), &offset)
1131 * The next set of routines handle the different operation types,
1132 * associated with UCP.
1135 add_00O(proto_tree
*tree
, tvbuff_t
*tvb
)
1139 UcpHandleString(hf_ucp_parm_AdC
);
1140 UcpHandleString(hf_ucp_parm_OAdC
);
1141 UcpHandleString(hf_ucp_parm_OAC
);
1145 add_00R(proto_tree
*tree
, packet_info
* pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1150 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1153 UcpHandleByte(hf_ucp_parm_BAS
);
1154 UcpHandleByte(hf_ucp_parm_LAR
);
1155 UcpHandleByte(hf_ucp_parm_L1R
);
1156 UcpHandleByte(hf_ucp_parm_L3R
);
1157 UcpHandleByte(hf_ucp_parm_LCR
);
1158 UcpHandleByte(hf_ucp_parm_LUR
);
1159 UcpHandleByte(hf_ucp_parm_LRR
);
1160 UcpHandleByte(hf_ucp_parm_RT
);
1161 UcpHandleInt(hf_ucp_parm_NoN
);
1162 UcpHandleInt(hf_ucp_parm_NoA
);
1163 UcpHandleInt(hf_ucp_parm_NoB
);
1165 tap_rec
->result
= 0;
1167 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1168 UcpHandleString(hf_ucp_parm_SM
);
1173 add_01O(proto_tree
*tree
, packet_info
* pinfo
, tvbuff_t
*tvb
)
1177 UcpHandleString(hf_ucp_parm_AdC
);
1178 UcpHandleString(hf_ucp_parm_OAdC
);
1179 UcpHandleString(hf_ucp_parm_OAC
);
1180 ucp_handle_mt(tree
, pinfo
, tvb
, &offset
);
1184 add_01R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1189 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1191 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1193 tap_rec
->result
= 0;
1194 UcpHandleString(hf_ucp_parm_SM
);
1198 add_02O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1199 { /* Multiple address call input*/
1204 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1205 for (idx
= 0; idx
< intval
; idx
++)
1206 UcpHandleString(hf_ucp_parm_AdC
);
1208 UcpHandleString(hf_ucp_parm_OAdC
);
1209 UcpHandleString(hf_ucp_parm_OAC
);
1210 ucp_handle_mt(tree
, pinfo
, tvb
, &offset
);
1213 #define add_02R(a, b, c, d) add_01R(a, b, c, d)
1216 add_03O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1217 { /* Call input with SS */
1222 UcpHandleString(hf_ucp_parm_AdC
);
1223 UcpHandleString(hf_ucp_parm_OAdC
);
1224 UcpHandleString(hf_ucp_parm_OAC
);
1225 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1226 for (idx
= 0; idx
< intval
; idx
++)
1227 UcpHandleString(hf_ucp_parm_GA
);
1229 UcpHandleByte(hf_ucp_parm_RP
);
1230 UcpHandleString(hf_ucp_parm_LRP
);
1231 UcpHandleByte(hf_ucp_parm_PR
);
1232 UcpHandleString(hf_ucp_parm_LPR
);
1233 UcpHandleByte(hf_ucp_parm_UM
);
1234 UcpHandleString(hf_ucp_parm_LUM
);
1235 UcpHandleByte(hf_ucp_parm_RC
);
1236 UcpHandleString(hf_ucp_parm_LRC
);
1237 UcpHandleByte(hf_ucp_parm_DD
);
1238 UcpHandleTime(hf_ucp_parm_DDT
); /* DDMMYYHHmm */
1239 ucp_handle_mt(tree
, pinfo
, tvb
, &offset
);
1242 #define add_03R(a, b, c, d) add_01R(a, b, c, d)
1245 add_04O(proto_tree
*tree
, tvbuff_t
*tvb
)
1246 { /* Address list information */
1249 UcpHandleString(hf_ucp_parm_GAdC
);
1250 UcpHandleString(hf_ucp_parm_AC
);
1251 UcpHandleString(hf_ucp_parm_OAdC
);
1252 UcpHandleString(hf_ucp_parm_OAC
);
1256 add_04R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1262 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1263 if (intval
== 'A') {
1264 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1265 for (idx
= 0; idx
< intval
; idx
++)
1266 UcpHandleString(hf_ucp_parm_AdC
);
1267 UcpHandleString(hf_ucp_parm_GAdC
);
1268 tap_rec
->result
= 0;
1270 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1271 UcpHandleString(hf_ucp_parm_SM
);
1275 add_05O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1276 { /* Change address list */
1281 UcpHandleString(hf_ucp_parm_GAdC
);
1282 UcpHandleString(hf_ucp_parm_AC
);
1283 UcpHandleString(hf_ucp_parm_OAdC
);
1284 UcpHandleString(hf_ucp_parm_OAC
);
1285 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1286 for (idx
= 0; idx
< intval
; idx
++)
1287 UcpHandleString(hf_ucp_parm_AdC
);
1288 UcpHandleByte(hf_ucp_parm_A_D
);
1291 #define add_05R(a, b, c, d) add_01R(a, b, c, d)
1294 add_06O(proto_tree
*tree
, tvbuff_t
*tvb
)
1295 { /* Advice of accum. charges */
1298 UcpHandleString(hf_ucp_parm_AdC
);
1299 UcpHandleString(hf_ucp_parm_AC
);
1303 add_06R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1308 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1309 if (intval
== 'A') {
1310 UcpHandleTime(hf_ucp_parm_CT
);
1311 UcpHandleString(hf_ucp_parm_AAC
);
1312 tap_rec
->result
= 0;
1314 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1315 UcpHandleString(hf_ucp_parm_SM
);
1319 add_07O(proto_tree
*tree
, tvbuff_t
*tvb
)
1320 { /* Password management */
1323 UcpHandleString(hf_ucp_parm_AdC
);
1324 UcpHandleString(hf_ucp_parm_AC
);
1325 UcpHandleString(hf_ucp_parm_NAC
);
1328 #define add_07R(a, b, c, d) add_01R(a, b, c, d)
1331 add_08O(proto_tree
*tree
, tvbuff_t
*tvb
)
1332 { /* Leg. code management */
1335 UcpHandleString(hf_ucp_parm_AdC
);
1336 UcpHandleString(hf_ucp_parm_AC
);
1337 UcpHandleString(hf_ucp_parm_LAC
);
1338 UcpHandleString(hf_ucp_parm_L1P
);
1339 UcpHandleString(hf_ucp_parm_L3P
);
1340 UcpHandleString(hf_ucp_parm_LRC
);
1341 UcpHandleString(hf_ucp_parm_LUM
);
1342 UcpHandleString(hf_ucp_parm_LRP
);
1343 UcpHandleString(hf_ucp_parm_LST
);
1346 #define add_08R(a, b, c, d) add_01R(a, b, c, d)
1349 add_09O(proto_tree
*tree
, tvbuff_t
*tvb
)
1350 { /* Standard text information */
1353 UcpHandleString(hf_ucp_parm_LNo
);
1354 UcpHandleString(hf_ucp_parm_LST
);
1358 add_09R(proto_tree
*tree
, packet_info
*pinfo
,tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1364 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1365 if (intval
== 'A') {
1366 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1367 for (idx
= 0; idx
< intval
; idx
++)
1368 UcpHandleString(hf_ucp_parm_LST
);
1369 tap_rec
->result
= 0;
1371 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1372 UcpHandleString(hf_ucp_parm_SM
);
1376 add_10O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1377 { /* Change standard text */
1380 UcpHandleString(hf_ucp_parm_AdC
);
1381 UcpHandleString(hf_ucp_parm_AC
);
1382 UcpHandleString(hf_ucp_parm_LNo
);
1383 UcpHandleString(hf_ucp_parm_TNo
);
1384 UcpHandleData(hf_ucp_parm_STx
);
1385 UcpHandleInt(hf_ucp_parm_CS
);
1388 #define add_10R(a, b, c, d) add_01R(a, b, c, d)
1390 #define add_11O(a, b) add_06O(a, b) /* Request roaming info */
1393 add_11R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1399 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1400 if (intval
== 'A') {
1401 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1402 for (idx
= 0; idx
< intval
; idx
++)
1403 UcpHandleString(hf_ucp_parm_GA
);
1404 tap_rec
->result
= 0;
1406 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1407 UcpHandleString(hf_ucp_parm_SM
);
1411 add_12O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1412 { /* Change roaming */
1417 UcpHandleString(hf_ucp_parm_AdC
);
1418 UcpHandleString(hf_ucp_parm_AC
);
1419 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1420 for (idx
= 0; idx
< intval
; idx
++)
1421 UcpHandleString(hf_ucp_parm_GA
);
1424 #define add_12R(a, b, c, d) add_01R(a, b, c, d)
1426 #define add_13O(a, c) add_06O(a, c) /* Roaming reset */
1428 #define add_13R(a, b, c, d) add_01R(a, b, c, d)
1431 add_14O(proto_tree
*tree
, tvbuff_t
*tvb
)
1432 { /* Message retrieval */
1435 UcpHandleString(hf_ucp_parm_AdC
);
1436 UcpHandleString(hf_ucp_parm_AC
);
1437 UcpHandleString(hf_ucp_parm_MNo
);
1438 UcpHandleByte(hf_ucp_parm_R_T
);
1442 add_14R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1448 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1449 if (intval
== 'A') {
1450 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1452 * Spec is unclear here. Is 'SM' part of the Msg:s field or not?
1453 * For now, assume it is part of it...
1455 for (idx
= 0; idx
< intval
; idx
++)
1456 UcpHandleData(hf_ucp_data_section
);
1457 tap_rec
->result
= 0;
1459 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1460 UcpHandleString(hf_ucp_parm_SM
);
1465 add_15O(proto_tree
*tree
, tvbuff_t
*tvb
)
1466 { /* Request call barring */
1469 UcpHandleString(hf_ucp_parm_AdC
);
1470 UcpHandleString(hf_ucp_parm_AC
);
1471 UcpHandleTime(hf_ucp_parm_ST
);
1472 UcpHandleTime(hf_ucp_parm_SP
);
1475 #define add_15R(a, b, c, d) add_01R(a, b, c, d)
1477 #define add_16O(a, b) add_06O(a, b) /* Cancel call barring */
1479 #define add_16R(a, b, c, d) add_01R(a, b, c, d)
1482 add_17O(proto_tree
*tree
, tvbuff_t
*tvb
)
1483 { /* Request call diversion */
1486 UcpHandleString(hf_ucp_parm_AdC
);
1487 UcpHandleString(hf_ucp_parm_AC
);
1488 UcpHandleString(hf_ucp_parm_DAdC
);
1489 UcpHandleTime(hf_ucp_parm_ST
);
1490 UcpHandleTime(hf_ucp_parm_SP
);
1493 #define add_17R(a, b, c, d) add_01R(a, b, c, d)
1495 #define add_18O(a, b) add_06O(a, b) /* Cancel call diversion */
1497 #define add_18R(a, b, c, d) add_01R(a, b, c, d)
1500 add_19O(proto_tree
*tree
, tvbuff_t
*tvb
)
1501 { /* Request deferred delivery*/
1504 UcpHandleString(hf_ucp_parm_AdC
);
1505 UcpHandleString(hf_ucp_parm_AC
);
1506 UcpHandleTime(hf_ucp_parm_ST
);
1507 UcpHandleTime(hf_ucp_parm_SP
);
1510 #define add_19R(a, b, c, d) add_01R(a, b, c, d)
1512 #define add_20O(a, b) add_06O(a, b) /* Cancel deferred delivery */
1514 #define add_20R(a, b, c, d) add_01R(a, b, c, d)
1516 #define add_21O(a, b) add_06O(a, b) /* All features reset */
1518 #define add_21R(a, b, c, d) add_01R(a, b, c, d)
1521 add_22O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1522 { /* Call input w. add. CS */
1525 UcpHandleString(hf_ucp_parm_AdC
);
1526 UcpHandleString(hf_ucp_parm_OAdC
);
1527 UcpHandleString(hf_ucp_parm_OAC
);
1528 UcpHandleData(hf_ucp_data_section
);
1529 UcpHandleInt(hf_ucp_parm_CS
);
1532 #define add_22R(a, b, c, d) add_01R(a, b, c, d)
1535 add_23O(proto_tree
*tree
, tvbuff_t
*tvb
)
1536 { /* UCP version status */
1539 UcpHandleString(hf_ucp_parm_IVR5x
);
1540 UcpHandleByte(hf_ucp_parm_REQ_OT
);
1544 add_23R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1550 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1551 if (intval
== 'A') {
1552 UcpHandleByte(hf_ucp_parm_IVR5x
);
1553 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1554 for (idx
= 0; idx
< intval
; idx
++)
1555 UcpHandleInt(hf_ucp_hdr_OT
);
1556 tap_rec
->result
= 0;
1558 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1559 UcpHandleString(hf_ucp_parm_SM
);
1563 add_24O(proto_tree
*tree
, tvbuff_t
*tvb
)
1564 { /* Mobile subs. feature stat*/
1567 UcpHandleString(hf_ucp_parm_AdC
);
1568 UcpHandleString(hf_ucp_parm_AC
);
1569 UcpHandleByte(hf_ucp_parm_SSTAT
);
1573 add_24R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1579 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1580 if (intval
== 'A') {
1581 if ((intval
= tvb_get_uint8(tvb
, offset
++)) != '/') {
1582 proto_tree_add_item(tree
, hf_ucp_ga_roaming
, tvb
, offset
- 1, 1, ENC_NA
);
1583 if (intval
== 'N') {
1584 proto_tree_add_item(tree
, hf_ucp_not_subscribed
, tvb
, offset
-1, 1, ENC_NA
);
1588 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1589 for (idx
= 0; idx
< intval
; idx
++)
1590 UcpHandleData(hf_ucp_data_section
);
1593 if ((intval
= tvb_get_uint8(tvb
, offset
++)) != '/') {
1594 proto_tree_add_item(tree
, hf_ucp_call_barring
, tvb
, offset
- 1, 1, ENC_NA
);
1595 if (intval
== 'N') {
1596 proto_tree_add_item(tree
, hf_ucp_not_subscribed
, tvb
, offset
-1, 1, ENC_NA
);
1600 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1601 for (idx
= 0; idx
< intval
; idx
++)
1602 UcpHandleData(hf_ucp_data_section
);
1605 if ((intval
= tvb_get_uint8(tvb
, offset
++)) != '/') {
1606 proto_tree_add_item(tree
, hf_ucp_deferred_delivery
, tvb
, offset
- 1, 1, ENC_NA
);
1607 if (intval
== 'N') {
1608 proto_tree_add_item(tree
, hf_ucp_not_subscribed
, tvb
, offset
-1, 1, ENC_NA
);
1612 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1613 for (idx
= 0; idx
< intval
; idx
++)
1614 UcpHandleData(hf_ucp_data_section
);
1617 if ((intval
= tvb_get_uint8(tvb
, offset
++)) != '/') {
1618 proto_tree_add_item(tree
, hf_ucp_diversion
, tvb
, offset
- 1, 1, ENC_NA
);
1619 if (intval
== 'N') {
1620 proto_tree_add_item(tree
, hf_ucp_not_subscribed
, tvb
, offset
-1, 1, ENC_NA
);
1624 intval
= UcpHandleInt(hf_ucp_parm_NPL
);
1625 for (idx
= 0; idx
< intval
; idx
++)
1626 UcpHandleData(hf_ucp_data_section
);
1629 UcpHandleInt(hf_ucp_parm_LMN
);
1630 if ((intval
= tvb_get_uint8(tvb
, offset
++)) != '/') {
1631 if (intval
== 'N') {
1632 proto_tree_add_item(tree
, hf_ucp_not_subscribed
, tvb
, offset
-1, 1, ENC_NA
);
1636 UcpHandleInt(hf_ucp_parm_NMESS
);
1639 tap_rec
->result
= 0;
1641 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1642 UcpHandleString(hf_ucp_parm_SM
);
1646 add_30O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1647 { /* SMS message transfer */
1650 UcpHandleString(hf_ucp_parm_AdC
);
1651 UcpHandleString(hf_ucp_parm_OAdC
);
1652 UcpHandleString(hf_ucp_parm_AC
);
1653 UcpHandleByte(hf_ucp_parm_NRq
);
1654 UcpHandleString(hf_ucp_parm_NAdC
);
1655 UcpHandleInt(hf_ucp_parm_NPID
);
1656 UcpHandleByte(hf_ucp_parm_DD
);
1657 UcpHandleTime(hf_ucp_parm_DDT
); /* DDMMYYHHmm */
1658 UcpHandleTime(hf_ucp_parm_VP
); /* DDMMYYHHmm */
1659 UcpHandleIRAString(hf_ucp_parm_AMsg
);
1663 add_30R(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, ucp_tap_rec_t
*tap_rec
)
1668 intval
= UcpHandleByte(hf_ucp_parm_ACK
);
1669 if (intval
== 'A') {
1670 UcpHandleTime(hf_ucp_parm_MVP
); /* DDMMYYHHmm */
1671 tap_rec
->result
= 0;
1673 tap_rec
->result
= UcpHandleInt(hf_ucp_parm_EC
);
1675 UcpHandleString(hf_ucp_parm_SM
);
1679 add_31O(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1683 UcpHandleString(hf_ucp_parm_AdC
);
1684 UcpHandleInt(hf_ucp_parm_PID
);
1687 #define add_31R(a, b, c, d) add_01R(a, b, c, d)
1690 add_5xO(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
)
1691 { /* 50-series operations */
1694 int tmpoff
, oadc_offset
;
1695 proto_item
*ti
, *oadc_item
;
1698 UcpHandleString(hf_ucp_parm_AdC
);
1699 oadc_offset
= offset
;
1700 oadc_item
= UcpHandleString(hf_ucp_parm_OAdC
);
1701 UcpHandleString(hf_ucp_parm_AC
);
1702 UcpHandleByte(hf_ucp_parm_NRq
);
1703 UcpHandleString(hf_ucp_parm_NAdC
);
1704 UcpHandleByte(hf_ucp_parm_NT
);
1705 UcpHandleInt(hf_ucp_parm_NPID
);
1706 UcpHandleByte(hf_ucp_parm_LRq
);
1707 UcpHandleString(hf_ucp_parm_LRAd
);
1708 UcpHandleInt(hf_ucp_parm_LPID
);
1709 UcpHandleByte(hf_ucp_parm_DD
);
1710 UcpHandleTime(hf_ucp_parm_DDT
); /* DDMMYYHHmm */
1711 UcpHandleTime(hf_ucp_parm_VP
); /* DDMMYYHHmm */
1712 UcpHandleString(hf_ucp_parm_RPID
);
1713 UcpHandleTime(hf_ucp_parm_SCTS
); /* DDMMYYhhmmss */
1714 UcpHandleByte(hf_ucp_parm_Dst
);
1715 UcpHandleInt(hf_ucp_parm_Rsn
);
1716 UcpHandleTime(hf_ucp_parm_DSCTS
); /* DDMMYYhhmmss */
1717 intval
= UcpHandleByte(hf_ucp_parm_MT
);
1718 UcpHandleString(hf_ucp_parm_NB
);
1720 UcpHandleData(hf_ucp_data_section
);
1722 UcpHandleIRAString(hf_ucp_parm_AMsg
);
1723 UcpHandleByte(hf_ucp_parm_MMS
);
1724 UcpHandleByte(hf_ucp_parm_PR
);
1725 UcpHandleByte(hf_ucp_parm_DCs
);
1726 UcpHandleByte(hf_ucp_parm_MCLs
);
1727 UcpHandleByte(hf_ucp_parm_RPI
);
1728 if (tvb_get_uint8(tvb
, offset
++) != '/') {
1729 proto_tree_add_string(tree
, hf_ucp_parm_CPg
, tvb
, offset
- 1,1,
1730 "(reserved for Code Page)");
1733 if (tvb_get_uint8(tvb
, offset
++) != '/') {
1734 proto_tree_add_string(tree
, hf_ucp_parm_RPLy
, tvb
, offset
- 1,1,
1735 "(reserved for Reply type)");
1738 intval
= UcpHandleInt(hf_ucp_parm_OTOA
);
1739 if (intval
== 5039) {
1740 ti
= ucp_handle_alphanum_OAdC(tree
, pinfo
, tvb
, hf_ucp_parm_OAdC
, &oadc_offset
);
1741 if (ti
&& oadc_item
) {
1742 proto_tree_move_item(tree
, oadc_item
, ti
);
1743 proto_item_set_hidden(oadc_item
);
1746 UcpHandleString(hf_ucp_parm_HPLMN
);
1747 tmpoff
= offset
; /* Extra services */
1748 while (tvb_get_uint8(tvb
, tmpoff
++) != '/')
1750 if ((tmpoff
- offset
) > 1) {
1751 int len
= tmpoff
- offset
- 1;
1752 proto_tree
*subtree
;
1754 ti
= proto_tree_add_item(tree
, hf_ucp_parm_XSer
, tvb
, offset
, len
, ENC_NA
);
1755 tmptvb
= tvb_new_subset_length(tvb
, offset
, len
+ 1);
1756 subtree
= proto_item_add_subtree(ti
, ett_XSer
);
1757 ucp_handle_XSer(subtree
, tmptvb
);
1760 UcpHandleDataString(hf_ucp_parm_RES4
);
1761 UcpHandleDataString(hf_ucp_parm_RES5
);
1764 #define add_5xR(a, b, c, d) add_30R(a, b, c, d)
1767 add_6xO(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, uint8_t OT
)
1768 { /* 60-series operations */
1771 UcpHandleString(hf_ucp_parm_OAdC
);
1772 UcpHandleByte(hf_ucp_parm_OTON
);
1773 UcpHandleByte(hf_ucp_parm_ONPI
);
1775 UcpHandleByte(hf_ucp_parm_STYP0
);
1777 UcpHandleByte(hf_ucp_parm_STYP1
);
1779 UcpHandleIRAString(hf_ucp_parm_PWD
);
1780 UcpHandleIRAString(hf_ucp_parm_NPWD
);
1781 UcpHandleString(hf_ucp_parm_VERS
);
1782 UcpHandleString(hf_ucp_parm_LAdC
);
1783 UcpHandleByte(hf_ucp_parm_LTON
);
1784 UcpHandleByte(hf_ucp_parm_LNPI
);
1786 UcpHandleInt(hf_ucp_parm_OPID
);
1788 UcpHandleDataString(hf_ucp_parm_RES1
);
1790 UcpHandleDataString(hf_ucp_parm_RES2
);
1794 #define add_6xR(a, b, c, d) add_01R(a, b, c, d)
1797 * End of convenient shorthands
1799 #undef UcpHandleString
1800 #undef UcpHandleIRAString
1801 #undef UcpHandleByte
1803 #undef UcpHandleTime
1804 #undef UcpHandleData
1807 get_ucp_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
1812 offset
= offset
+ 4;
1813 for (i
= 0; i
< UCP_LEN_LEN
; i
++) { /* Length */
1814 intval
= 10 * intval
+
1815 (tvb_get_uint8(tvb
, offset
) - '0');
1823 * The actual dissector
1826 /* We get here only with at least LEN+2 bytes in the buffer */
1829 dissect_ucp_common(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
1831 int offset
= 0; /* Offset in packet within tvbuff */
1832 uint8_t O_R
; /* Request or response */
1833 uint8_t OT
; /* Operation type */
1838 ucp_tap_rec_t
*tap_rec
; /* Tap record */
1840 /* Set up structures needed to add the protocol subtree and manage it */
1843 proto_tree
*ucp_tree
;
1844 proto_tree
*sub_tree
;
1847 /* Make entries in Protocol column */
1848 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "UCP");
1849 col_clear(pinfo
->cinfo
, COL_INFO
);
1851 if (tvb_get_uint8(tvb
, 0) != UCP_STX
){
1852 proto_tree_add_expert(tree
, pinfo
, &ei_ucp_stx_missing
, tvb
, 0, -1);
1853 return tvb_captured_length(tvb
);
1856 /* Get data needed for dissect_ucp_common */
1857 result
= check_ucp(tvb
, &endpkt
);
1859 O_R
= tvb_get_uint8(tvb
, UCP_O_R_OFFSET
);
1860 OT
= tvb_get_uint8(tvb
, UCP_OT_OFFSET
) - '0';
1861 OT
= 10 * OT
+ (tvb_get_uint8(tvb
, UCP_OT_OFFSET
+ 1) - '0');
1863 /* Create Tap record */
1864 tap_rec
= wmem_new0(wmem_packet_scope(), ucp_tap_rec_t
);
1865 tap_rec
->message_type
= (O_R
== 'O' ? 0 : 1);
1866 tap_rec
->operation
= OT
;
1868 /* Make entries in Info column on summary display */
1869 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "%s (%s)",
1870 val_to_str_ext_const(OT
, &vals_hdr_OT_ext
, "unknown operation"),
1871 val_to_str(O_R
, vals_hdr_O_R
, "Unknown (%d)"));
1872 if (result
== UCP_INV_CHK
)
1873 col_append_str(pinfo
->cinfo
, COL_INFO
, " [checksum invalid]");
1875 /* In the interest of speed, if "tree" is NULL, don't do any work not
1876 necessary to generate protocol tree items. */
1879 /* create display subtree for the protocol */
1880 ti
= proto_tree_add_item(tree
, proto_ucp
, tvb
, 0, -1, ENC_NA
);
1882 ucp_tree
= proto_item_add_subtree(ti
, ett_ucp
);
1884 * Process the packet here.
1885 * Transaction number
1887 offset
++; /* Skip <stx> */
1888 intval
= tvb_get_uint8(tvb
, offset
+0) - '0';
1889 intval
= 10 * intval
+ (tvb_get_uint8(tvb
, offset
+1) - '0');
1890 proto_tree_add_uint(ucp_tree
, hf_ucp_hdr_TRN
, tvb
, offset
,
1891 UCP_TRN_LEN
, intval
);
1892 offset
+= UCP_TRN_LEN
+ 1; /* Skip TN/ */
1895 for (i
= 0; i
< UCP_LEN_LEN
; i
++) { /* Length */
1896 intval
= 10 * intval
+
1897 (tvb_get_uint8(tvb
, offset
+i
) - '0');
1899 proto_tree_add_uint(ucp_tree
, hf_ucp_hdr_LEN
, tvb
, offset
,
1900 UCP_LEN_LEN
, intval
);
1901 offset
+= UCP_LEN_LEN
+ 1; /* skip LEN/ */
1903 proto_tree_add_uint(ucp_tree
, hf_ucp_hdr_O_R
, tvb
, offset
,
1906 offset
+= UCP_O_R_LEN
+ 1; /* skip Operation_type/ */
1908 proto_tree_add_uint(ucp_tree
, hf_ucp_hdr_OT
, tvb
, offset
,
1910 offset
+= UCP_OT_LEN
;
1913 * Variable part starts here.
1916 tmp_tvb
= tvb_new_subset_remaining(tvb
, offset
);
1917 sub_ti
= proto_tree_add_item(ucp_tree
, hf_ucp_oper_section
, tvb
,
1918 offset
, endpkt
- offset
, ENC_NA
);
1919 sub_tree
= proto_item_add_subtree(sub_ti
, ett_sub
);
1923 O_R
== 'O' ? add_00O(sub_tree
, tmp_tvb
) : add_00R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1926 O_R
== 'O' ? add_01O(sub_tree
, pinfo
, tmp_tvb
) : add_01R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1929 O_R
== 'O' ? add_02O(sub_tree
, pinfo
, tmp_tvb
) : add_02R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1932 O_R
== 'O' ? add_03O(sub_tree
, pinfo
, tmp_tvb
) : add_03R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1935 O_R
== 'O' ? add_04O(sub_tree
, tmp_tvb
) : add_04R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1938 O_R
== 'O' ? add_05O(sub_tree
, pinfo
, tmp_tvb
) : add_05R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1941 O_R
== 'O' ? add_06O(sub_tree
, tmp_tvb
) : add_06R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1944 O_R
== 'O' ? add_07O(sub_tree
,tmp_tvb
) : add_07R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1947 O_R
== 'O' ? add_08O(sub_tree
,tmp_tvb
) : add_08R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1950 O_R
== 'O' ? add_09O(sub_tree
,tmp_tvb
) : add_09R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1953 O_R
== 'O' ? add_10O(sub_tree
, pinfo
, tmp_tvb
) : add_10R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1956 O_R
== 'O' ? add_11O(sub_tree
,tmp_tvb
) : add_11R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1959 O_R
== 'O' ? add_12O(sub_tree
, pinfo
, tmp_tvb
) : add_12R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1962 O_R
== 'O' ? add_13O(sub_tree
, tmp_tvb
) : add_13R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1965 O_R
== 'O' ? add_14O(sub_tree
,tmp_tvb
) : add_14R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1968 O_R
== 'O' ? add_15O(sub_tree
,tmp_tvb
) : add_15R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1971 O_R
== 'O' ? add_16O(sub_tree
,tmp_tvb
) : add_16R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1974 O_R
== 'O' ? add_17O(sub_tree
,tmp_tvb
) : add_17R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1977 O_R
== 'O' ? add_18O(sub_tree
,tmp_tvb
) : add_18R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1980 O_R
== 'O' ? add_19O(sub_tree
,tmp_tvb
) : add_19R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1983 O_R
== 'O' ? add_20O(sub_tree
,tmp_tvb
) : add_20R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1986 O_R
== 'O' ? add_21O(sub_tree
,tmp_tvb
) : add_21R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1989 O_R
== 'O' ? add_22O(sub_tree
, pinfo
, tmp_tvb
) : add_22R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1992 O_R
== 'O' ? add_23O(sub_tree
,tmp_tvb
) : add_23R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1995 O_R
== 'O' ? add_24O(sub_tree
,tmp_tvb
) : add_24R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
1998 O_R
== 'O' ? add_30O(sub_tree
, pinfo
, tmp_tvb
) : add_30R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
2001 O_R
== 'O' ? add_31O(sub_tree
, pinfo
, tmp_tvb
) : add_31R(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
2003 case 51: case 52: case 53: case 54: case 55: case 56: case 57:
2005 O_R
== 'O' ? add_5xO(sub_tree
, pinfo
, tmp_tvb
) : add_5xR(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
2008 O_R
== 'O' ? add_6xO(sub_tree
, pinfo
, tmp_tvb
,OT
) : add_6xR(sub_tree
, pinfo
, tmp_tvb
, tap_rec
);
2015 /* Queue packet for Tap */
2016 tap_queue_packet(ucp_tap
, pinfo
, tap_rec
);
2018 return tvb_captured_length(tvb
);
2022 dissect_ucp_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
2024 tcp_dissect_pdus(tvb
, pinfo
, tree
, ucp_desegment
, UCP_HEADER_SIZE
,
2025 get_ucp_pdu_len
, dissect_ucp_common
, data
);
2026 return tvb_captured_length(tvb
);
2030 * The heuristic dissector
2034 dissect_ucp_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
2036 conversation_t
*conversation
;
2040 if (tvb_captured_length(tvb
) < UCP_HEADER_SIZE
)
2043 if ((tvb_get_uint8(tvb
, 0) != UCP_STX
) ||
2044 (tvb_get_uint8(tvb
, UCP_TRN_OFFSET
+ UCP_TRN_LEN
) != '/') ||
2045 (tvb_get_uint8(tvb
, UCP_LEN_OFFSET
+ UCP_LEN_LEN
) != '/') ||
2046 (tvb_get_uint8(tvb
, UCP_O_R_OFFSET
+ UCP_O_R_LEN
) != '/') ||
2047 (tvb_get_uint8(tvb
, UCP_OT_OFFSET
+ UCP_OT_LEN
) != '/'))
2050 if (try_val_to_str(tvb_get_uint8(tvb
, UCP_O_R_OFFSET
), vals_hdr_O_R
) == NULL
)
2054 * Ok, looks like a valid packet
2057 /* Set up a conversation with attached dissector so dissect_ucp_heur
2058 * won't be called any more for this TCP connection.
2061 conversation
= find_or_create_conversation(pinfo
);
2062 conversation_set_dissector(conversation
, ucp_handle
);
2064 dissect_ucp_tcp(tvb
, pinfo
, tree
, data
);
2069 /* Register the protocol with Wireshark */
2071 proto_register_ucp(void)
2074 /* Setup list of fields */
2075 static hf_register_info hf
[] = {
2077 { "Transaction Reference Number", "ucp.hdr.TRN",
2078 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2079 "Transaction number for this command, used in windowing.",
2084 { "Length", "ucp.hdr.LEN",
2085 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2086 "Total number of characters between <stx>...<etx>.",
2091 { "Type", "ucp.hdr.O_R",
2092 FT_CHAR
, BASE_HEX
, VALS(vals_hdr_O_R
), 0x00,
2093 "Your basic 'is a request or response'.",
2098 { "Operation", "ucp.hdr.OT",
2099 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &vals_hdr_OT_ext
, 0x00,
2100 "The operation that is requested with this message.",
2104 { &hf_ucp_oper_section
,
2105 { "Data", "ucp.parm",
2106 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2107 "The actual content of the operation.",
2112 { "AdC", "ucp.parm.AdC",
2113 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2114 "Address code recipient.",
2118 { &hf_ucp_parm_OAdC
,
2119 { "OAdC", "ucp.parm.OAdC",
2120 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2121 "Address code originator.",
2125 { &hf_ucp_parm_DAdC
,
2126 { "DAdC", "ucp.parm.DAdC",
2127 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2128 "Diverted address code.",
2133 { "AC", "ucp.parm.AC",
2134 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2135 "Authentication code.",
2140 { "OAC", "ucp.parm.OAC",
2141 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2142 "Authentication code, originator.",
2147 { "NAC", "ucp.parm.NAC",
2148 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2149 "New authentication code.",
2154 { "BAS", "ucp.parm.BAS",
2155 FT_CHAR
, BASE_HEX
, VALS(vals_parm_BAS
), 0x00,
2156 "Barring status flag.",
2161 { "LAR", "ucp.parm.LAR",
2162 FT_CHAR
, BASE_HEX
, VALS(vals_parm_LAR
), 0x00,
2163 "Leg. code for all calls flag.",
2168 { "LAC", "ucp.parm.LAC",
2169 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2170 "New leg. code for all calls.",
2175 { "L1R", "ucp.parm.L1R",
2176 FT_CHAR
, BASE_HEX
, VALS(vals_parm_L1R
), 0x00,
2177 "Leg. code for priority 1 flag.",
2182 { "L1P", "ucp.parm.L1P",
2183 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2184 "New leg. code for level 1 priority.",
2189 { "L3R", "ucp.parm.L3R",
2190 FT_CHAR
, BASE_HEX
, VALS(vals_parm_L3R
), 0x00,
2191 "Leg. code for priority 3 flag.",
2196 { "L3P", "ucp.parm.L3P",
2197 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2198 "New leg. code for level 3 priority.",
2203 { "LCR", "ucp.parm.LCR",
2204 FT_CHAR
, BASE_HEX
, VALS(vals_parm_LCR
), 0x00,
2205 "Leg. code for reverse charging flag.",
2210 { "LUR", "ucp.parm.LUR",
2211 FT_CHAR
, BASE_HEX
, VALS(vals_parm_LUR
), 0x00,
2212 "Leg. code for urgent message flag.",
2217 { "LRR", "ucp.parm.LRR",
2218 FT_CHAR
, BASE_HEX
, VALS(vals_parm_LRR
), 0x00,
2219 "Leg. code for repetition flag.",
2224 { "RT", "ucp.parm.RT",
2225 FT_CHAR
, BASE_HEX
, VALS(vals_parm_RT
), 0x00,
2231 { "NoN", "ucp.parm.NoN",
2232 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2233 "Maximum number of numerical characters accepted.",
2238 { "NoA", "ucp.parm.NoA",
2239 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2240 "Maximum number of alphanumerical characters accepted.",
2245 { "NoB", "ucp.parm.NoB",
2246 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2247 "Maximum number of data bits accepted.",
2252 { "PNC", "ucp.parm.PNC",
2253 FT_CHAR
, BASE_HEX
, VALS(vals_parm_PNC
), 0x00,
2254 "Paging network controller.",
2258 { &hf_ucp_parm_AMsg
,
2259 { "AMsg", "ucp.parm.AMsg",
2260 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2261 "The alphanumeric message that is being sent.",
2266 { "LNo", "ucp.parm.LNo",
2267 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2268 "Standard text list number requested by calling party.",
2273 { "LST", "ucp.parm.LST",
2274 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2275 "Legitimisation code for standard text.",
2280 { "TNo", "ucp.parm.TNo",
2281 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2282 "Standard text number requested by calling party.",
2287 { "CS", "ucp.parm.CS",
2288 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2289 "Additional character set number.",
2294 { "PID", "ucp.parm.PID",
2295 FT_UINT16
, BASE_DEC
, VALS(vals_parm_PID
), 0x00,
2301 { "NPL", "ucp.parm.NPL",
2302 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2303 "Number of parameters in the following list.",
2308 { "GA", "ucp.parm.GA",
2309 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2310 "GA?? haven't got a clue.",
2315 { "RP", "ucp.parm.RP",
2316 FT_CHAR
, BASE_HEX
, VALS(vals_parm_RP
), 0x00,
2317 "Repetition requested.",
2322 { "LRP", "ucp.parm.LRP",
2323 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2324 "Legitimisation code for repetition.",
2329 { "PR", "ucp.parm.PR",
2330 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2331 "Priority requested.",
2336 { "LPR", "ucp.parm.LPR",
2337 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2338 "Legitimisation code for priority requested.",
2343 { "UM", "ucp.parm.UM",
2344 FT_CHAR
, BASE_HEX
, VALS(vals_parm_UM
), 0x00,
2345 "Urgent message indicator.",
2350 { "LUM", "ucp.parm.LUM",
2351 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2352 "Legitimisation code for urgent message.",
2357 { "RC", "ucp.parm.RC",
2358 FT_CHAR
, BASE_HEX
, VALS(vals_parm_RC
), 0x00,
2359 "Reverse charging request.",
2364 { "LRC", "ucp.parm.LRC",
2365 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2366 "Legitimisation code for reverse charging.",
2371 { "NRq", "ucp.parm.NRq",
2372 FT_CHAR
, BASE_HEX
, VALS(vals_parm_NRq
), 0x00,
2373 "Notification request.",
2377 { &hf_ucp_parm_GAdC
,
2378 { "GAdC", "ucp.parm.GAdC",
2379 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2380 "Group address code.",
2385 { "A_D", "ucp.parm.A_D",
2386 FT_CHAR
, BASE_HEX
, VALS(vals_parm_A_D
), 0x00,
2387 "Add to/delete from fixed subscriber address list record.",
2392 { "CT", "ucp.parm.CT",
2393 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2394 "Accumulated charges timestamp.",
2399 { "AAC", "ucp.parm.AAC",
2400 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2401 "Accumulated charges.",
2406 { "MNo", "ucp.parm.MNo",
2407 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2413 { "R_T", "ucp.parm.R_T",
2414 FT_CHAR
, BASE_HEX
, VALS(vals_parm_R_T
), 0x00,
2419 { &hf_ucp_parm_NAdC
,
2420 { "NAdC", "ucp.parm.NAdC",
2421 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2422 "Notification address.",
2427 { "NT", "ucp.parm.NT",
2428 FT_CHAR
, BASE_HEX
, VALS(vals_parm_NT
), 0x00,
2429 "Notification type.",
2433 { &hf_ucp_parm_IVR5x
,
2434 { "IVR5x", "ucp.parm.IVR5x",
2435 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2436 "UCP release number supported/accepted.",
2440 { &hf_ucp_parm_REQ_OT
,
2441 { "REQ_OT", "ucp.parm.REQ_OT",
2442 FT_CHAR
, BASE_HEX
, VALS(vals_parm_REQ_OT
), 0x00,
2443 "UCP release number supported/accepted.",
2447 { &hf_ucp_parm_SSTAT
,
2448 { "SSTAT", "ucp.parm.SSTAT",
2449 FT_CHAR
, BASE_HEX
, VALS(vals_parm_SSTAT
), 0x00,
2450 "Supplementary services for which status is requested.",
2455 { "LMN", "ucp.parm.LMN",
2456 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2457 "Last message number.",
2461 { &hf_ucp_parm_NMESS
,
2462 { "NMESS", "ucp.parm.NMESS",
2463 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2464 "Number of stored messages.",
2468 { &hf_ucp_parm_NPID
,
2469 { "NPID", "ucp.parm.NPID",
2470 FT_UINT16
, BASE_DEC
, VALS(vals_parm_PID
), 0x00,
2471 "Notification PID value.",
2476 { "LRq", "ucp.parm.LRq",
2477 FT_CHAR
, BASE_HEX
, VALS(vals_parm_LRq
), 0x00,
2478 "Last resort address request.",
2482 { &hf_ucp_parm_LRAd
,
2483 { "LRAd", "ucp.parm.LRAd",
2484 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2485 "Last resort address.",
2489 { &hf_ucp_parm_LPID
,
2490 { "LPID", "ucp.parm.LPID",
2491 FT_UINT16
, BASE_DEC
, VALS(vals_parm_PID
), 0x00,
2492 "Last resort PID value.",
2497 { "DD", "ucp.parm.DD",
2498 FT_CHAR
, BASE_HEX
, VALS(vals_parm_DD
), 0x00,
2499 "Deferred delivery requested.",
2504 { "DDT", "ucp.parm.DDT",
2505 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2506 "Deferred delivery time.",
2511 { "STx", "ucp.parm.STx",
2512 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2518 { "ST", "ucp.parm.ST",
2519 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2525 { "SP", "ucp.parm.SP",
2526 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2532 { "VP", "ucp.parm.VP",
2533 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2538 { &hf_ucp_parm_RPID
,
2539 { "RPID", "ucp.parm.RPID",
2540 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2545 { &hf_ucp_parm_SCTS
,
2546 { "SCTS", "ucp.parm.SCTS",
2547 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2548 "Service Centre timestamp.",
2553 { "Dst", "ucp.parm.Dst",
2554 FT_CHAR
, BASE_HEX
, VALS(vals_parm_Dst
), 0x00,
2560 { "Rsn", "ucp.parm.Rsn",
2561 FT_UINT16
, BASE_DEC
| BASE_EXT_STRING
, &vals_parm_Rsn_ext
, 0x00,
2566 { &hf_ucp_parm_DSCTS
,
2567 { "DSCTS", "ucp.parm.DSCTS",
2568 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2569 "Delivery timestamp.",
2574 { "MT", "ucp.parm.MT",
2575 FT_CHAR
, BASE_HEX
, VALS(vals_parm_MT
), 0x00,
2581 { "NB", "ucp.parm.NB",
2582 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2583 "No. of bits in Transparent Data (TD) message.",
2587 { &hf_ucp_data_section
,
2588 { "Data", "ucp.message",
2589 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2590 "The actual message or data.",
2595 { "MMS", "ucp.parm.MMS",
2596 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2597 "More messages to send.",
2602 { "DCs", "ucp.parm.DCs",
2603 FT_CHAR
, BASE_HEX
, VALS(vals_parm_DCs
), 0x00,
2604 "Data coding scheme (deprecated).",
2608 { &hf_ucp_parm_MCLs
,
2609 { "MCLs", "ucp.parm.MCLs",
2610 FT_CHAR
, BASE_HEX
, VALS(vals_parm_MCLs
), 0x00,
2616 { "RPI", "ucp.parm.RPI",
2617 FT_CHAR
, BASE_HEX
, VALS(vals_parm_RPI
), 0x00,
2623 { "CPg", "ucp.parm.CPg",
2624 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2625 "Reserved for Code Page.",
2629 { &hf_ucp_parm_RPLy
,
2630 { "RPLy", "ucp.parm.RPLy",
2631 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2632 "Reserved for Reply type.",
2636 { &hf_ucp_parm_OTOA
,
2637 { "OTOA", "ucp.parm.OTOA",
2638 FT_UINT16
, BASE_DEC
, VALS(vals_parm_OTOA
), 0x00,
2639 "Originator Type Of Address.",
2643 { &hf_ucp_parm_HPLMN
,
2644 { "HPLMN", "ucp.parm.HPLMN",
2645 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2646 "Home PLMN address.",
2650 { &hf_ucp_parm_XSer
,
2651 { "Extra services:", "ucp.parm.XSer",
2652 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2657 { &hf_ucp_parm_RES4
,
2658 { "RES4", "ucp.parm.RES4",
2659 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2660 "Reserved for future use.",
2664 { &hf_ucp_parm_RES5
,
2665 { "RES5", "ucp.parm.RES5",
2666 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2667 "Reserved for future use.",
2671 { &hf_ucp_parm_OTON
,
2672 { "OTON", "ucp.parm.OTON",
2673 FT_CHAR
, BASE_HEX
, VALS(vals_parm_OTON
), 0x00,
2674 "Originator type of number.",
2678 { &hf_ucp_parm_ONPI
,
2679 { "ONPI", "ucp.parm.ONPI",
2680 FT_CHAR
, BASE_HEX
, VALS(vals_parm_ONPI
), 0x00,
2681 "Originator numbering plan id.",
2685 { &hf_ucp_parm_STYP0
,
2686 { "STYP0", "ucp.parm.STYP0",
2687 FT_CHAR
, BASE_HEX
, VALS(vals_parm_STYP0
), 0x00,
2688 "Subtype of operation.",
2692 { &hf_ucp_parm_STYP1
,
2693 { "STYP1", "ucp.parm.STYP1",
2694 FT_CHAR
, BASE_HEX
, VALS(vals_parm_STYP1
), 0x00,
2695 "Subtype of operation.",
2700 { "PWD", "ucp.parm.PWD",
2701 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2702 "Current password.",
2706 { &hf_ucp_parm_NPWD
,
2707 { "NPWD", "ucp.parm.NPWD",
2708 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2713 { &hf_ucp_parm_VERS
,
2714 { "VERS", "ucp.parm.VERS",
2715 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2720 { &hf_ucp_parm_LAdC
,
2721 { "LAdC", "ucp.parm.LAdC",
2722 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2723 "Address for VSMSC list operation.",
2727 { &hf_ucp_parm_LTON
,
2728 { "LTON", "ucp.parm.LTON",
2729 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2730 "Type of number list address.",
2734 { &hf_ucp_parm_LNPI
,
2735 { "LNPI", "ucp.parm.LNPI",
2736 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2737 "Numbering plan id. list address.",
2741 { &hf_ucp_parm_OPID
,
2742 { "OPID", "ucp.parm.OPID",
2743 FT_UINT8
, BASE_DEC
, VALS(vals_parm_OPID
), 0x00,
2744 "Originator protocol identifier.",
2748 { &hf_ucp_parm_RES1
,
2749 { "RES1", "ucp.parm.RES1",
2750 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2751 "Reserved for future use.",
2755 { &hf_ucp_parm_RES2
,
2756 { "RES2", "ucp.parm.RES2",
2757 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2758 "Reserved for future use.",
2763 { "(N)Ack", "ucp.parm.ACK",
2764 FT_CHAR
, BASE_HEX
, VALS(vals_parm_ACK
), 0x00,
2765 "Positive or negative acknowledge of the operation.",
2770 { "MVP", "ucp.parm.MVP",
2771 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
2772 "Modified validity period.",
2777 { "Error code", "ucp.parm.EC",
2778 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &vals_parm_EC_ext
, 0x00,
2779 "The result of the requested operation.",
2784 { "SM", "ucp.parm.SM",
2785 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2790 { &hf_ucp_ga_roaming
,
2791 { "GA roaming definitions", "ucp.parm.ga_roaming",
2792 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2797 { &hf_ucp_call_barring
,
2798 { "Call barring definitions", "ucp.parm.call_barring",
2799 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2804 { &hf_ucp_deferred_delivery
,
2805 { "Deferred delivery definitions", "ucp.parm.deferred_delivery",
2806 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2811 { &hf_ucp_diversion
,
2812 { "Diversion definitions", "ucp.parm.diversion",
2813 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2818 { &hf_ucp_not_subscribed
,
2819 { "Not subscribed/not allowed", "ucp.parm.not_subscribed",
2820 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2826 { "Type of service", "ucp.xser.service",
2827 FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, &vals_xser_service_ext
, 0x00,
2828 "The type of service specified.",
2833 { "Length", "ucp.xser.length",
2834 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
2840 { "Data", "ucp.xser.data",
2841 FT_STRING
, BASE_NONE
, NULL
, 0x00,
2847 /* Setup protocol subtree array */
2848 static int *ett
[] = {
2854 static ei_register_info ei
[] = {
2855 { &ei_ucp_stx_missing
, { "ucp.stx_missing", PI_MALFORMED
, PI_ERROR
, "UCP_STX missing, this is not a new packet", EXPFILL
}},
2856 { &ei_ucp_intstring_invalid
, { "ucp.intstring.invalid", PI_MALFORMED
, PI_ERROR
, "Invalid integer string", EXPFILL
}},
2857 { &ei_ucp_hexstring_invalid
, { "ucp.hexstring.invalid", PI_PROTOCOL
, PI_WARN
, "Invalid hex string", EXPFILL
}},
2858 { &ei_ucp_short_data
, { "ucp.short_data", PI_PROTOCOL
, PI_WARN
, "Short Data (?)", EXPFILL
}}
2861 module_t
*ucp_module
;
2862 expert_module_t
* expert_ucp
;
2864 /* Register the protocol name and description */
2865 proto_ucp
= proto_register_protocol("Universal Computer Protocol",
2868 /* Required function calls to register header fields and subtrees used */
2869 proto_register_field_array(proto_ucp
, hf
, array_length(hf
));
2870 proto_register_subtree_array(ett
, array_length(ett
));
2871 expert_ucp
= expert_register_protocol(proto_ucp
);
2872 expert_register_field_array(expert_ucp
, ei
, array_length(ei
));
2874 /* Register the dissector handle */
2875 ucp_handle
= register_dissector("ucp", dissect_ucp_tcp
, proto_ucp
);
2877 /* Register for tapping */
2878 ucp_tap
= register_tap("ucp");
2880 /* register preferences */
2881 ucp_module
= prefs_register_protocol(proto_ucp
, NULL
);
2882 prefs_register_bool_preference(ucp_module
, "desegment_ucp_messages",
2883 "Reassemble UCP messages spanning multiple TCP segments",
2884 "Whether the UCP dissector should reassemble messages spanning"
2885 " multiple TCP segments."
2886 " To use this option, you must also enable "
2887 "\"Allow subdissectors to reassemble TCP streams\" in the "
2888 "TCP protocol settings.",
2893 proto_reg_handoff_ucp(void)
2896 * UCP can be spoken on any port so, when not on a specific port, try heuristic
2897 * whenever TCP is spoken.
2899 heur_dissector_add("tcp", dissect_ucp_heur
, "UCP over TCP", "ucp_tcp", proto_ucp
, HEURISTIC_ENABLE
);
2902 * Also register as a dissector that can be selected by a TCP port number via "decode as".
2904 dissector_add_for_decode_as_with_preference("tcp.port", ucp_handle
);
2907 stats_tree_cfg
*st_config
= stats_tree_register("ucp", "ucp_messages", "_UCP Messages", 0,
2908 ucp_stats_tree_per_packet
, ucp_stats_tree_init
, NULL
);
2909 stats_tree_set_group(st_config
, REGISTER_TELEPHONY_GROUP_UNSORTED
);
2913 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2918 * indent-tabs-mode: nil
2921 * vi: set shiftwidth=4 tabstop=8 expandtab:
2922 * :indentSize=4:tabSize=8:noTabs=true: