2 * Routines for Universal Computer Protocol dissection
3 * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl>
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * Dissector of a UCP (Universal Computer Protocol) PDU, as defined for the
27 * ERMES paging system in ETS 300 133-3 (2nd final draft, September 1997,
29 * Includes the extension of EMI-UCP interface (V4.0, May 2001, www.cmgwds.com)
45 #include <epan/packet.h>
46 #include <epan/prefs.h>
47 #include <epan/emem.h>
48 #include "packet-tcp.h"
50 /* #include "packet-ucp.h" */ /* We autoregister */
53 static void dissect_ucp_common(tvbuff_t *, packet_info *, proto_tree *);
56 gboolean ucp_desegment = TRUE;
57 /* STX + TRN 2 num. char.+ LEN 5 num. char. + O/R Char 'O' or 'R' + OT 2 num. char. */
58 #define UCP_HEADER_SIZE 11
61 * Convert ASCII-hex character to binary equivalent. No checks, assume
62 * is valid hex character.
64 #define AHex2Bin(n) (((n) & 0x40) ? ((n) & 0x0F) + 9 : ((n) & 0x0F))
66 #define UCP_STX 0x02 /* Start of UCP PDU */
67 #define UCP_ETX 0x03 /* End of UCP PDU */
69 #define UCP_MALFORMED -1 /* Not a valid PDU */
70 #define UCP_SHORTENED -2 /* May be valid but short */
71 #define UCP_INV_CHK -3 /* Checksum doesn't add up */
73 #define UCP_O_R_OFFSET 10 /* Location of O/R field*/
74 #define UCP_OT_OFFSET 12 /* Location of OT field */
76 #define UCP_TRN_LEN 2 /* Length of TRN-field */
77 #define UCP_LEN_LEN 5 /* Length of LEN-field */
78 #define UCP_O_R_LEN 1 /* Length of O/R-field */
79 #define UCP_OT_LEN 2 /* Length of OT-field */
82 * Initialize the protocol and registered fields
84 * Header (fixed) section
86 static int proto_ucp = -1;
88 static int hf_ucp_hdr_TRN = -1;
89 static int hf_ucp_hdr_LEN = -1;
90 static int hf_ucp_hdr_O_R = -1;
91 static int hf_ucp_hdr_OT = -1;
94 * Data (variable) section
96 static int hf_ucp_oper_section = -1;
97 static int hf_ucp_parm_AdC = -1;
98 static int hf_ucp_parm_OAdC = -1;
99 static int hf_ucp_parm_DAdC = -1;
100 static int hf_ucp_parm_AC = -1;
101 static int hf_ucp_parm_OAC = -1;
102 static int hf_ucp_parm_BAS = -1;
103 static int hf_ucp_parm_LAR = -1;
104 static int hf_ucp_parm_LAC = -1;
105 static int hf_ucp_parm_L1R = -1;
106 static int hf_ucp_parm_L1P = -1;
107 static int hf_ucp_parm_L3R = -1;
108 static int hf_ucp_parm_L3P = -1;
109 static int hf_ucp_parm_LCR = -1;
110 static int hf_ucp_parm_LUR = -1;
111 static int hf_ucp_parm_LRR = -1;
112 static int hf_ucp_parm_RT = -1;
113 static int hf_ucp_parm_NoN = -1;
114 static int hf_ucp_parm_NoA = -1;
115 static int hf_ucp_parm_NoB = -1;
116 static int hf_ucp_parm_NAC = -1;
117 static int hf_ucp_parm_PNC = -1;
118 static int hf_ucp_parm_AMsg = -1;
119 static int hf_ucp_parm_LNo = -1;
120 static int hf_ucp_parm_LST = -1;
121 static int hf_ucp_parm_TNo = -1;
122 static int hf_ucp_parm_CS = -1;
123 static int hf_ucp_parm_PID = -1;
124 static int hf_ucp_parm_NPL = -1;
125 static int hf_ucp_parm_GA = -1;
126 static int hf_ucp_parm_RP = -1;
127 static int hf_ucp_parm_LRP = -1;
128 static int hf_ucp_parm_PR = -1;
129 static int hf_ucp_parm_LPR = -1;
130 static int hf_ucp_parm_UM = -1;
131 static int hf_ucp_parm_LUM = -1;
132 static int hf_ucp_parm_RC = -1;
133 static int hf_ucp_parm_LRC = -1;
134 static int hf_ucp_parm_NRq = -1;
135 static int hf_ucp_parm_GAdC = -1;
136 static int hf_ucp_parm_A_D = -1;
137 static int hf_ucp_parm_CT = -1;
138 static int hf_ucp_parm_AAC = -1;
139 static int hf_ucp_parm_MNo = -1;
140 static int hf_ucp_parm_R_T = -1;
141 static int hf_ucp_parm_IVR5x = -1;
142 static int hf_ucp_parm_REQ_OT = -1;
143 static int hf_ucp_parm_SSTAT = -1;
144 static int hf_ucp_parm_LMN = -1;
145 static int hf_ucp_parm_NMESS = -1;
146 static int hf_ucp_parm_NMESS_str= -1;
147 static int hf_ucp_parm_NAdC = -1;
148 static int hf_ucp_parm_NT = -1;
149 static int hf_ucp_parm_NPID = -1;
150 static int hf_ucp_parm_LRq = -1;
151 static int hf_ucp_parm_LRAd = -1;
152 static int hf_ucp_parm_LPID = -1;
153 static int hf_ucp_parm_DD = -1;
154 static int hf_ucp_parm_DDT = -1;
155 static int hf_ucp_parm_STx = -1;
156 static int hf_ucp_parm_ST = -1;
157 static int hf_ucp_parm_SP = -1;
158 static int hf_ucp_parm_VP = -1;
159 static int hf_ucp_parm_RPID = -1;
160 static int hf_ucp_parm_SCTS = -1;
161 static int hf_ucp_parm_Dst = -1;
162 static int hf_ucp_parm_Rsn = -1;
163 static int hf_ucp_parm_DSCTS = -1;
164 static int hf_ucp_parm_MT = -1;
165 static int hf_ucp_parm_NB = -1;
166 static int hf_ucp_data_section = -1;
167 static int hf_ucp_parm_MMS = -1;
168 static int hf_ucp_parm_DCs = -1;
169 static int hf_ucp_parm_MCLs = -1;
170 static int hf_ucp_parm_RPI = -1;
171 static int hf_ucp_parm_CPg = -1;
172 static int hf_ucp_parm_RPLy = -1;
173 static int hf_ucp_parm_OTOA = -1;
174 static int hf_ucp_parm_HPLMN = -1;
175 static int hf_ucp_parm_RES4 = -1;
176 static int hf_ucp_parm_RES5 = -1;
177 static int hf_ucp_parm_OTON = -1;
178 static int hf_ucp_parm_ONPI = -1;
179 static int hf_ucp_parm_STYP0 = -1;
180 static int hf_ucp_parm_STYP1 = -1;
181 static int hf_ucp_parm_ACK = -1;
182 static int hf_ucp_parm_PWD = -1;
183 static int hf_ucp_parm_NPWD = -1;
184 static int hf_ucp_parm_VERS = -1;
185 static int hf_ucp_parm_LAdC = -1;
186 static int hf_ucp_parm_LTON = -1;
187 static int hf_ucp_parm_LNPI = -1;
188 static int hf_ucp_parm_OPID = -1;
189 static int hf_ucp_parm_RES1 = -1;
190 static int hf_ucp_parm_RES2 = -1;
191 static int hf_ucp_parm_MVP = -1;
192 static int hf_ucp_parm_EC = -1;
193 static int hf_ucp_parm_SM = -1;
195 static int hf_ucp_parm_XSer = -1;
196 static int hf_xser_service = -1;
198 /* Initialize the subtree pointers */
199 static gint ett_ucp = -1;
200 static gint ett_sub = -1;
201 static gint ett_XSer = -1;
204 * Value-arrays for certain field-contents
206 static const value_string vals_hdr_O_R[] = {
207 { 'O', "Operation" },
212 static const value_string vals_hdr_OT[] = { /* Operation type */
215 { 2, "Call input (multiple address)" },
216 { 3, "Call input (supplementary services included)" },
217 { 4, "Address list information" },
218 { 5, "Change address list" },
219 { 6, "Advice of accumulated charges" },
220 { 7, "Password management" },
221 { 8, "Legitimisation code management" },
222 { 9, "Standard text information" },
223 { 10, "Change standard text" },
224 { 11, "Request roaming information" },
225 { 12, "Change roaming information" },
226 { 13, "Roaming reset" },
227 { 14, "Message retrieval" },
228 { 15, "Request call barring" },
229 { 16, "Cancel call barring" },
230 { 17, "Request call diversion" },
231 { 18, "Cancel call diversion" },
232 { 19, "Request deferred delivery" },
233 { 20, "Cancel deferred delivery" },
234 { 21, "All features reset" },
235 { 22, "Call input (with specific character set)" },
236 { 23, "UCP version status request" },
237 { 24, "Mobile subscriber feature status request" },
238 { 30, "SMS message transfer" },
240 { 32, "(proprietary)" },
241 { 34, "(proprietary)" },
242 { 36, "(proprietary)" },
243 { 38, "(proprietary)" },
244 { 40, "(proprietary)" },
245 { 41, "(proprietary)" },
246 { 42, "(proprietary)" },
247 { 43, "(proprietary)" },
248 { 44, "(proprietary)" },
249 { 45, "(proprietary)" },
250 { 51, "Submit short message" },
251 { 52, "Deliver short message" },
252 { 53, "Deliver notification" },
253 { 54, "Modify message" },
254 { 55, "Inquiry message" },
255 { 56, "Delete message" },
256 { 57, "Inquiry response message" },
257 { 58, "Delete response message" },
258 { 60, "Session management" },
259 { 61, "List management" },
260 { 95, "(proprietary)" },
261 { 96, "(proprietary)" },
262 { 97, "(proprietary)" },
263 { 98, "(proprietary)" },
264 { 99, "(proprietary)" },
268 static const value_string vals_parm_EC[] = { /* Error code */
269 { 1, "Checksum error" },
270 { 2, "Syntax error" },
271 { 3, "Operation not supported by system" },
272 { 4, "Operation not allowed" },
273 { 5, "Call barring active" },
274 { 6, "AdC invalid" },
275 { 7, "Authentication failure" },
276 { 8, "Legitimisation code for all calls, failure" },
277 { 9, "GA not valid" },
278 { 10, "Repetition not allowed" },
279 { 11, "Legitimisation code for repetition, failure" },
280 { 12, "Priority call not allowed" },
281 { 13, "Legitimisation code for priority call, failure" },
282 { 14, "Urgent message not allowed" },
283 { 15, "Legitimisation code for urgent message, failure" },
284 { 16, "Reverse charging not alllowed" },
285 { 17, "Legitimisation code for rev. charging, failure" },
286 { 18, "Deferred delivery not allowed" },
287 { 19, "New AC not valid" },
288 { 20, "New legitimisation code not valid" },
289 { 21, "Standard text not valid" },
290 { 22, "Time period not valid" },
291 { 23, "Message type not supported by system" },
292 { 24, "Message too long" },
293 { 25, "Requested standard text not valid" },
294 { 26, "Message type not valid for the pager type" },
295 { 27, "Message not found in SMSC" },
296 { 28, "Invalid character set" },
297 { 30, "Subscriber hang-up" },
298 { 31, "Fax group not supported" },
299 { 32, "Fax message type not supported" },
300 { 33, "Address already in list (60-series)" },
301 { 34, "Address not in list (60-series)" },
302 { 35, "List full, cannot add address to list (60-series)" },
303 { 36, "RPID already in use" },
304 { 37, "Delivery in progress" },
305 { 38, "Message forwarded" },
306 { 50, "Low network status" },
307 { 51, "Legitimisation code for standard text, failure" },
308 { 53, "Operation partially successful" },
309 { 54, "Operation not successful" },
310 { 55, "System error" },
311 { 57, "AdC already a member of GAdC address list" },
312 { 58, "AdC not a member of GAdC address list" },
313 { 59, "Requested standard text list invalid" },
314 { 61, "Not controller of GAdC address list" },
315 { 62, "Standard text too large" },
316 { 63, "Not owner of standard text list" },
317 { 64, "Address list full" },
318 { 65, "GAdC invalid" },
319 { 66, "Operation restricted to mobile subscribers" },
320 { 68, "Invalid AdC type" },
321 { 69, "Cannot add AdC to GAdC address list" },
322 { 90, "(proprietary error code)" },
323 { 91, "(proprietary error code)" },
324 { 92, "(proprietary error code)" },
325 { 93, "(proprietary error code)" },
326 { 94, "(proprietary error code)" },
327 { 95, "(proprietary error code)" },
328 { 96, "(proprietary error code)" },
329 { 97, "(proprietary error code)" },
330 { 98, "(proprietary error code)" },
331 { 99, "(proprietary error code)" },
335 static const value_string vals_parm_NRq[] = {
336 { '0', "NAdC not used" },
337 { '1', "NAdC used" },
341 static const value_string vals_parm_NT[] = {
342 { '0', "Default value" },
343 { '1', "Delivery notification" },
344 { '2', "Non-delivery notification" },
345 { '3', "Delivery and Non-delivery notification" },
346 { '4', "Buffered message notification" },
347 { '5', "Buffered and Delivery notification" },
348 { '6', "Buffered and Non-delivery notification" },
349 { '7', "All notifications" },
353 static const value_string vals_parm_PID[] = {
354 { 100, "Mobile station" },
355 { 122, "Fax Group 3" },
357 { 138, "Menu over PSTN" },
358 { 139, "PC appl. over PSTN (E.164)" },
359 { 339, "PC appl. over X.25 (X.121)" },
360 { 439, "PC appl. over ISDN (E.164)" },
361 { 539, "PC appl. over TCP/IP" },
365 static const value_string vals_parm_LRq[] = {
366 { '0', "LRAd not used" },
367 { '1', "LRAd used" },
371 static const value_string vals_parm_DD[] = {
372 { '0', "DDT not used" },
377 static const value_string vals_parm_Dst[] = {
378 { '0', "delivered" },
379 { '1', "buffered (see Rsn)" },
380 { '2', "not delivered (see Rsn)" },
384 static const value_string vals_parm_Rsn[] = {
385 { 0, "Unknown subscriber" },
386 { 1, "Service temporary not available" },
387 { 2, "Service temporary not available" },
388 { 3, "Service temporary not available" },
389 { 4, "Service temporary not available" },
390 { 5, "Service temporary not available" },
391 { 6, "Service temporary not available" },
392 { 7, "Service temporary not available" },
393 { 8, "Service temporary not available" },
394 { 9, "Illegal error code" },
395 { 10, "Network time-out" },
396 { 100, "Facility not supported" },
397 { 101, "Unknown subscriber" },
398 { 102, "Facility not provided" },
399 { 103, "Call barred" },
400 { 104, "Operation barred" },
401 { 105, "SC congestion" },
402 { 106, "Facility not supported" },
403 { 107, "Absent subscriber" },
404 { 108, "Delivery fail" },
405 { 109, "Sc congestion" },
406 { 110, "Protocol error" },
407 { 111, "MS not equipped" },
408 { 112, "Unknown SC" },
409 { 113, "SC congestion" },
410 { 114, "Illegal MS" },
411 { 115, "MS nota subscriber" },
412 { 116, "Error in MS" },
413 { 117, "SMS lower layer not provisioned" },
414 { 118, "System fail" },
415 { 119, "PLMN system failure" },
416 { 120, "HLR system failure" },
417 { 121, "VLR system failure" },
418 { 122, "Previous VLR system failure" },
419 { 123, "Controlling MSC system failure" },
420 { 124, "VMSC system failure" },
421 { 125, "EIR system failure" },
422 { 126, "System failure" },
423 { 127, "Unexpected data value" },
424 { 200, "Error in address service centre" },
425 { 201, "Invalid absolute validity period" },
426 { 202, "Short message exceeds maximum" },
427 { 203, "Unable to unpack GSM message" },
428 { 204, "Unable to convert to IRA alphabet" },
429 { 205, "Invalid validity period format" },
430 { 206, "Invalid destination address" },
431 { 207, "Duplicate message submit" },
432 { 208, "Invalid message type indicator" },
436 static const value_string vals_parm_MT[] = {
437 { '2', "Numeric message" },
438 { '3', "Alphanumeric message" },
439 { '4', "Transparent data" },
443 static const value_string vals_parm_DCs[] = {
444 { '0', "default alphabet" },
445 { '1', "User defined data (8 bit)" },
449 static const value_string vals_parm_MCLs[] = {
450 { '0', "message class 0" },
451 { '1', "message class 1" },
452 { '2', "message class 2" },
453 { '3', "message class 3" },
457 static const value_string vals_parm_RPI[] = {
463 static const value_string vals_parm_ACK[] = {
469 static const value_string vals_parm_RP[] = {
470 { '1', "Repetition requested" },
474 static const value_string vals_parm_UM[] = {
475 { '1', "Urgent message" },
479 static const value_string vals_parm_RC[] = {
480 { '1', "Reverse charging request" },
484 static const value_string vals_parm_OTON[] = {
485 { '1', "International number" },
486 { '2', "National number" },
487 { '6', "Abbreviated number (short number alias)" },
491 static const value_string vals_parm_ONPI[] = {
492 { '1', "E.164 address" },
493 { '3', "X.121 address" },
494 { '5', "Private -TCP/IP or abbreviated number- address" },
498 static const value_string vals_parm_STYP0[] = {
499 { '1', "open session" },
501 { '3', "change password" },
502 { '4', "open provisioning session" },
504 { '6', "change provisioning password" },
508 static const value_string vals_parm_STYP1[] = {
509 { '1', "add item to mo-list" },
510 { '2', "remove item from mo-list" },
511 { '3', "verify item mo-list" },
512 { '4', "add item to mt-list" },
513 { '5', "remove item from mt-list" },
514 { '6', "verify item mt-list" },
518 static const value_string vals_parm_OPID[] = {
519 { 0, "Mobile station" },
520 { 39, "PC application" },
524 static const value_string vals_parm_BAS[] = {
529 static const value_string vals_parm_LAR[] = {
530 { '1', "Leg. code for all calls requested" },
534 static const value_string vals_parm_L1R[] = {
535 { '1', "Leg. code for priority 1 requested" },
539 static const value_string vals_parm_L3R[] = {
540 { '1', "Leg. code for priority 3 requested" },
544 static const value_string vals_parm_LCR[] = {
545 { '1', "Leg. code for reverse charging requested" },
549 static const value_string vals_parm_LUR[] = {
550 { '1', "Leg. code for urgent message requested" },
554 static const value_string vals_parm_LRR[] = {
555 { '1', "Leg. code for repitition requested" },
559 static const value_string vals_parm_RT[] = {
560 { '1', "Tone only" },
562 { '3', "Alphanumeric" },
563 { '4', "Transparent data" },
567 static const value_string vals_parm_PNC[] = {
569 { 'I', "Input PNC" },
573 static const value_string vals_parm_A_D[] = {
579 static const value_string vals_parm_R_T[] = {
580 { 'R', "Retrieval Ok" },
581 { 'T', "Retransmit on radio channel" },
585 static const value_string vals_parm_REQ_OT[] = {
586 { 'S', "Send used operation types" },
587 { 'N', "Don't send used operation types" },
591 static const value_string vals_parm_SSTAT[] = {
592 { '0', "All services" },
593 { '1', "All in the moment active servics" },
594 { '2', "Call diversion" },
595 { '3', "Roaming information status" },
596 { '4', "Call barring status" },
597 { '5', "Deferred delivery status" },
598 { '6', "Number of stored messages" },
602 static const value_string vals_xser_service[] = {
603 { 1, "GSM UDH information" },
604 { 2, "GSM DCS information" },
605 { 3, "[Message Type] TDMA information exchange" },
606 { 4, "[Message Reference] TDMA information exchange" },
607 { 5, "[Privacy Indicator] TDMA information exchange" },
608 { 6, "[Urgency Indicator] TDMA information exchange" },
609 { 7, "[Acknowledgement Request] TDMA information exchange" },
610 { 8, "[Messsage Updating] TDMA information exchange" },
611 { 9, "[Call Back Number] TDMA information exchange" },
612 { 10, "[Response Code] TDMA information exchange" },
613 { 11, "[Teleservice ID] TDMA information exchange" },
614 { 12, "Billing identifier" },
615 { 13, "Single shot indicator" },
620 * Checks whether the PDU looks a bit like UCP and checks the checksum
622 * \param tvb The buffer with PDU-data
623 * \param endpkt Returns pointer, indicating the end of the PDU
625 * \return The state of this PDU
626 * \retval 0 Definitely UCP
627 * \retval UCP_SHORTENED Packet may be there, but not complete
628 * \retval UCP_MALFORMED Hmmmm, not UCP after all...
629 * \retval UCP_INV_CHK Nice packet, but checksum doesn't add up...
632 check_ucp(tvbuff_t *tvb, int *endpkt)
639 length = tvb_find_guint8(tvb, offset, -1, UCP_ETX);
641 *endpkt = tvb_reported_length_remaining(tvb, offset);
642 return UCP_SHORTENED;
644 if (length > (int) tvb_reported_length(tvb)) {
645 /* XXX - "cannot happen" */
647 return UCP_MALFORMED;
649 for (; offset < (guint) (length - 2); offset++)
650 checksum += tvb_get_guint8(tvb, offset);
652 tmp = tvb_get_guint8(tvb, offset++);
653 pkt_check = AHex2Bin(tmp);
654 tmp = tvb_get_guint8(tvb, offset++);
655 pkt_check = 16 * pkt_check + AHex2Bin(tmp);
656 *endpkt = offset + 1;
657 if (checksum == (guint) pkt_check)
664 * UCP equivalent of mktime() (3). Convert date to standard 'time_t' format
666 * \param datestr The UCP-formatted date to convert
668 * \return The date in standard 'time_t' format.
671 ucp_mktime(char *datestr)
675 r_time.tm_mday = 10 * (datestr[0] - '0') + (datestr[1] - '0');
676 r_time.tm_mon = (10 * (datestr[2] - '0') + (datestr[3] - '0')) - 1;
677 r_time.tm_year = 10 * (datestr[4] - '0') + (datestr[5] - '0');
678 if (r_time.tm_year < 90)
679 r_time.tm_year += 100;
680 r_time.tm_hour = 10 * (datestr[6] - '0') + (datestr[7] - '0');
681 r_time.tm_min = 10 * (datestr[8] - '0') + (datestr[9] - '0');
683 r_time.tm_sec = 10 * (datestr[10] - '0') + (datestr[11] - '0');
686 r_time.tm_isdst = -1;
687 return mktime(&r_time);
691 * Scanning routines to add standard types (byte, int, string, data)
692 * to the protocol-tree. Each field is seperated with a slash ('/').
694 * \param tree The protocol tree to add to
695 * \param tvb Buffer containing the data
696 * \param field The actual field, whose value needs displaying
697 * \param offset Location of field within the buffer, returns location
700 * \return For 'int'-types, the value of the field.
703 ucp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
707 idx = tvb_find_guint8(tvb, *offset, -1, '/');
709 /* Force the appropriate exception to be thrown. */
710 len = tvb_length_remaining(tvb, *offset);
711 tvb_ensure_bytes_exist(tvb, *offset, len + 1);
715 proto_tree_add_item(tree, field, tvb, *offset, len, FALSE);
718 *offset += 1; /* skip terminating '/' */
722 ucp_handle_IRAstring(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
724 char strval[BUFSIZ + 1],
728 int tmpoff = *offset;
730 while (((byte = tvb_get_guint8(tvb, tmpoff++)) != '/') &&
733 if (byte >= '0' && byte <= '9')
735 *p_dst = (byte - '0') * 16;
739 *p_dst = (byte - 'A' + 10) * 16;
741 if ((byte = tvb_get_guint8(tvb, tmpoff++)) == '/')
745 if (byte >= '0' && byte <= '9')
747 *p_dst++ += byte - '0';
751 *p_dst++ += byte - 'A' + 10;
759 * Data clipped, eat rest of field
761 while ((tvb_get_guint8(tvb, tmpoff++)) != '/')
764 if ((tmpoff - *offset) > 1)
765 proto_tree_add_string(tree, field, tvb, *offset,
766 tmpoff - *offset - 1, strval);
771 ucp_handle_byte(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
775 if ((intval = tvb_get_guint8(tvb, (*offset)++)) != '/') {
776 proto_tree_add_uint(tree, field, tvb, *offset - 1, 1, intval);
783 ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
789 idx = tvb_find_guint8(tvb, *offset, -1, '/');
791 /* Force the appropriate exception to be thrown. */
792 len = tvb_length_remaining(tvb, *offset);
793 tvb_ensure_bytes_exist(tvb, *offset, len + 1);
796 strval = tvb_get_ephemeral_string(tvb, *offset, len);
798 intval = atoi(strval);
799 proto_tree_add_uint(tree, field, tvb, *offset, idx, intval);
803 *offset += 1; /* skip terminating '/' */
808 ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
815 idx = tvb_find_guint8(tvb, *offset, -1, '/');
817 /* Force the appropriate exception to be thrown. */
818 len = tvb_length_remaining(tvb, *offset);
819 tvb_ensure_bytes_exist(tvb, *offset, len + 1);
822 strval = tvb_get_ephemeral_string(tvb, *offset, len);
824 tval = ucp_mktime(strval);
827 proto_tree_add_time(tree, field, tvb, *offset, idx, &tmptime);
831 *offset += 1; /* skip terminating '/' */
835 ucp_handle_data(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
837 int tmpoff = *offset;
839 while (tvb_get_guint8(tvb, tmpoff++) != '/')
841 if ((tmpoff - *offset) > 1)
842 proto_tree_add_item(tree, field, tvb, *offset,
843 tmpoff - *offset - 1, FALSE);
848 * Handle the data-field within the UCP-message, according the Message Type
850 * - 2 Numeric message
851 * - 3 Alphanumeric message
852 * - 4 Transparent (binary) data
853 * - 5 Standard text handling
854 * - 6 Alphanumeric message in specified character set
856 * \param tree The protocol tree to add to
857 * \param tvb Buffer containing the data
858 * \param field The actual field, whose value needs displaying
859 * \param offset Location of field within the buffer, returns location
863 ucp_handle_mt(proto_tree *tree, tvbuff_t *tvb, int *offset)
867 intval = ucp_handle_byte(tree, tvb, hf_ucp_parm_MT, offset);
869 case '1': /* Tone only, no data */
871 case '4': /* TMsg, no of bits */
872 ucp_handle_string(tree, tvb, hf_ucp_parm_NB, offset);
873 /* fall through here for the data piece */
875 ucp_handle_data(tree, tvb, hf_ucp_data_section, offset);
878 ucp_handle_IRAstring(tree, tvb, hf_ucp_parm_AMsg, offset);
881 ucp_handle_byte(tree, tvb, hf_ucp_parm_PNC, offset);
882 ucp_handle_string(tree, tvb, hf_ucp_parm_LNo, offset);
883 ucp_handle_string(tree, tvb, hf_ucp_parm_LST, offset);
884 ucp_handle_string(tree, tvb, hf_ucp_parm_TNo, offset);
887 ucp_handle_data(tree, tvb, hf_ucp_data_section, offset);
888 ucp_handle_int(tree, tvb, hf_ucp_parm_CS, offset);
891 break; /* No data so ? */
896 * Handle the data within the 'Extended services' field. Each field having the
897 * format TTLLDD..., TT being the type of service, LL giving the length of the
898 * field, DD... containing the actual data
900 * \param tree The protocol tree to add to
901 * \param tvb Buffer containing the extended services data
904 ucp_handle_XSer(proto_tree *tree, tvbuff_t *tvb)
911 while ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
912 service = AHex2Bin(intval);
913 intval = tvb_get_guint8(tvb, offset++);
914 service = service * 16 + AHex2Bin(intval);
915 intval = tvb_get_guint8(tvb, offset++);
916 len = AHex2Bin(intval);
917 intval = tvb_get_guint8(tvb, offset++);
918 len = len * 16 + AHex2Bin(intval);
919 proto_tree_add_uint(tree, hf_xser_service, tvb, offset,
925 /* Next definitions are just a convenient shorthand to make the coding a
926 * bit more readable instead of summing up all these parameters.
928 #define UcpHandleString(field) ucp_handle_string(tree, tvb, (field), &offset)
930 #define UcpHandleIRAString(field) \
931 ucp_handle_IRAstring(tree, tvb, (field), &offset)
933 #define UcpHandleByte(field) ucp_handle_byte(tree, tvb, (field), &offset)
935 #define UcpHandleInt(field) ucp_handle_int(tree, tvb, (field), &offset)
937 #define UcpHandleTime(field) ucp_handle_time(tree, tvb, (field), &offset)
939 #define UcpHandleData(field) ucp_handle_data(tree, tvb, (field), &offset)
942 * The next set of routines handle the different operation types,
943 * associated with UCP.
946 add_00O(proto_tree *tree, tvbuff_t *tvb)
950 UcpHandleString(hf_ucp_parm_AdC);
951 UcpHandleString(hf_ucp_parm_OAdC);
952 UcpHandleString(hf_ucp_parm_OAC);
956 add_00R(proto_tree *tree, tvbuff_t *tvb)
961 intval = UcpHandleByte(hf_ucp_parm_ACK);
964 UcpHandleByte(hf_ucp_parm_BAS);
965 UcpHandleByte(hf_ucp_parm_LAR);
966 UcpHandleByte(hf_ucp_parm_L1R);
967 UcpHandleByte(hf_ucp_parm_L3R);
968 UcpHandleByte(hf_ucp_parm_LCR);
969 UcpHandleByte(hf_ucp_parm_LUR);
970 UcpHandleByte(hf_ucp_parm_LRR);
971 UcpHandleByte(hf_ucp_parm_RT);
972 UcpHandleInt(hf_ucp_parm_NoN);
973 UcpHandleInt(hf_ucp_parm_NoA);
974 UcpHandleInt(hf_ucp_parm_NoB);
976 UcpHandleInt(hf_ucp_parm_EC);
977 UcpHandleString(hf_ucp_parm_SM);
982 add_01O(proto_tree *tree, tvbuff_t *tvb)
986 UcpHandleString(hf_ucp_parm_AdC);
987 UcpHandleString(hf_ucp_parm_OAdC);
988 UcpHandleString(hf_ucp_parm_OAC);
989 ucp_handle_mt(tree, tvb, &offset);
993 add_01R(proto_tree *tree, tvbuff_t *tvb)
998 intval = UcpHandleByte(hf_ucp_parm_ACK);
1000 UcpHandleInt(hf_ucp_parm_EC);
1001 UcpHandleString(hf_ucp_parm_SM);
1005 add_02O(proto_tree *tree, tvbuff_t *tvb)
1006 { /* Multiple address call input*/
1011 intval = UcpHandleInt(hf_ucp_parm_NPL);
1012 for (idx = 0; idx < intval; idx++)
1013 UcpHandleString(hf_ucp_parm_AdC);
1015 UcpHandleString(hf_ucp_parm_OAdC);
1016 UcpHandleString(hf_ucp_parm_OAC);
1017 ucp_handle_mt(tree, tvb, &offset);
1020 #define add_02R(a, b) add_01R(a,b)
1023 add_03O(proto_tree *tree, tvbuff_t *tvb)
1024 { /* Call input with SS */
1029 UcpHandleString(hf_ucp_parm_AdC);
1030 UcpHandleString(hf_ucp_parm_OAdC);
1031 UcpHandleString(hf_ucp_parm_OAC);
1032 intval = UcpHandleInt(hf_ucp_parm_NPL);
1033 for (idx = 0; idx < intval; idx++)
1034 UcpHandleString(hf_ucp_parm_GA);
1036 UcpHandleByte(hf_ucp_parm_RP);
1037 UcpHandleString(hf_ucp_parm_LRP);
1038 UcpHandleByte(hf_ucp_parm_PR);
1039 UcpHandleString(hf_ucp_parm_LPR);
1040 UcpHandleByte(hf_ucp_parm_UM);
1041 UcpHandleString(hf_ucp_parm_LUM);
1042 UcpHandleByte(hf_ucp_parm_RC);
1043 UcpHandleString(hf_ucp_parm_LRC);
1044 UcpHandleByte(hf_ucp_parm_DD);
1045 UcpHandleTime(hf_ucp_parm_DDT);
1046 ucp_handle_mt(tree, tvb, &offset);
1049 #define add_03R(a, b) add_01R(a,b)
1052 add_04O(proto_tree *tree, tvbuff_t *tvb)
1053 { /* Address list information */
1056 UcpHandleString(hf_ucp_parm_GAdC);
1057 UcpHandleString(hf_ucp_parm_AC);
1058 UcpHandleString(hf_ucp_parm_OAdC);
1059 UcpHandleString(hf_ucp_parm_OAC);
1063 add_04R(proto_tree *tree, tvbuff_t *tvb)
1069 intval = UcpHandleByte(hf_ucp_parm_ACK);
1070 if (intval == 'A') {
1071 intval = UcpHandleInt(hf_ucp_parm_NPL);
1072 for (idx = 0; idx < intval; idx++)
1073 UcpHandleString(hf_ucp_parm_AdC);
1074 UcpHandleString(hf_ucp_parm_GAdC);
1076 UcpHandleInt(hf_ucp_parm_EC);
1077 UcpHandleString(hf_ucp_parm_SM);
1081 add_05O(proto_tree *tree, tvbuff_t *tvb)
1082 { /* Change address list */
1087 UcpHandleString(hf_ucp_parm_GAdC);
1088 UcpHandleString(hf_ucp_parm_AC);
1089 UcpHandleString(hf_ucp_parm_OAdC);
1090 UcpHandleString(hf_ucp_parm_OAC);
1091 intval = UcpHandleInt(hf_ucp_parm_NPL);
1092 for (idx = 0; idx < intval; idx++)
1093 UcpHandleString(hf_ucp_parm_AdC);
1094 UcpHandleByte(hf_ucp_parm_A_D);
1097 #define add_05R(a, b) add_01R(a, b)
1100 add_06O(proto_tree *tree, tvbuff_t *tvb)
1101 { /* Advice of accum. charges */
1104 UcpHandleString(hf_ucp_parm_AdC);
1105 UcpHandleString(hf_ucp_parm_AC);
1109 add_06R(proto_tree *tree, tvbuff_t *tvb)
1114 intval = UcpHandleByte(hf_ucp_parm_ACK);
1115 if (intval == 'A') {
1116 UcpHandleTime(hf_ucp_parm_CT);
1117 UcpHandleString(hf_ucp_parm_AAC);
1119 UcpHandleInt(hf_ucp_parm_EC);
1120 UcpHandleString(hf_ucp_parm_SM);
1124 add_07O(proto_tree *tree, tvbuff_t *tvb)
1125 { /* Password management */
1128 UcpHandleString(hf_ucp_parm_AdC);
1129 UcpHandleString(hf_ucp_parm_AC);
1130 UcpHandleString(hf_ucp_parm_NAC);
1133 #define add_07R(a, b) add_01R(a, b)
1136 add_08O(proto_tree *tree, tvbuff_t *tvb)
1137 { /* Leg. code management */
1140 UcpHandleString(hf_ucp_parm_AdC);
1141 UcpHandleString(hf_ucp_parm_AC);
1142 UcpHandleString(hf_ucp_parm_LAC);
1143 UcpHandleString(hf_ucp_parm_L1P);
1144 UcpHandleString(hf_ucp_parm_L3P);
1145 UcpHandleString(hf_ucp_parm_LRC);
1146 UcpHandleString(hf_ucp_parm_LUM);
1147 UcpHandleString(hf_ucp_parm_LRP);
1148 UcpHandleString(hf_ucp_parm_LST);
1151 #define add_08R(a, b) add_01R(a, b)
1154 add_09O(proto_tree *tree, tvbuff_t *tvb)
1155 { /* Standard text information */
1158 UcpHandleString(hf_ucp_parm_LNo);
1159 UcpHandleString(hf_ucp_parm_LST);
1163 add_09R(proto_tree *tree, tvbuff_t *tvb)
1169 intval = UcpHandleByte(hf_ucp_parm_ACK);
1170 if (intval == 'A') {
1171 intval = UcpHandleInt(hf_ucp_parm_NPL);
1172 for (idx = 0; idx < intval; idx++)
1173 UcpHandleString(hf_ucp_parm_LST);
1175 UcpHandleInt(hf_ucp_parm_EC);
1176 UcpHandleString(hf_ucp_parm_SM);
1180 add_10O(proto_tree *tree, tvbuff_t *tvb)
1181 { /* Change standard text */
1184 UcpHandleString(hf_ucp_parm_AdC);
1185 UcpHandleString(hf_ucp_parm_AC);
1186 UcpHandleString(hf_ucp_parm_LNo);
1187 UcpHandleString(hf_ucp_parm_TNo);
1188 UcpHandleData(hf_ucp_parm_STx);
1189 UcpHandleInt(hf_ucp_parm_CS);
1192 #define add_10R(a, b) add_01R(a, b)
1194 #define add_11O(a, b) add_06O(a, b) /* Request roaming info */
1197 add_11R(proto_tree *tree, tvbuff_t *tvb)
1203 intval = UcpHandleByte(hf_ucp_parm_ACK);
1204 if (intval == 'A') {
1205 intval = UcpHandleInt(hf_ucp_parm_NPL);
1206 for (idx = 0; idx < intval; idx++)
1207 UcpHandleString(hf_ucp_parm_GA);
1209 UcpHandleInt(hf_ucp_parm_EC);
1210 UcpHandleString(hf_ucp_parm_SM);
1214 add_12O(proto_tree *tree, tvbuff_t *tvb)
1215 { /* Change roaming */
1220 UcpHandleString(hf_ucp_parm_AdC);
1221 UcpHandleString(hf_ucp_parm_AC);
1222 intval = UcpHandleInt(hf_ucp_parm_NPL);
1223 for (idx = 0; idx < intval; idx++)
1224 UcpHandleString(hf_ucp_parm_GA);
1227 #define add_12R(a, b) add_01R(a, b)
1229 #define add_13O(a, b) add_06O(a, b) /* Roaming reset */
1231 #define add_13R(a, b) add_01R(a, b)
1234 add_14O(proto_tree *tree, tvbuff_t *tvb)
1235 { /* Message retrieval */
1238 UcpHandleString(hf_ucp_parm_AdC);
1239 UcpHandleString(hf_ucp_parm_AC);
1240 UcpHandleString(hf_ucp_parm_MNo);
1241 UcpHandleByte(hf_ucp_parm_R_T);
1245 add_14R(proto_tree *tree, tvbuff_t *tvb)
1251 intval = UcpHandleByte(hf_ucp_parm_ACK);
1252 if (intval == 'A') {
1253 intval = UcpHandleInt(hf_ucp_parm_NPL);
1255 * Spec is unclear here. Is 'SM' part of the Msg:s field or not?
1256 * For now, assume it is part of it...
1258 for (idx = 0; idx < intval; idx++)
1259 UcpHandleData(hf_ucp_data_section);
1261 UcpHandleInt(hf_ucp_parm_EC);
1262 UcpHandleString(hf_ucp_parm_SM);
1267 add_15O(proto_tree *tree, tvbuff_t *tvb)
1268 { /* Request call barring */
1271 UcpHandleString(hf_ucp_parm_AdC);
1272 UcpHandleString(hf_ucp_parm_AC);
1273 UcpHandleTime(hf_ucp_parm_ST);
1274 UcpHandleTime(hf_ucp_parm_SP);
1277 #define add_15R(a, b) add_01R(a, b)
1279 #define add_16O(a, b) add_06O(a, b) /* Cancel call barring */
1281 #define add_16R(a, b) add_01R(a, b)
1284 add_17O(proto_tree *tree, tvbuff_t *tvb)
1285 { /* Request call diversion */
1288 UcpHandleString(hf_ucp_parm_AdC);
1289 UcpHandleString(hf_ucp_parm_AC);
1290 UcpHandleString(hf_ucp_parm_DAdC);
1291 UcpHandleTime(hf_ucp_parm_ST);
1292 UcpHandleTime(hf_ucp_parm_SP);
1295 #define add_17R(a, b) add_01R(a, b)
1297 #define add_18O(a, b) add_06O(a, b) /* Cancel call diversion */
1299 #define add_18R(a, b) add_01R(a, b)
1302 add_19O(proto_tree *tree, tvbuff_t *tvb)
1303 { /* Request deferred delivery*/
1306 UcpHandleString(hf_ucp_parm_AdC);
1307 UcpHandleString(hf_ucp_parm_AC);
1308 UcpHandleTime(hf_ucp_parm_ST);
1309 UcpHandleTime(hf_ucp_parm_SP);
1312 #define add_19R(a, b) add_01R(a, b)
1314 #define add_20O(a, b) add_06O(a, b) /* Cancel deferred delivery */
1316 #define add_20R(a, b) add_01R(a, b)
1318 #define add_21O(a, b) add_06O(a, b) /* All features reset */
1320 #define add_21R(a, b) add_01R(a, b)
1323 add_22O(proto_tree *tree, tvbuff_t *tvb)
1324 { /* Call input w. add. CS */
1327 UcpHandleString(hf_ucp_parm_AdC);
1328 UcpHandleString(hf_ucp_parm_OAdC);
1329 UcpHandleString(hf_ucp_parm_OAC);
1330 UcpHandleData(hf_ucp_data_section);
1331 UcpHandleInt(hf_ucp_parm_CS);
1334 #define add_22R(a, b) add_01R(a, b)
1337 add_23O(proto_tree *tree, tvbuff_t *tvb)
1338 { /* UCP version status */
1341 UcpHandleString(hf_ucp_parm_IVR5x);
1342 UcpHandleByte(hf_ucp_parm_REQ_OT);
1346 add_23R(proto_tree *tree, tvbuff_t *tvb)
1352 intval = UcpHandleByte(hf_ucp_parm_ACK);
1353 if (intval == 'A') {
1354 UcpHandleByte(hf_ucp_parm_IVR5x);
1355 intval = UcpHandleInt(hf_ucp_parm_NPL);
1356 for (idx = 0; idx < intval; idx++)
1357 UcpHandleInt(hf_ucp_hdr_OT);
1359 UcpHandleInt(hf_ucp_parm_EC);
1360 UcpHandleString(hf_ucp_parm_SM);
1364 add_24O(proto_tree *tree, tvbuff_t *tvb)
1365 { /* Mobile subs. feature stat*/
1368 UcpHandleString(hf_ucp_parm_AdC);
1369 UcpHandleString(hf_ucp_parm_AC);
1370 UcpHandleByte(hf_ucp_parm_SSTAT);
1374 add_24R(proto_tree *tree, tvbuff_t *tvb)
1380 intval = UcpHandleByte(hf_ucp_parm_ACK);
1381 if (intval == 'A') {
1382 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1383 proto_tree_add_text(tree, tvb, offset - 1, 1,
1384 "GA roaming definitions");
1385 if (intval == 'N') {
1386 proto_tree_add_text(tree, tvb, offset -1, 1,
1387 "Not subscribed/not allowed");
1391 intval = UcpHandleInt(hf_ucp_parm_NPL);
1392 for (idx = 0; idx < intval; idx++)
1393 UcpHandleData(hf_ucp_data_section);
1396 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1397 proto_tree_add_text(tree, tvb, offset - 1, 1,
1398 "Call barring definitions");
1399 if (intval == 'N') {
1400 proto_tree_add_text(tree, tvb, offset -1, 1,
1401 "Not subscribed/not allowed");
1405 intval = UcpHandleInt(hf_ucp_parm_NPL);
1406 for (idx = 0; idx < intval; idx++)
1407 UcpHandleData(hf_ucp_data_section);
1410 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1411 proto_tree_add_text(tree, tvb, offset - 1, 1,
1412 "Deferred delivery definitions");
1413 if (intval == 'N') {
1414 proto_tree_add_text(tree, tvb, offset -1, 1,
1415 "Not subscribed/not allowed");
1419 intval = UcpHandleInt(hf_ucp_parm_NPL);
1420 for (idx = 0; idx < intval; idx++)
1421 UcpHandleData(hf_ucp_data_section);
1424 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1425 proto_tree_add_text(tree, tvb, offset - 1, 1,
1426 "Diversion definitions");
1427 if (intval == 'N') {
1428 proto_tree_add_text(tree, tvb, offset -1, 1,
1429 "Not subscribed/not allowed");
1433 intval = UcpHandleInt(hf_ucp_parm_NPL);
1434 for (idx = 0; idx < intval; idx++)
1435 UcpHandleData(hf_ucp_data_section);
1438 UcpHandleInt(hf_ucp_parm_LMN);
1439 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1440 if (intval == 'N') {
1441 proto_tree_add_string(tree, hf_ucp_parm_NMESS_str, tvb,
1442 offset -1, 1, "Not subscribed/not allowed");
1446 intval = UcpHandleInt(hf_ucp_parm_NMESS);
1450 UcpHandleInt(hf_ucp_parm_EC);
1451 UcpHandleString(hf_ucp_parm_SM);
1455 add_30O(proto_tree *tree, tvbuff_t *tvb)
1456 { /* SMS message transfer */
1459 UcpHandleString(hf_ucp_parm_AdC);
1460 UcpHandleString(hf_ucp_parm_OAdC);
1461 UcpHandleString(hf_ucp_parm_AC);
1462 UcpHandleByte(hf_ucp_parm_NRq);
1463 UcpHandleString(hf_ucp_parm_NAdC);
1464 UcpHandleInt(hf_ucp_parm_NPID);
1465 UcpHandleByte(hf_ucp_parm_DD);
1466 UcpHandleTime(hf_ucp_parm_DDT);
1467 UcpHandleTime(hf_ucp_parm_VP);
1468 UcpHandleData(hf_ucp_data_section);
1472 add_30R(proto_tree *tree, tvbuff_t *tvb)
1477 intval = UcpHandleByte(hf_ucp_parm_ACK);
1479 UcpHandleTime(hf_ucp_parm_MVP);
1481 UcpHandleInt(hf_ucp_parm_EC);
1482 UcpHandleString(hf_ucp_parm_SM);
1486 add_31O(proto_tree *tree, tvbuff_t *tvb)
1490 UcpHandleString(hf_ucp_parm_AdC);
1491 UcpHandleInt(hf_ucp_parm_PID);
1494 #define add_31R(a, b) add_01R(a, b)
1497 add_5xO(proto_tree *tree, tvbuff_t *tvb)
1498 { /* 50-series operations */
1505 UcpHandleString(hf_ucp_parm_AdC);
1506 UcpHandleString(hf_ucp_parm_OAdC);
1507 UcpHandleString(hf_ucp_parm_AC);
1508 UcpHandleByte(hf_ucp_parm_NRq);
1509 UcpHandleString(hf_ucp_parm_NAdC);
1510 UcpHandleByte(hf_ucp_parm_NT);
1511 UcpHandleInt(hf_ucp_parm_NPID);
1512 UcpHandleByte(hf_ucp_parm_LRq);
1513 UcpHandleString(hf_ucp_parm_LRAd);
1514 UcpHandleInt(hf_ucp_parm_LPID);
1515 UcpHandleByte(hf_ucp_parm_DD);
1516 UcpHandleTime(hf_ucp_parm_DDT);
1517 UcpHandleTime(hf_ucp_parm_VP);
1518 UcpHandleString(hf_ucp_parm_RPID);
1519 UcpHandleTime(hf_ucp_parm_SCTS);
1520 UcpHandleByte(hf_ucp_parm_Dst);
1521 UcpHandleInt(hf_ucp_parm_Rsn);
1522 UcpHandleTime(hf_ucp_parm_DSCTS);
1523 intval = UcpHandleByte(hf_ucp_parm_MT);
1524 UcpHandleString(hf_ucp_parm_NB);
1526 UcpHandleData(hf_ucp_data_section);
1528 UcpHandleIRAString(hf_ucp_parm_AMsg);
1529 UcpHandleByte(hf_ucp_parm_MMS);
1530 UcpHandleByte(hf_ucp_parm_PR);
1531 UcpHandleByte(hf_ucp_parm_DCs);
1532 UcpHandleByte(hf_ucp_parm_MCLs);
1533 UcpHandleByte(hf_ucp_parm_RPI);
1534 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1535 proto_tree_add_string(tree, hf_ucp_parm_CPg, tvb, offset - 1,1,
1536 "(reserved for Code Page)");
1539 if ((intval = tvb_get_guint8(tvb, offset++)) != '/') {
1540 proto_tree_add_string(tree, hf_ucp_parm_RPLy, tvb, offset - 1,1,
1541 "(reserved for Reply type)");
1544 UcpHandleString(hf_ucp_parm_OTOA);
1545 UcpHandleString(hf_ucp_parm_HPLMN);
1546 tmpoff = offset; /* Extra services */
1547 while (tvb_get_guint8(tvb, tmpoff++) != '/')
1549 if ((tmpoff - offset) > 1) {
1550 int len = tmpoff - offset - 1;
1552 ti = proto_tree_add_item(tree, hf_ucp_parm_XSer,tvb,offset,len,FALSE);
1553 tmptvb = tvb_new_subset(tvb, offset, len + 1, len + 1);
1554 proto_item_add_subtree(ti, ett_XSer);
1555 ucp_handle_XSer(ti, tmptvb);
1558 UcpHandleData(hf_ucp_parm_RES4);
1559 UcpHandleData(hf_ucp_parm_RES5);
1562 #define add_5xR(a, b) add_30R(a, b)
1565 add_6xO(proto_tree *tree, tvbuff_t *tvb, guint8 OT)
1566 { /* 60-series operations */
1569 UcpHandleString(hf_ucp_parm_OAdC);
1570 UcpHandleByte(hf_ucp_parm_OTON);
1571 UcpHandleByte(hf_ucp_parm_ONPI);
1573 UcpHandleByte(hf_ucp_parm_STYP0);
1575 UcpHandleByte(hf_ucp_parm_STYP1);
1577 UcpHandleIRAString(hf_ucp_parm_PWD);
1578 UcpHandleIRAString(hf_ucp_parm_NPWD);
1579 UcpHandleString(hf_ucp_parm_VERS);
1580 UcpHandleString(hf_ucp_parm_LAdC);
1581 UcpHandleByte(hf_ucp_parm_LTON);
1582 UcpHandleByte(hf_ucp_parm_LNPI);
1583 UcpHandleInt(hf_ucp_parm_OPID);
1584 UcpHandleData(hf_ucp_parm_RES1);
1585 UcpHandleData(hf_ucp_parm_RES2);
1588 #define add_6xR(a, b) add_01R(a, b)
1591 * End of convenient shorthands
1593 #undef UcpHandleString
1594 #undef UcpHandleIRAString
1595 #undef UcpHandleByte
1597 #undef UcpHandleTime
1598 #undef UcpHandleData
1600 /* Code to actually dissect the packets */
1602 * Overlapping data for these functions
1604 static int result, endpkt;
1607 * The heuristic dissector
1610 dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1612 guint8 O_R; /* Request or response */
1614 /* This runs atop TCP, so we are guaranteed that there is at least one
1615 byte in the tvbuff. */
1616 if (tvb_get_guint8(tvb, 0) != UCP_STX)
1619 result = check_ucp(tvb, &endpkt);
1621 if (result == UCP_MALFORMED)
1623 if (endpkt < UCP_OT_OFFSET + 1)
1625 * Might be shortened packet but don't handle anyway.
1630 * Try getting the operation-type and whether it's a request/response
1632 O_R = tvb_get_guint8(tvb, UCP_O_R_OFFSET);
1633 if (match_strval(O_R, vals_hdr_O_R) == NULL)
1636 * Ok, looks like a valid packet, go dissect.
1639 dissect_ucp_common(tvb, pinfo, tree);
1644 get_ucp_pdu_len(tvbuff_t *tvb, int offset)
1649 offset = offset + 4;
1650 for (i = 0; i < UCP_LEN_LEN; i++) { /* Length */
1651 intval = 10 * intval +
1652 (tvb_get_guint8(tvb, offset) - '0');
1661 dissect_ucp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1663 tcp_dissect_pdus(tvb, pinfo, tree, ucp_desegment, UCP_HEADER_SIZE,
1664 get_ucp_pdu_len, dissect_ucp_common);
1667 * The actual dissector
1670 dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1672 int offset = 0; /* Offset in packet within tvbuff */
1673 int tmpoff; /* Local offset value (per field) */
1674 guint8 O_R; /* Request or response */
1675 guint8 OT; /* Operation type */
1679 /* Set up structures needed to add the protocol subtree and manage it */
1682 proto_tree *ucp_tree;
1683 proto_tree *sub_tree;
1686 /* Make entries in Protocol column */
1687 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1688 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCP");
1690 /* This runs atop TCP, so we are guaranteed that there is at least one
1691 byte in the tvbuff. */
1692 if (tvb_get_guint8(tvb, 0) != UCP_STX){
1693 proto_tree_add_text(tree, tvb, 0, -1,"UCP_STX missing, this is not a new packet");
1697 /* Get data needed for dissect_ucp_common */
1698 result = check_ucp(tvb, &endpkt);
1700 O_R = tvb_get_guint8(tvb, UCP_O_R_OFFSET);
1702 * So do an atoi() on the operation type
1704 OT = tvb_get_guint8(tvb, UCP_OT_OFFSET) - '0';
1705 OT = 10 * OT + (tvb_get_guint8(tvb, UCP_OT_OFFSET + 1) - '0');
1707 /* Make entries in Info column on summary display */
1708 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1709 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCP");
1710 if (check_col(pinfo->cinfo, COL_INFO)) {
1711 col_clear(pinfo->cinfo, COL_INFO);
1712 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (%s)",
1713 val_to_str(OT, vals_hdr_OT, "unknown operation"),
1714 match_strval(O_R, vals_hdr_O_R));
1715 if (result == UCP_SHORTENED)
1716 col_append_str(pinfo->cinfo, COL_INFO, " [short packet]");
1717 else if (result == UCP_INV_CHK)
1718 col_append_str(pinfo->cinfo, COL_INFO, " [checksum invalid]");
1721 /* In the interest of speed, if "tree" is NULL, don't do any work not
1722 necessary to generate protocol tree items. */
1725 /* create display subtree for the protocol */
1726 ti = proto_tree_add_item(tree, proto_ucp, tvb, 0, -1, FALSE);
1728 ucp_tree = proto_item_add_subtree(ti, ett_ucp);
1730 * Process the packet here.
1731 * Transaction number
1733 offset++; /* Skip <stx> */
1735 intval = tvb_get_guint8(tvb, tmpoff++) - '0';
1736 intval = 10 * intval + (tvb_get_guint8(tvb, tmpoff++) - '0');
1737 proto_tree_add_uint(ucp_tree, hf_ucp_hdr_TRN, tvb, offset,
1738 UCP_TRN_LEN, intval);
1741 offset++; /* Skip '/' */
1744 for (i = 0; i < UCP_LEN_LEN; i++) { /* Length */
1745 intval = 10 * intval +
1746 (tvb_get_guint8(tvb, tmpoff++) - '0');
1748 proto_tree_add_uint(ucp_tree, hf_ucp_hdr_LEN, tvb, offset,
1749 UCP_LEN_LEN, intval);
1752 offset++; /* Operation/Response */
1753 proto_tree_add_uint(ucp_tree, hf_ucp_hdr_O_R, tvb, offset++,
1756 offset++; /* Operation type */
1757 proto_tree_add_uint(ucp_tree, hf_ucp_hdr_OT, tvb, offset,
1759 offset += UCP_OT_LEN;
1761 * Variable part starts here. Don't dissect if not complete.
1763 if (result == UCP_SHORTENED)
1765 tmp_tvb = tvb_new_subset(tvb, offset, -1, -1);
1766 sub_ti = proto_tree_add_item(ucp_tree, hf_ucp_oper_section, tvb,
1767 offset, endpkt - offset, FALSE);
1768 sub_tree = proto_item_add_subtree(sub_ti, ett_sub);
1772 O_R == 'O' ? add_00O(sub_tree,tmp_tvb) : add_00R(sub_tree,tmp_tvb);
1775 O_R == 'O' ? add_01O(sub_tree,tmp_tvb) : add_01R(sub_tree,tmp_tvb);
1778 O_R == 'O' ? add_02O(sub_tree,tmp_tvb) : add_02R(sub_tree,tmp_tvb);
1781 O_R == 'O' ? add_03O(sub_tree,tmp_tvb) : add_03R(sub_tree,tmp_tvb);
1784 O_R == 'O' ? add_04O(sub_tree,tmp_tvb) : add_04R(sub_tree,tmp_tvb);
1787 O_R == 'O' ? add_05O(sub_tree,tmp_tvb) : add_05R(sub_tree,tmp_tvb);
1790 O_R == 'O' ? add_06O(sub_tree,tmp_tvb) : add_06R(sub_tree,tmp_tvb);
1793 O_R == 'O' ? add_07O(sub_tree,tmp_tvb) : add_07R(sub_tree,tmp_tvb);
1796 O_R == 'O' ? add_08O(sub_tree,tmp_tvb) : add_08R(sub_tree,tmp_tvb);
1799 O_R == 'O' ? add_09O(sub_tree,tmp_tvb) : add_09R(sub_tree,tmp_tvb);
1802 O_R == 'O' ? add_10O(sub_tree,tmp_tvb) : add_10R(sub_tree,tmp_tvb);
1805 O_R == 'O' ? add_11O(sub_tree,tmp_tvb) : add_11R(sub_tree,tmp_tvb);
1808 O_R == 'O' ? add_12O(sub_tree,tmp_tvb) : add_12R(sub_tree,tmp_tvb);
1811 O_R == 'O' ? add_13O(sub_tree,tmp_tvb) : add_13R(sub_tree,tmp_tvb);
1814 O_R == 'O' ? add_14O(sub_tree,tmp_tvb) : add_14R(sub_tree,tmp_tvb);
1817 O_R == 'O' ? add_15O(sub_tree,tmp_tvb) : add_15R(sub_tree,tmp_tvb);
1820 O_R == 'O' ? add_16O(sub_tree,tmp_tvb) : add_16R(sub_tree,tmp_tvb);
1823 O_R == 'O' ? add_17O(sub_tree,tmp_tvb) : add_17R(sub_tree,tmp_tvb);
1826 O_R == 'O' ? add_18O(sub_tree,tmp_tvb) : add_18R(sub_tree,tmp_tvb);
1829 O_R == 'O' ? add_19O(sub_tree,tmp_tvb) : add_19R(sub_tree,tmp_tvb);
1832 O_R == 'O' ? add_20O(sub_tree,tmp_tvb) : add_20R(sub_tree,tmp_tvb);
1835 O_R == 'O' ? add_21O(sub_tree,tmp_tvb) : add_21R(sub_tree,tmp_tvb);
1838 O_R == 'O' ? add_22O(sub_tree,tmp_tvb) : add_22R(sub_tree,tmp_tvb);
1841 O_R == 'O' ? add_23O(sub_tree,tmp_tvb) : add_23R(sub_tree,tmp_tvb);
1844 O_R == 'O' ? add_24O(sub_tree,tmp_tvb) : add_24R(sub_tree,tmp_tvb);
1847 O_R == 'O' ? add_30O(sub_tree,tmp_tvb) : add_30R(sub_tree,tmp_tvb);
1850 O_R == 'O' ? add_31O(sub_tree,tmp_tvb) : add_31R(sub_tree,tmp_tvb);
1852 case 51: case 52: case 53: case 54: case 55: case 56: case 57:
1854 O_R == 'O' ? add_5xO(sub_tree,tmp_tvb) : add_5xR(sub_tree,tmp_tvb);
1857 O_R == 'O' ? add_6xO(sub_tree,tmp_tvb,OT) : add_6xR(sub_tree,tmp_tvb);
1866 /* Register the protocol with Ethereal */
1868 proto_register_ucp(void)
1871 /* Setup list of fields */
1872 static hf_register_info hf[] = {
1874 { "Transaction Reference Number", "ucp.hdr.TRN",
1875 FT_UINT8, BASE_DEC, NULL, 0x00,
1876 "Transaction number for this command, used in windowing.",
1881 { "Length", "ucp.hdr.LEN",
1882 FT_UINT16, BASE_DEC, NULL, 0x00,
1883 "Total number of characters between <stx>...<etx>.",
1888 { "Type", "ucp.hdr.O_R",
1889 FT_UINT8, BASE_DEC, VALS(vals_hdr_O_R), 0x00,
1890 "Your basic 'is a request or response'.",
1895 { "Operation", "ucp.hdr.OT",
1896 FT_UINT8, BASE_DEC, VALS(vals_hdr_OT), 0x00,
1897 "The operation that is requested with this message.",
1901 { &hf_ucp_oper_section,
1902 { "Data", "ucp.parm",
1903 FT_NONE, BASE_DEC, NULL, 0x00,
1904 "The actual content of the operation.",
1909 { "AdC", "ucp.parm.AdC",
1910 FT_STRING, BASE_NONE, NULL, 0x00,
1911 "Address code recipient.",
1915 { &hf_ucp_parm_OAdC,
1916 { "OAdC", "ucp.parm.OAdC",
1917 FT_STRING, BASE_NONE, NULL, 0x00,
1918 "Address code originator.",
1922 { &hf_ucp_parm_DAdC,
1923 { "DAdC", "ucp.parm.DAdC",
1924 FT_STRING, BASE_NONE, NULL, 0x00,
1925 "Diverted address code.",
1930 { "AC", "ucp.parm.AC",
1931 FT_STRING, BASE_NONE, NULL, 0x00,
1932 "Authentication code.",
1937 { "OAC", "ucp.parm.OAC",
1938 FT_STRING, BASE_NONE, NULL, 0x00,
1939 "Authentication code, originator.",
1944 { "NAC", "ucp.parm.NAC",
1945 FT_STRING, BASE_NONE, NULL, 0x00,
1946 "New authentication code.",
1951 { "BAS", "ucp.parm.BAS",
1952 FT_UINT8, BASE_DEC, VALS(vals_parm_BAS), 0x00,
1953 "Barring status flag.",
1958 { "LAR", "ucp.parm.LAR",
1959 FT_UINT8, BASE_DEC, VALS(vals_parm_LAR), 0x00,
1960 "Leg. code for all calls flag.",
1965 { "LAC", "ucp.parm.LAC",
1966 FT_STRING, BASE_NONE, NULL, 0x00,
1967 "New leg. code for all calls.",
1972 { "L1R", "ucp.parm.L1R",
1973 FT_UINT8, BASE_DEC, VALS(vals_parm_L1R), 0x00,
1974 "Leg. code for priority 1 flag.",
1979 { "L1P", "ucp.parm.L1P",
1980 FT_STRING, BASE_NONE, NULL, 0x00,
1981 "New leg. code for level 1 priority.",
1986 { "L3R", "ucp.parm.L3R",
1987 FT_UINT8, BASE_DEC, VALS(vals_parm_L3R), 0x00,
1988 "Leg. code for priority 3 flag.",
1993 { "L3P", "ucp.parm.L3P",
1994 FT_STRING, BASE_NONE, NULL, 0x00,
1995 "New leg. code for level 3 priority.",
2000 { "LCR", "ucp.parm.LCR",
2001 FT_UINT8, BASE_DEC, VALS(vals_parm_LCR), 0x00,
2002 "Leg. code for reverse charging flag.",
2007 { "LUR", "ucp.parm.LUR",
2008 FT_UINT8, BASE_DEC, VALS(vals_parm_LUR), 0x00,
2009 "Leg. code for urgent message flag.",
2014 { "LRR", "ucp.parm.LRR",
2015 FT_UINT8, BASE_DEC, VALS(vals_parm_LRR), 0x00,
2016 "Leg. code for repitition flag.",
2021 { "RT", "ucp.parm.RT",
2022 FT_UINT8, BASE_DEC, VALS(vals_parm_RT), 0x00,
2028 { "NoN", "ucp.parm.NoN",
2029 FT_UINT16, BASE_DEC, NULL, 0x00,
2030 "Maximum number of numerical characters accepted.",
2035 { "NoA", "ucp.parm.NoA",
2036 FT_UINT16, BASE_DEC, NULL, 0x00,
2037 "Maximum number of alphanumerical characters accepted.",
2042 { "NoB", "ucp.parm.NoB",
2043 FT_UINT16, BASE_DEC, NULL, 0x00,
2044 "Maximum number of data bits accepted.",
2049 { "PNC", "ucp.parm.PNC",
2050 FT_UINT8, BASE_DEC, VALS(vals_parm_PNC), 0x00,
2051 "Paging network controller.",
2055 { &hf_ucp_parm_AMsg,
2056 { "AMsg", "ucp.parm.AMsg",
2057 FT_STRING, BASE_NONE, NULL, 0x00,
2058 "The alphanumeric message that is being sent.",
2063 { "LNo", "ucp.parm.LNo",
2064 FT_STRING, BASE_NONE, NULL, 0x00,
2065 "Standard text list number requested by calling party.",
2070 { "LST", "ucp.parm.LST",
2071 FT_STRING, BASE_NONE, NULL, 0x00,
2072 "Legitimisation code for standard text.",
2077 { "TNo", "ucp.parm.TNo",
2078 FT_STRING, BASE_NONE, NULL, 0x00,
2079 "Standard text number requested by calling party.",
2084 { "CS", "ucp.parm.CS",
2085 FT_UINT8, BASE_DEC, NULL, 0x00,
2086 "Additional character set number.",
2091 { "PID", "ucp.parm.PID",
2092 FT_UINT16, BASE_DEC, VALS(vals_parm_PID), 0x00,
2098 { "NPL", "ucp.parm.NPL",
2099 FT_UINT16, BASE_DEC, NULL, 0x00,
2100 "Number of parameters in the following list.",
2105 { "GA", "ucp.parm.GA",
2106 FT_STRING, BASE_NONE, NULL, 0x00,
2107 "GA?? haven't got a clue.",
2112 { "RP", "ucp.parm.RP",
2113 FT_UINT8, BASE_DEC, VALS(vals_parm_RP), 0x00,
2114 "Repitition requested.",
2119 { "LRP", "ucp.parm.LRP",
2120 FT_STRING, BASE_DEC, NULL, 0x00,
2121 "Legitimisation code for repitition.",
2126 { "PR", "ucp.parm.PR",
2127 FT_UINT8, BASE_DEC, NULL, 0x00,
2128 "Priority requested.",
2133 { "LPR", "ucp.parm.LPR",
2134 FT_STRING, BASE_DEC, NULL, 0x00,
2135 "Legitimisation code for priority requested.",
2140 { "UM", "ucp.parm.UM",
2141 FT_UINT8, BASE_DEC, VALS(vals_parm_UM), 0x00,
2142 "Urgent message indicator.",
2147 { "LUM", "ucp.parm.LUM",
2148 FT_STRING, BASE_DEC, NULL, 0x00,
2149 "Legitimisation code for urgent message.",
2154 { "RC", "ucp.parm.RC",
2155 FT_UINT8, BASE_DEC, VALS(vals_parm_RC), 0x00,
2156 "Reverse charging request.",
2161 { "LRC", "ucp.parm.LRC",
2162 FT_STRING, BASE_DEC, NULL, 0x00,
2163 "Legitimisation code for reverse charging.",
2168 { "NRq", "ucp.parm.NRq",
2169 FT_UINT8, BASE_DEC, VALS(vals_parm_NRq), 0x00,
2170 "Notification request.",
2174 { &hf_ucp_parm_GAdC,
2175 { "GAdC", "ucp.parm.GAdC",
2176 FT_STRING, BASE_NONE, NULL, 0x00,
2177 "Group address code.",
2182 { "A_D", "ucp.parm.A_D",
2183 FT_UINT8, BASE_DEC, VALS(vals_parm_A_D), 0x00,
2184 "Add to/delete from fixed subscriber address list record.",
2189 { "CT", "ucp.parm.CT",
2190 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2191 "Accumulated charges timestamp.",
2196 { "AAC", "ucp.parm.AAC",
2197 FT_STRING, BASE_NONE, NULL, 0x00,
2198 "Accumulated charges.",
2203 { "MNo", "ucp.parm.MNo",
2204 FT_STRING, BASE_NONE, NULL, 0x00,
2210 { "R_T", "ucp.parm.R_T",
2211 FT_UINT8, BASE_DEC, VALS(vals_parm_R_T), 0x00,
2216 { &hf_ucp_parm_NAdC,
2217 { "NAdC", "ucp.parm.NAdC",
2218 FT_STRING, BASE_NONE, NULL, 0x00,
2219 "Notification address.",
2224 { "NT", "ucp.parm.NT",
2225 FT_UINT8, BASE_DEC, VALS(vals_parm_NT), 0x00,
2226 "Notification type.",
2230 { &hf_ucp_parm_IVR5x,
2231 { "IVR5x", "ucp.parm.IVR5x",
2232 FT_STRING, BASE_NONE, NULL, 0x00,
2233 "UCP release number supported/accepted.",
2237 { &hf_ucp_parm_REQ_OT,
2238 { "REQ_OT", "ucp.parm.REQ_OT",
2239 FT_UINT8, BASE_DEC, VALS(vals_parm_REQ_OT), 0x00,
2240 "UCP release number supported/accepted.",
2244 { &hf_ucp_parm_SSTAT,
2245 { "SSTAT", "ucp.parm.SSTAT",
2246 FT_UINT8, BASE_DEC, VALS(vals_parm_SSTAT), 0x00,
2247 "Supplementary services for which status is requested.",
2252 { "LMN", "ucp.parm.LMN",
2253 FT_UINT8, BASE_DEC, NULL, 0x00,
2254 "Last message number.",
2258 { &hf_ucp_parm_NMESS,
2259 { "NMESS", "ucp.parm.NMESS",
2260 FT_UINT8, BASE_DEC, NULL, 0x00,
2261 "Number of stored messages.",
2265 { &hf_ucp_parm_NMESS_str,
2266 { "NMESS_str", "ucp.parm.NMESS_str",
2267 FT_STRING, BASE_NONE, NULL, 0x00,
2268 "Number of stored messages.",
2272 { &hf_ucp_parm_NPID,
2273 { "NPID", "ucp.parm.NPID",
2274 FT_UINT16, BASE_DEC, VALS(vals_parm_PID), 0x00,
2275 "Notification PID value.",
2280 { "LRq", "ucp.parm.LRq",
2281 FT_UINT8, BASE_DEC, VALS(vals_parm_LRq), 0x00,
2282 "Last resort address request.",
2286 { &hf_ucp_parm_LRAd,
2287 { "LRAd", "ucp.parm.LRAd",
2288 FT_STRING, BASE_NONE, NULL, 0x00,
2289 "Last resort address.",
2293 { &hf_ucp_parm_LPID,
2294 { "LPID", "ucp.parm.LPID",
2295 FT_UINT16, BASE_DEC, VALS(vals_parm_PID), 0x00,
2296 "Last resort PID value.",
2301 { "DD", "ucp.parm.DD",
2302 FT_UINT8, BASE_DEC, VALS(vals_parm_DD), 0x00,
2303 "Deferred delivery requested.",
2308 { "DDT", "ucp.parm.DDT",
2309 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2310 "Deferred delivery time.",
2315 { "STx", "ucp.parm.STx",
2316 FT_NONE, BASE_NONE, NULL, 0x00,
2322 { "ST", "ucp.parm.ST",
2323 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2329 { "SP", "ucp.parm.SP",
2330 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2336 { "VP", "ucp.parm.VP",
2337 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2342 { &hf_ucp_parm_RPID,
2343 { "RPID", "ucp.parm.RPID",
2344 FT_STRING, BASE_NONE, NULL, 0x00,
2349 { &hf_ucp_parm_SCTS,
2350 { "SCTS", "ucp.parm.SCTS",
2351 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2352 "Service Centre timestamp.",
2357 { "Dst", "ucp.parm.Dst",
2358 FT_UINT8, BASE_DEC, VALS(vals_parm_Dst), 0x00,
2364 { "Rsn", "ucp.parm.Rsn",
2365 FT_UINT16, BASE_DEC, VALS(vals_parm_Rsn), 0x00,
2370 { &hf_ucp_parm_DSCTS,
2371 { "DSCTS", "ucp.parm.DSCTS",
2372 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2373 "Delivery timestamp.",
2378 { "MT", "ucp.parm.MT",
2379 FT_UINT8, BASE_DEC, VALS(vals_parm_MT), 0x00,
2385 { " NB", "ucp.parm.NB",
2386 FT_STRING, BASE_NONE, NULL, 0x00,
2387 "No. of bits in Transparent Data (TD) message.",
2391 { &hf_ucp_data_section,
2392 { " Data", "ucp.message",
2393 FT_NONE, BASE_NONE, NULL, 0x00,
2394 "The actual message or data.",
2399 { "MMS", "ucp.parm.MMS",
2400 FT_UINT8, BASE_DEC, NULL, 0x00,
2401 "More messages to send.",
2406 { "DCs", "ucp.parm.DCs",
2407 FT_UINT8, BASE_DEC, VALS(vals_parm_DCs), 0x00,
2408 "Data coding scheme (deprecated).",
2412 { &hf_ucp_parm_MCLs,
2413 { "MCLs", "ucp.parm.MCLs",
2414 FT_UINT8, BASE_DEC, VALS(vals_parm_MCLs), 0x00,
2420 { "RPI", "ucp.parm.RPI",
2421 FT_UINT8, BASE_DEC, VALS(vals_parm_RPI), 0x00,
2427 { "CPg", "ucp.parm.CPg",
2428 FT_STRING, BASE_NONE, NULL, 0x00,
2429 "Reserved for Code Page.",
2433 { &hf_ucp_parm_RPLy,
2434 { "RPLy", "ucp.parm.RPLy",
2435 FT_STRING, BASE_NONE, NULL, 0x00,
2436 "Reserved for Reply type.",
2440 { &hf_ucp_parm_OTOA,
2441 { "OTOA", "ucp.parm.OTOA",
2442 FT_STRING, BASE_NONE, NULL, 0x00,
2443 "Originator Type Of Address.",
2447 { &hf_ucp_parm_HPLMN,
2448 { "HPLMN", "ucp.parm.HPLMN",
2449 FT_STRING, BASE_NONE, NULL, 0x00,
2450 "Home PLMN address.",
2454 { &hf_ucp_parm_XSer,
2455 { "Extra services:", "ucp.parm.XSer",
2456 FT_NONE, BASE_DEC, NULL, 0x00,
2461 { &hf_ucp_parm_RES4,
2462 { "RES4", "ucp.parm.RES4",
2463 FT_STRING, BASE_NONE, NULL, 0x00,
2464 "Reserved for future use.",
2468 { &hf_ucp_parm_RES5,
2469 { "RES5", "ucp.parm.RES5",
2470 FT_STRING, BASE_NONE, NULL, 0x00,
2471 "Reserved for future use.",
2475 { &hf_ucp_parm_OTON,
2476 { "OTON", "ucp.parm.OTON",
2477 FT_UINT8, BASE_DEC, VALS(vals_parm_OTON), 0x00,
2478 "Originator type of number.",
2482 { &hf_ucp_parm_ONPI,
2483 { "ONPI", "ucp.parm.ONPI",
2484 FT_UINT8, BASE_DEC, VALS(vals_parm_ONPI), 0x00,
2485 "Originator numbering plan id.",
2489 { &hf_ucp_parm_STYP0,
2490 { "STYP0", "ucp.parm.STYP0",
2491 FT_UINT8, BASE_DEC, VALS(vals_parm_STYP0), 0x00,
2492 "Subtype of operation.",
2496 { &hf_ucp_parm_STYP1,
2497 { "STYP1", "ucp.parm.STYP1",
2498 FT_UINT8, BASE_DEC, VALS(vals_parm_STYP1), 0x00,
2499 "Subtype of operation.",
2504 { "PWD", "ucp.parm.PWD",
2505 FT_STRING, BASE_NONE, NULL, 0x00,
2506 "Current password.",
2510 { &hf_ucp_parm_NPWD,
2511 { "NPWD", "ucp.parm.NPWD",
2512 FT_STRING, BASE_NONE, NULL, 0x00,
2517 { &hf_ucp_parm_VERS,
2518 { "VERS", "ucp.parm.VERS",
2519 FT_STRING, BASE_NONE, NULL, 0x00,
2524 { &hf_ucp_parm_LAdC,
2525 { "LAdC", "ucp.parm.LAdC",
2526 FT_STRING, BASE_NONE, NULL, 0x00,
2527 "Address for VSMSC list operation.",
2531 { &hf_ucp_parm_LTON,
2532 { "LTON", "ucp.parm.LTON",
2533 FT_UINT8, BASE_DEC, NULL, 0x00,
2534 "Type of number list address.",
2538 { &hf_ucp_parm_LNPI,
2539 { "LNPI", "ucp.parm.LNPI",
2540 FT_UINT8, BASE_DEC, NULL, 0x00,
2541 "Numbering plan id. list address.",
2545 { &hf_ucp_parm_OPID,
2546 { "OPID", "ucp.parm.OPID",
2547 FT_UINT8, BASE_DEC, VALS(vals_parm_OPID), 0x00,
2548 "Originator protocol identifier.",
2552 { &hf_ucp_parm_RES1,
2553 { "RES1", "ucp.parm.RES1",
2554 FT_STRING, BASE_NONE, NULL, 0x00,
2555 "Reserved for future use.",
2559 { &hf_ucp_parm_RES2,
2560 { "RES2", "ucp.parm.RES2",
2561 FT_STRING, BASE_NONE, NULL, 0x00,
2562 "Reserved for future use.",
2567 { "(N)Ack", "ucp.parm.ACK",
2568 FT_UINT8, BASE_DEC, VALS(vals_parm_ACK), 0x00,
2569 "Positive or negative acknowledge of the operation.",
2574 { "MVP", "ucp.parm.MVP",
2575 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
2576 "Mofified validity period.",
2581 { "Error code", "ucp.parm.EC",
2582 FT_UINT8, BASE_DEC, VALS(vals_parm_EC), 0x00,
2583 "The result of the requested operation.",
2588 { "SM", "ucp.parm.SM",
2589 FT_STRING, BASE_NONE, NULL, 0x00,
2595 { "Type of service", "ucp.xser.service",
2596 FT_UINT8, BASE_HEX, VALS(vals_xser_service), 0x00,
2597 "The type of service specified.",
2602 /* Setup protocol subtree array */
2603 static gint *ett[] = {
2608 module_t *ucp_module;
2610 /* Register the protocol name and description */
2611 proto_ucp = proto_register_protocol("Universal Computer Protocol",
2614 /* Required function calls to register header fields and subtrees used */
2615 proto_register_field_array(proto_ucp, hf, array_length(hf));
2616 proto_register_subtree_array(ett, array_length(ett));
2618 /* register preferences */
2619 ucp_module = prefs_register_protocol(proto_ucp, NULL);
2620 prefs_register_bool_preference(ucp_module, "desegment_ucp_messages",
2621 "Reassemble UCP messages spanning multiple TCP segments",
2622 "Whether the UCP dissector should reassemble messages spanning multiple TCP segments."
2623 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
2629 * If dissector uses sub-dissector registration add a registration routine.
2630 * This format is required because a script is used to find these routines and
2631 * create the code that calls these routines.
2634 proto_reg_handoff_ucp(void)
2636 dissector_handle_t ucp_handle;
2639 * UCP can be spoken on any port so, when not on a specific port, try this
2640 * one whenever TCP is spoken.
2642 heur_dissector_add("tcp", dissect_ucp_heur, proto_ucp);
2645 * Also register as one that can be selected by a TCP port number.
2647 ucp_handle = create_dissector_handle(dissect_ucp_tcp, proto_ucp);
2648 dissector_add_handle("tcp.port", ucp_handle);