2 * Routines for Signalling Connection Control Part (SCCP) dissection
4 * It is hopefully compliant to:
7 * YDN 038-1997 (Chinese ITU variant)
8 * JT-Q713 and NTT-Q713 (Japan)
10 * Note that Japan-specific GTT is incomplete; in particular, the specific
11 * TTs that are defined in TTC and NTT are not decoded in detail.
13 * Copyright 2002, Jeff Morriss <jeff.morriss[AT]ulticom.com>
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * Copied from packet-m2pa.c
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * as published by the Free Software Foundation; either version 2
26 * of the License, or (at your option) any later version.
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the Free Software
35 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 #include <epan/packet.h>
49 #include <epan/prefs.h>
50 #include <epan/emem.h>
51 #include <epan/reassemble.h>
52 #include <epan/asn1.h>
54 #include <epan/strutil.h>
55 #include "packet-mtp3.h"
56 #include "packet-tcap.h"
57 #include "packet-sccp.h"
58 #include "packet-e164.h"
59 #include "packet-e212.h"
60 #include "packet-frame.h"
63 static Standard_Type decode_mtp3_standard;
66 #define SCCP_MSG_TYPE_OFFSET 0
67 #define SCCP_MSG_TYPE_LENGTH 1
68 #define POINTER_LENGTH 1
69 #define POINTER_LENGTH_LONG 2
71 #define INVALID_LR 0xffffff /* a reserved value */
73 /* Same as below but with names typed out */
74 static const value_string sccp_message_type_values[] = {
75 { SCCP_MSG_TYPE_CR, "Connection Request" },
76 { SCCP_MSG_TYPE_CC, "Connection Confirm" },
77 { SCCP_MSG_TYPE_CREF, "Connection Refused" },
78 { SCCP_MSG_TYPE_RLSD, "Released" },
79 { SCCP_MSG_TYPE_RLC, "Release Complete" },
80 { SCCP_MSG_TYPE_DT1, "Data Form 1" },
81 { SCCP_MSG_TYPE_DT2, "Data Form 2" },
82 { SCCP_MSG_TYPE_AK, "Data Acknowledgement" },
83 { SCCP_MSG_TYPE_UDT, "Unitdata" },
84 { SCCP_MSG_TYPE_UDTS, "Unitdata Service" },
85 { SCCP_MSG_TYPE_ED, "Expedited Data" },
86 { SCCP_MSG_TYPE_EA, "Expedited Data Acknowledgement" },
87 { SCCP_MSG_TYPE_RSR, "Reset Request" },
88 { SCCP_MSG_TYPE_RSC, "Reset Confirmation" },
89 { SCCP_MSG_TYPE_ERR, "Error" },
90 { SCCP_MSG_TYPE_IT, "Inactivity Timer" },
91 { SCCP_MSG_TYPE_XUDT, "Extended Unitdata" },
92 { SCCP_MSG_TYPE_XUDTS, "Extended Unitdata Service" },
93 { SCCP_MSG_TYPE_LUDT, "Long Unitdata (ITU)" },
94 { SCCP_MSG_TYPE_LUDTS, "Long Unitdata Service (ITU)" },
97 /* Same as above but in acronym form (for the Info column) */
98 const value_string sccp_message_type_acro_values[] = {
99 { SCCP_MSG_TYPE_CR, "CR" },
100 { SCCP_MSG_TYPE_CC, "CC" },
101 { SCCP_MSG_TYPE_CREF, "CREF" },
102 { SCCP_MSG_TYPE_RLSD, "RLSD" },
103 { SCCP_MSG_TYPE_RLC, "RLC" },
104 { SCCP_MSG_TYPE_DT1, "DT1" },
105 { SCCP_MSG_TYPE_DT2, "DT2" },
106 { SCCP_MSG_TYPE_AK, "AK" },
107 { SCCP_MSG_TYPE_UDT, "UDT" },
108 { SCCP_MSG_TYPE_UDTS, "UDTS" },
109 { SCCP_MSG_TYPE_ED, "ED" },
110 { SCCP_MSG_TYPE_EA, "EA" },
111 { SCCP_MSG_TYPE_RSR, "RSR" },
112 { SCCP_MSG_TYPE_RSC, "RSC" },
113 { SCCP_MSG_TYPE_ERR, "ERR" },
114 { SCCP_MSG_TYPE_IT, "IT" },
115 { SCCP_MSG_TYPE_XUDT, "XUDT" },
116 { SCCP_MSG_TYPE_XUDTS, "XUDTS" },
117 { SCCP_MSG_TYPE_LUDT, "LUDT" },
118 { SCCP_MSG_TYPE_LUDTS, "LUDTS" },
121 #define PARAMETER_LENGTH_LENGTH 1
122 #define PARAMETER_LONG_DATA_LENGTH_LENGTH 2
123 #define PARAMETER_TYPE_LENGTH 1
125 #define PARAMETER_END_OF_OPTIONAL_PARAMETERS 0x00
126 #define PARAMETER_DESTINATION_LOCAL_REFERENCE 0x01
127 #define PARAMETER_SOURCE_LOCAL_REFERENCE 0x02
128 #define PARAMETER_CALLED_PARTY_ADDRESS 0x03
129 #define PARAMETER_CALLING_PARTY_ADDRESS 0x04
130 #define PARAMETER_CLASS 0x05
131 #define PARAMETER_SEGMENTING_REASSEMBLING 0x06
132 #define PARAMETER_RECEIVE_SEQUENCE_NUMBER 0x07
133 #define PARAMETER_SEQUENCING_SEGMENTING 0x08
134 #define PARAMETER_CREDIT 0x09
135 #define PARAMETER_RELEASE_CAUSE 0x0a
136 #define PARAMETER_RETURN_CAUSE 0x0b
137 #define PARAMETER_RESET_CAUSE 0x0c
138 #define PARAMETER_ERROR_CAUSE 0x0d
139 #define PARAMETER_REFUSAL_CAUSE 0x0e
140 #define PARAMETER_DATA 0x0f
141 #define PARAMETER_SEGMENTATION 0x10
142 #define PARAMETER_HOP_COUNTER 0x11
143 /* The below 2 are ITU only */
144 #define PARAMETER_IMPORTANCE 0x12
145 #define PARAMETER_LONG_DATA 0x13
146 /* ISNI is ANSI only */
147 #define PARAMETER_ISNI 0xfa
149 static const value_string sccp_parameter_values[] = {
150 { PARAMETER_END_OF_OPTIONAL_PARAMETERS, "End of Optional Parameters" },
151 { PARAMETER_DESTINATION_LOCAL_REFERENCE, "Destination Local Reference" },
152 { PARAMETER_SOURCE_LOCAL_REFERENCE, "Source Local Reference" },
153 { PARAMETER_CALLED_PARTY_ADDRESS, "Called Party Address" },
154 { PARAMETER_CALLING_PARTY_ADDRESS, "Calling Party Address" },
155 { PARAMETER_CLASS, "Protocol Class" },
156 { PARAMETER_SEGMENTING_REASSEMBLING, "Segmenting/Reassembling" },
157 { PARAMETER_RECEIVE_SEQUENCE_NUMBER, "Receive Sequence Number" },
158 { PARAMETER_SEQUENCING_SEGMENTING, "Sequencing/Segmenting" },
159 { PARAMETER_CREDIT, "Credit" },
160 { PARAMETER_RELEASE_CAUSE, "Release Cause" },
161 { PARAMETER_RETURN_CAUSE, "Return Cause" },
162 { PARAMETER_RESET_CAUSE, "Reset Cause" },
163 { PARAMETER_ERROR_CAUSE, "Error Cause" },
164 { PARAMETER_REFUSAL_CAUSE, "Refusal Cause" },
165 { PARAMETER_DATA, "Data" },
166 { PARAMETER_SEGMENTATION, "Segmentation" },
167 { PARAMETER_HOP_COUNTER, "Hop Counter" },
168 { PARAMETER_IMPORTANCE, "Importance (ITU)" },
169 { PARAMETER_LONG_DATA, "Long Data (ITU)" },
170 { PARAMETER_ISNI, "Intermediate Signaling Network Identification (ANSI)" },
174 #define END_OF_OPTIONAL_PARAMETERS_LENGTH 1
175 #define DESTINATION_LOCAL_REFERENCE_LENGTH 3
176 #define SOURCE_LOCAL_REFERENCE_LENGTH 3
177 #define PROTOCOL_CLASS_LENGTH 1
178 #define RECEIVE_SEQUENCE_NUMBER_LENGTH 1
179 #define CREDIT_LENGTH 1
180 #define RELEASE_CAUSE_LENGTH 1
181 #define RETURN_CAUSE_LENGTH 1
182 #define RESET_CAUSE_LENGTH 1
183 #define ERROR_CAUSE_LENGTH 1
184 #define REFUSAL_CAUSE_LENGTH 1
185 #define HOP_COUNTER_LENGTH 1
186 #define IMPORTANCE_LENGTH 1
189 /* Parts of the Called and Calling Address parameters */
190 /* Address Indicator */
191 #define ADDRESS_INDICATOR_LENGTH 1
192 #define ITU_RESERVED_MASK 0x80
193 #define ANSI_NATIONAL_MASK 0x80
194 #define ROUTING_INDICATOR_MASK 0x40
195 #define GTI_MASK 0x3C
197 #define ITU_SSN_INDICATOR_MASK 0x02
198 #define ITU_PC_INDICATOR_MASK 0x01
199 #define ANSI_PC_INDICATOR_MASK 0x02
200 #define ANSI_SSN_INDICATOR_MASK 0x01
202 static const value_string sccp_national_indicator_values[] = {
203 { 0x0, "Address coded to International standard" },
204 { 0x1, "Address coded to National standard" },
207 static const value_string sccp_routing_indicator_values[] = {
208 { 0x0, "Route on GT" },
209 { 0x1, "Route on SSN" },
212 #define AI_GTI_NO_GT 0x0
213 #define ITU_AI_GTI_NAI 0x1
214 #define AI_GTI_TT 0x2
215 #define ITU_AI_GTI_TT_NP_ES 0x3
216 #define ITU_AI_GTI_TT_NP_ES_NAI 0x4
217 static const value_string sccp_itu_global_title_indicator_values[] = {
218 { AI_GTI_NO_GT, "No Global Title" },
219 { ITU_AI_GTI_NAI, "Nature of Address Indicator only" },
220 { AI_GTI_TT, "Translation Type only" },
221 { ITU_AI_GTI_TT_NP_ES, "Translation Type, Numbering Plan, and Encoding Scheme included" },
222 { ITU_AI_GTI_TT_NP_ES_NAI, "Translation Type, Numbering Plan, Encoding Scheme, and Nature of Address Indicator included" },
225 /* #define AI_GTI_NO_GT 0x0 */
226 #define ANSI_AI_GTI_TT_NP_ES 0x1
227 /* #define AI_GTI_TT 0x2 */
228 static const value_string sccp_ansi_global_title_indicator_values[] = {
229 { AI_GTI_NO_GT, "No Global Title" },
230 { ANSI_AI_GTI_TT_NP_ES, "Translation Type, Numbering Plan, and Encoding Scheme included" },
231 { AI_GTI_TT, "Translation Type only" },
234 static const value_string sccp_ai_pci_values[] = {
235 { 0x1, "Point Code present" },
236 { 0x0, "Point Code not present" },
239 static const value_string sccp_ai_ssni_values[] = {
240 { 0x1, "SSN present" },
241 { 0x0, "SSN not present" },
244 #define ADDRESS_SSN_LENGTH 1
245 #define INVALID_SSN 0xff
246 /* Some values from 3GPP TS 23.003 */
247 /* Japan TTC and NTT define a lot of SSNs, some of which conflict with
248 * these. They are not added for now.
250 static const value_string sccp_ssn_values[] = {
251 { 0x00, "SSN not known/not used" },
252 { 0x01, "SCCP management" },
253 { 0x02, "Reserved for ITU-T allocation" },
254 { 0x03, "ISDN User Part" },
255 { 0x04, "OMAP (Operation, Maintenance, and Administration Part)" },
256 { 0x05, "MAP (Mobile Application Part)" },
257 { 0x06, "HLR (Home Location Register)" },
258 { 0x07, "VLR (Visitor Location Register)" },
259 { 0x08, "MSC (Mobile Switching Center)" },
260 { 0x09, "EIC/EIR (Equipment Identifier Center/Equipment Identification Register)" },
261 { 0x0a, "AUC/AC (Authentication Center)" },
262 { 0x0b, "ISDN supplementary services (ITU only)" },
263 { 0x0c, "Reserved for international use (ITU only)" },
264 { 0x0d, "Broadband ISDN edge-to-edge applications (ITU only)" },
265 { 0x0e, "TC test responder (ITU only)" },
266 /* The following national network subsystem numbers have been allocated for use within and
267 * between GSM/UMTS networks:
271 { 0x91, "GMLC(MAP)" },
273 { 0x93, "gsmSCF (MAP) or IM-SSF (MAP) or Presence Network Agent" },
274 { 0x94, "SIWF (MAP)" },
275 { 0x95, "SGSN (MAP)" },
276 { 0x96, "GGSN (MAP)" },
277 /* The following national network subsystem numbers have been allocated for use within GSM/UMTS networks:*/
279 { 0xfa, "BSC (BSSAP-LE)" },
280 { 0xfb, "MSC (BSSAP-LE)" },
281 { 0xfc, "IOS or SMLC (BSSAP-LE)" },
282 { 0xfd, "BSS O&M (A interface)" },
283 { 0xfe, "BSSAP/BSAP" },
287 /* * * * * * * * * * * * * * * * *
288 * Global Title: ITU GTI == 0001 *
289 * * * * * * * * * * * * * * * * */
290 #define GT_NAI_MASK 0x7F
291 #define GT_NAI_LENGTH 1
292 #define GT_NAI_UNKNOWN 0x00
293 #define GT_NAI_SUBSCRIBER_NUMBER 0x01
294 #define GT_NAI_RESERVED_NATIONAL 0x02
295 #define GT_NAI_NATIONAL_SIG_NUM 0x03
296 #define GT_NAI_INTERNATIONAL_NUM 0x04
297 static const value_string sccp_nai_values[] = {
298 { GT_NAI_UNKNOWN, "NAI unknown" },
299 { GT_NAI_SUBSCRIBER_NUMBER, "Subscriber Number" },
300 { GT_NAI_RESERVED_NATIONAL, "Reserved for national use" },
301 { GT_NAI_NATIONAL_SIG_NUM, "National significant number" },
302 { GT_NAI_INTERNATIONAL_NUM, "International number" },
306 #define GT_OE_MASK 0x80
309 static const value_string sccp_oe_values[] = {
310 { GT_OE_EVEN, "Even number of address signals" },
311 { GT_OE_ODD, "Odd number of address signals" },
314 #define GT_SIGNAL_LENGTH 1
315 #define GT_ODD_SIGNAL_MASK 0x0f
316 #define GT_EVEN_SIGNAL_MASK 0xf0
317 #define GT_EVEN_SIGNAL_SHIFT 4
318 #define GT_MAX_SIGNALS (32*7) /* its a bit big, but it allows for adding a lot of "(spare)" and "Unknown" values (7 chars) if there are errors - e.g. ANSI vs ITU wrongly selected */
319 static const value_string sccp_address_signal_values[] = {
339 /* * * * * * * * * * * * * * * * * * * * *
340 * Global Title: ITU and ANSI GTI == 0010 *
341 * * * * * * * * * * * * * * * * * * * * */
342 #define GT_TT_LENGTH 1
345 /* * * * * * * * * * * * * * * * * * * * * * * * * *
346 * Global Title: ITU GTI == 0011, ANSI GTI == 0001 *
347 * * * * * * * * * * * * * * * * * * * * * * * * * */
348 #define GT_NP_MASK 0xf0
349 #define GT_NP_SHIFT 4
350 #define GT_NP_ES_LENGTH 1
351 #define GT_NP_UNKNOWN 0x00
352 #define GT_NP_ISDN 0x01
353 #define GT_NP_GENERIC_RESERVED 0x02
354 #define GT_NP_DATA 0x03
355 #define GT_NP_TELEX 0x04
356 #define GT_NP_MARITIME_MOBILE 0x05
357 #define GT_NP_LAND_MOBILE 0x06
358 #define GT_NP_ISDN_MOBILE 0x07
359 #define GT_NP_PRIVATE_NETWORK 0x0e
360 #define GT_NP_RESERVED 0x0f
361 static const value_string sccp_np_values[] = {
362 { GT_NP_UNKNOWN, "Unknown" },
363 { GT_NP_ISDN, "ISDN/telephony" },
364 { GT_NP_GENERIC_RESERVED, "Generic (ITU)/Reserved (ANSI)" },
365 { GT_NP_DATA, "Data" },
366 { GT_NP_TELEX, "Telex" },
367 { GT_NP_MARITIME_MOBILE, "Maritime mobile" },
368 { GT_NP_LAND_MOBILE, "Land mobile" },
369 { GT_NP_ISDN_MOBILE, "ISDN/mobile" },
370 { GT_NP_PRIVATE_NETWORK, "Private network or network-specific" },
371 { GT_NP_RESERVED, "Reserved" },
374 #define GT_ES_MASK 0x0f
375 #define GT_ES_UNKNOWN 0x0
376 #define GT_ES_BCD_ODD 0x1
377 #define GT_ES_BCD_EVEN 0x2
378 #define GT_ES_NATIONAL 0x3
379 #define GT_ES_RESERVED 0xf
380 static const value_string sccp_es_values[] = {
381 { GT_ES_UNKNOWN, "Unknown" },
382 { GT_ES_BCD_ODD, "BCD, odd number of digits" },
383 { GT_ES_BCD_EVEN, "BCD, even number of digits" },
384 { GT_ES_NATIONAL, "National specific" },
385 { GT_ES_RESERVED, "Reserved (ITU)/Spare (ANSI)" },
388 /* Address signals above */
391 /* * * * * * * * * * * * * * * * *
392 * Global Title: ITU GTI == 0100 *
393 * * * * * * * * * * * * * * * * */
397 /* Address signals above */
400 #define CLASS_CLASS_MASK 0xf
401 #define CLASS_SPARE_HANDLING_MASK 0xf0
402 static const value_string sccp_class_handling_values [] = {
403 { 0x0, "No special options" },
404 { 0x8, "Return message on error" },
408 #define SEGMENTING_REASSEMBLING_LENGTH 1
409 #define SEGMENTING_REASSEMBLING_MASK 0x01
410 #define NO_MORE_DATA 0
412 /* This is also used by sequencing-segmenting parameter */
413 static const value_string sccp_segmenting_reassembling_values [] = {
414 { NO_MORE_DATA, "No more data" },
415 { MORE_DATA, "More data" },
419 #define RECEIVE_SEQUENCE_NUMBER_LENGTH 1
420 #define RSN_MASK 0xfe
422 #define SEQUENCING_SEGMENTING_LENGTH 2
423 #define SEQUENCING_SEGMENTING_SSN_LENGTH 1
424 #define SEQUENCING_SEGMENTING_RSN_LENGTH 1
425 #define SEND_SEQUENCE_NUMBER_MASK 0xfe
426 #define RECEIVE_SEQUENCE_NUMBER_MASK 0xfe
427 #define SEQUENCING_SEGMENTING_MORE_MASK 0x01
430 #define CREDIT_LENGTH 1
432 #define RELEASE_CAUSE_LENGTH 1
433 static const value_string sccp_release_cause_values [] = {
434 { 0x00, "End user originated" },
435 { 0x01, "End user congestion" },
436 { 0x02, "End user failure" },
437 { 0x03, "SCCP user originated" },
438 { 0x04, "Remote procedure error" },
439 { 0x05, "Inconsistent connection data" },
440 { 0x06, "Access failure" },
441 { 0x07, "Access congestion" },
442 { 0x08, "Subsystem failure" },
443 { 0x09, "Subsystem congestion" },
444 { 0x0a, "MTP failure" },
445 { 0x0b, "Netowrk congestion" },
446 { 0x0c, "Expiration of reset timer" },
447 { 0x0d, "Expiration of receive inactivity timer" },
448 { 0x0e, "Reserved" },
449 { 0x0f, "Unqualified" },
450 { 0x10, "SCCP failure (ITU only)" },
454 #define RETURN_CAUSE_LENGTH 1
455 static const value_string sccp_return_cause_values [] = {
456 { 0x00, "No translation for an address of such nature" },
457 { 0x01, "No translation for this specific address" },
458 { 0x02, "Subsystem congestion" },
459 { 0x03, "Subsystem failure" },
460 { 0x04, "Unequipped failure" },
461 { 0x05, "MTP failure" },
462 { 0x06, "Network congestion" },
463 { 0x07, "Unqualified" },
464 { 0x08, "Error in message transport" },
465 { 0x09, "Error in local processing" },
466 { 0x0a, "Destination cannot perform reassembly" },
467 { 0x0b, "SCCP failure" },
468 { 0x0c, "Hop counter violation" },
469 { 0x0d, "Segmentation not supported (ITU only)" },
470 { 0x0e, "Segmentation failure (ITU only)" },
471 { 0xf9, "Invalid ISNI routing request (ANSI only)"},
472 { 0xfa, "Unauthorized message (ANSI only)" },
473 { 0xfb, "Message incompatibility (ANSI only)" },
474 { 0xfc, "Cannot perform ISNI constrained routing (ANSI only)" },
475 { 0xfd, "Unable to perform ISNI identification (ANSI only)" },
479 #define RESET_CAUSE_LENGTH 1
480 static const value_string sccp_reset_cause_values [] = {
481 { 0x00, "End user originated" },
482 { 0x01, "SCCP user originated" },
483 { 0x02, "Message out of order - incorrect send sequence number" },
484 { 0x03, "Message out of order - incorrect receive sequence number" },
485 { 0x04, "Remote procedure error - message out of window" },
486 { 0x05, "Remote procedure error - incorrect send sequence number after (re)initialization" },
487 { 0x06, "Remote procedure error - general" },
488 { 0x07, "Remote end user operational" },
489 { 0x08, "Network operational" },
490 { 0x09, "Access operational" },
491 { 0x0a, "Network congestion" },
492 { 0x0b, "Reserved (ITU)/Not obtainable (ANSI)" },
493 { 0x0c, "Unqualified" },
497 #define ERROR_CAUSE_LENGTH 1
498 static const value_string sccp_error_cause_values [] = {
499 { 0x00, "Local Reference Number (LRN) mismatch - unassigned destination LRN" },
500 { 0x01, "Local Reference Number (LRN) mismatch - inconsistent source LRN" },
501 { 0x02, "Point code mismatch" },
502 { 0x03, "Service class mismatch" },
503 { 0x04, "Unqualified" },
507 #define REFUSAL_CAUSE_LENGTH 1
508 static const value_string sccp_refusal_cause_values [] = {
509 { 0x00, "End user originated" },
510 { 0x01, "End user congestion" },
511 { 0x02, "End user failure" },
512 { 0x03, "SCCP user originated" },
513 { 0x04, "Destination address unknown" },
514 { 0x05, "Destination inaccessible" },
515 { 0x06, "Network resource - QOS not available/non-transient" },
516 { 0x07, "Network resource - QOS not available/transient" },
517 { 0x08, "Access failure" },
518 { 0x09, "Access congestion" },
519 { 0x0a, "Subsystem failure" },
520 { 0x0b, "Subsystem congestion" },
521 { 0x0c, "Expiration of connection establishment timer" },
522 { 0x0d, "Incompatible user data" },
523 { 0x0e, "Reserved" },
524 { 0x0f, "Unqualified" },
525 { 0x10, "Hop counter violation" },
526 { 0x11, "SCCP failure (ITU only)" },
527 { 0x12, "No translation for an address of such nature" },
528 { 0x13, "Unequipped user" },
532 #define SEGMENTATION_LENGTH 4
533 #define SEGMENTATION_FIRST_SEGMENT_MASK 0x80
534 #define SEGMENTATION_CLASS_MASK 0x40
535 #define SEGMENTATION_SPARE_MASK 0x30
536 #define SEGMENTATION_REMAINING_MASK 0x0f
537 static const value_string sccp_segmentation_first_segment_values [] = {
538 { 1, "First segment" },
539 { 0, "Not first segment" },
541 static const value_string sccp_segmentation_class_values [] = {
542 { 0, "Class 0 selected" },
543 { 1, "Class 1 selected" },
547 #define HOP_COUNTER_LENGTH 1
549 #define IMPORTANCE_LENGTH 1
550 #define IMPORTANCE_IMPORTANCE_MASK 0x7
553 #define ANSI_ISNI_ROUTING_CONTROL_LENGTH 1
554 #define ANSI_ISNI_MI_MASK 0x01
555 #define ANSI_ISNI_IRI_MASK 0x06
556 #define ANSI_ISNI_RES_MASK 0x08
557 #define ANSI_ISNI_TI_MASK 0x10
558 #define ANSI_ISNI_TI_SHIFT 4
559 #define ANSI_ISNI_COUNTER_MASK 0xe0
560 #define ANSI_ISNI_NETSPEC_MASK 0x03
562 static const value_string sccp_isni_mark_for_id_values [] = {
563 { 0x0, "Do not identify networks" },
564 { 0x1, "Identify networks" },
567 static const value_string sccp_isni_iri_values [] = {
568 { 0x0, "Neither constrained nor suggested ISNI routing" },
569 { 0x1, "Constrained ISNI routing" },
570 { 0x2, "Reserved for suggested ISNI routing" },
574 #define ANSI_ISNI_TYPE_0 0x0
575 #define ANSI_ISNI_TYPE_1 0x1
576 static const value_string sccp_isni_ti_values [] = {
577 { ANSI_ISNI_TYPE_0, "Type zero ISNI parameter format" },
578 { ANSI_ISNI_TYPE_1, "Type one ISNI parameter format" },
582 /* Initialize the protocol and registered fields */
583 static int proto_sccp = -1;
584 static int hf_sccp_message_type = -1;
585 static int hf_sccp_variable_pointer1 = -1;
586 static int hf_sccp_variable_pointer2 = -1;
587 static int hf_sccp_variable_pointer3 = -1;
588 static int hf_sccp_optional_pointer = -1;
589 static int hf_sccp_ssn = -1;
590 static int hf_sccp_gt_digits = -1;
592 /* Called Party address */
593 static int hf_sccp_called_national_indicator = -1;
594 static int hf_sccp_called_routing_indicator = -1;
595 static int hf_sccp_called_itu_global_title_indicator = -1;
596 static int hf_sccp_called_ansi_global_title_indicator = -1;
597 static int hf_sccp_called_itu_ssn_indicator = -1;
598 static int hf_sccp_called_itu_point_code_indicator = -1;
599 static int hf_sccp_called_ansi_ssn_indicator = -1;
600 static int hf_sccp_called_ansi_point_code_indicator = -1;
601 static int hf_sccp_called_ssn = -1;
602 static int hf_sccp_called_pc_member = -1;
603 static int hf_sccp_called_pc_cluster = -1;
604 static int hf_sccp_called_pc_network = -1;
605 static int hf_sccp_called_ansi_pc = -1;
606 static int hf_sccp_called_chinese_pc = -1;
607 static int hf_sccp_called_itu_pc = -1;
608 static int hf_sccp_called_japan_pc = -1;
609 static int hf_sccp_called_gt_nai = -1;
610 static int hf_sccp_called_gt_oe = -1;
611 static int hf_sccp_called_gt_tt = -1;
612 static int hf_sccp_called_gt_np = -1;
613 static int hf_sccp_called_gt_es = -1;
614 static int hf_sccp_called_gt_digits = -1;
616 /* Calling party address */
617 static int hf_sccp_calling_national_indicator = -1;
618 static int hf_sccp_calling_routing_indicator = -1;
619 static int hf_sccp_calling_itu_global_title_indicator = -1;
620 static int hf_sccp_calling_ansi_global_title_indicator = -1;
621 static int hf_sccp_calling_itu_ssn_indicator = -1;
622 static int hf_sccp_calling_itu_point_code_indicator = -1;
623 static int hf_sccp_calling_ansi_ssn_indicator = -1;
624 static int hf_sccp_calling_ansi_point_code_indicator = -1;
625 static int hf_sccp_calling_ssn = -1;
626 static int hf_sccp_calling_pc_member = -1;
627 static int hf_sccp_calling_pc_cluster = -1;
628 static int hf_sccp_calling_pc_network = -1;
629 static int hf_sccp_calling_ansi_pc = -1;
630 static int hf_sccp_calling_chinese_pc = -1;
631 static int hf_sccp_calling_itu_pc = -1;
632 static int hf_sccp_calling_japan_pc = -1;
633 static int hf_sccp_calling_gt_nai = -1;
634 static int hf_sccp_calling_gt_oe = -1;
635 static int hf_sccp_calling_gt_tt = -1;
636 static int hf_sccp_calling_gt_np = -1;
637 static int hf_sccp_calling_gt_es = -1;
638 static int hf_sccp_calling_gt_digits = -1;
640 /* Other parameter values */
641 static int hf_sccp_dlr = -1;
642 static int hf_sccp_slr = -1;
643 static int hf_sccp_lr = -1;
644 static int hf_sccp_class = -1;
645 static int hf_sccp_handling = -1;
646 static int hf_sccp_more = -1;
647 static int hf_sccp_rsn = -1;
648 static int hf_sccp_sequencing_segmenting_ssn = -1;
649 static int hf_sccp_sequencing_segmenting_rsn = -1;
650 static int hf_sccp_sequencing_segmenting_more = -1;
651 static int hf_sccp_credit = -1;
652 static int hf_sccp_release_cause = -1;
653 static int hf_sccp_return_cause = -1;
654 static int hf_sccp_reset_cause = -1;
655 static int hf_sccp_error_cause = -1;
656 static int hf_sccp_refusal_cause = -1;
657 static int hf_sccp_segmentation_first = -1;
658 static int hf_sccp_segmentation_class = -1;
659 static int hf_sccp_segmentation_remaining = -1;
660 static int hf_sccp_segmentation_slr = -1;
661 static int hf_sccp_hop_counter = -1;
662 static int hf_sccp_importance = -1;
663 static int hf_sccp_ansi_isni_mi = -1;
664 static int hf_sccp_ansi_isni_iri = -1;
665 static int hf_sccp_ansi_isni_ti = -1;
666 static int hf_sccp_ansi_isni_netspec = -1;
667 static int hf_sccp_ansi_isni_counter = -1;
668 static int hf_sccp_xudt_msg_fragments = -1;
669 static int hf_sccp_xudt_msg_fragment = -1;
670 static int hf_sccp_xudt_msg_fragment_overlap = -1;
671 static int hf_sccp_xudt_msg_fragment_overlap_conflicts = -1;
672 static int hf_sccp_xudt_msg_fragment_multiple_tails = -1;
673 static int hf_sccp_xudt_msg_fragment_too_long_fragment = -1;
674 static int hf_sccp_xudt_msg_fragment_error = -1;
675 static int hf_sccp_xudt_msg_reassembled_in = -1;
676 static int hf_sccp_assoc_msg = -1;
677 static int hf_sccp_assoc_id = -1;
679 /* Initialize the subtree pointers */
680 static gint ett_sccp = -1;
681 static gint ett_sccp_called = -1;
682 static gint ett_sccp_called_ai = -1;
683 static gint ett_sccp_called_pc = -1;
684 static gint ett_sccp_called_gt = -1;
685 static gint ett_sccp_calling = -1;
686 static gint ett_sccp_calling_ai = -1;
687 static gint ett_sccp_calling_pc = -1;
688 static gint ett_sccp_calling_gt = -1;
689 static gint ett_sccp_sequencing_segmenting = -1;
690 static gint ett_sccp_segmentation = -1;
691 static gint ett_sccp_ansi_isni_routing_control = -1;
692 static gint ett_sccp_xudt_msg_fragment = -1;
693 static gint ett_sccp_xudt_msg_fragments = -1;
694 static gint ett_sccp_assoc = -1;
695 static gint ett_sccp_digits = -1;
697 /* Declarations to desegment XUDT Messages */
698 static gboolean sccp_xudt_desegment = TRUE;
700 static gboolean show_key_params = FALSE;
702 static int sccp_tap = -1;
705 static const fragment_items sccp_xudt_msg_frag_items = {
706 /* Fragment subtrees */
707 &ett_sccp_xudt_msg_fragment,
708 &ett_sccp_xudt_msg_fragments,
709 /* Fragment fields */
710 &hf_sccp_xudt_msg_fragments,
711 &hf_sccp_xudt_msg_fragment,
712 &hf_sccp_xudt_msg_fragment_overlap,
713 &hf_sccp_xudt_msg_fragment_overlap_conflicts,
714 &hf_sccp_xudt_msg_fragment_multiple_tails,
715 &hf_sccp_xudt_msg_fragment_too_long_fragment,
716 &hf_sccp_xudt_msg_fragment_error,
717 /* Reassembled in field */
718 &hf_sccp_xudt_msg_reassembled_in,
720 "SCCP XUDT Message fragments"
723 static GHashTable *sccp_xudt_msg_fragment_table = NULL;
724 static GHashTable *sccp_xudt_msg_reassembled_table = NULL;
727 #define SCCP_USER_DATA 0
728 #define SCCP_USER_TCAP 1
729 #define SCCP_USER_RANAP 2
730 #define SCCP_USER_BSSAP 3
731 #define SCCP_USER_GSMMAP 4
732 #define SCCP_USER_CAMEL 5
733 #define SCCP_USER_INAP 6
735 typedef struct _sccp_user_t {
741 dissector_handle_t* handlep;
744 static sccp_user_t* sccp_users;
745 static guint num_sccp_users;
747 static dissector_handle_t data_handle;
748 static dissector_handle_t tcap_handle;
749 static dissector_handle_t ranap_handle;
750 static dissector_handle_t bssap_handle;
751 static dissector_handle_t gsmmap_handle;
752 static dissector_handle_t camel_handle;
753 static dissector_handle_t inap_handle;
755 static value_string sccp_users_vals[] = {
756 { SCCP_USER_DATA, "Data"},
757 { SCCP_USER_TCAP, "TCAP"},
758 { SCCP_USER_RANAP, "RANAP"},
759 { SCCP_USER_BSSAP, "BSSAP"},
760 { SCCP_USER_GSMMAP, "GSM MAP"},
761 { SCCP_USER_CAMEL, "CAMEL"},
762 { SCCP_USER_INAP, "INAP"},
767 * Here are the global variables associated with
768 * the various user definable characteristics of the dissection
770 static guint32 sccp_source_pc_global = 0;
771 static gboolean sccp_show_length = FALSE;
773 static module_t *sccp_module;
774 static heur_dissector_list_t heur_subdissector_list;
776 /* Keep track of SSN value of current message so if/when we get to the data
777 * parameter, we can call appropriate sub-dissector. TODO: can this info
778 * be stored elsewhere?
781 static guint8 message_type = 0;
782 static guint dlr = 0;
783 static guint slr = 0;
785 static dissector_table_t sccp_ssn_dissector_table;
787 static emem_tree_t* assocs = NULL;
788 static sccp_assoc_info_t* assoc;
789 static sccp_msg_info_t* sccp_msg;
790 static sccp_assoc_info_t no_assoc = {0,0,0,0,0,FALSE,FALSE,NULL,NULL,SCCP_PLOAD_NONE,NULL,NULL,NULL};
791 static gboolean trace_sccp = FALSE;
792 static guint32 next_assoc_id = 0;
794 static const value_string assoc_protos[] = {
795 { SCCP_PLOAD_BSSAP, "BSSAP" },
796 { SCCP_PLOAD_RANAP, "RANAP" },
800 static sccp_assoc_info_t* new_assoc(guint32 calling, guint32 called){
801 sccp_assoc_info_t* a = se_alloc(sizeof(sccp_assoc_info_t));
803 a->id = next_assoc_id++;
804 a->calling_dpc = calling;
805 a->called_dpc = called;
806 a->calling_ssn = INVALID_SSN;
807 a->called_ssn = INVALID_SSN;
808 a->has_fw_key = FALSE;
809 a->has_bw_key = FALSE;
810 a->payload = SCCP_PLOAD_NONE;
811 a->calling_party = NULL;
812 a->called_party = NULL;
813 a->extra_info = NULL;
819 void reset_sccp_assoc(void) {
823 sccp_assoc_info_t* get_sccp_assoc(packet_info* pinfo, guint offset, guint32 src_lr, guint32 dst_lr, guint msg_type) {
825 address* opc = &(pinfo->src);
826 address* dpc = &(pinfo->dst);
827 guint framenum = pinfo->fd->num;
832 opck = opc->type == AT_SS7PC ? mtp3_pc_hash((const mtp3_addr_pc_t *)opc->data) : g_str_hash(address_to_str(opc));
833 dpck = dpc->type == AT_SS7PC ? mtp3_pc_hash((const mtp3_addr_pc_t *)dpc->data) : g_str_hash(address_to_str(dpc));
837 case SCCP_MSG_TYPE_CR:
839 /* CR contains the opc,dpc,dlr key of backward messages swapped as dpc,opc,slr */
840 emem_tree_key_t bw_key[] = {
841 {1, &dpck}, {1, &opck}, {1, &src_lr}, {0, NULL}
844 if (! ( assoc = se_tree_lookup32_array(assocs,bw_key) ) && ! pinfo->fd->flags.visited ) {
845 assoc = new_assoc(opck,dpck);
846 se_tree_insert32_array(assocs,bw_key,assoc);
847 assoc->has_bw_key = TRUE;
850 pinfo->p2p_dir = P2P_DIR_SENT;
854 case SCCP_MSG_TYPE_CC:
856 emem_tree_key_t fw_key[] = {
857 {1, &dpck}, {1, &opck}, {1, &src_lr}, {0, NULL}
859 emem_tree_key_t bw_key[] = {
860 {1, &opck}, {1, &dpck}, {1, &dst_lr}, {0, NULL}
863 if ( ( assoc = se_tree_lookup32_array(assocs,bw_key) ) ) {
867 if ( (assoc = se_tree_lookup32_array(assocs,fw_key) ) ) {
871 assoc = new_assoc(dpck,opck);
875 pinfo->p2p_dir = P2P_DIR_RECV;
877 if ( ! pinfo->fd->flags.visited && ! assoc->has_bw_key ) {
878 se_tree_insert32_array(assocs,bw_key,assoc);
879 assoc->has_bw_key = TRUE;
882 if ( ! pinfo->fd->flags.visited && ! assoc->has_fw_key ) {
883 se_tree_insert32_array(assocs,fw_key,assoc);
884 assoc->has_fw_key = TRUE;
891 emem_tree_key_t key[] = {
892 {1, &opck}, {1, &dpck}, {1, &dst_lr}, {0, NULL}
895 assoc = se_tree_lookup32_array(assocs,key);
898 if (assoc->calling_dpc == dpck) {
899 pinfo->p2p_dir = P2P_DIR_RECV;
901 pinfo->p2p_dir = P2P_DIR_SENT;
909 if (assoc && trace_sccp) {
910 if ( ! pinfo->fd->flags.visited) {
911 sccp_msg_info_t* msg = se_alloc(sizeof(sccp_msg_info_t));
912 msg->framenum = framenum;
913 msg->offset = offset;
914 msg->data.co.next = NULL;
915 msg->data.co.assoc = assoc;
916 msg->data.co.label = NULL;
917 msg->data.co.comment = NULL;
918 msg->type = msg_type;
922 for (m = assoc->msgs; m->data.co.next; m = m->data.co.next) ;
923 m->data.co.next = msg;
928 assoc->curr_msg = msg;
934 for (m = assoc->msgs; m; m = m->data.co.next) {
935 if (m->framenum == framenum && m->offset == offset) {
943 return assoc ? assoc : &no_assoc;
948 dissect_sccp_unknown_message(tvbuff_t *message_tvb, proto_tree *sccp_tree)
950 guint32 message_length;
952 message_length = tvb_length(message_tvb);
954 proto_tree_add_text(sccp_tree, message_tvb, 0, message_length,
955 "Unknown message (%u byte%s)",
956 message_length, plurality(message_length, "", "s"));
960 dissect_sccp_unknown_param(tvbuff_t *tvb, proto_tree *tree, guint8 type, guint length)
962 proto_tree_add_text(tree, tvb, 0, length, "Unknown parameter 0x%x (%u byte%s)",
963 type, length, plurality(length, "", "s"));
967 dissect_sccp_dlr_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
971 dlr = tvb_get_letoh24(tvb, 0);
972 proto_tree_add_uint(tree, hf_sccp_dlr, tvb, 0, length, dlr);
973 lr_item = proto_tree_add_uint(tree, hf_sccp_lr, tvb, 0, length, dlr);
974 PROTO_ITEM_SET_HIDDEN(lr_item);
976 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
977 col_append_fstr(pinfo->cinfo, COL_INFO, "DLR=%d ", dlr);
981 dissect_sccp_slr_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
985 slr = tvb_get_letoh24(tvb, 0);
986 proto_tree_add_uint(tree, hf_sccp_slr, tvb, 0, length, slr);
987 lr_item = proto_tree_add_uint(tree, hf_sccp_lr, tvb, 0, length, slr);
988 PROTO_ITEM_SET_HIDDEN(lr_item);
990 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
991 col_append_fstr(pinfo->cinfo, COL_INFO, "SLR=%d ", slr);
995 #define is_connectionless(m) \
996 ( m == SCCP_MSG_TYPE_UDT || m == SCCP_MSG_TYPE_UDTS \
997 || m == SCCP_MSG_TYPE_XUDT|| m == SCCP_MSG_TYPE_XUDTS \
998 || m == SCCP_MSG_TYPE_LUDT|| m == SCCP_MSG_TYPE_LUDTS)
1001 dissect_sccp_gt_address_information(tvbuff_t *tvb, proto_tree *tree,
1002 guint length, gboolean even_length,
1006 guint8 odd_signal, even_signal = 0x0f;
1007 proto_item *digits_item, *hidden_item;
1008 char gt_digits[GT_MAX_SIGNALS+1] = { 0 };
1010 while(offset < length)
1012 odd_signal = tvb_get_guint8(tvb, offset) & GT_ODD_SIGNAL_MASK;
1013 even_signal = tvb_get_guint8(tvb, offset) & GT_EVEN_SIGNAL_MASK;
1014 even_signal >>= GT_EVEN_SIGNAL_SHIFT;
1016 g_strlcat(gt_digits, val_to_str(odd_signal, sccp_address_signal_values,
1017 "Unknown"), GT_MAX_SIGNALS+1);
1019 /* If the last signal is NOT filler */
1020 if (offset != (length - 1) || even_length == TRUE)
1021 g_strlcat(gt_digits, val_to_str(even_signal, sccp_address_signal_values,
1022 "Unknown"), GT_MAX_SIGNALS+1);
1024 offset += GT_SIGNAL_LENGTH;
1027 if (is_connectionless(message_type) && sccp_msg) {
1028 guint8** gt_ptr = called ? &(sccp_msg->data.ud.called_gt) : &(sccp_msg->data.ud.calling_gt);
1030 *gt_ptr = (guint8 *)ep_strdup(gt_digits);
1033 digits_item = proto_tree_add_string_format(tree,
1034 called ? hf_sccp_called_gt_digits
1035 : hf_sccp_calling_gt_digits,
1036 tvb, 0, length, gt_digits,
1037 "Address information (digits): %s",
1040 hidden_item = proto_tree_add_string(tree, hf_sccp_gt_digits, tvb, 0, length,
1042 PROTO_ITEM_SET_HIDDEN(hidden_item);
1048 dissect_sccp_global_title(tvbuff_t *tvb, proto_tree *tree, guint length,
1049 guint8 gti, gboolean called)
1051 proto_item *gt_item = 0;
1052 proto_item *digits_item = 0;
1053 proto_tree *gt_tree = 0;
1054 proto_tree *digits_tree = 0;
1055 tvbuff_t *signals_tvb;
1057 guint8 odd_even, nai = 0, tt, np = 0, es;
1058 gboolean even = TRUE;
1060 /* Shift GTI to where we can work with it */
1063 gt_item = proto_tree_add_text(tree, tvb, offset, length,
1064 "Global Title 0x%x (%u byte%s)",
1065 gti, length, plurality(length,"", "s"));
1066 gt_tree = proto_item_add_subtree(gt_item, called ? ett_sccp_called_gt
1067 : ett_sccp_calling_gt);
1069 /* Decode Transation Type (if present) */
1070 if ((gti == AI_GTI_TT) ||
1071 (decode_mtp3_standard != ANSI_STANDARD &&
1072 (gti == ITU_AI_GTI_TT_NP_ES || gti == ITU_AI_GTI_TT_NP_ES_NAI)) ||
1073 (decode_mtp3_standard == ANSI_STANDARD && gti == ANSI_AI_GTI_TT_NP_ES)) {
1075 tt = tvb_get_guint8(tvb, offset);
1076 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_tt
1077 : hf_sccp_calling_gt_tt,
1078 tvb, offset, GT_TT_LENGTH, tt);
1079 offset += GT_TT_LENGTH;
1082 if (gti == AI_GTI_TT) {
1083 /* Protocol doesn't tell us, so we ASSUME even... */
1087 /* Decode Numbering Plan and Encoding Scheme (if present) */
1088 if ((decode_mtp3_standard != ANSI_STANDARD &&
1089 (gti == ITU_AI_GTI_TT_NP_ES || gti == ITU_AI_GTI_TT_NP_ES_NAI)) ||
1090 (decode_mtp3_standard == ANSI_STANDARD && gti == ANSI_AI_GTI_TT_NP_ES)) {
1092 np = tvb_get_guint8(tvb, offset) & GT_NP_MASK;
1093 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_np
1094 : hf_sccp_calling_gt_np,
1095 tvb, offset, GT_NP_ES_LENGTH, np);
1097 es = tvb_get_guint8(tvb, offset) & GT_ES_MASK;
1098 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_es
1099 : hf_sccp_calling_gt_es,
1100 tvb, offset, GT_NP_ES_LENGTH, es);
1102 even = (es == GT_ES_BCD_EVEN) ? TRUE : FALSE;
1104 offset += GT_NP_ES_LENGTH;
1107 /* Decode Nature of Address Indicator (if present) */
1108 if (decode_mtp3_standard != ANSI_STANDARD &&
1109 (gti == ITU_AI_GTI_NAI || gti == ITU_AI_GTI_TT_NP_ES_NAI)) {
1111 /* Decode Odd/Even Indicator (if present) */
1112 if (gti == ITU_AI_GTI_NAI) {
1113 odd_even = tvb_get_guint8(tvb, offset) & GT_OE_MASK;
1114 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_oe
1115 : hf_sccp_calling_gt_oe,
1116 tvb, offset, GT_NAI_LENGTH, odd_even);
1117 even = (odd_even == GT_OE_EVEN) ? TRUE : FALSE;
1120 nai = tvb_get_guint8(tvb, offset) & GT_NAI_MASK;
1121 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_nai
1122 : hf_sccp_calling_gt_nai,
1123 tvb, offset, GT_NAI_LENGTH, nai);
1125 offset += GT_NAI_LENGTH;
1128 /* Decode address signal(s) */
1129 if (length < offset)
1132 signals_tvb = tvb_new_subset(tvb, offset, (length - offset),
1135 digits_item = dissect_sccp_gt_address_information(signals_tvb, gt_tree,
1139 /* Display the country code (if we can) */
1140 switch(np >> GT_NP_SHIFT) {
1142 case GT_NP_ISDN_MOBILE:
1143 if(nai == GT_NAI_INTERNATIONAL_NUM) {
1144 digits_tree = proto_item_add_subtree(digits_item,
1146 dissect_e164_cc(signals_tvb, digits_tree, 0, TRUE);
1149 case GT_NP_LAND_MOBILE:
1150 digits_tree = proto_item_add_subtree(digits_item,
1152 dissect_e212_mcc_mnc(signals_tvb, digits_tree, 0);
1160 dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset,
1165 if (decode_mtp3_standard == ANSI_STANDARD)
1168 hf_pc = &hf_sccp_called_ansi_pc;
1170 hf_pc = &hf_sccp_calling_ansi_pc;
1171 } else /* CHINESE_ITU_STANDARD */ {
1173 hf_pc = &hf_sccp_called_chinese_pc;
1175 hf_pc = &hf_sccp_calling_chinese_pc;
1178 /* create and fill the PC tree */
1179 dissect_mtp3_3byte_pc(tvb, offset, call_tree,
1180 called ? ett_sccp_called_pc : ett_sccp_calling_pc,
1182 called ? hf_sccp_called_pc_network : hf_sccp_calling_pc_network,
1183 called ? hf_sccp_called_pc_cluster : hf_sccp_calling_pc_cluster,
1184 called ? hf_sccp_called_pc_member : hf_sccp_calling_pc_member,
1187 return(offset + ANSI_PC_LENGTH);
1190 /* FUNCTION dissect_sccp_called_calling_param():
1191 * Dissect the Calling or Called Party Address parameters.
1193 * The boolean 'called' describes whether this function is decoding a
1194 * called (TRUE) or calling (FALSE) party address. There is simply too
1195 * much code in this function to have 2 copies of it (one for called, one
1198 * NOTE: this function is called even when (!tree) so that we can get
1199 * the SSN and subsequently call subdissectors (if and when there's a data
1200 * parameter). Realistically we should put if (!tree)'s around a lot of the
1201 * code, but I think that would make it unreadable--and the expense of not
1202 * doing so does not appear to be very high.
1205 dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree,
1206 guint length, gboolean called)
1208 proto_item *call_item = 0, *call_ai_item = 0, *item, *hidden_item;
1209 proto_tree *call_tree = 0, *call_ai_tree = 0;
1211 guint8 national = 0xFFU, routing_ind, gti, pci, ssni, ssn;
1213 dissector_handle_t ssn_dissector = NULL, tcap_ssn_dissector = NULL;
1214 const char *ssn_dissector_short_name = NULL;
1215 const char *tcap_ssn_dissector_short_name = NULL;
1217 call_item = proto_tree_add_text(tree, tvb, 0, length,
1218 "%s Party address (%u byte%s)",
1219 called ? "Called" : "Calling", length,
1220 plurality(length, "", "s"));
1221 call_tree = proto_item_add_subtree(call_item, called ? ett_sccp_called
1222 : ett_sccp_calling);
1224 call_ai_item = proto_tree_add_text(call_tree, tvb, 0,
1225 ADDRESS_INDICATOR_LENGTH,
1226 "Address Indicator");
1227 call_ai_tree = proto_item_add_subtree(call_ai_item, called ? ett_sccp_called_ai
1228 : ett_sccp_calling_ai);
1230 if (decode_mtp3_standard == ANSI_STANDARD)
1232 national = tvb_get_guint8(tvb, 0) & ANSI_NATIONAL_MASK;
1233 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_national_indicator
1234 : hf_sccp_calling_national_indicator,
1235 tvb, 0, ADDRESS_INDICATOR_LENGTH, national);
1238 routing_ind = tvb_get_guint8(tvb, 0) & ROUTING_INDICATOR_MASK;
1239 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_routing_indicator
1240 : hf_sccp_calling_routing_indicator,
1241 tvb, 0, ADDRESS_INDICATOR_LENGTH, routing_ind);
1243 gti = tvb_get_guint8(tvb, 0) & GTI_MASK;
1245 if (decode_mtp3_standard == ITU_STANDARD ||
1246 decode_mtp3_standard == CHINESE_ITU_STANDARD ||
1247 decode_mtp3_standard == JAPAN_STANDARD ||
1250 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_global_title_indicator
1251 : hf_sccp_calling_itu_global_title_indicator,
1252 tvb, 0, ADDRESS_INDICATOR_LENGTH, gti);
1254 ssni = tvb_get_guint8(tvb, 0) & ITU_SSN_INDICATOR_MASK;
1255 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_ssn_indicator
1256 : hf_sccp_calling_itu_ssn_indicator,
1257 tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
1259 pci = tvb_get_guint8(tvb, 0) & ITU_PC_INDICATOR_MASK;
1260 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_point_code_indicator
1261 : hf_sccp_calling_itu_point_code_indicator,
1262 tvb, 0, ADDRESS_INDICATOR_LENGTH, pci);
1264 offset = ADDRESS_INDICATOR_LENGTH;
1266 /* Dissect PC (if present) */
1268 if (decode_mtp3_standard == ITU_STANDARD) {
1270 proto_tree_add_item(call_tree, called ? hf_sccp_called_itu_pc
1271 : hf_sccp_calling_itu_pc,
1272 tvb, offset, ITU_PC_LENGTH, TRUE);
1274 offset += ITU_PC_LENGTH;
1276 } else if (decode_mtp3_standard == JAPAN_STANDARD) {
1278 proto_tree_add_item(call_tree, called ? hf_sccp_called_japan_pc
1279 : hf_sccp_calling_japan_pc,
1280 tvb, offset, JAPAN_PC_LENGTH, TRUE);
1282 offset += JAPAN_PC_LENGTH;
1284 } else /* CHINESE_ITU_STANDARD */ {
1286 offset = dissect_sccp_3byte_pc(tvb, call_tree, offset, called);
1291 /* Dissect SSN (if present) */
1293 ssn = tvb_get_guint8(tvb, offset);
1295 if (called && assoc)
1296 assoc->called_ssn = ssn;
1298 assoc->calling_ssn = ssn;
1300 if (is_connectionless(message_type) && sccp_msg) {
1301 guint* ssn_ptr = called ? &(sccp_msg->data.ud.called_ssn) : &(sccp_msg->data.ud.calling_ssn);
1306 proto_tree_add_uint(call_tree, called ? hf_sccp_called_ssn
1307 : hf_sccp_calling_ssn,
1308 tvb, offset, ADDRESS_SSN_LENGTH, ssn);
1309 hidden_item = proto_tree_add_uint(call_tree, hf_sccp_ssn, tvb, offset,
1310 ADDRESS_SSN_LENGTH, ssn);
1311 PROTO_ITEM_SET_HIDDEN(hidden_item);
1313 offset += ADDRESS_SSN_LENGTH;
1315 /* Get the dissector handle of the dissector registered for this ssn
1316 * And print it's name.
1318 ssn_dissector = dissector_get_port_handle(sccp_ssn_dissector_table, ssn);
1320 if (ssn_dissector) {
1321 ssn_dissector_short_name = dissector_handle_get_short_name(ssn_dissector);
1323 if(ssn_dissector_short_name) {
1324 item = proto_tree_add_text(call_tree, tvb, offset - 1, ADDRESS_SSN_LENGTH, "Linked to %s", ssn_dissector_short_name);
1325 PROTO_ITEM_SET_GENERATED(item);
1327 if (g_ascii_strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) {
1328 tcap_ssn_dissector = get_itu_tcap_subdissector(ssn);
1330 if(tcap_ssn_dissector){
1331 tcap_ssn_dissector_short_name = dissector_handle_get_short_name(tcap_ssn_dissector);
1332 proto_item_append_text(item,", TCAP SSN linked to %s", tcap_ssn_dissector_short_name);
1336 } /* ssn_dissector */
1340 return; /* got SSN, that's all we need here... */
1342 /* Dissect GT (if present) */
1343 if (gti != AI_GTI_NO_GT) {
1344 if (length < offset)
1347 gt_tvb = tvb_new_subset(tvb, offset, (length - offset),
1349 dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti,
1353 } else if (decode_mtp3_standard == ANSI_STANDARD) {
1355 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_global_title_indicator
1356 : hf_sccp_calling_ansi_global_title_indicator,
1357 tvb, 0, ADDRESS_INDICATOR_LENGTH, gti);
1359 pci = tvb_get_guint8(tvb, 0) & ANSI_PC_INDICATOR_MASK;
1360 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_point_code_indicator
1361 : hf_sccp_calling_ansi_point_code_indicator,
1362 tvb, 0, ADDRESS_INDICATOR_LENGTH, pci);
1364 ssni = tvb_get_guint8(tvb, 0) & ANSI_SSN_INDICATOR_MASK;
1365 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_ssn_indicator
1366 : hf_sccp_calling_ansi_ssn_indicator,
1367 tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
1369 offset = ADDRESS_INDICATOR_LENGTH;
1371 /* Dissect SSN (if present) */
1373 ssn = tvb_get_guint8(tvb, offset);
1375 if (called && assoc)
1376 assoc->called_ssn = ssn;
1378 assoc->calling_ssn = ssn;
1380 if (is_connectionless(message_type) && sccp_msg) {
1381 guint* ssn_ptr = called ? &(sccp_msg->data.ud.called_ssn) : &(sccp_msg->data.ud.calling_ssn);
1386 proto_tree_add_uint(call_tree, called ? hf_sccp_called_ssn
1387 : hf_sccp_calling_ssn,
1388 tvb, offset, ADDRESS_SSN_LENGTH, ssn);
1389 hidden_item = proto_tree_add_uint(call_tree, hf_sccp_ssn, tvb, offset,
1390 ADDRESS_SSN_LENGTH, ssn);
1391 PROTO_ITEM_SET_HIDDEN(hidden_item);
1393 offset += ADDRESS_SSN_LENGTH;
1397 return; /* got SSN, that's all we need here... */
1399 /* Dissect PC (if present) */
1401 offset = dissect_sccp_3byte_pc(tvb, call_tree, offset, called);
1404 /* Dissect GT (if present) */
1405 if (gti != AI_GTI_NO_GT) {
1406 if (length < offset)
1408 gt_tvb = tvb_new_subset(tvb, offset, (length - offset),
1410 dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti,
1419 dissect_sccp_called_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1421 dissect_sccp_called_calling_param(tvb, tree, length, TRUE);
1425 dissect_sccp_calling_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1427 dissect_sccp_called_calling_param(tvb, tree, length, FALSE);
1431 dissect_sccp_class_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1433 guint8 class, handling;
1435 class = tvb_get_guint8(tvb, 0) & CLASS_CLASS_MASK;
1436 handling = tvb_get_guint8(tvb, 0) & CLASS_SPARE_HANDLING_MASK;
1438 proto_tree_add_uint(tree, hf_sccp_class, tvb, 0, length, class);
1440 if (class == 0 || class == 1)
1441 proto_tree_add_uint(tree, hf_sccp_handling, tvb, 0, length, handling);
1445 dissect_sccp_segmenting_reassembling_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1447 proto_tree_add_item(tree, hf_sccp_more, tvb, 0, length, FALSE);
1451 dissect_sccp_receive_sequence_number_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1455 rsn = tvb_get_guint8(tvb, 0) >> 1;
1456 proto_tree_add_uint(tree, hf_sccp_rsn, tvb, 0, length, rsn);
1460 dissect_sccp_sequencing_segmenting_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1462 guint8 rsn, ssn, more;
1463 proto_item *param_item;
1464 proto_tree *param_tree;
1466 ssn = tvb_get_guint8(tvb, 0) >> 1;
1467 rsn = tvb_get_guint8(tvb, SEQUENCING_SEGMENTING_SSN_LENGTH) >> 1;
1468 more = tvb_get_guint8(tvb, SEQUENCING_SEGMENTING_SSN_LENGTH) & SEQUENCING_SEGMENTING_MORE_MASK;
1470 param_item = proto_tree_add_text(tree, tvb, 0, length,
1471 val_to_str(PARAMETER_SEQUENCING_SEGMENTING,
1472 sccp_parameter_values, "Unknown"));
1473 param_tree = proto_item_add_subtree(param_item,
1474 ett_sccp_sequencing_segmenting);
1476 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_ssn, tvb, 0,
1477 SEQUENCING_SEGMENTING_SSN_LENGTH, ssn);
1478 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_rsn, tvb,
1479 SEQUENCING_SEGMENTING_SSN_LENGTH,
1480 SEQUENCING_SEGMENTING_RSN_LENGTH, rsn);
1481 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_more, tvb,
1482 SEQUENCING_SEGMENTING_SSN_LENGTH,
1483 SEQUENCING_SEGMENTING_RSN_LENGTH, more);
1487 dissect_sccp_credit_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1491 credit = tvb_get_guint8(tvb, 0);
1492 proto_tree_add_uint(tree, hf_sccp_credit, tvb, 0, length, credit);
1496 dissect_sccp_release_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
1500 cause = tvb_get_guint8(tvb, 0);
1501 proto_tree_add_uint(tree, hf_sccp_release_cause, tvb, 0, length, cause);
1503 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
1504 col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause);
1508 dissect_sccp_return_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
1512 cause = tvb_get_guint8(tvb, 0);
1513 proto_tree_add_uint(tree, hf_sccp_return_cause, tvb, 0, length, cause);
1515 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
1516 col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause);
1520 dissect_sccp_reset_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
1524 cause = tvb_get_guint8(tvb, 0);
1525 proto_tree_add_uint(tree, hf_sccp_reset_cause, tvb, 0, length, cause);
1527 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
1528 col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause);
1532 dissect_sccp_error_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
1536 cause = tvb_get_guint8(tvb, 0);
1537 proto_tree_add_uint(tree, hf_sccp_error_cause, tvb, 0, length, cause);
1539 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
1540 col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause);
1544 dissect_sccp_refusal_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length, packet_info *pinfo)
1548 cause = tvb_get_guint8(tvb, 0);
1549 proto_tree_add_uint(tree, hf_sccp_refusal_cause, tvb, 0, length, cause);
1551 if (show_key_params && check_col(pinfo->cinfo, COL_INFO))
1552 col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause);
1556 /* This function is used for both data and long data (ITU only) parameters */
1558 dissect_sccp_data_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1560 guint8 ssn = INVALID_SSN;
1561 guint8 other_ssn = INVALID_SSN;
1562 const mtp3_addr_pc_t* dpc;
1563 const mtp3_addr_pc_t* opc;
1565 if (trace_sccp && assoc && assoc != &no_assoc) {
1566 pinfo->sccp_info = assoc->curr_msg;
1568 pinfo->sccp_info = NULL;
1571 switch (pinfo->p2p_dir) {
1573 ssn = assoc->calling_ssn;
1574 other_ssn = assoc->called_ssn;
1575 dpc = (const mtp3_addr_pc_t*)pinfo->dst.data;
1576 opc = (const mtp3_addr_pc_t*)pinfo->src.data;
1579 ssn = assoc->called_ssn;
1580 other_ssn = assoc->calling_ssn;
1581 dpc = (const mtp3_addr_pc_t*)pinfo->src.data;
1582 opc = (const mtp3_addr_pc_t*)pinfo->dst.data;
1585 ssn = assoc->called_ssn;
1586 other_ssn = assoc->calling_ssn;
1587 dpc = (const mtp3_addr_pc_t*)pinfo->dst.data;
1588 opc = (const mtp3_addr_pc_t*)pinfo->src.data;
1593 if (num_sccp_users && pinfo->src.type == AT_SS7PC) {
1595 dissector_handle_t handle = NULL;
1596 gboolean uses_tcap = FALSE;
1598 for (i=0; i < num_sccp_users; i++) {
1599 sccp_user_t* u = &(sccp_users[i]);
1601 if (dpc->ni != u->ni) continue;
1603 if (value_is_in_range(u->called_ssn, ssn) && value_is_in_range(u->called_pc, dpc->pc) ) {
1604 handle = *(u->handlep);
1605 uses_tcap = u->uses_tcap;
1607 } else if (value_is_in_range(u->called_ssn, other_ssn) && value_is_in_range(u->called_pc, opc->pc) ) {
1608 handle = *(u->handlep);
1609 uses_tcap = u->uses_tcap;
1616 call_tcap_dissector(handle, tvb, pinfo, tree);
1618 call_dissector(handle, tvb, pinfo, tree);
1625 if (ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, ssn, tvb, pinfo, tree)) {
1629 if (other_ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, other_ssn, tvb, pinfo, tree)) {
1633 /* try heuristic subdissector list to see if there are any takers */
1634 if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree)) {
1638 /* No sub-dissection occured, treat it as raw data */
1639 call_dissector(data_handle, tvb, pinfo, tree);
1644 dissect_sccp_segmentation_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1646 guint8 first, class, remaining;
1648 proto_item *param_item;
1649 proto_tree *param_tree;
1651 first = tvb_get_guint8(tvb, 0) & SEGMENTATION_FIRST_SEGMENT_MASK;
1652 class = tvb_get_guint8(tvb, 0) & SEGMENTATION_CLASS_MASK;
1653 remaining = tvb_get_guint8(tvb, 0) & SEGMENTATION_REMAINING_MASK;
1655 slrx = tvb_get_letoh24(tvb, 1);
1657 param_item = proto_tree_add_text(tree, tvb, 0, length,
1658 val_to_str(PARAMETER_SEGMENTATION,
1659 sccp_parameter_values, "Unknown"));
1660 param_tree = proto_item_add_subtree(param_item, ett_sccp_segmentation);
1662 proto_tree_add_uint(param_tree, hf_sccp_segmentation_first, tvb, 0, length,
1664 proto_tree_add_uint(param_tree, hf_sccp_segmentation_class, tvb, 0, length,
1666 proto_tree_add_uint(param_tree, hf_sccp_segmentation_remaining, tvb, 0,
1668 proto_tree_add_uint(param_tree, hf_sccp_segmentation_slr, tvb, 1, length,
1673 dissect_sccp_hop_counter_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1677 hops = tvb_get_guint8(tvb, 0);
1678 proto_tree_add_uint(tree, hf_sccp_hop_counter, tvb, 0, length, hops);
1682 dissect_sccp_importance_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1686 importance = tvb_get_guint8(tvb, 0) & IMPORTANCE_IMPORTANCE_MASK;
1687 proto_tree_add_uint(tree, hf_sccp_importance, tvb, 0, length, importance);
1691 dissect_sccp_isni_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1693 guint8 mi, iri, ti, network, netspec;
1695 proto_item *param_item;
1696 proto_tree *param_tree;
1698 /* Create a subtree for ISNI Routing Control */
1699 param_item = proto_tree_add_text(tree, tvb, offset, ANSI_ISNI_ROUTING_CONTROL_LENGTH,
1700 "ISNI Routing Control");
1701 param_tree = proto_item_add_subtree(param_item,
1702 ett_sccp_ansi_isni_routing_control);
1704 mi = tvb_get_guint8(tvb, offset) & ANSI_ISNI_MI_MASK;
1705 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_mi, tvb, offset,
1706 ANSI_ISNI_ROUTING_CONTROL_LENGTH, mi);
1708 iri = tvb_get_guint8(tvb, offset) & ANSI_ISNI_IRI_MASK;
1709 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_iri, tvb, offset,
1710 ANSI_ISNI_ROUTING_CONTROL_LENGTH, iri);
1712 ti = tvb_get_guint8(tvb, offset) & ANSI_ISNI_TI_MASK;
1713 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_ti, tvb, offset,
1714 ANSI_ISNI_ROUTING_CONTROL_LENGTH, ti);
1716 proto_tree_add_item(param_tree, hf_sccp_ansi_isni_counter, tvb, offset,
1717 ANSI_ISNI_ROUTING_CONTROL_LENGTH, TRUE);
1719 offset += ANSI_ISNI_ROUTING_CONTROL_LENGTH;
1721 if ((ti >> ANSI_ISNI_TI_SHIFT) == ANSI_ISNI_TYPE_1) {
1722 netspec = tvb_get_guint8(tvb, offset) & ANSI_ISNI_NETSPEC_MASK;
1723 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_netspec, tvb, offset,
1724 ANSI_ISNI_ROUTING_CONTROL_LENGTH, ti);
1725 offset += ANSI_ISNI_ROUTING_CONTROL_LENGTH;
1728 while (offset < length) {
1730 network = tvb_get_guint8(tvb, offset);
1731 proto_tree_add_text(tree, tvb, offset, ANSI_NCM_LENGTH,
1732 "Network ID network: %d", network);
1735 network = tvb_get_guint8(tvb, offset);
1736 proto_tree_add_text(tree, tvb, offset, ANSI_NCM_LENGTH,
1737 "Network ID cluster: %d", network);
1743 /* FUNCTION dissect_sccp_parameter():
1744 * Dissect a parameter given its type, offset into tvb, and length.
1747 dissect_sccp_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree,
1748 proto_tree *tree, guint8 parameter_type, guint16 offset,
1749 guint16 parameter_length)
1751 tvbuff_t *parameter_tvb;
1753 switch (parameter_type) {
1754 case PARAMETER_CALLED_PARTY_ADDRESS:
1755 case PARAMETER_CALLING_PARTY_ADDRESS:
1756 case PARAMETER_DATA:
1757 case PARAMETER_LONG_DATA:
1758 case PARAMETER_SOURCE_LOCAL_REFERENCE:
1759 case PARAMETER_DESTINATION_LOCAL_REFERENCE:
1760 case PARAMETER_RELEASE_CAUSE:
1761 case PARAMETER_RETURN_CAUSE:
1762 case PARAMETER_RESET_CAUSE:
1763 case PARAMETER_ERROR_CAUSE:
1764 case PARAMETER_REFUSAL_CAUSE:
1766 /* These parameters must be dissected even if !sccp_tree (so that
1767 * assoc information can be created).
1772 if (!sccp_tree) return(parameter_length);
1776 parameter_tvb = tvb_new_subset(tvb, offset, parameter_length, parameter_length);
1778 switch (parameter_type) {
1780 case PARAMETER_END_OF_OPTIONAL_PARAMETERS:
1781 proto_tree_add_text(sccp_tree, tvb, offset, parameter_length,
1785 case PARAMETER_DESTINATION_LOCAL_REFERENCE:
1786 dissect_sccp_dlr_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1789 case PARAMETER_SOURCE_LOCAL_REFERENCE:
1790 dissect_sccp_slr_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1793 case PARAMETER_CALLED_PARTY_ADDRESS:
1794 dissect_sccp_called_param(parameter_tvb, sccp_tree, parameter_length);
1797 case PARAMETER_CALLING_PARTY_ADDRESS:
1798 dissect_sccp_calling_param(parameter_tvb, sccp_tree, parameter_length);
1801 case PARAMETER_CLASS:
1802 dissect_sccp_class_param(parameter_tvb, sccp_tree, parameter_length);
1805 case PARAMETER_SEGMENTING_REASSEMBLING:
1806 dissect_sccp_segmenting_reassembling_param(parameter_tvb, sccp_tree,
1810 case PARAMETER_RECEIVE_SEQUENCE_NUMBER:
1811 dissect_sccp_receive_sequence_number_param(parameter_tvb, sccp_tree,
1815 case PARAMETER_SEQUENCING_SEGMENTING:
1816 dissect_sccp_sequencing_segmenting_param(parameter_tvb, sccp_tree,
1820 case PARAMETER_CREDIT:
1821 dissect_sccp_credit_param(parameter_tvb, sccp_tree, parameter_length);
1824 case PARAMETER_RELEASE_CAUSE:
1825 dissect_sccp_release_cause_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1828 case PARAMETER_RETURN_CAUSE:
1829 dissect_sccp_return_cause_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1832 case PARAMETER_RESET_CAUSE:
1833 dissect_sccp_reset_cause_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1836 case PARAMETER_ERROR_CAUSE:
1837 dissect_sccp_error_cause_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1840 case PARAMETER_REFUSAL_CAUSE:
1841 dissect_sccp_refusal_cause_param(parameter_tvb, sccp_tree, parameter_length, pinfo);
1844 case PARAMETER_DATA:
1845 dissect_sccp_data_param(parameter_tvb, pinfo, tree);
1847 /* TODO? Re-adjust length of SCCP item since it may be sub-dissected */
1848 /* sccp_length = proto_item_get_len(sccp_item);
1849 * sccp_length -= parameter_length;
1850 * proto_item_set_len(sccp_item, sccp_length);
1854 case PARAMETER_SEGMENTATION:
1855 dissect_sccp_segmentation_param(parameter_tvb, sccp_tree, parameter_length);
1858 case PARAMETER_HOP_COUNTER:
1859 dissect_sccp_hop_counter_param(parameter_tvb, sccp_tree, parameter_length);
1862 case PARAMETER_IMPORTANCE:
1863 if (decode_mtp3_standard != ANSI_STANDARD)
1864 dissect_sccp_importance_param(parameter_tvb, sccp_tree, parameter_length);
1866 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1870 case PARAMETER_LONG_DATA:
1871 if (decode_mtp3_standard != ANSI_STANDARD)
1872 dissect_sccp_data_param(parameter_tvb, pinfo, tree);
1874 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1878 case PARAMETER_ISNI:
1879 if (decode_mtp3_standard != ANSI_STANDARD)
1880 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1883 dissect_sccp_isni_param(parameter_tvb, sccp_tree, parameter_length);
1887 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1892 return(parameter_length);
1895 /* FUNCTION dissect_sccp_variable_parameter():
1896 * Dissect a variable parameter given its type and offset into tvb. Length
1897 * of the parameter is gotten from tvb[0].
1898 * Length returned is sum of (length + parameter).
1901 dissect_sccp_variable_parameter(tvbuff_t *tvb, packet_info *pinfo,
1902 proto_tree *sccp_tree, proto_tree *tree,
1903 guint8 parameter_type, guint16 offset)
1905 guint16 parameter_length;
1906 guint8 length_length;
1908 if (parameter_type != PARAMETER_LONG_DATA)
1910 parameter_length = tvb_get_guint8(tvb, offset);
1911 length_length = PARAMETER_LENGTH_LENGTH;
1915 /* Long data parameter has 16 bit length */
1916 parameter_length = tvb_get_letohs(tvb, offset);
1917 length_length = PARAMETER_LONG_DATA_LENGTH_LENGTH;
1920 if (sccp_tree && sccp_show_length)
1922 proto_tree_add_text(sccp_tree, tvb, offset, length_length,
1924 val_to_str(parameter_type, sccp_parameter_values,
1929 offset += length_length;
1931 dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree, parameter_type, offset,
1934 return(parameter_length + length_length);
1937 /* FUNCTION dissect_sccp_optional_parameters():
1938 * Dissect all the optional parameters given the start of the optional
1939 * parameters into tvb. Parameter types and lengths are read from tvb.
1942 dissect_sccp_optional_parameters(tvbuff_t *tvb, packet_info *pinfo,
1943 proto_tree *sccp_tree, proto_tree *tree,
1946 guint8 parameter_type;
1948 while ((parameter_type = tvb_get_guint8(tvb, offset)) !=
1949 PARAMETER_END_OF_OPTIONAL_PARAMETERS) {
1951 offset += PARAMETER_TYPE_LENGTH;
1952 offset += dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
1953 parameter_type, offset);
1956 /* Process end of optional parameters */
1957 dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree, parameter_type, offset,
1958 END_OF_OPTIONAL_PARAMETERS_LENGTH);
1962 static sccp_msg_info_t* new_ud_msg(packet_info* pinfo, guint32 msg_type _U_) {
1963 sccp_msg_info_t* m = ep_alloc(sizeof(sccp_msg_info_t));
1964 m->framenum = pinfo->fd->num;
1965 m->offset = 0; /* irrelevant */
1967 m->data.ud.calling_gt = NULL;
1968 m->data.ud.calling_ssn = 0;
1969 m->data.ud.called_gt = NULL;
1970 m->data.ud.called_ssn = 0;
1972 register_frame_end_routine(reset_sccp_assoc);
1977 dissect_sccp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree,
1980 guint16 variable_pointer1 = 0, variable_pointer2 = 0, variable_pointer3 = 0;
1981 guint16 optional_pointer = 0, orig_opt_ptr = 0;
1983 guint8 parameter_type;
1984 gboolean save_fragmented;
1985 tvbuff_t *new_tvb = NULL;
1986 fragment_data *frag_msg = NULL;
1987 guint32 source_local_ref=0;
1989 guint msg_offset = offset_from_real_beginning(tvb,0);
1991 /* Macro for getting pointer to mandatory variable parameters */
1992 #define VARIABLE_POINTER(var, hf_var, ptr_size) \
1993 if (ptr_size == POINTER_LENGTH) \
1994 var = tvb_get_guint8(tvb, offset); \
1996 var = tvb_get_letohs(tvb, offset); \
1997 proto_tree_add_uint(sccp_tree, hf_var, tvb, \
1998 offset, ptr_size, var); \
2000 if (ptr_size == POINTER_LENGTH_LONG) \
2004 /* Macro for getting pointer to optional parameters */
2005 #define OPTIONAL_POINTER(ptr_size) \
2006 if (ptr_size == POINTER_LENGTH) \
2007 orig_opt_ptr = optional_pointer = tvb_get_guint8(tvb, offset); \
2009 orig_opt_ptr = optional_pointer = tvb_get_letohs(tvb, offset); \
2010 proto_tree_add_uint(sccp_tree, hf_sccp_optional_pointer, tvb, \
2011 offset, ptr_size, optional_pointer); \
2012 optional_pointer += offset; \
2013 if (ptr_size == POINTER_LENGTH_LONG) \
2014 optional_pointer += 1; \
2018 /* Extract the message type; all other processing is based on this */
2019 message_type = tvb_get_guint8(tvb, SCCP_MSG_TYPE_OFFSET);
2020 offset = SCCP_MSG_TYPE_LENGTH;
2022 if (check_col(pinfo->cinfo, COL_INFO)) {
2023 /* Do not change col_add_fstr() to col_append_fstr() here: we _want_
2024 * this call to overwrite whatever's currently in the INFO column (e.g.,
2025 * "DATA" from the SCTP dissector).
2027 * If there's something there that should not be overwritten, whoever
2028 * put that info there should call col_set_fence() to protect it.
2030 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",
2031 val_to_str(message_type, sccp_message_type_acro_values, "Unknown"));
2035 /* add the message type to the protocol tree */
2036 proto_tree_add_uint(sccp_tree, hf_sccp_message_type, tvb,
2037 SCCP_MSG_TYPE_OFFSET, SCCP_MSG_TYPE_LENGTH, message_type);
2041 /* Starting a new message dissection; clear the global assoc, SLR, and DLR values */
2046 no_assoc.calling_dpc = 0;
2047 no_assoc.called_dpc = 0;
2048 no_assoc.calling_ssn = INVALID_SSN;
2049 no_assoc.called_ssn = INVALID_SSN;
2050 no_assoc.has_fw_key = FALSE;
2051 no_assoc.has_bw_key = FALSE;
2052 no_assoc.payload = SCCP_PLOAD_NONE;
2053 no_assoc.called_party = NULL;
2054 no_assoc.calling_party = NULL;
2055 no_assoc.extra_info = NULL;
2057 switch(message_type) {
2058 case SCCP_MSG_TYPE_CR:
2059 /* TTC and NTT (Japan) say that the connection-oriented messages are
2060 * deleted (not standardized), but they appear to be used anyway, so
2061 * we'll dissect it...
2063 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2064 PARAMETER_SOURCE_LOCAL_REFERENCE,
2065 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2066 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2067 PARAMETER_CLASS, offset,
2068 PROTOCOL_CLASS_LENGTH);
2069 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2071 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2072 OPTIONAL_POINTER(POINTER_LENGTH)
2074 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2075 PARAMETER_CALLED_PARTY_ADDRESS,
2079 case SCCP_MSG_TYPE_CC:
2080 /* TODO: connection has been established; theoretically we could keep
2081 * keep track of the SLR/DLR with the called/calling from the CR and
2082 * track the connection (e.g., on subsequent messages regarding this
2083 * SLR we could set the global vars "call*_ssn" so data could get
2086 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2087 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2089 DESTINATION_LOCAL_REFERENCE_LENGTH);
2090 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2091 PARAMETER_SOURCE_LOCAL_REFERENCE,
2092 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2094 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2096 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2097 PARAMETER_CLASS, offset,
2098 PROTOCOL_CLASS_LENGTH);
2099 OPTIONAL_POINTER(POINTER_LENGTH);
2102 case SCCP_MSG_TYPE_CREF:
2103 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2104 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2106 DESTINATION_LOCAL_REFERENCE_LENGTH);
2108 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2110 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2111 PARAMETER_REFUSAL_CAUSE, offset,
2112 REFUSAL_CAUSE_LENGTH);
2113 OPTIONAL_POINTER(POINTER_LENGTH);
2116 case SCCP_MSG_TYPE_RLSD:
2117 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2118 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2120 DESTINATION_LOCAL_REFERENCE_LENGTH);
2121 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2122 PARAMETER_SOURCE_LOCAL_REFERENCE,
2123 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2125 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2127 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2128 PARAMETER_RELEASE_CAUSE, offset,
2129 RELEASE_CAUSE_LENGTH);
2131 OPTIONAL_POINTER(POINTER_LENGTH);
2132 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2135 case SCCP_MSG_TYPE_RLC:
2136 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2137 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2139 DESTINATION_LOCAL_REFERENCE_LENGTH);
2140 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2141 PARAMETER_SOURCE_LOCAL_REFERENCE,
2142 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2144 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2147 case SCCP_MSG_TYPE_DT1:
2148 source_local_ref = tvb_get_letoh24(tvb, offset);
2149 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2150 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2152 DESTINATION_LOCAL_REFERENCE_LENGTH);
2154 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2156 more = tvb_get_guint8(tvb, offset) & SEGMENTING_REASSEMBLING_MASK;
2158 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2159 PARAMETER_SEGMENTING_REASSEMBLING,
2160 offset, SEGMENTING_REASSEMBLING_LENGTH);
2161 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2164 if (!sccp_xudt_desegment) {
2165 proto_tree_add_text(sccp_tree, tvb, variable_pointer1,
2166 tvb_get_guint8(tvb, variable_pointer1)+1,
2168 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2169 PARAMETER_DATA, variable_pointer1);
2172 save_fragmented = pinfo->fragmented;
2173 pinfo->fragmented = TRUE;
2174 frag_msg = fragment_add_seq_next(tvb, variable_pointer1 + 1, pinfo,
2175 source_local_ref, /* ID for fragments belonging together */
2176 sccp_xudt_msg_fragment_table, /* list of message fragments */
2177 sccp_xudt_msg_reassembled_table, /* list of reassembled messages */
2178 tvb_get_guint8(tvb,variable_pointer1),/* fragment length - to the end */
2179 more); /* More fragments? */
2181 new_tvb = process_reassembled_data(tvb, variable_pointer1 + 1, pinfo,
2182 "Reassembled Message", frag_msg,
2183 &sccp_xudt_msg_frag_items, NULL,
2186 if (frag_msg && frag_msg->next) { /* Reassembled */
2187 if (check_col(pinfo->cinfo, COL_INFO))
2188 col_append_str(pinfo->cinfo, COL_INFO,
2189 "(Message reassembled) ");
2190 } else if (more) { /* Not last packet of reassembled message */
2191 if (check_col(pinfo->cinfo, COL_INFO))
2192 col_append_str(pinfo->cinfo, COL_INFO, "(Message fragment) ");
2195 pinfo->fragmented = save_fragmented;
2198 dissect_sccp_data_param(new_tvb, pinfo, tree);
2201 /* End reassemble */
2204 case SCCP_MSG_TYPE_DT2:
2205 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2206 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2208 DESTINATION_LOCAL_REFERENCE_LENGTH);
2210 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2212 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2213 PARAMETER_SEQUENCING_SEGMENTING, offset,
2214 SEQUENCING_SEGMENTING_LENGTH);
2217 case SCCP_MSG_TYPE_AK:
2218 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2219 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2221 DESTINATION_LOCAL_REFERENCE_LENGTH);
2223 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2225 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2226 PARAMETER_RECEIVE_SEQUENCE_NUMBER,
2227 offset, RECEIVE_SEQUENCE_NUMBER_LENGTH);
2228 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2229 PARAMETER_CREDIT, offset, CREDIT_LENGTH);
2232 case SCCP_MSG_TYPE_UDT:
2233 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2235 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2236 PARAMETER_CLASS, offset,
2237 PROTOCOL_CLASS_LENGTH);
2238 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2239 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2240 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2242 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2244 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2245 PARAMETER_CALLED_PARTY_ADDRESS,
2247 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2248 PARAMETER_CALLING_PARTY_ADDRESS,
2251 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2255 case SCCP_MSG_TYPE_UDTS:
2256 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2258 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2259 PARAMETER_RETURN_CAUSE, offset,
2260 RETURN_CAUSE_LENGTH);
2262 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2263 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2264 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2266 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2268 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2269 PARAMETER_CALLED_PARTY_ADDRESS,
2272 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2273 PARAMETER_CALLING_PARTY_ADDRESS,
2276 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2280 case SCCP_MSG_TYPE_ED:
2281 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2282 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2284 DESTINATION_LOCAL_REFERENCE_LENGTH);
2286 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2288 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH);
2290 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2294 case SCCP_MSG_TYPE_EA:
2295 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2296 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2298 DESTINATION_LOCAL_REFERENCE_LENGTH);
2299 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2302 case SCCP_MSG_TYPE_RSR:
2303 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2304 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2306 DESTINATION_LOCAL_REFERENCE_LENGTH);
2307 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2308 PARAMETER_SOURCE_LOCAL_REFERENCE,
2309 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2310 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2311 PARAMETER_RESET_CAUSE, offset,
2312 RESET_CAUSE_LENGTH);
2313 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2316 case SCCP_MSG_TYPE_RSC:
2317 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2318 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2320 DESTINATION_LOCAL_REFERENCE_LENGTH);
2321 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2322 PARAMETER_SOURCE_LOCAL_REFERENCE,
2323 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2324 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2327 case SCCP_MSG_TYPE_ERR:
2328 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2329 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2331 DESTINATION_LOCAL_REFERENCE_LENGTH);
2332 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2333 PARAMETER_ERROR_CAUSE, offset,
2334 ERROR_CAUSE_LENGTH);
2335 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2338 case SCCP_MSG_TYPE_IT:
2339 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2340 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2342 DESTINATION_LOCAL_REFERENCE_LENGTH);
2343 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2344 PARAMETER_SOURCE_LOCAL_REFERENCE,
2345 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2346 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2347 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2348 PARAMETER_CLASS, offset,
2349 PROTOCOL_CLASS_LENGTH);
2350 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2351 PARAMETER_SEQUENCING_SEGMENTING,
2352 offset, SEQUENCING_SEGMENTING_LENGTH);
2353 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2354 PARAMETER_CREDIT, offset, CREDIT_LENGTH);
2357 case SCCP_MSG_TYPE_XUDT:
2358 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2359 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2360 PARAMETER_CLASS, offset,
2361 PROTOCOL_CLASS_LENGTH);
2362 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2363 PARAMETER_HOP_COUNTER, offset,
2364 HOP_COUNTER_LENGTH);
2366 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2367 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2368 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2369 OPTIONAL_POINTER(POINTER_LENGTH)
2371 /* Optional parameters are Segmentation and Importance
2372 * NOTE 2 - Segmentation Should not be present in case of a single XUDT
2376 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2378 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2379 PARAMETER_CALLED_PARTY_ADDRESS,
2381 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2382 PARAMETER_CALLING_PARTY_ADDRESS,
2385 if ((parameter_type = tvb_get_guint8(tvb, optional_pointer)) == PARAMETER_SEGMENTATION){
2386 if (!sccp_xudt_desegment){
2387 proto_tree_add_text(sccp_tree, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, "Segmented Data");
2390 gboolean more_frag = TRUE;
2393 /* Get the first octet of parameter Segmentation, Ch 3.17 in Q.713
2394 * Bit 8 of octet 1 is used for First segment indication
2395 * Bit 7 of octet 1 is used to keep in the message in sequence
2396 * delivery option required by the SCCP user
2397 * Bits 6 and 5 in octet 1 are spare bits.
2398 * Bits 4-1 of octet 1 are used to indicate the number of
2399 * remaining segments.
2400 * The values 0000 to 1111 are possible; the value 0000 indicates
2403 octet = tvb_get_guint8(tvb,optional_pointer+2);
2404 source_local_ref = tvb_get_letoh24(tvb, optional_pointer+3);
2406 if ((octet&0x0f) == 0)
2409 save_fragmented = pinfo->fragmented;
2410 pinfo->fragmented = TRUE;
2411 frag_msg = fragment_add_seq_next(tvb, variable_pointer3 + 1, pinfo,
2412 source_local_ref, /* ID for fragments belonging together */
2413 sccp_xudt_msg_fragment_table, /* list of message fragments */
2414 sccp_xudt_msg_reassembled_table, /* list of reassembled messages */
2415 tvb_get_guint8(tvb,variable_pointer3), /* fragment length - to the end */
2416 more_frag); /* More fragments? */
2418 if ((octet&0x80) == 0x80) /*First segment, set number of segments*/
2419 fragment_set_tot_len(pinfo, source_local_ref, sccp_xudt_msg_fragment_table,(octet & 0xf));
2421 new_tvb = process_reassembled_data(tvb, variable_pointer3 + 1,
2422 pinfo, "Reassembled Message",
2424 &sccp_xudt_msg_frag_items,
2427 if (frag_msg) { /* Reassembled */
2428 if (check_col(pinfo->cinfo, COL_INFO))
2429 col_append_str(pinfo->cinfo, COL_INFO,"(Message reassembled) ");
2430 } else { /* Not last packet of reassembled message */
2431 if (check_col(pinfo->cinfo, COL_INFO))
2432 col_append_str(pinfo->cinfo, COL_INFO,"(Message fragment) ");
2435 pinfo->fragmented = save_fragmented;
2438 dissect_sccp_data_param(new_tvb, pinfo, tree);
2441 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2442 PARAMETER_DATA, variable_pointer3);
2446 case SCCP_MSG_TYPE_XUDTS:
2447 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2448 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2449 PARAMETER_RETURN_CAUSE, offset,
2450 RETURN_CAUSE_LENGTH);
2451 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2452 PARAMETER_HOP_COUNTER, offset,
2453 HOP_COUNTER_LENGTH);
2455 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2456 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2457 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2458 OPTIONAL_POINTER(POINTER_LENGTH)
2460 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2462 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2463 PARAMETER_CALLED_PARTY_ADDRESS,
2465 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2466 PARAMETER_CALLING_PARTY_ADDRESS,
2469 if ((parameter_type = tvb_get_guint8(tvb, optional_pointer)) == PARAMETER_SEGMENTATION){
2470 if (!sccp_xudt_desegment){
2471 proto_tree_add_text(sccp_tree, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, "Segmented Data");
2475 gboolean more_frag = TRUE;
2478 /* Get the first octet of parameter Segmentation, Ch 3.17 in Q.713
2479 * Bit 8 of octet 1 is used for First segment indication
2480 * Bit 7 of octet 1 is used to keep in the message in sequence
2481 * delivery option required by the SCCP user
2482 * Bits 6 and 5 in octet 1 are spare bits.
2483 * Bits 4-1 of octet 1 are used to indicate the number of
2484 * remaining segments.
2485 * The values 0000 to 1111 are possible; the value 0000 indicates
2488 octet = tvb_get_guint8(tvb,optional_pointer+2);
2489 source_local_ref = tvb_get_letoh24(tvb, optional_pointer+3);
2491 if ((octet&0x0f) == 0)
2494 save_fragmented = pinfo->fragmented;
2495 pinfo->fragmented = TRUE;
2496 frag_msg = fragment_add_seq_next(tvb, variable_pointer3 + 1, pinfo,
2497 source_local_ref, /* ID for fragments belonging together */
2498 sccp_xudt_msg_fragment_table, /* list of message fragments */
2499 sccp_xudt_msg_reassembled_table, /* list of reassembled messages */
2500 tvb_get_guint8(tvb,variable_pointer3), /* fragment length - to the end */
2501 more_frag); /* More fragments? */
2503 if ((octet&0x80) == 0x80) /*First segment, set number of segments*/
2504 fragment_set_tot_len(pinfo, source_local_ref, sccp_xudt_msg_fragment_table,(octet & 0xf));
2506 new_tvb = process_reassembled_data(tvb, variable_pointer3 + 1,
2507 pinfo, "Reassembled Message",
2509 &sccp_xudt_msg_frag_items,
2512 if (frag_msg) { /* Reassembled */
2513 if (check_col(pinfo->cinfo, COL_INFO))
2514 col_append_str(pinfo->cinfo, COL_INFO,
2515 "(Message reassembled) ");
2516 } else { /* Not last packet of reassembled message */
2517 if (check_col(pinfo->cinfo, COL_INFO))
2518 col_append_str(pinfo->cinfo, COL_INFO,
2519 "(Message fragment) ");
2522 pinfo->fragmented = save_fragmented;
2525 dissect_sccp_data_param(new_tvb, pinfo, tree);
2528 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2529 PARAMETER_DATA, variable_pointer3);
2533 case SCCP_MSG_TYPE_LUDT:
2534 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2535 if (decode_mtp3_standard != ANSI_STANDARD)
2537 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2538 PARAMETER_CLASS, offset,
2539 PROTOCOL_CLASS_LENGTH);
2540 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2541 PARAMETER_HOP_COUNTER, offset,
2542 HOP_COUNTER_LENGTH);
2544 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH_LONG)
2545 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH_LONG)
2546 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH_LONG)
2547 OPTIONAL_POINTER(POINTER_LENGTH_LONG)
2549 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2551 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2552 PARAMETER_CALLED_PARTY_ADDRESS,
2554 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2555 PARAMETER_CALLING_PARTY_ADDRESS,
2557 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2558 PARAMETER_LONG_DATA, variable_pointer3);
2560 dissect_sccp_unknown_message(tvb, sccp_tree);
2563 case SCCP_MSG_TYPE_LUDTS:
2564 pinfo->sccp_info = sccp_msg = new_ud_msg(pinfo,message_type);
2565 if (decode_mtp3_standard != ANSI_STANDARD)
2567 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2568 PARAMETER_RETURN_CAUSE, offset,
2569 RETURN_CAUSE_LENGTH);
2570 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2571 PARAMETER_HOP_COUNTER, offset,
2572 HOP_COUNTER_LENGTH);
2574 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH_LONG)
2575 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH_LONG)
2576 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH_LONG)
2577 OPTIONAL_POINTER(POINTER_LENGTH_LONG)
2579 assoc = get_sccp_assoc(pinfo, msg_offset, slr, dlr, message_type);
2581 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2582 PARAMETER_CALLED_PARTY_ADDRESS,
2584 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2585 PARAMETER_CALLING_PARTY_ADDRESS,
2587 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2588 PARAMETER_LONG_DATA, variable_pointer3);
2590 dissect_sccp_unknown_message(tvb, sccp_tree);
2594 dissect_sccp_unknown_message(tvb, sccp_tree);
2598 dissect_sccp_optional_parameters(tvb, pinfo, sccp_tree, tree,
2601 if (trace_sccp && assoc && assoc != &no_assoc) {
2602 proto_item* pi = proto_tree_add_uint(sccp_tree,hf_sccp_assoc_id,tvb,0,0,assoc->id);
2603 proto_tree* pt = proto_item_add_subtree(pi,ett_sccp_assoc);
2604 PROTO_ITEM_SET_GENERATED(pi);
2607 for(m = assoc->msgs; m ; m = m->data.co.next) {
2608 pi = proto_tree_add_uint( pt,hf_sccp_assoc_msg,tvb,0,0,m->framenum);
2610 if (assoc->payload != SCCP_PLOAD_NONE)
2611 proto_item_append_text(pi," %s", val_to_str(assoc->payload, assoc_protos, "Unknown"));
2613 if (m->data.co.label)
2614 proto_item_append_text(pi," %s", m->data.co.label);
2616 if (m->framenum == pinfo->fd->num && m->offset == msg_offset ) {
2617 tap_queue_packet(sccp_tap, pinfo, m);
2618 proto_item_append_text(pi," (current)");
2620 PROTO_ITEM_SET_GENERATED(pi);
2628 dissect_sccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2630 proto_item *sccp_item = NULL;
2631 proto_tree *sccp_tree = NULL;
2632 const mtp3_addr_pc_t *mtp3_addr_p;
2634 if ((pinfo->src.type == AT_SS7PC) &&
2635 ((mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->src.data)->type <= CHINESE_ITU_STANDARD))
2638 * Allow a protocol beneath to specify how the SCCP layer should be
2641 * It is possible to have multiple sets of SCCP traffic some of which is
2642 * ITU and some of which is ANSI.
2643 * An example is A-interface traffic having ANSI MTP3/ANSI SCCP/3GPP2 IOS
2644 * and at the same time ITU MTP3/ITU SCCP/ANSI TCAP/ANSI MAP.
2646 decode_mtp3_standard = mtp3_addr_p->type;
2650 decode_mtp3_standard = mtp3_standard;
2653 /* Make entry in the Protocol column on summary display */
2654 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2655 switch(decode_mtp3_standard) {
2657 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Int. ITU)");
2660 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (ANSI)");
2662 case CHINESE_ITU_STANDARD:
2663 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Chin. ITU)");
2665 case JAPAN_STANDARD:
2666 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Japan)");
2670 /* In the interest of speed, if "tree" is NULL, don't do any work not
2671 necessary to generate protocol tree items. */
2673 /* create the sccp protocol tree */
2674 sccp_item = proto_tree_add_item(tree, proto_sccp, tvb, 0, -1, FALSE);
2675 sccp_tree = proto_item_add_subtree(sccp_item, ett_sccp);
2678 /* Set whether message is UPLINK, DOWNLINK, or of UNKNOWN direction */
2680 if (pinfo->src.type == AT_SS7PC)
2683 * XXX - we assume that the "data" pointers of the source and destination
2684 * addresses are set to point to "mtp3_addr_pc_t" structures, so that
2685 * we can safely cast them.
2687 mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->src.data;
2689 if (sccp_source_pc_global == mtp3_addr_p->pc)
2691 pinfo->p2p_dir = P2P_DIR_SENT;
2695 /* assuming if src was SS7 PC then dst will be too */
2696 mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->dst.data;
2698 if (sccp_source_pc_global == mtp3_addr_p->pc)
2700 pinfo->p2p_dir = P2P_DIR_RECV;
2704 pinfo->p2p_dir = P2P_DIR_UNKNOWN;
2709 /* dissect the message */
2710 dissect_sccp_message(tvb, pinfo, sccp_tree, tree);
2714 /*** SccpUsers Table **/
2716 static struct _sccp_ul {
2719 dissector_handle_t* handlep;
2721 {SCCP_USER_DATA,FALSE,&data_handle},
2722 {SCCP_USER_TCAP,FALSE,&tcap_handle},
2723 {SCCP_USER_RANAP,FALSE,&ranap_handle},
2724 {SCCP_USER_BSSAP,FALSE,&bssap_handle},
2725 {SCCP_USER_GSMMAP,TRUE,&gsmmap_handle},
2726 {SCCP_USER_CAMEL,TRUE,&camel_handle},
2727 {SCCP_USER_INAP,TRUE,&inap_handle},
2731 static void sccp_users_update_cb(void* r, const char** err _U_) {
2735 for (c=user_list; c->handlep; c++) {
2736 if (c->id == u->user) {
2737 u->uses_tcap = c->uses_tcap;
2738 u->handlep = c->handlep;
2743 u->uses_tcap = FALSE;
2744 u->handlep = &data_handle;
2747 static void* sccp_users_copy_cb(void* n, const void* o, unsigned siz _U_) {
2748 const sccp_user_t* u = o;
2749 sccp_user_t* un = n;
2753 un->uses_tcap = u->uses_tcap;
2754 un->handlep = u->handlep;
2755 if (u->called_pc) un->called_pc = range_copy(u->called_pc);
2756 if (u->called_ssn) un->called_ssn = range_copy(u->called_ssn);
2761 static void sccp_users_free_cb(void*r) {
2763 if (u->called_pc) g_free(u->called_pc);
2764 if (u->called_ssn) g_free(u->called_ssn);
2768 UAT_DEC_CB_DEF(sccp_users, ni, sccp_user_t)
2769 UAT_RANGE_CB_DEF(sccp_users,called_pc,sccp_user_t)
2770 UAT_RANGE_CB_DEF(sccp_users,called_ssn,sccp_user_t)
2771 UAT_VS_DEF(sccp_users, user, sccp_user_t, SCCP_USER_DATA, "Data")
2773 /** End SccpUsersTable **/
2776 static void init_sccp(void) {
2778 fragment_table_init (&sccp_xudt_msg_fragment_table);
2779 reassembled_table_init(&sccp_xudt_msg_reassembled_table);
2783 /* Register the protocol with Wireshark */
2785 proto_register_sccp(void)
2787 /* Setup list of header fields */
2788 static hf_register_info hf[] = {
2789 { &hf_sccp_message_type,
2790 { "Message Type", "sccp.message_type",
2791 FT_UINT8, BASE_HEX, VALS(sccp_message_type_values), 0x0,
2793 { &hf_sccp_variable_pointer1,
2794 { "Pointer to first Mandatory Variable parameter", "sccp.variable_pointer1",
2795 FT_UINT16, BASE_DEC, NULL, 0x0,
2797 { &hf_sccp_variable_pointer2,
2798 { "Pointer to second Mandatory Variable parameter", "sccp.variable_pointer2",
2799 FT_UINT16, BASE_DEC, NULL, 0x0,
2801 { &hf_sccp_variable_pointer3,
2802 { "Pointer to third Mandatory Variable parameter", "sccp.variable_pointer3",
2803 FT_UINT16, BASE_DEC, NULL, 0x0,
2805 { &hf_sccp_optional_pointer,
2806 { "Pointer to Optional parameter", "sccp.optional_pointer",
2807 FT_UINT16, BASE_DEC, NULL, 0x0,
2810 { "Called or Calling SubSystem Number", "sccp.ssn",
2811 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2813 { &hf_sccp_gt_digits,
2814 { "Called or Calling GT Digits",
2816 FT_STRING, BASE_NONE, NULL, 0x0,
2818 { &hf_sccp_called_national_indicator,
2819 { "National Indicator", "sccp.called.ni",
2820 FT_UINT8, BASE_HEX, VALS(sccp_national_indicator_values), ANSI_NATIONAL_MASK,
2822 { &hf_sccp_called_routing_indicator,
2823 { "Routing Indicator", "sccp.called.ri",
2824 FT_UINT8, BASE_HEX, VALS(sccp_routing_indicator_values), ROUTING_INDICATOR_MASK,
2826 { &hf_sccp_called_itu_global_title_indicator,
2827 { "Global Title Indicator", "sccp.called.gti",
2828 FT_UINT8, BASE_HEX, VALS(sccp_itu_global_title_indicator_values), GTI_MASK,
2830 { &hf_sccp_called_ansi_global_title_indicator,
2831 { "Global Title Indicator", "sccp.called.gti",
2832 FT_UINT8, BASE_HEX, VALS(sccp_ansi_global_title_indicator_values), GTI_MASK,
2834 { &hf_sccp_called_itu_ssn_indicator,
2835 { "SubSystem Number Indicator", "sccp.called.ssni",
2836 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ITU_SSN_INDICATOR_MASK,
2838 { &hf_sccp_called_itu_point_code_indicator,
2839 { "Point Code Indicator", "sccp.called.pci",
2840 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ITU_PC_INDICATOR_MASK,
2842 { &hf_sccp_called_ansi_ssn_indicator,
2843 { "SubSystem Number Indicator", "sccp.called.ssni",
2844 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ANSI_SSN_INDICATOR_MASK,
2846 { &hf_sccp_called_ansi_point_code_indicator,
2847 { "Point Code Indicator", "sccp.called.pci",
2848 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ANSI_PC_INDICATOR_MASK,
2850 { &hf_sccp_called_ssn,
2851 { "SubSystem Number", "sccp.called.ssn",
2852 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2854 { &hf_sccp_called_itu_pc,
2855 { "PC", "sccp.called.pc",
2856 FT_UINT16, BASE_DEC, NULL, ITU_PC_MASK,
2858 { &hf_sccp_called_ansi_pc,
2859 { "PC", "sccp.called.ansi_pc",
2860 FT_STRING, BASE_NONE, NULL, 0x0,
2862 { &hf_sccp_called_chinese_pc,
2863 { "PC", "sccp.called.chinese_pc",
2864 FT_STRING, BASE_NONE, NULL, 0x0,
2866 { &hf_sccp_called_japan_pc,
2867 { "PC", "sccp.called.pc",
2868 FT_UINT16, BASE_DEC, NULL, 0x0,
2870 { &hf_sccp_called_pc_network,
2872 "sccp.called.network",
2873 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
2875 { &hf_sccp_called_pc_cluster,
2877 "sccp.called.cluster",
2878 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
2880 { &hf_sccp_called_pc_member,
2882 "sccp.called.member",
2883 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
2885 { &hf_sccp_called_gt_nai,
2886 { "Nature of Address Indicator",
2888 FT_UINT8, BASE_HEX, VALS(sccp_nai_values), GT_NAI_MASK,
2890 { &hf_sccp_called_gt_oe,
2891 { "Odd/Even Indicator",
2893 FT_UINT8, BASE_HEX, VALS(sccp_oe_values), GT_OE_MASK,
2895 { &hf_sccp_called_gt_tt,
2896 { "Translation Type",
2898 FT_UINT8, BASE_HEX, NULL, 0x0,
2900 { &hf_sccp_called_gt_np,
2903 FT_UINT8, BASE_HEX, VALS(sccp_np_values), GT_NP_MASK,
2905 { &hf_sccp_called_gt_es,
2906 { "Encoding Scheme",
2908 FT_UINT8, BASE_HEX, VALS(sccp_es_values), GT_ES_MASK,
2910 { &hf_sccp_called_gt_digits,
2912 "sccp.called.digits",
2913 FT_STRING, BASE_NONE, NULL, 0x0,
2915 { &hf_sccp_calling_national_indicator,
2916 { "National Indicator", "sccp.calling.ni",
2917 FT_UINT8, BASE_HEX, VALS(sccp_national_indicator_values), ANSI_NATIONAL_MASK,
2919 { &hf_sccp_calling_routing_indicator,
2920 { "Routing Indicator", "sccp.calling.ri",
2921 FT_UINT8, BASE_HEX, VALS(sccp_routing_indicator_values), ROUTING_INDICATOR_MASK,
2923 { &hf_sccp_calling_itu_global_title_indicator,
2924 { "Global Title Indicator", "sccp.calling.gti",
2925 FT_UINT8, BASE_HEX, VALS(sccp_itu_global_title_indicator_values), GTI_MASK,
2927 { &hf_sccp_calling_ansi_global_title_indicator,
2928 { "Global Title Indicator", "sccp.calling.gti",
2929 FT_UINT8, BASE_HEX, VALS(sccp_ansi_global_title_indicator_values), GTI_MASK,
2931 { &hf_sccp_calling_itu_ssn_indicator,
2932 { "SubSystem Number Indicator", "sccp.calling.ssni",
2933 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ITU_SSN_INDICATOR_MASK,
2935 { &hf_sccp_calling_itu_point_code_indicator,
2936 { "Point Code Indicator", "sccp.calling.pci",
2937 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ITU_PC_INDICATOR_MASK,
2939 { &hf_sccp_calling_ansi_ssn_indicator,
2940 { "SubSystem Number Indicator", "sccp.calling.ssni",
2941 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ANSI_SSN_INDICATOR_MASK,
2943 { &hf_sccp_calling_ansi_point_code_indicator,
2944 { "Point Code Indicator", "sccp.calling.pci",
2945 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ANSI_PC_INDICATOR_MASK,
2947 { &hf_sccp_calling_ssn,
2948 { "SubSystem Number", "sccp.calling.ssn",
2949 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2951 { &hf_sccp_calling_itu_pc,
2952 { "PC", "sccp.calling.pc",
2953 FT_UINT16, BASE_DEC, NULL, ITU_PC_MASK,
2955 { &hf_sccp_calling_ansi_pc,
2956 { "PC", "sccp.calling.ansi_pc",
2957 FT_STRING, BASE_NONE, NULL, 0x0,
2959 { &hf_sccp_calling_chinese_pc,
2960 { "PC", "sccp.calling.chinese_pc",
2961 FT_STRING, BASE_NONE, NULL, 0x0,
2963 { &hf_sccp_calling_japan_pc,
2964 { "PC", "sccp.calling.pc",
2965 FT_UINT16, BASE_DEC, NULL, 0x0,
2967 { &hf_sccp_calling_pc_network,
2969 "sccp.calling.network",
2970 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
2972 { &hf_sccp_calling_pc_cluster,
2974 "sccp.calling.cluster",
2975 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
2977 { &hf_sccp_calling_pc_member,
2979 "sccp.calling.member",
2980 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
2982 { &hf_sccp_calling_gt_nai,
2983 { "Nature of Address Indicator",
2985 FT_UINT8, BASE_HEX, VALS(sccp_nai_values), GT_NAI_MASK,
2987 { &hf_sccp_calling_gt_oe,
2988 { "Odd/Even Indicator",
2990 FT_UINT8, BASE_HEX, VALS(sccp_oe_values), GT_OE_MASK,
2992 { &hf_sccp_calling_gt_tt,
2993 { "Translation Type",
2995 FT_UINT8, BASE_HEX, NULL, 0x0,
2997 { &hf_sccp_calling_gt_np,
3000 FT_UINT8, BASE_HEX, VALS(sccp_np_values), GT_NP_MASK,
3002 { &hf_sccp_calling_gt_es,
3003 { "Encoding Scheme",
3005 FT_UINT8, BASE_HEX, VALS(sccp_es_values), GT_ES_MASK,
3007 { &hf_sccp_calling_gt_digits,
3009 "sccp.calling.digits",
3010 FT_STRING, BASE_NONE, NULL, 0x0,
3013 { "Destination Local Reference", "sccp.dlr",
3014 FT_UINT24, BASE_HEX, NULL, 0x0,
3017 { "Source Local Reference", "sccp.slr",
3018 FT_UINT24, BASE_HEX, NULL, 0x0,
3021 { "Local Reference", "sccp.lr",
3022 FT_UINT24, BASE_HEX, NULL, 0x0,
3025 { "Class", "sccp.class",
3026 FT_UINT8, BASE_HEX, NULL, CLASS_CLASS_MASK,
3028 { &hf_sccp_handling,
3029 { "Message handling", "sccp.handling",
3030 FT_UINT8, BASE_HEX, VALS(sccp_class_handling_values), CLASS_SPARE_HANDLING_MASK,
3033 { "More data", "sccp.more",
3034 FT_UINT8, BASE_HEX, VALS(sccp_segmenting_reassembling_values), SEGMENTING_REASSEMBLING_MASK,
3037 { "Receive Sequence Number", "sccp.rsn",
3038 FT_UINT8, BASE_HEX, NULL, RSN_MASK,
3040 { &hf_sccp_sequencing_segmenting_ssn,
3041 { "Sequencing Segmenting: Send Sequence Number", "sccp.sequencing_segmenting.ssn",
3042 FT_UINT8, BASE_HEX, NULL, SEND_SEQUENCE_NUMBER_MASK,
3044 { &hf_sccp_sequencing_segmenting_rsn,
3045 { "Sequencing Segmenting: Receive Sequence Number", "sccp.sequencing_segmenting.rsn",
3046 FT_UINT8, BASE_HEX, NULL, RECEIVE_SEQUENCE_NUMBER_MASK,
3048 { &hf_sccp_sequencing_segmenting_more,
3049 { "Sequencing Segmenting: More", "sccp.sequencing_segmenting.more",
3050 FT_UINT8, BASE_HEX, VALS(sccp_segmenting_reassembling_values), SEQUENCING_SEGMENTING_MORE_MASK,
3053 { "Credit", "sccp.credit",
3054 FT_UINT8, BASE_HEX, NULL, 0x0,
3056 { &hf_sccp_release_cause,
3057 { "Release Cause", "sccp.release_cause",
3058 FT_UINT8, BASE_HEX, VALS(sccp_release_cause_values), 0x0,
3060 { &hf_sccp_return_cause,
3061 { "Return Cause", "sccp.return_cause",
3062 FT_UINT8, BASE_HEX, VALS(sccp_return_cause_values), 0x0,
3064 { &hf_sccp_reset_cause,
3065 { "Reset Cause", "sccp.reset_cause",
3066 FT_UINT8, BASE_HEX, VALS(sccp_reset_cause_values), 0x0,
3068 { &hf_sccp_error_cause,
3069 { "Error Cause", "sccp.error_cause",
3070 FT_UINT8, BASE_HEX, VALS(sccp_error_cause_values), 0x0,
3072 { &hf_sccp_refusal_cause,
3073 { "Refusal Cause", "sccp.refusal_cause",
3074 FT_UINT8, BASE_HEX, VALS(sccp_refusal_cause_values), 0x0,
3076 { &hf_sccp_segmentation_first,
3077 { "Segmentation: First", "sccp.segmentation.first",
3078 FT_UINT8, BASE_HEX, VALS(sccp_segmentation_first_segment_values), SEGMENTATION_FIRST_SEGMENT_MASK,
3080 { &hf_sccp_segmentation_class,
3081 { "Segmentation: Class", "sccp.segmentation.class",
3082 FT_UINT8, BASE_HEX, VALS(sccp_segmentation_class_values), SEGMENTATION_CLASS_MASK,
3084 { &hf_sccp_segmentation_remaining,
3085 { "Segmentation: Remaining", "sccp.segmentation.remaining",
3086 FT_UINT8, BASE_HEX, NULL, SEGMENTATION_REMAINING_MASK,
3088 { &hf_sccp_segmentation_slr,
3089 { "Segmentation: Source Local Reference", "sccp.segmentation.slr",
3090 FT_UINT24, BASE_HEX, NULL, 0x0,
3092 { &hf_sccp_hop_counter,
3093 { "Hop Counter", "sccp.hops",
3094 FT_UINT8, BASE_HEX, NULL, 0x0,
3096 { &hf_sccp_importance,
3097 { "Importance", "sccp.importance",
3098 FT_UINT8, BASE_HEX, NULL, IMPORTANCE_IMPORTANCE_MASK,
3100 /* ISNI is ANSI only */
3101 { &hf_sccp_ansi_isni_mi,
3102 { "ISNI Mark for Identification Indicator", "sccp.isni.mi",
3103 FT_UINT8, BASE_HEX, VALS(sccp_isni_mark_for_id_values), ANSI_ISNI_MI_MASK,
3105 { &hf_sccp_ansi_isni_iri,
3106 { "ISNI Routing Indicator", "sccp.isni.iri",
3107 FT_UINT8, BASE_HEX, VALS(sccp_isni_iri_values), ANSI_ISNI_IRI_MASK,
3109 { &hf_sccp_ansi_isni_ti,
3110 { "ISNI Type Indicator", "sccp.isni.ti",
3111 FT_UINT8, BASE_HEX, VALS(sccp_isni_ti_values), ANSI_ISNI_TI_MASK,
3113 { &hf_sccp_ansi_isni_netspec,
3114 { "ISNI Network Specific (Type 1)", "sccp.isni.netspec",
3115 FT_UINT8, BASE_HEX, NULL, ANSI_ISNI_NETSPEC_MASK,
3117 { &hf_sccp_ansi_isni_counter,
3118 { "ISNI Counter", "sccp.isni.counter",
3119 FT_UINT8, BASE_DEC, NULL, ANSI_ISNI_COUNTER_MASK,
3121 {&hf_sccp_xudt_msg_fragments,
3122 {"Message fragments", "sccp.msg.fragments",
3123 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
3125 {&hf_sccp_xudt_msg_fragment,
3126 {"Message fragment", "sccp.msg.fragment",
3127 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
3129 {&hf_sccp_xudt_msg_fragment_overlap,
3130 {"Message fragment overlap", "sccp.msg.fragment.overlap",
3131 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
3133 {&hf_sccp_xudt_msg_fragment_overlap_conflicts,
3134 {"Message fragment overlapping with conflicting data", "sccp.msg.fragment.overlap.conflicts",
3135 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
3137 {&hf_sccp_xudt_msg_fragment_multiple_tails,
3138 {"Message has multiple tail fragments", "sccp.msg.fragment.multiple_tails",
3139 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
3141 {&hf_sccp_xudt_msg_fragment_too_long_fragment,
3142 {"Message fragment too long", "sccp.msg.fragment.too_long_fragment",
3143 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
3145 {&hf_sccp_xudt_msg_fragment_error,
3146 {"Message defragmentation error", "sccp.msg.fragment.error",
3147 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
3149 {&hf_sccp_xudt_msg_reassembled_in,
3150 {"Reassembled in", "sccp.msg.reassembled.in",
3151 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
3153 { &hf_sccp_assoc_id,
3154 { "Association ID", "sccp.assoc.id",
3155 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
3156 {&hf_sccp_assoc_msg,
3157 {"Message in frame", "sccp.assoc.msg",
3158 FT_FRAMENUM, BASE_NONE, NULL, 0x00, "", HFILL }
3163 /* Setup protocol subtree array */
3164 static gint *ett[] = {
3167 &ett_sccp_called_ai,
3168 &ett_sccp_called_pc,
3169 &ett_sccp_called_gt,
3171 &ett_sccp_calling_ai,
3172 &ett_sccp_calling_pc,
3173 &ett_sccp_calling_gt,
3174 &ett_sccp_sequencing_segmenting,
3175 &ett_sccp_segmentation,
3176 &ett_sccp_ansi_isni_routing_control,
3177 &ett_sccp_xudt_msg_fragment,
3178 &ett_sccp_xudt_msg_fragments,
3184 static uat_field_t users_flds[] = {
3185 UAT_FLD_DEC(sccp_users,ni,"Network Indicator"),
3186 UAT_FLD_RANGE(sccp_users,called_pc,65535,"DPCs for which this protocol is to be used"),
3187 UAT_FLD_RANGE(sccp_users,called_ssn,65535,"Called SSNs for which this protocol is to be used"),
3188 UAT_FLD_VS(sccp_users,user,sccp_users_vals,"The User Protocol"),
3193 uat_t* users_uat = uat_new("SCCP Users Table",
3194 sizeof(sccp_user_t),
3197 (void**) &sccp_users,
3202 sccp_users_update_cb,
3206 /* Register the protocol name and description */
3207 proto_sccp = proto_register_protocol("Signalling Connection Control Part",
3210 register_dissector("sccp", dissect_sccp, proto_sccp);
3212 /* Required function calls to register the header fields and subtrees used */
3213 proto_register_field_array(proto_sccp, hf, array_length(hf));
3214 proto_register_subtree_array(ett, array_length(ett));
3217 sccp_ssn_dissector_table = register_dissector_table("sccp.ssn", "SCCP SSN", FT_UINT8, BASE_DEC);
3219 register_heur_dissector_list("sccp", &heur_subdissector_list);
3221 sccp_module = prefs_register_protocol(proto_sccp, NULL);
3223 prefs_register_uint_preference(sccp_module, "source_pc",
3225 "The source point code (usually MSC) (to determine whether message is uplink or downlink)",
3226 16, &sccp_source_pc_global);
3228 prefs_register_bool_preference(sccp_module, "show_length", "Show length",
3229 "Show parameter length in the protocol tree",
3232 prefs_register_bool_preference(sccp_module, "defragment_xudt",
3233 "Reassemble XUDT messages",
3234 "Whether XUDT messages should be reassembled",
3235 &sccp_xudt_desegment);
3237 prefs_register_bool_preference(sccp_module, "trace_sccp",
3238 "Trace Associations",
3239 "Whether to keep infomation about messages and their associations",
3243 prefs_register_bool_preference(sccp_module, "show_more_info",
3244 "Show key parameters in Info Column",
3245 "Show SLR, DLR, and CAUSE Parameters in the Information Column of the Summary",
3249 prefs_register_uat_preference(sccp_module, "users_table", "Users Table",
3250 "A table that enumerates user protocols to be used against specific PCs and SSNs",
3253 register_init_routine(&init_sccp);
3255 assocs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "sccp_associations");
3257 sccp_tap = register_tap("sccp");
3262 proto_reg_handoff_sccp(void)
3264 dissector_handle_t sccp_handle;
3266 sccp_handle = find_dissector("sccp");
3268 dissector_add("wtap_encap", WTAP_ENCAP_SCCP, sccp_handle);
3269 dissector_add("mtp3.service_indicator", SCCP_SI, sccp_handle);
3270 dissector_add_string("tali.opcode", "sccp", sccp_handle);
3272 data_handle = find_dissector("data");
3273 tcap_handle = find_dissector("tcap");
3274 ranap_handle = find_dissector("ranap");
3275 bssap_handle = find_dissector("bssap");
3276 gsmmap_handle = find_dissector("gsm_map");
3277 camel_handle = find_dissector("camel");
3278 inap_handle = find_dissector("inap");