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 "packet-mtp3.h"
50 #include <epan/prefs.h>
51 #include <epan/emem.h>
52 #include <epan/reassemble.h>
53 #include "packet-tcap.h"
54 #include "packet-sccp.h"
56 static Standard_Type decode_mtp3_standard;
59 #define MESSAGE_TYPE_OFFSET 0
60 #define MESSAGE_TYPE_LENGTH 1
61 #define POINTER_LENGTH 1
62 #define POINTER_LENGTH_LONG 2
64 #define MESSAGE_TYPE_CR 0x01
65 #define MESSAGE_TYPE_CC 0x02
66 #define MESSAGE_TYPE_CREF 0x03
67 #define MESSAGE_TYPE_RLSD 0x04
68 #define MESSAGE_TYPE_RLC 0x05
69 #define MESSAGE_TYPE_DT1 0x06
70 #define MESSAGE_TYPE_DT2 0x07
71 #define MESSAGE_TYPE_AK 0x08
72 #define MESSAGE_TYPE_UDT 0x09
73 #define MESSAGE_TYPE_UDTS 0x0a
74 #define MESSAGE_TYPE_ED 0x0b
75 #define MESSAGE_TYPE_EA 0x0c
76 #define MESSAGE_TYPE_RSR 0x0d
77 #define MESSAGE_TYPE_RSC 0x0e
78 #define MESSAGE_TYPE_ERR 0x0f
79 #define MESSAGE_TYPE_IT 0x10
80 #define MESSAGE_TYPE_XUDT 0x11
81 #define MESSAGE_TYPE_XUDTS 0x12
82 /* The below 2 are ITU only */
83 #define MESSAGE_TYPE_LUDT 0x13
84 #define MESSAGE_TYPE_LUDTS 0x14
86 /* Same as below but with names typed out */
87 static const value_string sccp_message_type_values[] = {
88 { MESSAGE_TYPE_CR, "Connection Request" },
89 { MESSAGE_TYPE_CC, "Connection Confirm" },
90 { MESSAGE_TYPE_CREF, "Connection Refused" },
91 { MESSAGE_TYPE_RLSD, "Released" },
92 { MESSAGE_TYPE_RLC, "Release Complete" },
93 { MESSAGE_TYPE_DT1, "Data Form 1" },
94 { MESSAGE_TYPE_DT2, "Data Form 2" },
95 { MESSAGE_TYPE_AK, "Data Acknowledgement" },
96 { MESSAGE_TYPE_UDT, "Unitdata" },
97 { MESSAGE_TYPE_UDTS, "Unitdata Service" },
98 { MESSAGE_TYPE_ED, "Expedited Data" },
99 { MESSAGE_TYPE_EA, "Expedited Data Acknowledgement" },
100 { MESSAGE_TYPE_RSR, "Reset Request" },
101 { MESSAGE_TYPE_RSC, "Reset Confirmation" },
102 { MESSAGE_TYPE_ERR, "Error" },
103 { MESSAGE_TYPE_IT, "Inactivity Timer" },
104 { MESSAGE_TYPE_XUDT, "Extended Unitdata" },
105 { MESSAGE_TYPE_XUDTS, "Extended Unitdata Service" },
106 { MESSAGE_TYPE_LUDT, "Long Unitdata (ITU)" },
107 { MESSAGE_TYPE_LUDTS, "Long Unitdata Service (ITU)" },
110 /* Same as above but in acronym form (for the Info column) */
111 static const value_string sccp_message_type_acro_values[] = {
112 { MESSAGE_TYPE_CR, "CR" },
113 { MESSAGE_TYPE_CC, "CC" },
114 { MESSAGE_TYPE_CREF, "CREF" },
115 { MESSAGE_TYPE_RLSD, "RLSD" },
116 { MESSAGE_TYPE_RLC, "RLC" },
117 { MESSAGE_TYPE_DT1, "DT1" },
118 { MESSAGE_TYPE_DT2, "DT2" },
119 { MESSAGE_TYPE_AK, "AK" },
120 { MESSAGE_TYPE_UDT, "UDT" },
121 { MESSAGE_TYPE_UDTS, "UDTS" },
122 { MESSAGE_TYPE_ED, "ED" },
123 { MESSAGE_TYPE_EA, "EA" },
124 { MESSAGE_TYPE_RSR, "RSR" },
125 { MESSAGE_TYPE_RSC, "RSC" },
126 { MESSAGE_TYPE_ERR, "ERR" },
127 { MESSAGE_TYPE_IT, "IT" },
128 { MESSAGE_TYPE_XUDT, "XUDT" },
129 { MESSAGE_TYPE_XUDTS, "XUDTS" },
130 { MESSAGE_TYPE_LUDT, "LUDT" },
131 { MESSAGE_TYPE_LUDTS, "LUDTS" },
134 #define PARAMETER_LENGTH_LENGTH 1
135 #define PARAMETER_LONG_DATA_LENGTH_LENGTH 2
136 #define PARAMETER_TYPE_LENGTH 1
138 #define PARAMETER_END_OF_OPTIONAL_PARAMETERS 0x00
139 #define PARAMETER_DESTINATION_LOCAL_REFERENCE 0x01
140 #define PARAMETER_SOURCE_LOCAL_REFERENCE 0x02
141 #define PARAMETER_CALLED_PARTY_ADDRESS 0x03
142 #define PARAMETER_CALLING_PARTY_ADDRESS 0x04
143 #define PARAMETER_CLASS 0x05
144 #define PARAMETER_SEGMENTING_REASSEMBLING 0x06
145 #define PARAMETER_RECEIVE_SEQUENCE_NUMBER 0x07
146 #define PARAMETER_SEQUENCING_SEGMENTING 0x08
147 #define PARAMETER_CREDIT 0x09
148 #define PARAMETER_RELEASE_CAUSE 0x0a
149 #define PARAMETER_RETURN_CAUSE 0x0b
150 #define PARAMETER_RESET_CAUSE 0x0c
151 #define PARAMETER_ERROR_CAUSE 0x0d
152 #define PARAMETER_REFUSAL_CAUSE 0x0e
153 #define PARAMETER_DATA 0x0f
154 #define PARAMETER_SEGMENTATION 0x10
155 #define PARAMETER_HOP_COUNTER 0x11
156 /* The below 2 are ITU only */
157 #define PARAMETER_IMPORTANCE 0x12
158 #define PARAMETER_LONG_DATA 0x13
159 /* ISNI is ANSI only */
160 #define PARAMETER_ISNI 0xfa
162 static const value_string sccp_parameter_values[] = {
163 { PARAMETER_END_OF_OPTIONAL_PARAMETERS, "End of Optional Parameters" },
164 { PARAMETER_DESTINATION_LOCAL_REFERENCE, "Destination Local Reference" },
165 { PARAMETER_SOURCE_LOCAL_REFERENCE, "Source Local Reference" },
166 { PARAMETER_CALLED_PARTY_ADDRESS, "Called Party Address" },
167 { PARAMETER_CALLING_PARTY_ADDRESS, "Calling Party Address" },
168 { PARAMETER_CLASS, "Protocol Class" },
169 { PARAMETER_SEGMENTING_REASSEMBLING, "Segmenting/Reassembling" },
170 { PARAMETER_RECEIVE_SEQUENCE_NUMBER, "Receive Sequence Number" },
171 { PARAMETER_SEQUENCING_SEGMENTING, "Sequencing/Segmenting" },
172 { PARAMETER_CREDIT, "Credit" },
173 { PARAMETER_RELEASE_CAUSE, "Release Cause" },
174 { PARAMETER_RETURN_CAUSE, "Return Cause" },
175 { PARAMETER_RESET_CAUSE, "Reset Cause" },
176 { PARAMETER_ERROR_CAUSE, "Error Cause" },
177 { PARAMETER_REFUSAL_CAUSE, "Refusal Cause" },
178 { PARAMETER_DATA, "Data" },
179 { PARAMETER_SEGMENTATION, "Segmentation" },
180 { PARAMETER_HOP_COUNTER, "Hop Counter" },
181 { PARAMETER_IMPORTANCE, "Importance (ITU)" },
182 { PARAMETER_LONG_DATA, "Long Data (ITU)" },
183 { PARAMETER_ISNI, "Intermediate Signaling Network Identification (ANSI)" },
187 #define END_OF_OPTIONAL_PARAMETERS_LENGTH 1
188 #define DESTINATION_LOCAL_REFERENCE_LENGTH 3
189 #define SOURCE_LOCAL_REFERENCE_LENGTH 3
190 #define PROTOCOL_CLASS_LENGTH 1
191 #define RECEIVE_SEQUENCE_NUMBER_LENGTH 1
192 #define CREDIT_LENGTH 1
193 #define RELEASE_CAUSE_LENGTH 1
194 #define RETURN_CAUSE_LENGTH 1
195 #define RESET_CAUSE_LENGTH 1
196 #define ERROR_CAUSE_LENGTH 1
197 #define REFUSAL_CAUSE_LENGTH 1
198 #define HOP_COUNTER_LENGTH 1
199 #define IMPORTANCE_LENGTH 1
202 /* Parts of the Called and Calling Address parameters */
203 /* Address Indicator */
204 #define ADDRESS_INDICATOR_LENGTH 1
205 #define ITU_RESERVED_MASK 0x80
206 #define ANSI_NATIONAL_MASK 0x80
207 #define ROUTING_INDICATOR_MASK 0x40
208 #define GTI_MASK 0x3C
210 #define ITU_SSN_INDICATOR_MASK 0x02
211 #define ITU_PC_INDICATOR_MASK 0x01
212 #define ANSI_PC_INDICATOR_MASK 0x02
213 #define ANSI_SSN_INDICATOR_MASK 0x01
215 static const value_string sccp_national_indicator_values[] = {
216 { 0x0, "Address coded to International standard" },
217 { 0x1, "Address coded to National standard" },
220 static const value_string sccp_routing_indicator_values[] = {
221 { 0x0, "Route on GT" },
222 { 0x1, "Route on SSN" },
225 #define AI_GTI_NO_GT 0x0
226 #define ITU_AI_GTI_NAI 0x1
227 #define AI_GTI_TT 0x2
228 #define ITU_AI_GTI_TT_NP_ES 0x3
229 #define ITU_AI_GTI_TT_NP_ES_NAI 0x4
230 static const value_string sccp_itu_global_title_indicator_values[] = {
231 { AI_GTI_NO_GT, "No Global Title" },
232 { ITU_AI_GTI_NAI, "Nature of Address Indicator only" },
233 { AI_GTI_TT, "Translation Type only" },
234 { ITU_AI_GTI_TT_NP_ES, "Translation Type, Numbering Plan, and Encoding Scheme included" },
235 { ITU_AI_GTI_TT_NP_ES_NAI, "Translation Type, Numbering Plan, Encoding Scheme, and Nature of Address Indicator included" },
238 /* #define AI_GTI_NO_GT 0x0 */
239 #define ANSI_AI_GTI_TT_NP_ES 0x1
240 /* #define AI_GTI_TT 0x2 */
241 static const value_string sccp_ansi_global_title_indicator_values[] = {
242 { AI_GTI_NO_GT, "No Global Title" },
243 { ANSI_AI_GTI_TT_NP_ES, "Translation Type, Numbering Plan, and Encoding Scheme included" },
244 { AI_GTI_TT, "Translation Type only" },
247 static const value_string sccp_ai_pci_values[] = {
248 { 0x1, "Point Code present" },
249 { 0x0, "Point Code not present" },
252 static const value_string sccp_ai_ssni_values[] = {
253 { 0x1, "SSN present" },
254 { 0x0, "SSN not present" },
257 #define ADDRESS_SSN_LENGTH 1
258 #define INVALID_SSN 0xff
259 /* Some values from 3GPP TS 23.003 */
260 /* Japan TTC and NTT define a lot of SSNs, some of which conflict with
261 * these. They are not added for now.
263 static const value_string sccp_ssn_values[] = {
264 { 0x00, "SSN not known/not used" },
265 { 0x01, "SCCP management" },
266 { 0x02, "Reserved for ITU-T allocation" },
267 { 0x03, "ISDN User Part" },
268 { 0x04, "OMAP (Operation, Maintenance, and Administration Part)" },
269 { 0x05, "MAP (Mobile Application Part)" },
270 { 0x06, "HLR (Home Location Register)" },
271 { 0x07, "VLR (Visitor Location Register)" },
272 { 0x08, "MSC (Mobile Switching Center)" },
273 { 0x09, "EIC/EIR (Equipment Identifier Center/Equipment Identification Register)" },
274 { 0x0a, "AUC/AC (Authentication Center)" },
275 { 0x0b, "ISDN supplementary services (ITU only)" },
276 { 0x0c, "Reserved for international use (ITU only)" },
277 { 0x0d, "Broadband ISDN edge-to-edge applications (ITU only)" },
278 { 0x0e, "TC test responder (ITU only)" },
279 /* The following national network subsystem numbers have been allocated for use within and
280 * between GSM/UMTS networks:
284 { 0x91, "GMLC(MAP)" },
286 { 0x93, "gsmSCF (MAP) or IM-SSF (MAP) or Presence Network Agent" },
287 { 0x94, "SIWF (MAP)" },
288 { 0x95, "SGSN (MAP)" },
289 { 0x96, "GGSN (MAP)" },
290 /* The following national network subsystem numbers have been allocated for use within GSM/UMTS networks:*/
292 { 0xfa, "BSC (BSSAP-LE)" },
293 { 0xfb, "MSC (BSSAP-LE)" },
294 { 0xfc, "IOS or SMLC (BSSAP-LE)" },
295 { 0xfd, "BSS O&M (A interface)" },
296 { 0xfe, "BSSAP/BSAP" },
300 /* * * * * * * * * * * * * * * * *
301 * Global Title: ITU GTI == 0001 *
302 * * * * * * * * * * * * * * * * */
303 #define GT_NAI_MASK 0x7F
304 #define GT_NAI_LENGTH 1
305 static const value_string sccp_nai_values[] = {
306 { 0x00, "NAI unknown" },
307 { 0x01, "Subscriber Number" },
308 { 0x02, "Reserved for national use" },
309 { 0x03, "National significant number" },
310 { 0x04, "International number" },
314 #define GT_OE_MASK 0x80
317 static const value_string sccp_oe_values[] = {
318 { GT_OE_EVEN, "Even number of address signals" },
319 { GT_OE_ODD, "Odd number of address signals" },
322 #define GT_SIGNAL_LENGTH 1
323 #define GT_ODD_SIGNAL_MASK 0x0f
324 #define GT_EVEN_SIGNAL_MASK 0xf0
325 #define GT_EVEN_SIGNAL_SHIFT 4
326 #define GT_MAX_SIGNALS 32
327 static const value_string sccp_address_signal_values[] = {
347 /* * * * * * * * * * * * * * * * * * * * *
348 * Global Title: ITU and ANSI GTI == 0010 *
349 * * * * * * * * * * * * * * * * * * * * */
350 #define GT_TT_LENGTH 1
353 /* * * * * * * * * * * * * * * * * * * * * * * * * *
354 * Global Title: ITU GTI == 0011, ANSI GTI == 0001 *
355 * * * * * * * * * * * * * * * * * * * * * * * * * */
356 #define GT_NP_MASK 0xf0
357 #define GT_NP_ES_LENGTH 1
358 static const value_string sccp_np_values[] = {
360 { 0x1, "ISDN/telephony" },
361 { 0x2, "Generic (ITU)/Reserved (ANSI)" },
364 { 0x5, "Maritime mobile" },
365 { 0x6, "Land mobile" },
366 { 0x7, "ISDN/mobile" },
367 { 0xe, "Private network or network-specific" },
371 #define GT_ES_MASK 0x0f
372 #define GT_ES_UNKNOWN 0x0
373 #define GT_ES_BCD_ODD 0x1
374 #define GT_ES_BCD_EVEN 0x2
375 #define GT_ES_NATIONAL 0x3
376 #define GT_ES_RESERVED 0xf
377 static const value_string sccp_es_values[] = {
378 { GT_ES_UNKNOWN, "Unknown" },
379 { GT_ES_BCD_ODD, "BCD, odd number of digits" },
380 { GT_ES_BCD_EVEN, "BCD, even number of digits" },
381 { GT_ES_NATIONAL, "National specific" },
382 { GT_ES_RESERVED, "Reserved (ITU)/Spare (ANSI)" },
385 /* Address signals above */
388 /* * * * * * * * * * * * * * * * *
389 * Global Title: ITU GTI == 0100 *
390 * * * * * * * * * * * * * * * * */
394 /* Address signals above */
397 #define CLASS_CLASS_MASK 0xf
398 #define CLASS_SPARE_HANDLING_MASK 0xf0
399 static const value_string sccp_class_handling_values [] = {
400 { 0x0, "No special options" },
401 { 0x8, "Return message on error" },
405 #define SEGMENTING_REASSEMBLING_LENGTH 1
406 #define SEGMENTING_REASSEMBLING_MASK 0x01
407 #define NO_MORE_DATA 0
409 /* This is also used by sequencing-segmenting parameter */
410 static const value_string sccp_segmenting_reassembling_values [] = {
411 { NO_MORE_DATA, "No more data" },
412 { MORE_DATA, "More data" },
416 #define RECEIVE_SEQUENCE_NUMBER_LENGTH 1
417 #define RSN_MASK 0xfe
419 #define SEQUENCING_SEGMENTING_LENGTH 2
420 #define SEQUENCING_SEGMENTING_SSN_LENGTH 1
421 #define SEQUENCING_SEGMENTING_RSN_LENGTH 1
422 #define SEND_SEQUENCE_NUMBER_MASK 0xfe
423 #define RECEIVE_SEQUENCE_NUMBER_MASK 0xfe
424 #define SEQUENCING_SEGMENTING_MORE_MASK 0x01
427 #define CREDIT_LENGTH 1
429 #define RELEASE_CAUSE_LENGTH 1
430 static const value_string sccp_release_cause_values [] = {
431 { 0x00, "End user originated" },
432 { 0x01, "End user congestion" },
433 { 0x02, "End user failure" },
434 { 0x03, "SCCP user originated" },
435 { 0x04, "Remote procedure error" },
436 { 0x05, "Inconsistent connection data" },
437 { 0x06, "Access failure" },
438 { 0x07, "Access congestion" },
439 { 0x08, "Subsystem failure" },
440 { 0x09, "Subsystem congestion" },
441 { 0x0a, "MTP failure" },
442 { 0x0b, "Netowrk congestion" },
443 { 0x0c, "Expiration of reset timer" },
444 { 0x0d, "Expiration of receive inactivity timer" },
445 { 0x0e, "Reserved" },
446 { 0x0f, "Unqualified" },
447 { 0x10, "SCCP failure (ITU only)" },
451 #define RETURN_CAUSE_LENGTH 1
452 static const value_string sccp_return_cause_values [] = {
453 { 0x00, "No translation for an address of such nature" },
454 { 0x01, "No translation for this specific address" },
455 { 0x02, "Subsystem congestion" },
456 { 0x03, "Subsystem failure" },
457 { 0x04, "Unequipped failure" },
458 { 0x05, "MTP failure" },
459 { 0x06, "Network congestion" },
460 { 0x07, "Unqualified" },
461 { 0x08, "Error in message transport" },
462 { 0x09, "Error in local processing" },
463 { 0x0a, "Destination cannot perform reassembly" },
464 { 0x0b, "SCCP failure" },
465 { 0x0c, "Hop counter violation" },
466 { 0x0d, "Segmentation not supported (ITU only)" },
467 { 0x0e, "Segmentation failure (ITU only)" },
468 { 0xf9, "Invalid ISNI routing request (ANSI only)"},
469 { 0xfa, "Unauthorized message (ANSI only)" },
470 { 0xfb, "Message incompatibility (ANSI only)" },
471 { 0xfc, "Cannot perform ISNI constrained routing (ANSI only)" },
472 { 0xfd, "Unable to perform ISNI identification (ANSI only)" },
476 #define RESET_CAUSE_LENGTH 1
477 static const value_string sccp_reset_cause_values [] = {
478 { 0x00, "End user originated" },
479 { 0x01, "SCCP user originated" },
480 { 0x02, "Message out of order - incorrect send sequence number" },
481 { 0x03, "Message out of order - incorrect receive sequence number" },
482 { 0x04, "Remote procedure error - message out of window" },
483 { 0x05, "Remote procedure error - incorrect send sequence number after (re)initialization" },
484 { 0x06, "Remote procedure error - general" },
485 { 0x07, "Remote end user operational" },
486 { 0x08, "Network operational" },
487 { 0x09, "Access operational" },
488 { 0x0a, "Network congestion" },
489 { 0x0b, "Reserved (ITU)/Not obtainable (ANSI)" },
490 { 0x0c, "Unqualified" },
494 #define ERROR_CAUSE_LENGTH 1
495 static const value_string sccp_error_cause_values [] = {
496 { 0x00, "Local Reference Number (LRN) mismatch - unassigned destination LRN" },
497 { 0x01, "Local Reference Number (LRN) mismatch - inconsistent source LRN" },
498 { 0x02, "Point code mismatch" },
499 { 0x03, "Service class mismatch" },
500 { 0x04, "Unqualified" },
504 #define REFUSAL_CAUSE_LENGTH 1
505 static const value_string sccp_refusal_cause_values [] = {
506 { 0x00, "End user originated" },
507 { 0x01, "End user congestion" },
508 { 0x02, "End user failure" },
509 { 0x03, "SCCP user originated" },
510 { 0x04, "Destination address unknown" },
511 { 0x05, "Destination inaccessible" },
512 { 0x06, "Network resource - QOS not available/non-transient" },
513 { 0x07, "Network resource - QOS not available/transient" },
514 { 0x08, "Access failure" },
515 { 0x09, "Access congestion" },
516 { 0x0a, "Subsystem failure" },
517 { 0x0b, "Subsystem congestion" },
518 { 0x0c, "Expiration of connection establishment timer" },
519 { 0x0d, "Incompatible user data" },
520 { 0x0e, "Reserved" },
521 { 0x0f, "Unqualified" },
522 { 0x10, "Hop counter violation" },
523 { 0x11, "SCCP failure (ITU only)" },
524 { 0x12, "No translation for an address of such nature" },
525 { 0x13, "Unequipped user" },
529 #define SEGMENTATION_LENGTH 4
530 #define SEGMENTATION_FIRST_SEGMENT_MASK 0x80
531 #define SEGMENTATION_CLASS_MASK 0x40
532 #define SEGMENTATION_SPARE_MASK 0x30
533 #define SEGMENTATION_REMAINING_MASK 0x0f
534 static const value_string sccp_segmentation_first_segment_values [] = {
535 { 1, "First segment" },
536 { 0, "Not first segment" },
538 static const value_string sccp_segmentation_class_values [] = {
539 { 0, "Class 0 selected" },
540 { 1, "Class 1 selected" },
544 #define HOP_COUNTER_LENGTH 1
546 #define IMPORTANCE_LENGTH 1
547 #define IMPORTANCE_IMPORTANCE_MASK 0x7
550 #define ANSI_ISNI_ROUTING_CONTROL_LENGTH 1
551 #define ANSI_ISNI_MI_MASK 0x01
552 #define ANSI_ISNI_IRI_MASK 0x06
553 #define ANSI_ISNI_RES_MASK 0x08
554 #define ANSI_ISNI_TI_MASK 0x10
555 #define ANSI_ISNI_TI_SHIFT 4
556 #define ANSI_ISNI_COUNTER_MASK 0xe0
557 #define ANSI_ISNI_NETSPEC_MASK 0x03
559 static const value_string sccp_isni_mark_for_id_values [] = {
560 { 0x0, "Do not identify networks" },
561 { 0x1, "Identify networks" },
564 static const value_string sccp_isni_iri_values [] = {
565 { 0x0, "Neither constrained nor suggested ISNI routing" },
566 { 0x1, "Constrained ISNI routing" },
567 { 0x2, "Reserved for suggested ISNI routing" },
571 #define ANSI_ISNI_TYPE_0 0x0
572 #define ANSI_ISNI_TYPE_1 0x1
573 static const value_string sccp_isni_ti_values [] = {
574 { ANSI_ISNI_TYPE_0, "Type zero ISNI parameter format" },
575 { ANSI_ISNI_TYPE_1, "Type one ISNI parameter format" },
579 /* Initialize the protocol and registered fields */
580 static int proto_sccp = -1;
581 static int hf_sccp_message_type = -1;
582 static int hf_sccp_variable_pointer1 = -1;
583 static int hf_sccp_variable_pointer2 = -1;
584 static int hf_sccp_variable_pointer3 = -1;
585 static int hf_sccp_optional_pointer = -1;
586 static int hf_sccp_ssn = -1;
587 static int hf_sccp_gt_digits = -1;
589 /* Called Party address */
590 static int hf_sccp_called_national_indicator = -1;
591 static int hf_sccp_called_routing_indicator = -1;
592 static int hf_sccp_called_itu_global_title_indicator = -1;
593 static int hf_sccp_called_ansi_global_title_indicator = -1;
594 static int hf_sccp_called_itu_ssn_indicator = -1;
595 static int hf_sccp_called_itu_point_code_indicator = -1;
596 static int hf_sccp_called_ansi_ssn_indicator = -1;
597 static int hf_sccp_called_ansi_point_code_indicator = -1;
598 static int hf_sccp_called_ssn = -1;
599 static int hf_sccp_called_pc_member = -1;
600 static int hf_sccp_called_pc_cluster = -1;
601 static int hf_sccp_called_pc_network = -1;
602 static int hf_sccp_called_ansi_pc = -1;
603 static int hf_sccp_called_chinese_pc = -1;
604 static int hf_sccp_called_itu_pc = -1;
605 static int hf_sccp_called_japan_pc = -1;
606 static int hf_sccp_called_gt_nai = -1;
607 static int hf_sccp_called_gt_oe = -1;
608 static int hf_sccp_called_gt_tt = -1;
609 static int hf_sccp_called_gt_np = -1;
610 static int hf_sccp_called_gt_es = -1;
611 static int hf_sccp_called_gt_digits = -1;
613 /* Calling party address */
614 static int hf_sccp_calling_national_indicator = -1;
615 static int hf_sccp_calling_routing_indicator = -1;
616 static int hf_sccp_calling_itu_global_title_indicator = -1;
617 static int hf_sccp_calling_ansi_global_title_indicator = -1;
618 static int hf_sccp_calling_itu_ssn_indicator = -1;
619 static int hf_sccp_calling_itu_point_code_indicator = -1;
620 static int hf_sccp_calling_ansi_ssn_indicator = -1;
621 static int hf_sccp_calling_ansi_point_code_indicator = -1;
622 static int hf_sccp_calling_ssn = -1;
623 static int hf_sccp_calling_pc_member = -1;
624 static int hf_sccp_calling_pc_cluster = -1;
625 static int hf_sccp_calling_pc_network = -1;
626 static int hf_sccp_calling_ansi_pc = -1;
627 static int hf_sccp_calling_chinese_pc = -1;
628 static int hf_sccp_calling_itu_pc = -1;
629 static int hf_sccp_calling_japan_pc = -1;
630 static int hf_sccp_calling_gt_nai = -1;
631 static int hf_sccp_calling_gt_oe = -1;
632 static int hf_sccp_calling_gt_tt = -1;
633 static int hf_sccp_calling_gt_np = -1;
634 static int hf_sccp_calling_gt_es = -1;
635 static int hf_sccp_calling_gt_digits = -1;
637 /* Other parameter values */
638 static int hf_sccp_dlr = -1;
639 static int hf_sccp_slr = -1;
640 static int hf_sccp_lr = -1;
641 static int hf_sccp_class = -1;
642 static int hf_sccp_handling = -1;
643 static int hf_sccp_more = -1;
644 static int hf_sccp_rsn = -1;
645 static int hf_sccp_sequencing_segmenting_ssn = -1;
646 static int hf_sccp_sequencing_segmenting_rsn = -1;
647 static int hf_sccp_sequencing_segmenting_more = -1;
648 static int hf_sccp_credit = -1;
649 static int hf_sccp_release_cause = -1;
650 static int hf_sccp_return_cause = -1;
651 static int hf_sccp_reset_cause = -1;
652 static int hf_sccp_error_cause = -1;
653 static int hf_sccp_refusal_cause = -1;
654 static int hf_sccp_segmentation_first = -1;
655 static int hf_sccp_segmentation_class = -1;
656 static int hf_sccp_segmentation_remaining = -1;
657 static int hf_sccp_segmentation_slr = -1;
658 static int hf_sccp_hop_counter = -1;
659 static int hf_sccp_importance = -1;
660 static int hf_sccp_ansi_isni_mi = -1;
661 static int hf_sccp_ansi_isni_iri = -1;
662 static int hf_sccp_ansi_isni_ti = -1;
663 static int hf_sccp_ansi_isni_netspec = -1;
664 static int hf_sccp_ansi_isni_counter = -1;
665 static int hf_sccp_xudt_msg_fragments = -1;
666 static int hf_sccp_xudt_msg_fragment = -1;
667 static int hf_sccp_xudt_msg_fragment_overlap = -1;
668 static int hf_sccp_xudt_msg_fragment_overlap_conflicts = -1;
669 static int hf_sccp_xudt_msg_fragment_multiple_tails = -1;
670 static int hf_sccp_xudt_msg_fragment_too_long_fragment = -1;
671 static int hf_sccp_xudt_msg_fragment_error = -1;
672 static int hf_sccp_xudt_msg_reassembled_in = -1;
673 static int hf_sccp_assoc_msg = -1;
674 static int hf_sccp_assoc_id = -1;
676 /* Initialize the subtree pointers */
677 static gint ett_sccp = -1;
678 static gint ett_sccp_called = -1;
679 static gint ett_sccp_called_ai = -1;
680 static gint ett_sccp_called_pc = -1;
681 static gint ett_sccp_called_gt = -1;
682 static gint ett_sccp_calling = -1;
683 static gint ett_sccp_calling_ai = -1;
684 static gint ett_sccp_calling_pc = -1;
685 static gint ett_sccp_calling_gt = -1;
686 static gint ett_sccp_sequencing_segmenting = -1;
687 static gint ett_sccp_segmentation = -1;
688 static gint ett_sccp_ansi_isni_routing_control = -1;
689 static gint ett_sccp_xudt_msg_fragment = -1;
690 static gint ett_sccp_xudt_msg_fragments = -1;
691 static gint ett_sccp_assoc = -1;
693 /* Declarations to desegment XUDT Messages */
694 static gboolean sccp_xudt_desegment = TRUE;
696 static const fragment_items sccp_xudt_msg_frag_items = {
697 /* Fragment subtrees */
698 &ett_sccp_xudt_msg_fragment,
699 &ett_sccp_xudt_msg_fragments,
700 /* Fragment fields */
701 &hf_sccp_xudt_msg_fragments,
702 &hf_sccp_xudt_msg_fragment,
703 &hf_sccp_xudt_msg_fragment_overlap,
704 &hf_sccp_xudt_msg_fragment_overlap_conflicts,
705 &hf_sccp_xudt_msg_fragment_multiple_tails,
706 &hf_sccp_xudt_msg_fragment_too_long_fragment,
707 &hf_sccp_xudt_msg_fragment_error,
708 /* Reassembled in field */
709 &hf_sccp_xudt_msg_reassembled_in,
711 "SCCP XUDT Message fragments"
714 static GHashTable *sccp_xudt_msg_fragment_table = NULL;
715 static GHashTable *sccp_xudt_msg_reassembled_table = NULL;
720 * Here are the global variables associated with
721 * the various user definable characteristics of the dissection
723 static guint32 sccp_source_pc_global = 0;
724 static gboolean sccp_show_length = FALSE;
726 static module_t *sccp_module;
727 static heur_dissector_list_t heur_subdissector_list;
729 /* Keep track of SSN value of current message so if/when we get to the data
730 * parameter, we can call appropriate sub-dissector. TODO: can this info
731 * be stored elsewhere?
734 static guint8 message_type = 0;
735 static guint dlr = 0;
736 static guint slr = 0;
738 static dissector_handle_t data_handle;
739 static dissector_table_t sccp_ssn_dissector_table;
741 static emem_tree_t* assocs = NULL;
742 static sccp_assoc_info_t* assoc;
743 static sccp_assoc_info_t no_assoc = {0,0,0,0,0,FALSE,FALSE,NULL,SCCP_PLOAD_NONE,NULL,NULL};
744 static gboolean trace_sccp = FALSE;
745 static guint32 next_assoc_id = 0;
747 static sccp_assoc_info_t* sccp_assoc(packet_info* pinfo, guint offset, guint src_lr, guint dst_lr) {
749 address* opc = &(pinfo->src);
750 address* dpc = &(pinfo->dst);
751 guint framenum = pinfo->fd->num;
756 if (!src_lr && !dst_lr){
760 opck = opc->type == AT_SS7PC ? mtp3_pc_hash(opc->data) : g_str_hash(address_to_str(opc));
761 dpck = dpc->type == AT_SS7PC ? mtp3_pc_hash(dpc->data) : g_str_hash(address_to_str(dpc));
763 switch (message_type) {
764 case MESSAGE_TYPE_CR:
766 /* Calling and called is seen from initiator of CR */
767 emem_tree_key_t key[] = {
776 key[2].key = &src_lr;
778 if (! ( assoc = se_tree_lookup32_array(assocs,key) ) ) {
779 assoc = se_alloc(sizeof(sccp_assoc_info_t));
781 assoc->id = next_assoc_id++;
782 assoc->calling_dpc = dpck;
783 assoc->called_dpc = opck;
784 assoc->calling_ssn = INVALID_SSN;
785 assoc->called_ssn = INVALID_SSN;
786 assoc->has_calling_key = FALSE;
787 assoc->has_called_key = TRUE;
788 assoc->pload = SCCP_PLOAD_NONE;
789 assoc->private_data = NULL;
792 se_tree_insert32_array(assocs,key,assoc);
796 case MESSAGE_TYPE_CC:
798 /* Calling and called is seen from initiator of CR */
799 emem_tree_key_t called_key[] = {
805 emem_tree_key_t calling_key[] = {
812 called_key[0].key = &opck;
813 called_key[1].key = &dpck;
814 called_key[2].key = &dst_lr;
816 calling_key[0].key = &dpck;
817 calling_key[1].key = &opck;
818 calling_key[2].key = &src_lr;
820 if (( assoc = se_tree_lookup32_array(assocs,calling_key) )) {
821 if ( ! assoc->has_called_key ) {
822 se_tree_insert32_array(assocs,called_key,assoc);
823 assoc->has_called_key = TRUE;
825 } else if (( assoc = se_tree_lookup32_array(assocs,called_key) )) {
826 if ( ! assoc->has_calling_key ) {
827 se_tree_insert32_array(assocs,calling_key,assoc);
828 assoc->has_calling_key = TRUE;
831 assoc = se_alloc(sizeof(sccp_assoc_info_t));
833 assoc->id = next_assoc_id++;
834 assoc->calling_dpc = dpck;
835 assoc->called_dpc = opck;
836 assoc->calling_ssn = INVALID_SSN;
837 assoc->called_ssn = INVALID_SSN;
838 assoc->has_calling_key = TRUE;
839 assoc->has_called_key = TRUE;
840 assoc->pload = SCCP_PLOAD_NONE;
841 assoc->private_data = NULL;
844 se_tree_insert32_array(assocs,calling_key,assoc);
845 se_tree_insert32_array(assocs,called_key,assoc);
851 emem_tree_key_t calling_key[] = {
858 calling_key[0].key = &opck;
859 calling_key[1].key = &dpck;
860 calling_key[2].key = &dst_lr;
862 assoc = se_tree_lookup32_array(assocs,calling_key);
863 /* Should a check be made on pinfo->p2p_dir ??? */
865 emem_tree_key_t called_key[] = {
872 called_key[0].key = &dpck;
873 called_key[1].key = &opck;
874 called_key[2].key = &dst_lr;
875 assoc = se_tree_lookup32_array(assocs,called_key);
881 if (assoc && trace_sccp) {
882 if ( ! pinfo->fd->flags.visited) {
883 sccp_msg_info_t* msg = se_alloc(sizeof(sccp_msg_info_t));
884 msg->framenum = framenum;
885 msg->offset = offset;
887 msg->private_data = NULL;
892 for (m = assoc->msgs; m->next; m = m->next) ;
898 assoc->cur_msg = msg;
901 for (m = assoc->msgs; m; m = m->next) {
902 if (m->framenum == framenum && m->offset == offset) {
910 return assoc ? assoc : &no_assoc;
915 dissect_sccp_unknown_message(tvbuff_t *message_tvb, proto_tree *sccp_tree)
917 guint32 message_length;
919 message_length = tvb_length(message_tvb);
921 proto_tree_add_text(sccp_tree, message_tvb, 0, message_length,
922 "Unknown message (%u byte%s)",
923 message_length, plurality(message_length, "", "s"));
927 dissect_sccp_unknown_param(tvbuff_t *tvb, proto_tree *tree, guint8 type, guint length)
929 proto_tree_add_text(tree, tvb, 0, length, "Unknown parameter 0x%x (%u byte%s)",
930 type, length, plurality(length, "", "s"));
934 dissect_sccp_dlr_param(tvbuff_t *tvb, proto_tree *tree, guint length)
938 dlr = tvb_get_letoh24(tvb, 0);
939 proto_tree_add_uint(tree, hf_sccp_dlr, tvb, 0, length, dlr);
940 lr_item = proto_tree_add_uint(tree, hf_sccp_lr, tvb, 0, length, dlr);
941 PROTO_ITEM_SET_HIDDEN(lr_item);
945 dissect_sccp_slr_param(tvbuff_t *tvb, proto_tree *tree, guint length)
949 slr = tvb_get_letoh24(tvb, 0);
950 proto_tree_add_uint(tree, hf_sccp_slr, tvb, 0, length, slr);
951 lr_item = proto_tree_add_uint(tree, hf_sccp_lr, tvb, 0, length, slr);
952 PROTO_ITEM_SET_HIDDEN(lr_item);
956 dissect_sccp_gt_address_information(tvbuff_t *tvb, proto_tree *tree,
957 guint length, gboolean even_length,
961 guint8 odd_signal, even_signal = 0x0f;
962 char gt_digits[GT_MAX_SIGNALS+1] = { 0 };
964 while(offset < length)
966 odd_signal = tvb_get_guint8(tvb, offset) & GT_ODD_SIGNAL_MASK;
967 even_signal = tvb_get_guint8(tvb, offset) & GT_EVEN_SIGNAL_MASK;
968 even_signal >>= GT_EVEN_SIGNAL_SHIFT;
970 strncat(gt_digits, val_to_str(odd_signal, sccp_address_signal_values,
971 "Unknown"), GT_MAX_SIGNALS - strlen(gt_digits));
973 /* If the last signal is NOT filler */
974 if (offset != (length - 1) || even_length == TRUE)
975 strncat(gt_digits, val_to_str(even_signal, sccp_address_signal_values,
976 "Unknown"), GT_MAX_SIGNALS - strlen(gt_digits));
978 offset += GT_SIGNAL_LENGTH;
981 proto_tree_add_string_format(tree, called ? hf_sccp_called_gt_digits
982 : hf_sccp_calling_gt_digits,
983 tvb, 0, length, gt_digits,
984 "Address information (digits): %s", gt_digits);
985 proto_tree_add_string_hidden(tree, called ? hf_sccp_gt_digits
987 tvb, 0, length, gt_digits);
991 dissect_sccp_global_title(tvbuff_t *tvb, proto_tree *tree, guint length,
992 guint8 gti, gboolean called)
994 proto_item *gt_item = 0;
995 proto_tree *gt_tree = 0;
996 tvbuff_t *signals_tvb;
998 guint8 odd_even, nai, tt, np, es;
999 gboolean even = TRUE;
1001 /* Shift GTI to where we can work with it */
1004 gt_item = proto_tree_add_text(tree, tvb, offset, length,
1005 "Global Title 0x%x (%u byte%s)",
1006 gti, length, plurality(length,"", "s"));
1007 gt_tree = proto_item_add_subtree(gt_item, called ? ett_sccp_called_gt
1008 : ett_sccp_calling_gt);
1010 /* Decode Transation Type (if present) */
1014 /* Protocol doesn't tell us, so we ASSUME even... */
1017 case ITU_AI_GTI_TT_NP_ES:
1018 case ITU_AI_GTI_TT_NP_ES_NAI:
1019 case ANSI_AI_GTI_TT_NP_ES:
1021 tt = tvb_get_guint8(tvb, offset);
1022 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_tt
1023 : hf_sccp_calling_gt_tt,
1024 tvb, offset, GT_TT_LENGTH, tt);
1025 offset += GT_TT_LENGTH;
1028 /* Decode Numbering Plan and Encoding Scheme (if present) */
1030 case ITU_AI_GTI_TT_NP_ES:
1031 case ITU_AI_GTI_TT_NP_ES_NAI:
1032 case ANSI_AI_GTI_TT_NP_ES:
1034 np = tvb_get_guint8(tvb, offset) & GT_NP_MASK;
1035 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_np
1036 : hf_sccp_calling_gt_np,
1037 tvb, offset, GT_NP_ES_LENGTH, np);
1039 es = tvb_get_guint8(tvb, offset) & GT_ES_MASK;
1040 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_es
1041 : hf_sccp_calling_gt_es,
1042 tvb, offset, GT_NP_ES_LENGTH, es);
1044 even = (es == GT_ES_BCD_EVEN) ? TRUE : FALSE;
1046 offset += GT_NP_ES_LENGTH;
1049 /* Decode Odd/Even Indicator (if present) */
1050 if (gti == ITU_AI_GTI_NAI) {
1051 odd_even = tvb_get_guint8(tvb, offset) & GT_OE_MASK;
1052 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_oe
1053 : hf_sccp_calling_gt_oe,
1054 tvb, offset, GT_NAI_LENGTH, odd_even);
1055 even = (odd_even == GT_OE_EVEN) ? TRUE : FALSE;
1057 /* offset doesn't change */
1060 /* Decode Nature of Address Indicator (if present) */
1062 case ITU_AI_GTI_NAI:
1063 case ITU_AI_GTI_TT_NP_ES_NAI:
1064 nai = tvb_get_guint8(tvb, offset) & GT_NAI_MASK;
1065 proto_tree_add_uint(gt_tree, called ? hf_sccp_called_gt_nai
1066 : hf_sccp_calling_gt_nai,
1067 tvb, offset, GT_NAI_LENGTH, nai);
1069 offset += GT_NAI_LENGTH;
1072 /* Decode address signal(s) */
1073 if (length < offset)
1076 signals_tvb = tvb_new_subset(tvb, offset, (length - offset),
1078 dissect_sccp_gt_address_information(signals_tvb, gt_tree, (length - offset),
1083 dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset,
1088 if (decode_mtp3_standard == ANSI_STANDARD)
1091 hf_pc = &hf_sccp_called_ansi_pc;
1093 hf_pc = &hf_sccp_calling_ansi_pc;
1094 } else /* CHINESE_ITU_STANDARD */ {
1096 hf_pc = &hf_sccp_called_chinese_pc;
1098 hf_pc = &hf_sccp_calling_chinese_pc;
1101 /* create and fill the PC tree */
1102 dissect_mtp3_3byte_pc(tvb, offset, call_tree,
1103 called ? ett_sccp_called_pc : ett_sccp_calling_pc,
1105 called ? hf_sccp_called_pc_network : hf_sccp_calling_pc_network,
1106 called ? hf_sccp_called_pc_cluster : hf_sccp_calling_pc_cluster,
1107 called ? hf_sccp_called_pc_member : hf_sccp_calling_pc_member,
1110 return(offset + ANSI_PC_LENGTH);
1113 /* FUNCTION dissect_sccp_called_calling_param():
1114 * Dissect the Calling or Called Party Address parameters.
1116 * The boolean 'called' describes whether this function is decoding a
1117 * called (TRUE) or calling (FALSE) party address. There is simply too
1118 * much code in this function to have 2 copies of it (one for called, one
1121 * NOTE: this function is called even when (!tree) so that we can get
1122 * the SSN and subsequently call subdissectors (if and when there's a data
1123 * parameter). Realistically we should put if (!tree)'s around a lot of the
1124 * code, but I think that would make it unreadable--and the expense of not
1125 * doing so does not appear to be very high.
1128 dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree,
1129 guint length, gboolean called)
1131 proto_item *call_item = 0, *call_ai_item = 0, *item;
1132 proto_tree *call_tree = 0, *call_ai_tree = 0;
1134 guint8 national = -1, routing_ind, gti, pci, ssni, ssn;
1136 dissector_handle_t ssn_dissector = NULL, tcap_ssn_dissector = NULL;
1137 const char *ssn_dissector_short_name = NULL;
1138 const char *tcap_ssn_dissector_short_name = NULL;
1140 call_item = proto_tree_add_text(tree, tvb, 0, length,
1141 "%s Party address (%u byte%s)",
1142 called ? "Called" : "Calling", length,
1143 plurality(length, "", "s"));
1144 call_tree = proto_item_add_subtree(call_item, called ? ett_sccp_called
1145 : ett_sccp_calling);
1147 call_ai_item = proto_tree_add_text(call_tree, tvb, 0,
1148 ADDRESS_INDICATOR_LENGTH,
1149 "Address Indicator");
1150 call_ai_tree = proto_item_add_subtree(call_ai_item, called ? ett_sccp_called_ai
1151 : ett_sccp_calling_ai);
1153 if (decode_mtp3_standard == ANSI_STANDARD)
1155 national = tvb_get_guint8(tvb, 0) & ANSI_NATIONAL_MASK;
1156 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_national_indicator
1157 : hf_sccp_calling_national_indicator,
1158 tvb, 0, ADDRESS_INDICATOR_LENGTH, national);
1161 routing_ind = tvb_get_guint8(tvb, 0) & ROUTING_INDICATOR_MASK;
1162 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_routing_indicator
1163 : hf_sccp_calling_routing_indicator,
1164 tvb, 0, ADDRESS_INDICATOR_LENGTH, routing_ind);
1166 gti = tvb_get_guint8(tvb, 0) & GTI_MASK;
1168 if (decode_mtp3_standard == ITU_STANDARD ||
1169 decode_mtp3_standard == CHINESE_ITU_STANDARD ||
1170 decode_mtp3_standard == JAPAN_STANDARD ||
1173 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_global_title_indicator
1174 : hf_sccp_called_itu_global_title_indicator,
1175 tvb, 0, ADDRESS_INDICATOR_LENGTH, gti);
1177 ssni = tvb_get_guint8(tvb, 0) & ITU_SSN_INDICATOR_MASK;
1178 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_ssn_indicator
1179 : hf_sccp_calling_itu_ssn_indicator,
1180 tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
1182 pci = tvb_get_guint8(tvb, 0) & ITU_PC_INDICATOR_MASK;
1183 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_point_code_indicator
1184 : hf_sccp_calling_itu_point_code_indicator,
1185 tvb, 0, ADDRESS_INDICATOR_LENGTH, pci);
1187 offset = ADDRESS_INDICATOR_LENGTH;
1189 /* Dissect PC (if present) */
1191 if (decode_mtp3_standard == ITU_STANDARD) {
1193 proto_tree_add_item(call_tree, called ? hf_sccp_called_itu_pc
1194 : hf_sccp_calling_itu_pc,
1195 tvb, offset, ITU_PC_LENGTH, TRUE);
1197 offset += ITU_PC_LENGTH;
1199 } else if (decode_mtp3_standard == JAPAN_STANDARD) {
1201 proto_tree_add_item(call_tree, called ? hf_sccp_called_japan_pc
1202 : hf_sccp_calling_japan_pc,
1203 tvb, offset, JAPAN_PC_LENGTH, TRUE);
1205 offset += JAPAN_PC_LENGTH;
1207 } else /* CHINESE_ITU_STANDARD */ {
1209 offset = dissect_sccp_3byte_pc(tvb, call_tree, offset, called);
1214 /* Dissect SSN (if present) */
1216 ssn = tvb_get_guint8(tvb, offset);
1218 if (called && assoc)
1219 assoc->called_ssn = ssn;
1221 assoc->calling_ssn = ssn;
1223 proto_tree_add_uint(call_tree, called ? hf_sccp_called_ssn
1224 : hf_sccp_calling_ssn,
1225 tvb, offset, ADDRESS_SSN_LENGTH, ssn);
1226 proto_tree_add_uint_hidden(call_tree, hf_sccp_ssn, tvb, offset,
1227 ADDRESS_SSN_LENGTH, ssn);
1228 offset += ADDRESS_SSN_LENGTH;
1230 /* Get the dissector handle of the dissector registered for this ssn
1231 * And print it's name.
1233 ssn_dissector = dissector_get_port_handle(sccp_ssn_dissector_table, ssn);
1235 if (ssn_dissector) {
1236 ssn_dissector_short_name = dissector_handle_get_short_name(ssn_dissector);
1238 if(ssn_dissector_short_name) {
1239 item = proto_tree_add_text(call_tree, tvb, offset - 1, ADDRESS_SSN_LENGTH, "Linked to %s", ssn_dissector_short_name);
1240 PROTO_ITEM_SET_GENERATED(item);
1242 if (strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) {
1243 tcap_ssn_dissector = get_itu_tcap_subdissector(ssn);
1245 if(tcap_ssn_dissector){
1246 tcap_ssn_dissector_short_name = dissector_handle_get_short_name(tcap_ssn_dissector);
1247 proto_item_append_text(item,", TCAP SSN linked to %s", tcap_ssn_dissector_short_name);
1251 } /* ssn_dissector */
1255 return; /* got SSN, that's all we need here... */
1257 /* Dissect GT (if present) */
1258 if (gti != AI_GTI_NO_GT) {
1259 if (length < offset)
1262 gt_tvb = tvb_new_subset(tvb, offset, (length - offset),
1264 dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti,
1268 } else if (decode_mtp3_standard == ANSI_STANDARD) {
1270 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_global_title_indicator
1271 : hf_sccp_calling_ansi_global_title_indicator,
1272 tvb, 0, ADDRESS_INDICATOR_LENGTH, gti);
1274 pci = tvb_get_guint8(tvb, 0) & ANSI_PC_INDICATOR_MASK;
1275 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_point_code_indicator
1276 : hf_sccp_calling_ansi_point_code_indicator,
1277 tvb, 0, ADDRESS_INDICATOR_LENGTH, pci);
1279 ssni = tvb_get_guint8(tvb, 0) & ANSI_SSN_INDICATOR_MASK;
1280 proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_ssn_indicator
1281 : hf_sccp_calling_ansi_ssn_indicator,
1282 tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
1284 offset = ADDRESS_INDICATOR_LENGTH;
1286 /* Dissect SSN (if present) */
1288 ssn = tvb_get_guint8(tvb, offset);
1290 if (called && assoc)
1291 assoc->called_ssn = ssn;
1293 assoc->calling_ssn = ssn;
1295 proto_tree_add_uint(call_tree, called ? hf_sccp_called_ssn
1296 : hf_sccp_calling_ssn,
1297 tvb, offset, ADDRESS_SSN_LENGTH, ssn);
1298 proto_tree_add_uint_hidden(call_tree, hf_sccp_ssn, tvb, offset,
1299 ADDRESS_SSN_LENGTH, ssn);
1300 offset += ADDRESS_SSN_LENGTH;
1304 return; /* got SSN, that's all we need here... */
1306 /* Dissect PC (if present) */
1308 offset = dissect_sccp_3byte_pc(tvb, call_tree, offset, called);
1311 /* Dissect GT (if present) */
1312 if (gti != AI_GTI_NO_GT) {
1313 if (length < offset)
1315 gt_tvb = tvb_new_subset(tvb, offset, (length - offset),
1317 dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti,
1326 dissect_sccp_called_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1328 dissect_sccp_called_calling_param(tvb, tree, length, TRUE);
1332 dissect_sccp_calling_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1334 dissect_sccp_called_calling_param(tvb, tree, length, FALSE);
1338 dissect_sccp_class_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1340 guint8 class, handling;
1342 class = tvb_get_guint8(tvb, 0) & CLASS_CLASS_MASK;
1343 handling = tvb_get_guint8(tvb, 0) & CLASS_SPARE_HANDLING_MASK;
1345 proto_tree_add_uint(tree, hf_sccp_class, tvb, 0, length, class);
1347 if (class == 0 || class == 1)
1348 proto_tree_add_uint(tree, hf_sccp_handling, tvb, 0, length, handling);
1352 dissect_sccp_segmenting_reassembling_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1354 proto_tree_add_item(tree, hf_sccp_more, tvb, 0, length, FALSE);
1358 dissect_sccp_receive_sequence_number_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1362 rsn = tvb_get_guint8(tvb, 0) >> 1;
1363 proto_tree_add_uint(tree, hf_sccp_rsn, tvb, 0, length, rsn);
1367 dissect_sccp_sequencing_segmenting_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1369 guint8 rsn, ssn, more;
1370 proto_item *param_item;
1371 proto_tree *param_tree;
1373 ssn = tvb_get_guint8(tvb, 0) >> 1;
1374 rsn = tvb_get_guint8(tvb, SEQUENCING_SEGMENTING_SSN_LENGTH) >> 1;
1375 more = tvb_get_guint8(tvb, SEQUENCING_SEGMENTING_SSN_LENGTH) & SEQUENCING_SEGMENTING_MORE_MASK;
1377 param_item = proto_tree_add_text(tree, tvb, 0, length,
1378 val_to_str(PARAMETER_SEQUENCING_SEGMENTING,
1379 sccp_parameter_values, "Unknown"));
1380 param_tree = proto_item_add_subtree(param_item,
1381 ett_sccp_sequencing_segmenting);
1383 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_ssn, tvb, 0,
1384 SEQUENCING_SEGMENTING_SSN_LENGTH, ssn);
1385 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_rsn, tvb,
1386 SEQUENCING_SEGMENTING_SSN_LENGTH,
1387 SEQUENCING_SEGMENTING_RSN_LENGTH, rsn);
1388 proto_tree_add_uint(param_tree, hf_sccp_sequencing_segmenting_more, tvb,
1389 SEQUENCING_SEGMENTING_SSN_LENGTH,
1390 SEQUENCING_SEGMENTING_RSN_LENGTH, more);
1394 dissect_sccp_credit_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1398 credit = tvb_get_guint8(tvb, 0);
1399 proto_tree_add_uint(tree, hf_sccp_credit, tvb, 0, length, credit);
1403 dissect_sccp_release_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1407 cause = tvb_get_guint8(tvb, 0);
1408 proto_tree_add_uint(tree, hf_sccp_release_cause, tvb, 0, length, cause);
1412 dissect_sccp_return_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1416 cause = tvb_get_guint8(tvb, 0);
1417 proto_tree_add_uint(tree, hf_sccp_return_cause, tvb, 0, length, cause);
1421 dissect_sccp_reset_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1425 cause = tvb_get_guint8(tvb, 0);
1426 proto_tree_add_uint(tree, hf_sccp_reset_cause, tvb, 0, length, cause);
1430 dissect_sccp_error_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1434 cause = tvb_get_guint8(tvb, 0);
1435 proto_tree_add_uint(tree, hf_sccp_error_cause, tvb, 0, length, cause);
1439 dissect_sccp_refusal_cause_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1443 cause = tvb_get_guint8(tvb, 0);
1444 proto_tree_add_uint(tree, hf_sccp_refusal_cause, tvb, 0, length, cause);
1447 /* This function is used for both data and long data (ITU only) parameters */
1449 dissect_sccp_data_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1453 void* save_priv_data = pinfo->private_data;
1456 other_ssn = INVALID_SSN;
1458 switch (pinfo->p2p_dir) {
1460 ssn = assoc->calling_ssn;
1463 ssn = assoc->called_ssn;
1466 ssn = assoc->called_ssn;
1467 other_ssn = assoc->calling_ssn;
1470 pinfo->private_data = assoc;
1473 ssn = assoc->called_ssn;
1474 other_ssn = assoc->calling_ssn;
1475 pinfo->private_data = NULL;
1480 if (ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, ssn, tvb, pinfo, tree)) {
1484 if (other_ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, other_ssn, tvb, pinfo, tree)) {
1488 /* try heuristic subdissector list to see if there are any takers */
1489 if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree)) {
1493 /* No sub-dissection occured, treat it as raw data */
1494 call_dissector(data_handle, tvb, pinfo, tree);
1497 pinfo->private_data = save_priv_data;
1501 dissect_sccp_segmentation_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1503 guint8 first, class, remaining;
1505 proto_item *param_item;
1506 proto_tree *param_tree;
1508 first = tvb_get_guint8(tvb, 0) & SEGMENTATION_FIRST_SEGMENT_MASK;
1509 class = tvb_get_guint8(tvb, 0) & SEGMENTATION_CLASS_MASK;
1510 remaining = tvb_get_guint8(tvb, 0) & SEGMENTATION_REMAINING_MASK;
1512 slr = tvb_get_letoh24(tvb, 1);
1514 param_item = proto_tree_add_text(tree, tvb, 0, length,
1515 val_to_str(PARAMETER_SEGMENTATION,
1516 sccp_parameter_values, "Unknown"));
1517 param_tree = proto_item_add_subtree(param_item, ett_sccp_segmentation);
1519 proto_tree_add_uint(param_tree, hf_sccp_segmentation_first, tvb, 0, length,
1521 proto_tree_add_uint(param_tree, hf_sccp_segmentation_class, tvb, 0, length,
1523 proto_tree_add_uint(param_tree, hf_sccp_segmentation_remaining, tvb, 0,
1525 proto_tree_add_uint(param_tree, hf_sccp_segmentation_slr, tvb, 1, length,
1530 dissect_sccp_hop_counter_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1534 hops = tvb_get_guint8(tvb, 0);
1535 proto_tree_add_uint(tree, hf_sccp_hop_counter, tvb, 0, length, hops);
1539 dissect_sccp_importance_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1543 importance = tvb_get_guint8(tvb, 0) & IMPORTANCE_IMPORTANCE_MASK;
1544 proto_tree_add_uint(tree, hf_sccp_importance, tvb, 0, length, importance);
1548 dissect_sccp_isni_param(tvbuff_t *tvb, proto_tree *tree, guint length)
1550 guint8 mi, iri, ti, network, netspec;
1552 proto_item *param_item;
1553 proto_tree *param_tree;
1555 /* Create a subtree for ISNI Routing Control */
1556 param_item = proto_tree_add_text(tree, tvb, offset, ANSI_ISNI_ROUTING_CONTROL_LENGTH,
1557 "ISNI Routing Control");
1558 param_tree = proto_item_add_subtree(param_item,
1559 ett_sccp_ansi_isni_routing_control);
1561 mi = tvb_get_guint8(tvb, offset) & ANSI_ISNI_MI_MASK;
1562 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_mi, tvb, offset,
1563 ANSI_ISNI_ROUTING_CONTROL_LENGTH, mi);
1565 iri = tvb_get_guint8(tvb, offset) & ANSI_ISNI_IRI_MASK;
1566 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_iri, tvb, offset,
1567 ANSI_ISNI_ROUTING_CONTROL_LENGTH, iri);
1569 ti = tvb_get_guint8(tvb, offset) & ANSI_ISNI_TI_MASK;
1570 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_ti, tvb, offset,
1571 ANSI_ISNI_ROUTING_CONTROL_LENGTH, ti);
1573 offset += ANSI_ISNI_ROUTING_CONTROL_LENGTH;
1575 if ((ti >> ANSI_ISNI_TI_SHIFT) == ANSI_ISNI_TYPE_1) {
1576 netspec = tvb_get_guint8(tvb, offset) & ANSI_ISNI_NETSPEC_MASK;
1577 proto_tree_add_uint(param_tree, hf_sccp_ansi_isni_netspec, tvb, offset,
1578 ANSI_ISNI_ROUTING_CONTROL_LENGTH, ti);
1579 offset += ANSI_ISNI_ROUTING_CONTROL_LENGTH;
1582 while (offset < length) {
1584 network = tvb_get_guint8(tvb, offset);
1585 proto_tree_add_text(tree, tvb, offset, ANSI_NCM_LENGTH,
1586 "Network ID network: %d", network);
1589 network = tvb_get_guint8(tvb, offset);
1590 proto_tree_add_text(tree, tvb, offset, ANSI_NCM_LENGTH,
1591 "Network ID cluster: %d", network);
1597 /* FUNCTION dissect_sccp_parameter():
1598 * Dissect a parameter given its type, offset into tvb, and length.
1601 dissect_sccp_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree,
1602 proto_tree *tree, guint8 parameter_type, guint16 offset,
1603 guint16 parameter_length)
1605 tvbuff_t *parameter_tvb;
1607 switch (parameter_type) {
1608 case PARAMETER_CALLED_PARTY_ADDRESS:
1609 case PARAMETER_CALLING_PARTY_ADDRESS:
1610 case PARAMETER_DATA:
1611 case PARAMETER_LONG_DATA:
1612 case PARAMETER_SOURCE_LOCAL_REFERENCE:
1613 case PARAMETER_DESTINATION_LOCAL_REFERENCE:
1615 /* These parameters must be dissected even if !sccp_tree (so that
1616 * assoc information can be created).
1622 return(parameter_length);
1626 parameter_tvb = tvb_new_subset(tvb, offset, parameter_length, parameter_length);
1628 switch (parameter_type) {
1630 case PARAMETER_END_OF_OPTIONAL_PARAMETERS:
1631 proto_tree_add_text(sccp_tree, tvb, offset, parameter_length,
1635 case PARAMETER_DESTINATION_LOCAL_REFERENCE:
1636 dissect_sccp_dlr_param(parameter_tvb, sccp_tree, parameter_length);
1639 case PARAMETER_SOURCE_LOCAL_REFERENCE:
1640 dissect_sccp_slr_param(parameter_tvb, sccp_tree, parameter_length);
1643 case PARAMETER_CALLED_PARTY_ADDRESS:
1644 dissect_sccp_called_param(parameter_tvb, sccp_tree, parameter_length);
1647 case PARAMETER_CALLING_PARTY_ADDRESS:
1648 dissect_sccp_calling_param(parameter_tvb, sccp_tree, parameter_length);
1651 case PARAMETER_CLASS:
1652 dissect_sccp_class_param(parameter_tvb, sccp_tree, parameter_length);
1655 case PARAMETER_SEGMENTING_REASSEMBLING:
1656 dissect_sccp_segmenting_reassembling_param(parameter_tvb, sccp_tree,
1660 case PARAMETER_RECEIVE_SEQUENCE_NUMBER:
1661 dissect_sccp_receive_sequence_number_param(parameter_tvb, sccp_tree,
1665 case PARAMETER_SEQUENCING_SEGMENTING:
1666 dissect_sccp_sequencing_segmenting_param(parameter_tvb, sccp_tree,
1670 case PARAMETER_CREDIT:
1671 dissect_sccp_credit_param(parameter_tvb, sccp_tree, parameter_length);
1674 case PARAMETER_RELEASE_CAUSE:
1675 dissect_sccp_release_cause_param(parameter_tvb, sccp_tree, parameter_length);
1678 case PARAMETER_RETURN_CAUSE:
1679 dissect_sccp_return_cause_param(parameter_tvb, sccp_tree, parameter_length);
1682 case PARAMETER_RESET_CAUSE:
1683 dissect_sccp_reset_cause_param(parameter_tvb, sccp_tree, parameter_length);
1686 case PARAMETER_ERROR_CAUSE:
1687 dissect_sccp_error_cause_param(parameter_tvb, sccp_tree, parameter_length);
1690 case PARAMETER_REFUSAL_CAUSE:
1691 dissect_sccp_refusal_cause_param(parameter_tvb, sccp_tree, parameter_length);
1694 case PARAMETER_DATA:
1695 dissect_sccp_data_param(parameter_tvb, pinfo, tree);
1697 /* TODO? Re-adjust length of SCCP item since it may be sub-dissected */
1698 /* sccp_length = proto_item_get_len(sccp_item);
1699 * sccp_length -= parameter_length;
1700 * proto_item_set_len(sccp_item, sccp_length);
1704 case PARAMETER_SEGMENTATION:
1705 dissect_sccp_segmentation_param(parameter_tvb, sccp_tree, parameter_length);
1708 case PARAMETER_HOP_COUNTER:
1709 dissect_sccp_hop_counter_param(parameter_tvb, sccp_tree, parameter_length);
1712 case PARAMETER_IMPORTANCE:
1713 if (decode_mtp3_standard != ANSI_STANDARD)
1714 dissect_sccp_importance_param(parameter_tvb, sccp_tree, parameter_length);
1716 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1720 case PARAMETER_LONG_DATA:
1721 if (decode_mtp3_standard != ANSI_STANDARD)
1722 dissect_sccp_data_param(parameter_tvb, pinfo, tree);
1724 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1728 case PARAMETER_ISNI:
1729 if (decode_mtp3_standard != ANSI_STANDARD)
1730 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1733 dissect_sccp_isni_param(parameter_tvb, sccp_tree, parameter_length);
1737 dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
1742 return(parameter_length);
1745 /* FUNCTION dissect_sccp_variable_parameter():
1746 * Dissect a variable parameter given its type and offset into tvb. Length
1747 * of the parameter is gotten from tvb[0].
1748 * Length returned is sum of (length + parameter).
1751 dissect_sccp_variable_parameter(tvbuff_t *tvb, packet_info *pinfo,
1752 proto_tree *sccp_tree, proto_tree *tree,
1753 guint8 parameter_type, guint16 offset)
1755 guint16 parameter_length;
1756 guint8 length_length;
1758 if (parameter_type != PARAMETER_LONG_DATA)
1760 parameter_length = tvb_get_guint8(tvb, offset);
1761 length_length = PARAMETER_LENGTH_LENGTH;
1765 /* Long data parameter has 16 bit length */
1766 parameter_length = tvb_get_letohs(tvb, offset);
1767 length_length = PARAMETER_LONG_DATA_LENGTH_LENGTH;
1770 if (sccp_tree && sccp_show_length)
1772 proto_tree_add_text(sccp_tree, tvb, offset, length_length,
1774 val_to_str(parameter_type, sccp_parameter_values,
1779 offset += length_length;
1781 dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree, parameter_type, offset,
1784 return(parameter_length + length_length);
1787 /* FUNCTION dissect_sccp_optional_parameters():
1788 * Dissect all the optional parameters given the start of the optional
1789 * parameters into tvb. Parameter types and lengths are read from tvb.
1792 dissect_sccp_optional_parameters(tvbuff_t *tvb, packet_info *pinfo,
1793 proto_tree *sccp_tree, proto_tree *tree,
1796 guint8 parameter_type;
1798 while ((parameter_type = tvb_get_guint8(tvb, offset)) !=
1799 PARAMETER_END_OF_OPTIONAL_PARAMETERS) {
1801 offset += PARAMETER_TYPE_LENGTH;
1802 offset += dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
1803 parameter_type, offset);
1806 /* Process end of optional parameters */
1807 dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree, parameter_type, offset,
1808 END_OF_OPTIONAL_PARAMETERS_LENGTH);
1814 dissect_sccp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree,
1817 guint16 variable_pointer1 = 0, variable_pointer2 = 0, variable_pointer3 = 0;
1818 guint16 optional_pointer = 0, orig_opt_ptr = 0;
1820 guint8 parameter_type;
1821 gboolean save_fragmented;
1822 tvbuff_t *new_tvb = NULL;
1823 fragment_data *frag_msg = NULL;
1824 guint32 source_local_ref=0;
1826 guint msg_offset = offset_from_real_beginning(tvb,0);
1828 /* Macro for getting pointer to mandatory variable parameters */
1829 #define VARIABLE_POINTER(var, hf_var, ptr_size) \
1830 if (ptr_size == POINTER_LENGTH) \
1831 var = tvb_get_guint8(tvb, offset); \
1833 var = tvb_get_letohs(tvb, offset); \
1834 proto_tree_add_uint(sccp_tree, hf_var, tvb, \
1835 offset, ptr_size, var); \
1837 if (ptr_size == POINTER_LENGTH_LONG) \
1841 /* Macro for getting pointer to optional parameters */
1842 #define OPTIONAL_POINTER(ptr_size) \
1843 if (ptr_size == POINTER_LENGTH) \
1844 orig_opt_ptr = optional_pointer = tvb_get_guint8(tvb, offset); \
1846 orig_opt_ptr = optional_pointer = tvb_get_letohs(tvb, offset); \
1847 proto_tree_add_uint(sccp_tree, hf_sccp_optional_pointer, tvb, \
1848 offset, ptr_size, optional_pointer); \
1849 optional_pointer += offset; \
1850 if (ptr_size == POINTER_LENGTH_LONG) \
1851 optional_pointer += 1; \
1855 /* Extract the message type; all other processing is based on this */
1856 message_type = tvb_get_guint8(tvb, MESSAGE_TYPE_OFFSET);
1857 offset = MESSAGE_TYPE_LENGTH;
1859 if (check_col(pinfo->cinfo, COL_INFO))
1860 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",
1861 val_to_str(message_type, sccp_message_type_acro_values, "Unknown"));
1864 /* add the message type to the protocol tree */
1865 proto_tree_add_uint(sccp_tree, hf_sccp_message_type, tvb,
1866 MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type);
1870 /* Starting a new message dissection; clear the global assoc, SLR, and DLR values */
1874 no_assoc.calling_dpc = 0;
1875 no_assoc.called_dpc = 0;
1876 no_assoc.calling_ssn = INVALID_SSN;
1877 no_assoc.called_ssn = INVALID_SSN;
1878 no_assoc.has_calling_key = FALSE;
1879 no_assoc.has_called_key = FALSE;
1880 no_assoc.pload = SCCP_PLOAD_NONE;
1881 no_assoc.private_data = NULL;
1883 switch(message_type) {
1884 case MESSAGE_TYPE_CR:
1885 /* TTC and NTT (Japan) say that the connection-oriented messages are
1886 * deleted (not standardized), but they appear to be used anyway, so
1887 * we'll dissect it...
1889 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1890 PARAMETER_SOURCE_LOCAL_REFERENCE,
1891 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
1892 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1893 PARAMETER_CLASS, offset,
1894 PROTOCOL_CLASS_LENGTH);
1895 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1897 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
1898 OPTIONAL_POINTER(POINTER_LENGTH)
1900 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
1901 PARAMETER_CALLED_PARTY_ADDRESS,
1905 case MESSAGE_TYPE_CC:
1906 /* TODO: connection has been established; theoretically we could keep
1907 * keep track of the SLR/DLR with the called/calling from the CR and
1908 * track the connection (e.g., on subsequent messages regarding this
1909 * SLR we could set the global vars "call*_ssn" so data could get
1912 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1913 PARAMETER_DESTINATION_LOCAL_REFERENCE,
1915 DESTINATION_LOCAL_REFERENCE_LENGTH);
1916 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1917 PARAMETER_SOURCE_LOCAL_REFERENCE,
1918 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
1920 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1922 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1923 PARAMETER_CLASS, offset,
1924 PROTOCOL_CLASS_LENGTH);
1925 OPTIONAL_POINTER(POINTER_LENGTH);
1928 case MESSAGE_TYPE_CREF:
1929 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1930 PARAMETER_DESTINATION_LOCAL_REFERENCE,
1932 DESTINATION_LOCAL_REFERENCE_LENGTH);
1934 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1936 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1937 PARAMETER_REFUSAL_CAUSE, offset,
1938 REFUSAL_CAUSE_LENGTH);
1939 OPTIONAL_POINTER(POINTER_LENGTH);
1942 case MESSAGE_TYPE_RLSD:
1943 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1944 PARAMETER_DESTINATION_LOCAL_REFERENCE,
1946 DESTINATION_LOCAL_REFERENCE_LENGTH);
1947 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1948 PARAMETER_SOURCE_LOCAL_REFERENCE,
1949 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
1951 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1953 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1954 PARAMETER_RELEASE_CAUSE, offset,
1955 RELEASE_CAUSE_LENGTH);
1957 OPTIONAL_POINTER(POINTER_LENGTH);
1958 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1961 case MESSAGE_TYPE_RLC:
1962 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1963 PARAMETER_DESTINATION_LOCAL_REFERENCE,
1965 DESTINATION_LOCAL_REFERENCE_LENGTH);
1966 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1967 PARAMETER_SOURCE_LOCAL_REFERENCE,
1968 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
1970 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1974 case MESSAGE_TYPE_DT1:
1975 source_local_ref = tvb_get_letoh24(tvb, offset);
1976 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1977 PARAMETER_DESTINATION_LOCAL_REFERENCE,
1979 DESTINATION_LOCAL_REFERENCE_LENGTH);
1981 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
1983 more = tvb_get_guint8(tvb, offset) & SEGMENTING_REASSEMBLING_MASK;
1985 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
1986 PARAMETER_SEGMENTING_REASSEMBLING,
1987 offset, SEGMENTING_REASSEMBLING_LENGTH);
1988 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
1991 if (!sccp_xudt_desegment) {
1992 proto_tree_add_text(sccp_tree, tvb, variable_pointer1,
1993 tvb_get_guint8(tvb, variable_pointer1)+1,
1995 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
1996 PARAMETER_DATA, variable_pointer1);
1999 save_fragmented = pinfo->fragmented;
2000 pinfo->fragmented = TRUE;
2001 frag_msg = fragment_add_seq_next(tvb, variable_pointer1 + 1, pinfo,
2002 source_local_ref, /* ID for fragments belonging together */
2003 sccp_xudt_msg_fragment_table, /* list of message fragments */
2004 sccp_xudt_msg_reassembled_table, /* list of reassembled messages */
2005 tvb_get_guint8(tvb,variable_pointer1),/* fragment length - to the end */
2006 more); /* More fragments? */
2008 new_tvb = process_reassembled_data(tvb, variable_pointer1 + 1, pinfo,
2009 "Reassembled Message", frag_msg,
2010 &sccp_xudt_msg_frag_items, NULL,
2013 if (frag_msg && frag_msg->next) { /* Reassembled */
2014 if (check_col(pinfo->cinfo, COL_INFO))
2015 col_append_str(pinfo->cinfo, COL_INFO,
2016 "(Message reassembled) ");
2017 } else if (more) { /* Not last packet of reassembled message */
2018 if (check_col(pinfo->cinfo, COL_INFO))
2019 col_append_str(pinfo->cinfo, COL_INFO, "(Message fragment) ");
2022 pinfo->fragmented = save_fragmented;
2025 dissect_sccp_data_param(new_tvb, pinfo, tree);
2028 /* End reassemble */
2031 case MESSAGE_TYPE_DT2:
2032 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2033 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2035 DESTINATION_LOCAL_REFERENCE_LENGTH);
2037 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2039 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2040 PARAMETER_SEQUENCING_SEGMENTING, offset,
2041 SEQUENCING_SEGMENTING_LENGTH);
2044 case MESSAGE_TYPE_AK:
2045 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2046 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2048 DESTINATION_LOCAL_REFERENCE_LENGTH);
2050 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2052 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2053 PARAMETER_RECEIVE_SEQUENCE_NUMBER,
2054 offset, RECEIVE_SEQUENCE_NUMBER_LENGTH);
2055 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2056 PARAMETER_CREDIT, offset, CREDIT_LENGTH);
2059 case MESSAGE_TYPE_UDT:
2060 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2061 PARAMETER_CLASS, offset,
2062 PROTOCOL_CLASS_LENGTH);
2063 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2064 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2065 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2067 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2069 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2070 PARAMETER_CALLED_PARTY_ADDRESS,
2072 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2073 PARAMETER_CALLING_PARTY_ADDRESS,
2076 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2080 case MESSAGE_TYPE_UDTS:
2081 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2082 PARAMETER_RETURN_CAUSE, offset,
2083 RETURN_CAUSE_LENGTH);
2085 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2086 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2087 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2089 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2091 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2092 PARAMETER_CALLED_PARTY_ADDRESS,
2095 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2096 PARAMETER_CALLING_PARTY_ADDRESS,
2099 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2103 case MESSAGE_TYPE_ED:
2104 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2105 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2107 DESTINATION_LOCAL_REFERENCE_LENGTH);
2109 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2111 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH);
2113 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2117 case MESSAGE_TYPE_EA:
2118 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2119 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2121 DESTINATION_LOCAL_REFERENCE_LENGTH);
2122 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2126 case MESSAGE_TYPE_RSR:
2127 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2128 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2130 DESTINATION_LOCAL_REFERENCE_LENGTH);
2131 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2132 PARAMETER_SOURCE_LOCAL_REFERENCE,
2133 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2134 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2135 PARAMETER_RESET_CAUSE, offset,
2136 RESET_CAUSE_LENGTH);
2137 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2140 case MESSAGE_TYPE_RSC:
2141 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2142 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2144 DESTINATION_LOCAL_REFERENCE_LENGTH);
2145 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2146 PARAMETER_SOURCE_LOCAL_REFERENCE,
2147 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2148 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2151 case MESSAGE_TYPE_ERR:
2152 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2153 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2155 DESTINATION_LOCAL_REFERENCE_LENGTH);
2156 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2157 PARAMETER_ERROR_CAUSE, offset,
2158 ERROR_CAUSE_LENGTH);
2159 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2162 case MESSAGE_TYPE_IT:
2163 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2164 PARAMETER_DESTINATION_LOCAL_REFERENCE,
2166 DESTINATION_LOCAL_REFERENCE_LENGTH);
2167 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2168 PARAMETER_SOURCE_LOCAL_REFERENCE,
2169 offset, SOURCE_LOCAL_REFERENCE_LENGTH);
2170 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2171 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2172 PARAMETER_CLASS, offset,
2173 PROTOCOL_CLASS_LENGTH);
2174 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2175 PARAMETER_SEQUENCING_SEGMENTING,
2176 offset, SEQUENCING_SEGMENTING_LENGTH);
2177 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2178 PARAMETER_CREDIT, offset, CREDIT_LENGTH);
2181 case MESSAGE_TYPE_XUDT:
2182 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2183 PARAMETER_CLASS, offset,
2184 PROTOCOL_CLASS_LENGTH);
2185 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2186 PARAMETER_HOP_COUNTER, offset,
2187 HOP_COUNTER_LENGTH);
2189 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2190 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2191 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2192 OPTIONAL_POINTER(POINTER_LENGTH)
2194 /* Optional parameters are Segmentation and Importance
2195 * NOTE 2 - Segmentation Should not be present in case of a single XUDT
2199 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2201 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2202 PARAMETER_CALLED_PARTY_ADDRESS,
2204 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2205 PARAMETER_CALLING_PARTY_ADDRESS,
2208 if ((parameter_type = tvb_get_guint8(tvb, optional_pointer)) == PARAMETER_SEGMENTATION){
2209 if (!sccp_xudt_desegment){
2210 proto_tree_add_text(sccp_tree, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, "Segmented Data" );
2214 gboolean more_frag = TRUE;
2217 /* Get the first octet of parameter Segmentation, Ch 3.17 in Q.713
2218 * Bit 8 of octet 1 is used for First segment indication
2219 * Bit 7 of octet 1 is used to keep in the message in sequence
2220 * delivery option required by the SCCP user
2221 * Bits 6 and 5 in octet 1 are spare bits.
2222 * Bits 4-1 of octet 1 are used to indicate the number of
2223 * remaining segments.
2224 * The values 0000 to 1111 are possible; the value 0000 indicates
2227 octet = tvb_get_guint8(tvb,optional_pointer+2);
2228 source_local_ref = tvb_get_letoh24(tvb, optional_pointer+3);
2230 if ((octet&0x0f) == 0)
2233 save_fragmented = pinfo->fragmented;
2234 pinfo->fragmented = TRUE;
2235 frag_msg = fragment_add_seq_next(tvb, variable_pointer3 + 1, pinfo,
2236 source_local_ref, /* ID for fragments belonging together */
2237 sccp_xudt_msg_fragment_table, /* list of message fragments */
2238 sccp_xudt_msg_reassembled_table, /* list of reassembled messages */
2239 tvb_get_guint8(tvb,variable_pointer3), /* fragment length - to the end */
2240 more_frag); /* More fragments? */
2242 if ((octet&0x80) == 0x80) /*First segment, set number of segments*/
2243 fragment_set_tot_len(pinfo, source_local_ref, sccp_xudt_msg_fragment_table,(octet & 0xf));
2245 new_tvb = process_reassembled_data(tvb, variable_pointer3 + 1,
2246 pinfo, "Reassembled Message",
2248 &sccp_xudt_msg_frag_items,
2251 if (frag_msg) { /* Reassembled */
2252 if (check_col(pinfo->cinfo, COL_INFO))
2253 col_append_str(pinfo->cinfo, COL_INFO,
2254 "(Message reassembled) ");
2255 } else { /* Not last packet of reassembled message */
2256 if (check_col(pinfo->cinfo, COL_INFO))
2257 col_append_str(pinfo->cinfo, COL_INFO,
2258 "(Message fragment) ");
2261 pinfo->fragmented = save_fragmented;
2264 dissect_sccp_data_param(new_tvb, pinfo, tree);
2267 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2268 PARAMETER_DATA, variable_pointer3);
2272 case MESSAGE_TYPE_XUDTS:
2273 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2274 PARAMETER_RETURN_CAUSE, offset,
2275 RETURN_CAUSE_LENGTH);
2276 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2277 PARAMETER_HOP_COUNTER, offset,
2278 HOP_COUNTER_LENGTH);
2280 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH)
2281 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH)
2282 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH)
2283 OPTIONAL_POINTER(POINTER_LENGTH)
2285 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2287 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2288 PARAMETER_CALLED_PARTY_ADDRESS,
2290 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2291 PARAMETER_CALLING_PARTY_ADDRESS,
2293 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA,
2297 case MESSAGE_TYPE_LUDT:
2298 if (decode_mtp3_standard != ANSI_STANDARD)
2300 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2301 PARAMETER_CLASS, offset,
2302 PROTOCOL_CLASS_LENGTH);
2303 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2304 PARAMETER_HOP_COUNTER, offset,
2305 HOP_COUNTER_LENGTH);
2307 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH_LONG)
2308 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH_LONG)
2309 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH_LONG)
2310 OPTIONAL_POINTER(POINTER_LENGTH_LONG)
2312 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2314 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2315 PARAMETER_CALLED_PARTY_ADDRESS,
2317 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2318 PARAMETER_CALLING_PARTY_ADDRESS,
2320 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2321 PARAMETER_LONG_DATA, variable_pointer3);
2323 dissect_sccp_unknown_message(tvb, sccp_tree);
2326 case MESSAGE_TYPE_LUDTS:
2327 if (decode_mtp3_standard != ANSI_STANDARD)
2329 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2330 PARAMETER_RETURN_CAUSE, offset,
2331 RETURN_CAUSE_LENGTH);
2332 offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
2333 PARAMETER_HOP_COUNTER, offset,
2334 HOP_COUNTER_LENGTH);
2336 VARIABLE_POINTER(variable_pointer1, hf_sccp_variable_pointer1, POINTER_LENGTH_LONG)
2337 VARIABLE_POINTER(variable_pointer2, hf_sccp_variable_pointer2, POINTER_LENGTH_LONG)
2338 VARIABLE_POINTER(variable_pointer3, hf_sccp_variable_pointer3, POINTER_LENGTH_LONG)
2339 OPTIONAL_POINTER(POINTER_LENGTH_LONG)
2341 assoc = sccp_assoc(pinfo, msg_offset, slr, dlr);
2343 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2344 PARAMETER_CALLED_PARTY_ADDRESS,
2346 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2347 PARAMETER_CALLING_PARTY_ADDRESS,
2349 dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
2350 PARAMETER_LONG_DATA, variable_pointer3);
2352 dissect_sccp_unknown_message(tvb, sccp_tree);
2356 dissect_sccp_unknown_message(tvb, sccp_tree);
2360 dissect_sccp_optional_parameters(tvb, pinfo, sccp_tree, tree,
2363 if (trace_sccp && assoc && assoc != &no_assoc) {
2364 proto_item* pi = proto_tree_add_uint(sccp_tree,hf_sccp_assoc_id,tvb,0,0,assoc->id);
2365 proto_tree* pt = proto_item_add_subtree(pi,ett_sccp_assoc);
2366 PROTO_ITEM_SET_GENERATED(pi);
2369 for(m = assoc->msgs; m ; m = m->next) {
2370 pi = proto_tree_add_uint( pt,hf_sccp_assoc_msg,tvb,0,0,m->framenum);
2371 PROTO_ITEM_SET_GENERATED(pi);
2372 if (m->info) proto_item_append_text(pi," %s", m->info);
2373 if (m->framenum == pinfo->fd->num && m->offset == msg_offset ) {
2374 proto_item_append_text(pi," (current)");
2383 dissect_sccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2385 proto_item *sccp_item;
2386 proto_tree *sccp_tree = NULL;
2387 const mtp3_addr_pc_t *mtp3_addr_p;
2389 if ((pinfo->src.type == AT_SS7PC) &&
2390 ((mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->src.data)->type <= CHINESE_ITU_STANDARD))
2393 * Allow a protocol beneath to specify how the SCCP layer should be
2396 * It is possible to have multiple sets of SCCP traffic some of which is
2397 * ITU and some of which is ANSI.
2398 * An example is A-interface traffic having ANSI MTP3/ANSI SCCP/3GPP2 IOS
2399 * and at the same time ITU MTP3/ITU SCCP/ANSI TCAP/ANSI MAP.
2401 decode_mtp3_standard = mtp3_addr_p->type;
2405 decode_mtp3_standard = mtp3_standard;
2408 /* Make entry in the Protocol column on summary display */
2409 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2410 switch(decode_mtp3_standard) {
2412 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Int. ITU)");
2415 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (ANSI)");
2417 case CHINESE_ITU_STANDARD:
2418 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Chin. ITU)");
2420 case JAPAN_STANDARD:
2421 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCP (Japan)");
2425 /* In the interest of speed, if "tree" is NULL, don't do any work not
2426 necessary to generate protocol tree items. */
2428 /* create the sccp protocol tree */
2429 sccp_item = proto_tree_add_item(tree, proto_sccp, tvb, 0, -1, FALSE);
2430 sccp_tree = proto_item_add_subtree(sccp_item, ett_sccp);
2433 /* Set whether message is UPLINK, DOWNLINK, or of UNKNOWN direction */
2435 if (pinfo->src.type == AT_SS7PC)
2438 * XXX - we assume that the "data" pointers of the source and destination
2439 * addresses are set to point to "mtp3_addr_pc_t" structures, so that
2440 * we can safely cast them.
2442 mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->src.data;
2444 if (sccp_source_pc_global == mtp3_addr_p->pc)
2446 pinfo->p2p_dir = P2P_DIR_SENT;
2450 /* assuming if src was SS7 PC then dst will be too */
2451 mtp3_addr_p = (const mtp3_addr_pc_t *)pinfo->dst.data;
2453 if (sccp_source_pc_global == mtp3_addr_p->pc)
2455 pinfo->p2p_dir = P2P_DIR_RECV;
2459 pinfo->p2p_dir = P2P_DIR_UNKNOWN;
2464 /* dissect the message */
2465 dissect_sccp_message(tvb, pinfo, sccp_tree, tree);
2469 static void init_sccp(void) {
2471 fragment_table_init (&sccp_xudt_msg_fragment_table);
2472 reassembled_table_init(&sccp_xudt_msg_reassembled_table);
2476 /* Register the protocol with Wireshark */
2478 proto_register_sccp(void)
2480 /* Setup list of header fields */
2481 static hf_register_info hf[] = {
2482 { &hf_sccp_message_type,
2483 { "Message Type", "sccp.message_type",
2484 FT_UINT8, BASE_HEX, VALS(sccp_message_type_values), 0x0,
2486 { &hf_sccp_variable_pointer1,
2487 { "Pointer to first Mandatory Variable parameter", "sccp.variable_pointer1",
2488 FT_UINT16, BASE_DEC, NULL, 0x0,
2490 { &hf_sccp_variable_pointer2,
2491 { "Pointer to second Mandatory Variable parameter", "sccp.variable_pointer2",
2492 FT_UINT16, BASE_DEC, NULL, 0x0,
2494 { &hf_sccp_variable_pointer3,
2495 { "Pointer to third Mandatory Variable parameter", "sccp.variable_pointer3",
2496 FT_UINT16, BASE_DEC, NULL, 0x0,
2498 { &hf_sccp_optional_pointer,
2499 { "Pointer to Optional parameter", "sccp.optional_pointer",
2500 FT_UINT16, BASE_DEC, NULL, 0x0,
2503 { "Called or Calling SubSystem Number", "sccp.ssn",
2504 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2506 { &hf_sccp_gt_digits,
2507 { "Called or Calling GT Digits",
2509 FT_STRING, BASE_NONE, NULL, 0x0,
2511 { &hf_sccp_called_national_indicator,
2512 { "National Indicator", "sccp.called.ni",
2513 FT_UINT8, BASE_HEX, VALS(sccp_national_indicator_values), ANSI_NATIONAL_MASK,
2515 { &hf_sccp_called_routing_indicator,
2516 { "Routing Indicator", "sccp.called.ri",
2517 FT_UINT8, BASE_HEX, VALS(sccp_routing_indicator_values), ROUTING_INDICATOR_MASK,
2519 { &hf_sccp_called_itu_global_title_indicator,
2520 { "Global Title Indicator", "sccp.called.gti",
2521 FT_UINT8, BASE_HEX, VALS(sccp_itu_global_title_indicator_values), GTI_MASK,
2523 { &hf_sccp_called_ansi_global_title_indicator,
2524 { "Global Title Indicator", "sccp.called.gti",
2525 FT_UINT8, BASE_HEX, VALS(sccp_ansi_global_title_indicator_values), GTI_MASK,
2527 { &hf_sccp_called_itu_ssn_indicator,
2528 { "SubSystem Number Indicator", "sccp.called.ssni",
2529 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ITU_SSN_INDICATOR_MASK,
2531 { &hf_sccp_called_itu_point_code_indicator,
2532 { "Point Code Indicator", "sccp.called.pci",
2533 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ITU_PC_INDICATOR_MASK,
2535 { &hf_sccp_called_ansi_ssn_indicator,
2536 { "SubSystem Number Indicator", "sccp.called.ssni",
2537 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ANSI_SSN_INDICATOR_MASK,
2539 { &hf_sccp_called_ansi_point_code_indicator,
2540 { "Point Code Indicator", "sccp.called.pci",
2541 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ANSI_PC_INDICATOR_MASK,
2543 { &hf_sccp_called_ssn,
2544 { "SubSystem Number", "sccp.called.ssn",
2545 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2547 { &hf_sccp_called_itu_pc,
2548 { "PC", "sccp.called.pc",
2549 FT_UINT16, BASE_DEC, NULL, ITU_PC_MASK,
2551 { &hf_sccp_called_ansi_pc,
2552 { "PC", "sccp.called.ansi_pc",
2553 FT_STRING, BASE_NONE, NULL, 0x0,
2555 { &hf_sccp_called_chinese_pc,
2556 { "PC", "sccp.called.chinese_pc",
2557 FT_STRING, BASE_NONE, NULL, 0x0,
2559 { &hf_sccp_called_japan_pc,
2560 { "PC", "sccp.called.pc",
2561 FT_UINT16, BASE_DEC, NULL, 0x0,
2563 { &hf_sccp_called_pc_network,
2565 "sccp.called.network",
2566 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
2568 { &hf_sccp_called_pc_cluster,
2570 "sccp.called.cluster",
2571 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
2573 { &hf_sccp_called_pc_member,
2575 "sccp.called.member",
2576 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
2578 { &hf_sccp_called_gt_nai,
2579 { "Nature of Address Indicator",
2581 FT_UINT8, BASE_HEX, VALS(sccp_nai_values), GT_NAI_MASK,
2583 { &hf_sccp_called_gt_oe,
2584 { "Odd/Even Indicator",
2586 FT_UINT8, BASE_HEX, VALS(sccp_oe_values), GT_OE_MASK,
2588 { &hf_sccp_called_gt_tt,
2589 { "Translation Type",
2591 FT_UINT8, BASE_HEX, NULL, 0x0,
2593 { &hf_sccp_called_gt_np,
2596 FT_UINT8, BASE_HEX, VALS(sccp_np_values), GT_NP_MASK,
2598 { &hf_sccp_called_gt_es,
2599 { "Encoding Scheme",
2601 FT_UINT8, BASE_HEX, VALS(sccp_es_values), GT_ES_MASK,
2603 { &hf_sccp_called_gt_digits,
2605 "sccp.called.digits",
2606 FT_STRING, BASE_NONE, NULL, 0x0,
2608 { &hf_sccp_calling_national_indicator,
2609 { "National Indicator", "sccp.calling.ni",
2610 FT_UINT8, BASE_HEX, VALS(sccp_national_indicator_values), ANSI_NATIONAL_MASK,
2612 { &hf_sccp_calling_routing_indicator,
2613 { "Routing Indicator", "sccp.calling.ri",
2614 FT_UINT8, BASE_HEX, VALS(sccp_routing_indicator_values), ROUTING_INDICATOR_MASK,
2616 { &hf_sccp_calling_itu_global_title_indicator,
2617 { "Global Title Indicator", "sccp.calling.gti",
2618 FT_UINT8, BASE_HEX, VALS(sccp_itu_global_title_indicator_values), GTI_MASK,
2620 { &hf_sccp_calling_ansi_global_title_indicator,
2621 { "Global Title Indicator", "sccp.calling.gti",
2622 FT_UINT8, BASE_HEX, VALS(sccp_ansi_global_title_indicator_values), GTI_MASK,
2624 { &hf_sccp_calling_itu_ssn_indicator,
2625 { "SubSystem Number Indicator", "sccp.calling.ssni",
2626 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ITU_SSN_INDICATOR_MASK,
2628 { &hf_sccp_calling_itu_point_code_indicator,
2629 { "Point Code Indicator", "sccp.calling.pci",
2630 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ITU_PC_INDICATOR_MASK,
2632 { &hf_sccp_calling_ansi_ssn_indicator,
2633 { "SubSystem Number Indicator", "sccp.calling.ssni",
2634 FT_UINT8, BASE_HEX, VALS(sccp_ai_ssni_values), ANSI_SSN_INDICATOR_MASK,
2636 { &hf_sccp_calling_ansi_point_code_indicator,
2637 { "Point Code Indicator", "sccp.calling.pci",
2638 FT_UINT8, BASE_HEX, VALS(sccp_ai_pci_values), ANSI_PC_INDICATOR_MASK,
2640 { &hf_sccp_calling_ssn,
2641 { "SubSystem Number", "sccp.calling.ssn",
2642 FT_UINT8, BASE_DEC, VALS(sccp_ssn_values), 0x0,
2644 { &hf_sccp_calling_itu_pc,
2645 { "PC", "sccp.calling.pc",
2646 FT_UINT16, BASE_DEC, NULL, ITU_PC_MASK,
2648 { &hf_sccp_calling_ansi_pc,
2649 { "PC", "sccp.calling.ansi_pc",
2650 FT_STRING, BASE_NONE, NULL, 0x0,
2652 { &hf_sccp_calling_chinese_pc,
2653 { "PC", "sccp.calling.chinese_pc",
2654 FT_STRING, BASE_NONE, NULL, 0x0,
2656 { &hf_sccp_calling_japan_pc,
2657 { "PC", "sccp.calling.pc",
2658 FT_UINT16, BASE_DEC, NULL, 0x0,
2660 { &hf_sccp_calling_pc_network,
2662 "sccp.calling.network",
2663 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
2665 { &hf_sccp_calling_pc_cluster,
2667 "sccp.calling.cluster",
2668 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
2670 { &hf_sccp_calling_pc_member,
2672 "sccp.calling.member",
2673 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
2675 { &hf_sccp_calling_gt_nai,
2676 { "Nature of Address Indicator",
2678 FT_UINT8, BASE_HEX, VALS(sccp_nai_values), GT_NAI_MASK,
2680 { &hf_sccp_calling_gt_oe,
2681 { "Odd/Even Indicator",
2683 FT_UINT8, BASE_HEX, VALS(sccp_oe_values), GT_OE_MASK,
2685 { &hf_sccp_calling_gt_tt,
2686 { "Translation Type",
2688 FT_UINT8, BASE_HEX, NULL, 0x0,
2690 { &hf_sccp_calling_gt_np,
2693 FT_UINT8, BASE_HEX, VALS(sccp_np_values), GT_NP_MASK,
2695 { &hf_sccp_calling_gt_es,
2696 { "Encoding Scheme",
2698 FT_UINT8, BASE_HEX, VALS(sccp_es_values), GT_ES_MASK,
2700 { &hf_sccp_calling_gt_digits,
2702 "sccp.calling.digits",
2703 FT_STRING, BASE_NONE, NULL, 0x0,
2706 { "Destination Local Reference", "sccp.dlr",
2707 FT_UINT24, BASE_HEX, NULL, 0x0,
2710 { "Source Local Reference", "sccp.slr",
2711 FT_UINT24, BASE_HEX, NULL, 0x0,
2714 { "Local Reference", "sccp.lr",
2715 FT_UINT24, BASE_HEX, NULL, 0x0,
2718 { "Class", "sccp.class",
2719 FT_UINT8, BASE_HEX, NULL, CLASS_CLASS_MASK,
2721 { &hf_sccp_handling,
2722 { "Message handling", "sccp.handling",
2723 FT_UINT8, BASE_HEX, VALS(sccp_class_handling_values), CLASS_SPARE_HANDLING_MASK,
2726 { "More data", "sccp.more",
2727 FT_UINT8, BASE_HEX, VALS(sccp_segmenting_reassembling_values), SEGMENTING_REASSEMBLING_MASK,
2730 { "Receive Sequence Number", "sccp.rsn",
2731 FT_UINT8, BASE_HEX, NULL, RSN_MASK,
2733 { &hf_sccp_sequencing_segmenting_ssn,
2734 { "Sequencing Segmenting: Send Sequence Number", "sccp.sequencing_segmenting.ssn",
2735 FT_UINT8, BASE_HEX, NULL, SEND_SEQUENCE_NUMBER_MASK,
2737 { &hf_sccp_sequencing_segmenting_rsn,
2738 { "Sequencing Segmenting: Receive Sequence Number", "sccp.sequencing_segmenting.rsn",
2739 FT_UINT8, BASE_HEX, NULL, RECEIVE_SEQUENCE_NUMBER_MASK,
2741 { &hf_sccp_sequencing_segmenting_more,
2742 { "Sequencing Segmenting: More", "sccp.sequencing_segmenting.more",
2743 FT_UINT8, BASE_HEX, VALS(sccp_segmenting_reassembling_values), SEQUENCING_SEGMENTING_MORE_MASK,
2746 { "Credit", "sccp.credit",
2747 FT_UINT8, BASE_HEX, NULL, 0x0,
2749 { &hf_sccp_release_cause,
2750 { "Release Cause", "sccp.release_cause",
2751 FT_UINT8, BASE_HEX, VALS(sccp_release_cause_values), 0x0,
2753 { &hf_sccp_return_cause,
2754 { "Return Cause", "sccp.return_cause",
2755 FT_UINT8, BASE_HEX, VALS(sccp_return_cause_values), 0x0,
2757 { &hf_sccp_reset_cause,
2758 { "Reset Cause", "sccp.reset_cause",
2759 FT_UINT8, BASE_HEX, VALS(sccp_reset_cause_values), 0x0,
2761 { &hf_sccp_error_cause,
2762 { "Error Cause", "sccp.error_cause",
2763 FT_UINT8, BASE_HEX, VALS(sccp_error_cause_values), 0x0,
2765 { &hf_sccp_refusal_cause,
2766 { "Refusal Cause", "sccp.refusal_cause",
2767 FT_UINT8, BASE_HEX, VALS(sccp_refusal_cause_values), 0x0,
2769 { &hf_sccp_segmentation_first,
2770 { "Segmentation: First", "sccp.segmentation.first",
2771 FT_UINT8, BASE_HEX, VALS(sccp_segmentation_first_segment_values), SEGMENTATION_FIRST_SEGMENT_MASK,
2773 { &hf_sccp_segmentation_class,
2774 { "Segmentation: Class", "sccp.segmentation.class",
2775 FT_UINT8, BASE_HEX, VALS(sccp_segmentation_class_values), SEGMENTATION_CLASS_MASK,
2777 { &hf_sccp_segmentation_remaining,
2778 { "Segmentation: Remaining", "sccp.segmentation.remaining",
2779 FT_UINT8, BASE_HEX, NULL, SEGMENTATION_REMAINING_MASK,
2781 { &hf_sccp_segmentation_slr,
2782 { "Segmentation: Source Local Reference", "sccp.segmentation.slr",
2783 FT_UINT24, BASE_HEX, NULL, 0x0,
2785 { &hf_sccp_hop_counter,
2786 { "Hop Counter", "sccp.hops",
2787 FT_UINT8, BASE_HEX, NULL, 0x0,
2789 { &hf_sccp_importance,
2790 { "Importance", "sccp.importance",
2791 FT_UINT8, BASE_HEX, NULL, IMPORTANCE_IMPORTANCE_MASK,
2793 /* ISNI is ANSI only */
2794 { &hf_sccp_ansi_isni_mi,
2795 { "ISNI Mark for Identification Indicator", "sccp.isni.mi",
2796 FT_UINT8, BASE_HEX, VALS(sccp_isni_mark_for_id_values), ANSI_ISNI_MI_MASK,
2798 { &hf_sccp_ansi_isni_iri,
2799 { "ISNI Routing Indicator", "sccp.isni.iri",
2800 FT_UINT8, BASE_HEX, VALS(sccp_isni_iri_values), ANSI_ISNI_IRI_MASK,
2802 { &hf_sccp_ansi_isni_ti,
2803 { "ISNI Type Indicator", "sccp.isni.ti",
2804 FT_UINT8, BASE_HEX, VALS(sccp_isni_ti_values), ANSI_ISNI_TI_MASK,
2806 { &hf_sccp_ansi_isni_netspec,
2807 { "ISNI Network Specific (Type 1)", "sccp.isni.netspec",
2808 FT_UINT8, BASE_HEX, NULL, ANSI_ISNI_NETSPEC_MASK,
2810 { &hf_sccp_ansi_isni_counter,
2811 { "ISNI Counter", "sccp.isni.counter",
2812 FT_UINT8, BASE_HEX, NULL, ANSI_ISNI_COUNTER_MASK,
2814 {&hf_sccp_xudt_msg_fragments,
2815 {"Message fragments", "sccp.msg.fragments",
2816 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
2818 {&hf_sccp_xudt_msg_fragment,
2819 {"Message fragment", "sccp.msg.fragment",
2820 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2822 {&hf_sccp_xudt_msg_fragment_overlap,
2823 {"Message fragment overlap", "sccp.msg.fragment.overlap",
2824 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2826 {&hf_sccp_xudt_msg_fragment_overlap_conflicts,
2827 {"Message fragment overlapping with conflicting data", "sccp.msg.fragment.overlap.conflicts",
2828 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2830 {&hf_sccp_xudt_msg_fragment_multiple_tails,
2831 {"Message has multiple tail fragments", "sccp.msg.fragment.multiple_tails",
2832 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2834 {&hf_sccp_xudt_msg_fragment_too_long_fragment,
2835 {"Message fragment too long", "sccp.msg.fragment.too_long_fragment",
2836 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2838 {&hf_sccp_xudt_msg_fragment_error,
2839 {"Message defragmentation error", "sccp.msg.fragment.error",
2840 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2842 {&hf_sccp_xudt_msg_reassembled_in,
2843 {"Reassembled in", "sccp.msg.reassembled.in",
2844 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2846 { &hf_sccp_assoc_id,
2847 { "Association ID", "sccp.assoc.id",
2848 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
2849 {&hf_sccp_assoc_msg,
2850 {"Message in frame", "sccp.assoc.msg",
2851 FT_FRAMENUM, BASE_NONE, NULL, 0x00, "", HFILL }
2856 /* Setup protocol subtree array */
2857 static gint *ett[] = {
2860 &ett_sccp_called_ai,
2861 &ett_sccp_called_pc,
2862 &ett_sccp_called_gt,
2864 &ett_sccp_calling_ai,
2865 &ett_sccp_calling_pc,
2866 &ett_sccp_calling_gt,
2867 &ett_sccp_sequencing_segmenting,
2868 &ett_sccp_segmentation,
2869 &ett_sccp_ansi_isni_routing_control,
2870 &ett_sccp_xudt_msg_fragment,
2871 &ett_sccp_xudt_msg_fragments,
2875 /* Register the protocol name and description */
2876 proto_sccp = proto_register_protocol("Signalling Connection Control Part",
2879 register_dissector("sccp", dissect_sccp, proto_sccp);
2881 /* Required function calls to register the header fields and subtrees used */
2882 proto_register_field_array(proto_sccp, hf, array_length(hf));
2883 proto_register_subtree_array(ett, array_length(ett));
2885 sccp_ssn_dissector_table = register_dissector_table("sccp.ssn", "SCCP SSN", FT_UINT8, BASE_DEC);
2887 register_heur_dissector_list("sccp", &heur_subdissector_list);
2889 sccp_module = prefs_register_protocol(proto_sccp, NULL);
2891 prefs_register_uint_preference(sccp_module, "source_pc",
2893 "The source point code (usually MSC) (to determine whether message is uplink or downlink)",
2894 16, &sccp_source_pc_global);
2896 prefs_register_bool_preference(sccp_module, "show_length", "Show length",
2897 "Show parameter length in the protocol tree",
2900 prefs_register_bool_preference(sccp_module, "defragment_xudt",
2901 "Reassemble XUDT messages",
2902 "Whether XUDT messages should be reassembled",
2903 &sccp_xudt_desegment);
2905 prefs_register_bool_preference(sccp_module, "trace_sccp",
2906 "Trace Associations",
2907 "Whether to keep infomation about messages and their associations",
2911 register_init_routine(&init_sccp);
2913 assocs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "sccp_associations");
2918 proto_reg_handoff_sccp(void)
2920 dissector_handle_t sccp_handle;
2922 sccp_handle = find_dissector("sccp");
2924 dissector_add("mtp3.service_indicator", SCCP_SI, sccp_handle);
2925 dissector_add_string("tali.opcode", "sccp", sccp_handle);
2927 data_handle = find_dissector("data");