In packet-sccp.c avoid not having a binding.
svn path=/trunk/; revision=16834
#include "packet-e164.h"
#include "packet-isup.h"
#include "packet-gsm_map.h"
+#include "packet-tcap.h"
#define PNAME "Camel"
#define PSNAME "CAMEL"
static void range_delete_callback(guint32 ssn)
{
if (ssn) {
- dissector_delete("tcap.itu_ssn", ssn, camel_handle);
+ delete_itu_tcap_subdissector(ssn, camel_handle);
}
}
static void range_add_callback(guint32 ssn)
{
if (ssn) {
- dissector_add("tcap.itu_ssn", ssn, camel_handle);
+ add_itu_tcap_subdissector(ssn, camel_handle);
}
}
#include "packet-q931.h"
#include "packet-gsm_map.h"
#include "packet-gsm_a.h"
+#include "packet-tcap.h"
#define PNAME "GSM Mobile Application"
#define PSNAME "GSM_MAP"
}
top_tree = parent_tree;
- dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
+
/* create display subtree for the protocol */
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
static void range_delete_callback(guint32 ssn)
{
if (ssn) {
- dissector_delete("tcap.itu_ssn", ssn, map_handle);
+ delete_itu_tcap_subdissector(ssn, map_handle);
}
}
static void range_add_callback(guint32 ssn)
{
if (ssn) {
- dissector_add("tcap.itu_ssn", ssn, map_handle);
+ add_itu_tcap_subdissector(ssn, map_handle);
}
}
#include "packet-q931.h"
#include "packet-e164.h"
#include "packet-isup.h"
+#include "packet-tcap.h"
#define PNAME "Intelligent Network Application Protocol"
#define PSNAME "INAP"
inap_prefs_initialized = TRUE;
}
else {
- dissector_delete("tcap.itu_ssn", tcap_itu_ssn, inap_handle);
- dissector_delete("tcap.itu_ssn", tcap_itu_ssn1, inap_handle);
+ delete_itu_tcap_subdissector(tcap_itu_ssn, inap_handle);
+ delete_itu_tcap_subdissector(tcap_itu_ssn1, inap_handle);
}
tcap_itu_ssn = global_tcap_itu_ssn;
tcap_itu_ssn1 = global_tcap_itu_ssn1;
- dissector_add("tcap.itu_ssn", global_tcap_itu_ssn, inap_handle);
- dissector_add("tcap.itu_ssn", global_tcap_itu_ssn1, inap_handle);
+ add_itu_tcap_subdissector(global_tcap_itu_ssn, inap_handle);
+ add_itu_tcap_subdissector(global_tcap_itu_ssn1, inap_handle);
}
static int hf_tcap_length = -1;
static int hf_tcap_data = -1;
static int hf_tcap_tid = -1;
-#include "packet-tcap-hf.c"
-static guint tcap_itu_ssn = 106;
-static guint global_tcap_itu_ssn = 1;
+#include "packet-tcap-hf.c"
/* Initialize the subtree pointers */
static gint ett_tcap = -1;
static range_t *global_ssn_range;
static range_t *ssn_range;
-dissector_handle_t tcap_handle;
+dissector_handle_t tcap_handle = NULL;
static dissector_table_t ber_oid_dissector_table=NULL;
static const char * cur_oid;
static const char * tcapext_oid;
static proto_tree *tcap_top_tree=NULL;
static dissector_handle_t data_handle;
-static dissector_table_t tcap_itu_ssn_dissector_table; /* map use ssn in sccp */
-static dissector_table_t tcap_ansi_ssn_dissector_table; /* map use ssn in sccp */
+static dissector_table_t sccp_ssn_table;
static int dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
static int dissect_tcap_UserInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_);
+static GHashTable* ansi_sub_dissectors = NULL;
+static GHashTable* itu_sub_dissectors = NULL;
+
+static void dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
+
+extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
+ g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
+ dissector_add("sccp.ssn",ssn,tcap_handle);
+}
+
+extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
+ g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
+ dissector_add("sccp.ssn",ssn,tcap_handle);
+}
+
+extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
+ g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
+ dissector_delete("sccp.ssn",ssn,tcap_handle);
+}
+extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
+ g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
+ dissector_delete("sccp.ssn", ssn,tcap_handle);
+}
+
+static dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) {
+ return g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
+}
+
+static dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) {
+ return g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
+}
+
+
+
#include "packet-tcap-fn.c"
}
+void
+proto_reg_handoff_tcap(void)
+{
+
+ static gboolean prefs_initialized = FALSE;
+
+ if (! prefs_initialized) {
+ sccp_ssn_table = find_dissector_table("sccp.ssn");
+ prefs_initialized = TRUE;
+ }
+
+ register_ber_oid_name("0.0.17.773.1.1.1",
+ "itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
+
+}
-/* Register the protocol with Ethereal */
-
-void proto_reg_handoff_tcap(void);
-
-/* this format is require because a script is used to build the C function
- that calls all the protocol registration.
-*/
-
+static void init_tcap(void);
void
proto_register_tcap(void)
#endif
/* Set default SSNs */
- range_convert_str(&global_ssn_range, "2,4-141,143-251,253,255", MAX_SSN);
+ range_convert_str(&global_ssn_range, "", MAX_SSN);
ssn_range = range_empty();
prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
"SCCP (and SUA) SSNs to decode as TCAP",
&global_ssn_range, MAX_SSN);
-
- /* we will fake a ssn subfield which has the same value obtained from sccp */
- tcap_itu_ssn_dissector_table = register_dissector_table("tcap.itu_ssn", "ITU TCAP SSN", FT_UINT8, BASE_DEC);
- tcap_ansi_ssn_dissector_table = register_dissector_table("tcap.ansi_ssn", "ANSI TCAP SSN", FT_UINT8, BASE_DEC);
+
+ ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
+ itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
/* 'globally' register dissector */
register_dissector("tcap", dissect_tcap, proto_tcap);
-}
-
-
+ tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
+ register_init_routine(&init_tcap);
+}
-/* If this dissector uses sub-dissector registration add a registration routine.
- This format is required because a script is used to find these routines and
- create the code that calls these routines.
-*/
static void range_delete_callback(guint32 ssn)
{
- if (ssn) {
- dissector_delete("sccp.ssn", ssn, tcap_handle);
+ if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
+ dissector_delete("sccp.ssn", ssn, tcap_handle);
}
}
static void range_add_callback(guint32 ssn)
{
- if (ssn) {
- dissector_add("sccp.ssn", ssn, tcap_handle);
+ if (ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
+ dissector_add("sccp.ssn", ssn, tcap_handle);
}
}
-void
-proto_reg_handoff_tcap(void)
-{
- static gboolean prefs_initialized = FALSE;
-
- if (!prefs_initialized) {
-
- tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
-
- prefs_initialized = TRUE;
-
- } else {
- range_foreach(ssn_range, range_delete_callback);
+static void init_tcap(void) {
+ if (ssn_range) {
+ range_foreach(ssn_range, range_delete_callback);
+ g_free(ssn_range);
}
-
- g_free(ssn_range);
+
ssn_range = range_copy(global_ssn_range);
-
range_foreach(ssn_range, range_add_callback);
- register_ber_oid_name("0.0.17.773.1.1.1",
- "itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
-
+
}
-
-
-
static int
dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
extern const value_string tcap_component_type_str[];
+extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+
+extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
#endif /* PACKET_INAP_H */
#include "packet-ansi_a.h"
#include "packet-ansi_map.h"
-
+#include "packet-tcap.h"
/* PROTOTYPES/FORWARDS */
ansi_map_handle = create_dissector_handle(dissect_ansi_map, proto_ansi_map);
- dissector_add("tcap.ansi_ssn", 5, ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 6, ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 7, ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 8, ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 9 , ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 10 , ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 11 , ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 12 , ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 13 , ansi_map_handle);
- dissector_add("tcap.ansi_ssn", 14 , ansi_map_handle);
+ add_ansi_tcap_subdissector(5, ansi_map_handle);
+ add_ansi_tcap_subdissector(6, ansi_map_handle);
+ add_ansi_tcap_subdissector(7, ansi_map_handle);
+ add_ansi_tcap_subdissector(8, ansi_map_handle);
+ add_ansi_tcap_subdissector(9 , ansi_map_handle);
+ add_ansi_tcap_subdissector(10 , ansi_map_handle);
+ add_ansi_tcap_subdissector(11 , ansi_map_handle);
+ add_ansi_tcap_subdissector(12 , ansi_map_handle);
+ add_ansi_tcap_subdissector(13 , ansi_map_handle);
+ add_ansi_tcap_subdissector(14 , ansi_map_handle);
data_handle = find_dissector("data");
}
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
-/* .\packet-camel.c */
+/* ./packet-camel.c */
/* ../../tools/asn2eth.py -X -b -e -p camel -c camel.cnf -s packet-camel-template camel.asn */
/* Input file: packet-camel-template.c */
#include "packet-e164.h"
#include "packet-isup.h"
#include "packet-gsm_map.h"
+#include "packet-tcap.h"
#define PNAME "Camel"
#define PSNAME "CAMEL"
static int hf_camel_OfferedCamel4Functionalities_serviceChangeDP = -1;
/*--- End of included file: packet-camel-hf.c ---*/
-#line 83 "packet-camel-template.c"
+#line 84 "packet-camel-template.c"
static guint global_tcap_itu_ssn = 0;
/* Initialize the subtree pointers */
static gint ett_camel_CancelFailedPARAM = -1;
/*--- End of included file: packet-camel-ett.c ---*/
-#line 95 "packet-camel-template.c"
+#line 96 "packet-camel-template.c"
/* Preference settings default */
/*--- End of included file: packet-camel-fn.c ---*/
-#line 170 "packet-camel-template.c"
+#line 171 "packet-camel-template.c"
const value_string camel_opr_code_strings[] = {
static void range_delete_callback(guint32 ssn)
{
if (ssn) {
- dissector_delete("tcap.itu_ssn", ssn, camel_handle);
+ delete_itu_tcap_subdissector(ssn, camel_handle);
}
}
static void range_add_callback(guint32 ssn)
{
if (ssn) {
- dissector_add("tcap.itu_ssn", ssn, camel_handle);
+ add_itu_tcap_subdissector(ssn, camel_handle);
}
}
"", HFILL }},
/*--- End of included file: packet-camel-hfarr.c ---*/
-#line 696 "packet-camel-template.c"
+#line 697 "packet-camel-template.c"
};
/* List of subtrees */
&ett_camel_CancelFailedPARAM,
/*--- End of included file: packet-camel-ettarr.c ---*/
-#line 709 "packet-camel-template.c"
+#line 710 "packet-camel-template.c"
};
/* Register protocol */
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
-/* .\packet-camel.h */
+/* ./packet-camel.h */
/* ../../tools/asn2eth.py -X -b -e -p camel -c camel.cnf -s packet-camel-template camel.asn */
/* Input file: packet-camel-template.h */
#include "packet-q931.h"
#include "packet-gsm_map.h"
#include "packet-gsm_a.h"
+#include "packet-tcap.h"
#define PNAME "GSM Mobile Application"
#define PSNAME "GSM_MAP"
static int hf_gsm_map_SupportedGADShapes_ellipsoidArc = -1;
/*--- End of included file: packet-gsm_map-hf.c ---*/
-#line 94 "packet-gsm_map-template.c"
+#line 95 "packet-gsm_map-template.c"
/* Initialize the subtree pointers */
static gint ett_gsm_map = -1;
static gint ett_gsm_map_ExtensionContainer = -1;
/*--- End of included file: packet-gsm_map-ett.c ---*/
-#line 106 "packet-gsm_map-template.c"
+#line 107 "packet-gsm_map-template.c"
static dissector_table_t sms_dissector_table; /* SMS TPDU */
static dissector_handle_t data_handle;
/*--- End of included file: packet-gsm_map-fn.c ---*/
-#line 163 "packet-gsm_map-template.c"
+#line 164 "packet-gsm_map-template.c"
const value_string gsm_map_opr_code_strings[] = {
{ 2, "updateLocation" },
}
top_tree = parent_tree;
- dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
+
/* create display subtree for the protocol */
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
static void range_delete_callback(guint32 ssn)
{
if (ssn) {
- dissector_delete("tcap.itu_ssn", ssn, map_handle);
+ delete_itu_tcap_subdissector(ssn, map_handle);
}
}
static void range_add_callback(guint32 ssn)
{
if (ssn) {
- dissector_add("tcap.itu_ssn", ssn, map_handle);
+ add_itu_tcap_subdissector(ssn, map_handle);
}
}
"", HFILL }},
/*--- End of included file: packet-gsm_map-hfarr.c ---*/
-#line 1595 "packet-gsm_map-template.c"
+#line 1596 "packet-gsm_map-template.c"
};
/* List of subtrees */
&ett_gsm_map_ExtensionContainer,
/*--- End of included file: packet-gsm_map-ettarr.c ---*/
-#line 1608 "packet-gsm_map-template.c"
+#line 1609 "packet-gsm_map-template.c"
};
/* Register protocol */
#include "packet-q931.h"
#include "packet-e164.h"
#include "packet-isup.h"
+#include "packet-tcap.h"
#define PNAME "Intelligent Network Application Protocol"
#define PSNAME "INAP"
static int hf_inap_rep = -1; /* ReturnErrorProblem */
/*--- End of included file: packet-inap-hf.c ---*/
-#line 65 "packet-inap-template.c"
+#line 66 "packet-inap-template.c"
static guint tcap_itu_ssn = 106;
static guint tcap_itu_ssn1 = 241;
static gint ett_inap_T_rproblem = -1;
/*--- End of included file: packet-inap-ett.c ---*/
-#line 83 "packet-inap-template.c"
+#line 84 "packet-inap-template.c"
static int dissect_invokeCmd(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
/*--- End of included file: packet-inap-fn.c ---*/
-#line 87 "packet-inap-template.c"
+#line 88 "packet-inap-template.c"
const value_string inap_opr_code_strings[] = {
inap_prefs_initialized = TRUE;
}
else {
- dissector_delete("tcap.itu_ssn", tcap_itu_ssn, inap_handle);
- dissector_delete("tcap.itu_ssn", tcap_itu_ssn1, inap_handle);
+ delete_itu_tcap_subdissector(tcap_itu_ssn, inap_handle);
+ delete_itu_tcap_subdissector(tcap_itu_ssn1, inap_handle);
}
tcap_itu_ssn = global_tcap_itu_ssn;
tcap_itu_ssn1 = global_tcap_itu_ssn1;
- dissector_add("tcap.itu_ssn", global_tcap_itu_ssn, inap_handle);
- dissector_add("tcap.itu_ssn", global_tcap_itu_ssn1, inap_handle);
+ add_itu_tcap_subdissector(global_tcap_itu_ssn, inap_handle);
+ add_itu_tcap_subdissector(global_tcap_itu_ssn1, inap_handle);
}
"RejectPDU/rproblem/rep", HFILL }},
/*--- End of included file: packet-inap-hfarr.c ---*/
-#line 658 "packet-inap-template.c"
+#line 659 "packet-inap-template.c"
};
&ett_inap_T_rproblem,
/*--- End of included file: packet-inap-ettarr.c ---*/
-#line 676 "packet-inap-template.c"
+#line 677 "packet-inap-template.c"
};
/* Register protocol */
static guint8 message_type = 0;
static guint dlr = 0;
static guint slr = 0;
-/* Put back old code(before binding) to be able to dissect data messages wher no setup info seen */
-static guint8 called_ssn = INVALID_SSN;
-static guint8 calling_ssn = INVALID_SSN;
static dissector_handle_t data_handle;
static dissector_table_t sccp_ssn_dissector_table;
static GHashTable* bindings = NULL;
sccp_binding_info_t* binding;
+sccp_binding_info_t no_binding = {NULL,NULL,0,0};
static sccp_binding_info_t* sccp_binding(address* opc, address* dpc, guint src_lr, guint dst_lr) {
return binding;
if (!src_lr && !dst_lr)
- return NULL;
+ return &no_binding;
switch (message_type) {
case MESSAGE_TYPE_CR:
}
}
- return binding;
+ return binding ? binding : &no_binding;
}
if (ssni) {
ssn = tvb_get_guint8(tvb, offset);
if (called) {
- called_ssn = ssn;
if (binding) binding->called_ssn = ssn;
}
else {
if (binding) binding->calling_ssn = ssn;
- calling_ssn = ssn;
- }
+ }
proto_tree_add_uint(call_tree, called ? hf_sccp_called_ssn
: hf_sccp_calling_ssn,
guint8 ssn;
if (binding) {
- if (pinfo->p2p_dir == P2P_DIR_SENT) {
- ssn = binding->calling_ssn;
- } else {
- ssn = binding->called_ssn;
+ switch (pinfo->p2p_dir) {
+ case P2P_DIR_SENT:
+ ssn = binding->calling_ssn;
+ break;
+ case P2P_DIR_RECV:
+ ssn = binding->called_ssn;
+ break;
+ default:
+ ssn = binding->called_ssn;
+ if (ssn == INVALID_SSN) ssn = binding->calling_ssn;
+ break;
}
} else {
- ssn = called_ssn;
+ ssn = binding->called_ssn;
}
- if ((ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, ssn, tvb, pinfo, tree))) {
+
+ if (ssn != INVALID_SSN && dissector_try_port(sccp_ssn_dissector_table, ssn, tvb, pinfo, tree) ) {
return;
}
dissect_sccp_message(tvb, pinfo, sccp_tree, tree);
}
-void init_sccp(void) {
+static void init_sccp(void) {
if (bindings) {
g_hash_table_destroy(bindings);
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
-/* .\packet-tcap.c */
+/* ./packet-tcap.c */
/* ../../tools/asn2eth.py -X -b -e -p tcap -c tcap.cnf -s packet-tcap-template tcap.asn */
/* Input file: packet-tcap-template.c */
static int hf_tcap_data = -1;
static int hf_tcap_tid = -1;
+
/*--- Included file: packet-tcap-hf.c ---*/
#line 1 "packet-tcap-hf.c"
static int hf_tcap_dialogueRequest = -1; /* AARQ_apdu */
static int hf_tcap_T_protocol_version3_version1 = -1;
/*--- End of included file: packet-tcap-hf.c ---*/
-#line 52 "packet-tcap-template.c"
-static guint tcap_itu_ssn = 106;
-
-static guint global_tcap_itu_ssn = 1;
+#line 53 "packet-tcap-template.c"
/* Initialize the subtree pointers */
static gint ett_tcap = -1;
static gint ett_tcap_ErrorCode = -1;
/*--- End of included file: packet-tcap-ett.c ---*/
-#line 65 "packet-tcap-template.c"
+#line 63 "packet-tcap-template.c"
#define MAX_SSN 254
static range_t *global_ssn_range;
static range_t *ssn_range;
-dissector_handle_t tcap_handle;
+dissector_handle_t tcap_handle = NULL;
static dissector_table_t ber_oid_dissector_table=NULL;
static const char * cur_oid;
static const char * tcapext_oid;
static proto_tree *tcap_top_tree=NULL;
static dissector_handle_t data_handle;
-static dissector_table_t tcap_itu_ssn_dissector_table; /* map use ssn in sccp */
-static dissector_table_t tcap_ansi_ssn_dissector_table; /* map use ssn in sccp */
+//static dissector_table_t tcap_itu_ssn_dissector_table; /* map use ssn in sccp */
+//static dissector_table_t tcap_ansi_ssn_dissector_table; /* map use ssn in sccp */
+
+static dissector_table_t sccp_ssn_table;
static int dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
static int dissect_tcap_UserInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_);
+static GHashTable* ansi_sub_dissectors = NULL;
+static GHashTable* itu_sub_dissectors = NULL;
+
+static void dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
+
+extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
+ g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
+ dissector_add("sccp.ssn",ssn,tcap_handle);
+}
+
+extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
+ g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
+ dissector_add("sccp.ssn",ssn,tcap_handle);
+}
+
+extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
+ g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
+ dissector_delete("sccp.ssn",ssn,tcap_handle);
+}
+extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
+ g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
+ dissector_delete("sccp.ssn", ssn,tcap_handle);
+}
+
+static dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) {
+ return g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
+}
+
+static dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) {
+ return g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
+}
+
+
+
/*--- Included file: packet-tcap-fn.c ---*/
#line 1 "packet-tcap-fn.c"
static int
dissect_tcap_Applicationcontext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 128 "tcap.cnf"
+#line 142 "tcap.cnf"
offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_index, &cur_oid);
- pinfo->private_data = cur_oid;
+ pinfo->private_data = (void*)cur_oid;
dissect_tcap_User_information(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 77 "tcap.cnf"
tvbuff_t *next_tvb;
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len;
- guint32 ind_field;
+ gint ind_field;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
static int
dissect_tcap_Dialog1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 43 "tcap.cnf"
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len;
- guint32 ind_field;
+ gint ind_field;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
static int
dissect_tcap_UserInfoOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 132 "tcap.cnf"
+#line 146 "tcap.cnf"
offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_index, &tcapext_oid);
- pinfo->private_data = tcapext_oid;
+ pinfo->private_data = (void*)tcapext_oid;
static int
dissect_tcap_ExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 136 "tcap.cnf"
+#line 150 "tcap.cnf"
tvbuff_t *next_tvb;
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len, start_offset;
- guint32 ind_field;
+ gint ind_field;
/*
* ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
*/
dissect_tcap_DialogueOC(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 21 "tcap.cnf"
tvbuff_t *next_tvb;
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len;
- guint32 ind_field;
+ gint ind_field;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
dissect_tcap_Parameter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 57 "tcap.cnf"
tvbuff_t *next_tvb;
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len;
- guint32 ind_field;
+ gint ind_field;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
dissect_tcap_Component(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 95 "tcap.cnf"
tvbuff_t *next_tvb;
-guint8 class;
+gint8 class;
gboolean pc;
- guint32 tag;
+ gint tag;
guint32 len, s_offset;
- guint32 ind_field;
+ gint ind_field;
/*
* ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
*/
ber_oid_dissector_table = find_dissector_table("ber.oid");
-tcap_itu_ssn_dissector_table = find_dissector_table("tcap.itu_ssn");
s_offset = offset;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
if (ber_oid_dissector_table && cur_oid){
if(!dissector_try_string(ber_oid_dissector_table, cur_oid, next_tvb, pinfo, tcap_top_tree))
{
- dissector_try_port(tcap_itu_ssn_dissector_table, pinfo->match_port, next_tvb,pinfo, tcap_top_tree);
+ dissector_handle_t subdissector_handle;
+
+ if (! (subdissector_handle = get_itu_tcap_subdissector(pinfo->match_port))) {
+ subdissector_handle = data_handle;
+ }
+
+ call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree);
+
}
}
-else
- dissector_try_port(tcap_itu_ssn_dissector_table, pinfo->match_port, next_tvb, pinfo, tcap_top_tree);
+else {
+ dissector_handle_t subdissector_handle;
+
+ if (! (subdissector_handle = get_itu_tcap_subdissector(pinfo->match_port))) {
+ subdissector_handle = data_handle;
+ }
+
+ call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree);
+}
+
return offset+len;
static int
dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 184 "tcap.cnf"
+#line 203 "tcap.cnf"
tvbuff_t *parameter_tvb;
guint8 len, i;
proto_item *tid_item;
static int
dissect_tcap_Begin(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 225 "tcap.cnf"
+#line 244 "tcap.cnf"
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " Begin ");
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
static int
dissect_tcap_DestTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 206 "tcap.cnf"
+#line 225 "tcap.cnf"
tvbuff_t *parameter_tvb;
guint8 len , i;
proto_item *tid_item;
static int
dissect_tcap_End(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 230 "tcap.cnf"
+#line 249 "tcap.cnf"
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " End ");
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
static int
dissect_tcap_Continue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 235 "tcap.cnf"
+#line 254 "tcap.cnf"
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " Continue ");
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
static int
dissect_tcap_Abort(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 240 "tcap.cnf"
+#line 259 "tcap.cnf"
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " Abort ");
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
static int
dissect_tcap_ANSIParameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 163 "tcap.cnf"
+#line 177 "tcap.cnf"
/* we are doing the ParamSet here so need to look at the tags*/
guint32 len;
len = tvb_length_remaining(tvb, offset);
static int
dissect_tcap_ComponentPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 174 "tcap.cnf"
+#line 188 "tcap.cnf"
tvbuff_t *next_tvb;
+dissector_handle_t subdissector_handle;
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_length_remaining(tvb, offset));
-dissector_try_port(tcap_ansi_ssn_dissector_table, pinfo->match_port, next_tvb, pinfo, tcap_top_tree);
+if (! (subdissector_handle = get_ansi_tcap_subdissector(pinfo->match_port))) {
+ subdissector_handle = data_handle;
+}
+call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree);
+
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
ComponentPDU_choice, hf_index, ett_tcap_ComponentPDU,NULL);
static int
dissect_tcap_TransactionPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 250 "tcap.cnf"
+#line 269 "tcap.cnf"
if ((hf_index == hf_tcap_ansiqueryWithPerm)&&(check_col(pinfo->cinfo, COL_INFO)))
col_append_fstr(pinfo->cinfo, COL_INFO, " QueryWithPerm");
static int
dissect_tcap_AbortPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 245 "tcap.cnf"
+#line 264 "tcap.cnf"
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " Abort ");
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
/*--- End of included file: packet-tcap-fn.c ---*/
-#line 84 "packet-tcap-template.c"
+#line 118 "packet-tcap-template.c"
}
+void
+proto_reg_handoff_tcap(void)
+{
+
+ static gboolean prefs_initialized = FALSE;
+
+ if (! prefs_initialized) {
+ sccp_ssn_table = find_dissector_table("sccp.ssn");
+ prefs_initialized = TRUE;
+ }
+
+ register_ber_oid_name("0.0.17.773.1.1.1",
+ "itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
+
+}
-/* Register the protocol with Ethereal */
-
-void proto_reg_handoff_tcap(void);
-
-/* this format is require because a script is used to build the C function
- that calls all the protocol registration.
-*/
-
+static void init_tcap(void);
void
proto_register_tcap(void)
"", HFILL }},
/*--- End of included file: packet-tcap-hfarr.c ---*/
-#line 159 "packet-tcap-template.c"
+#line 201 "packet-tcap-template.c"
};
/* Setup protocol subtree array */
&ett_tcap_ErrorCode,
/*--- End of included file: packet-tcap-ettarr.c ---*/
-#line 168 "packet-tcap-template.c"
+#line 210 "packet-tcap-template.c"
};
/*static enum_val_t tcap_options[] = {
#endif
/* Set default SSNs */
- range_convert_str(&global_ssn_range, "2,4-141,143-251,253,255", MAX_SSN);
+ range_convert_str(&global_ssn_range, "", MAX_SSN);
ssn_range = range_empty();
prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
"SCCP (and SUA) SSNs to decode as TCAP",
&global_ssn_range, MAX_SSN);
-
- /* we will fake a ssn subfield which has the same value obtained from sccp */
- tcap_itu_ssn_dissector_table = register_dissector_table("tcap.itu_ssn", "ITU TCAP SSN", FT_UINT8, BASE_DEC);
- tcap_ansi_ssn_dissector_table = register_dissector_table("tcap.ansi_ssn", "ANSI TCAP SSN", FT_UINT8, BASE_DEC);
+
+ ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
+ itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
/* 'globally' register dissector */
register_dissector("tcap", dissect_tcap, proto_tcap);
-}
-
-
+ tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
+ register_init_routine(&init_tcap);
+}
-/* If this dissector uses sub-dissector registration add a registration routine.
- This format is required because a script is used to find these routines and
- create the code that calls these routines.
-*/
static void range_delete_callback(guint32 ssn)
{
- if (ssn) {
- dissector_delete("sccp.ssn", ssn, tcap_handle);
+ if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
+ dissector_delete("sccp.ssn", ssn, tcap_handle);
}
}
static void range_add_callback(guint32 ssn)
{
- if (ssn) {
- dissector_add("sccp.ssn", ssn, tcap_handle);
+ if (ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
+ dissector_add("sccp.ssn", ssn, tcap_handle);
}
}
-void
-proto_reg_handoff_tcap(void)
-{
- static gboolean prefs_initialized = FALSE;
-
- if (!prefs_initialized) {
- tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
-
- prefs_initialized = TRUE;
-
- } else {
-
- range_foreach(ssn_range, range_delete_callback);
+static void init_tcap(void) {
+ if (ssn_range) {
+ range_foreach(ssn_range, range_delete_callback);
+ g_free(ssn_range);
+ ssn_range = NULL;
}
-
- g_free(ssn_range);
+
ssn_range = range_copy(global_ssn_range);
-
range_foreach(ssn_range, range_add_callback);
- register_ber_oid_name("0.0.17.773.1.1.1",
- "itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
-
+
}
-
-
-
static int
dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
-/* .\packet-tcap.h */
+/* ./packet-tcap.h */
/* ../../tools/asn2eth.py -X -b -e -p tcap -c tcap.cnf -s packet-tcap-template tcap.asn */
/* Input file: packet-tcap-template.h */
extern const value_string tcap_component_type_str[];
+extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+
+extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
+extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);
#endif /* PACKET_INAP_H */