diff options
author | Bill Meier <wmeier@newsguy.com> | 2008-11-07 17:13:25 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2008-11-07 17:13:25 +0000 |
commit | 8da394baaedd4e6deec831bdff1353f2b513393c (patch) | |
tree | 6f08d2839264ead982c89af41a054f6025222154 | |
parent | 0132b9a092fd0e60e32af3127a30f3ca9b839a42 (diff) |
Minor cleanup related to proto_reg_handoff...
svn path=/trunk/; revision=26728
-rw-r--r-- | asn1/camel/packet-camel-template.c | 162 | ||||
-rw-r--r-- | asn1/inap/packet-inap-template.c | 10 | ||||
-rw-r--r-- | asn1/pcap/packet-pcap-template.c | 38 | ||||
-rw-r--r-- | asn1/pkixcmp/packet-cmp-template.c | 15 |
4 files changed, 106 insertions, 119 deletions
diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c index b7ac5eb40a..2814c6a0c5 100644 --- a/asn1/camel/packet-camel-template.c +++ b/asn1/camel/packet-camel-template.c @@ -138,7 +138,6 @@ static gint ett_camel_stat = -1; /* Preference settings default */ #define MAX_SSN 254 static range_t *global_ssn_range; -static range_t *ssn_range; static dissector_handle_t camel_handle; /* Global variables */ @@ -488,18 +487,21 @@ static void range_add_callback(guint32 ssn) } void proto_reg_handoff_camel(void) { - int i; - dissector_handle_t camel_arg_handle; - dissector_handle_t camel_res_handle; - dissector_handle_t camel_err_handle; + static gboolean camel_prefs_initialized = FALSE; + static range_t *ssn_range; - static int camel_prefs_initialized = FALSE; if (!camel_prefs_initialized) { + int i; + dissector_handle_t camel_arg_handle; + dissector_handle_t camel_res_handle; + dissector_handle_t camel_err_handle; + camel_prefs_initialized = TRUE; - camel_handle = create_dissector_handle(dissect_camel, proto_camel); + camel_handle = find_dissector("camel"); - camel_arg_handle = new_create_dissector_handle(dissect_camel_arg, proto_camel); - camel_res_handle = new_create_dissector_handle(dissect_camel_res, proto_camel); + camel_arg_handle = new_create_dissector_handle(dissect_camel_arg, proto_camel); + camel_res_handle = new_create_dissector_handle(dissect_camel_res, proto_camel); + camel_err_handle = new_create_dissector_handle(dissect_camel_err, proto_camel); register_ber_oid_dissector_handle("0.4.0.0.1.0.50.0",camel_handle, proto_camel, "CAP-v1-gsmSSF-to-gsmSCF-AC" ); register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_handle, proto_camel, "CAP-v2-gsmSSF-to-gsmSCF-AC" ); @@ -508,24 +510,23 @@ void proto_reg_handoff_camel(void) { register_ber_oid_dissector_handle("0.4.0.0.1.21.3.50",camel_handle, proto_camel, "cap3-gprssf-scfAC" ); register_ber_oid_dissector_handle("0.4.0.0.1.21.3.51",camel_handle, proto_camel, "cap3-gsmscf-gprsssfAC" ); register_ber_oid_dissector_handle("0.4.0.0.1.21.3.61",camel_handle, proto_camel, "cap3-sms-AC" ); - register_ber_oid_dissector_handle("0.4.0.0.1.23.3.4",camel_handle, proto_camel, "capssf-scfGenericAC" ); + register_ber_oid_dissector_handle("0.4.0.0.1.23.3.4",camel_handle, proto_camel, "capssf-scfGenericAC" ); register_ber_oid_dissector_handle("0.4.0.0.1.23.3.61",camel_handle, proto_camel, "cap4-sms-AC" ); - for (i=0; i<(int)array_length(camel_op_tab); i++) { - dissector_add("camel.ros.local.arg", camel_op_tab[i].opcode, camel_arg_handle); - dissector_add("camel.ros.local.res", camel_op_tab[i].opcode, camel_res_handle); - } - camel_err_handle = new_create_dissector_handle(dissect_camel_err, proto_camel); - for (i=0; i<(int)array_length(camel_err_tab); i++) { - dissector_add("camel.ros.local.err", camel_err_tab[i].errcode, camel_err_handle); - } + for (i=0; i<(int)array_length(camel_op_tab); i++) { + dissector_add("camel.ros.local.arg", camel_op_tab[i].opcode, camel_arg_handle); + dissector_add("camel.ros.local.res", camel_op_tab[i].opcode, camel_res_handle); + } + for (i=0; i<(int)array_length(camel_err_tab); i++) { + dissector_add("camel.ros.local.err", camel_err_tab[i].errcode, camel_err_handle); + } #include "packet-camel-dis-tab.c" } else { 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); @@ -544,72 +545,72 @@ void proto_register_camel(void) { { "local", "camel.error_code_local", FT_INT32, BASE_DEC, VALS(camel_err_code_string_vals), 0, "ERROR code", HFILL }}, - { &hf_camel_cause_indicator, /* Currently not enabled */ - { "Cause indicator", "camel.cause_indicator", - FT_UINT8, BASE_DEC, VALS(q850_cause_code_vals), 0x7f, - "", HFILL }}, - { &hf_digit, + { &hf_camel_cause_indicator, /* Currently not enabled */ + { "Cause indicator", "camel.cause_indicator", + FT_UINT8, BASE_DEC, VALS(q850_cause_code_vals), 0x7f, + "", HFILL }}, + { &hf_digit, { "Digit Value", "camel.digit_value", - FT_UINT8, BASE_DEC, VALS(digit_value), 0, "Digit Value", HFILL }}, - { &hf_camel_PDPTypeNumber_etsi, + FT_UINT8, BASE_DEC, VALS(digit_value), 0, "Digit Value", HFILL }}, + { &hf_camel_PDPTypeNumber_etsi, { "ETSI defined PDP Type Value", "camel.PDPTypeNumber_etsi", - FT_UINT8, BASE_HEX, VALS(gsm_map_etsi_defined_pdp_vals), 0, - "ETSI defined PDP Type Value", HFILL }}, - { &hf_camel_PDPTypeNumber_ietf, + FT_UINT8, BASE_HEX, VALS(gsm_map_etsi_defined_pdp_vals), 0, + "ETSI defined PDP Type Value", HFILL }}, + { &hf_camel_PDPTypeNumber_ietf, { "IETF defined PDP Type Value", "camel.PDPTypeNumber_ietf", - FT_UINT8, BASE_HEX, VALS(gsm_map_ietf_defined_pdp_vals), 0, - "IETF defined PDP Type Value", HFILL }}, - { &hf_camel_PDPAddress_IPv4, + FT_UINT8, BASE_HEX, VALS(gsm_map_ietf_defined_pdp_vals), 0, + "IETF defined PDP Type Value", HFILL }}, + { &hf_camel_PDPAddress_IPv4, { "PDPAddress IPv4", "camel.PDPAddress_IPv4", - FT_IPv4, BASE_NONE, NULL, 0, - "IPAddress IPv4", HFILL }}, - { &hf_camel_PDPAddress_IPv6, + FT_IPv4, BASE_NONE, NULL, 0, + "IPAddress IPv4", HFILL }}, + { &hf_camel_PDPAddress_IPv6, { "PDPAddress IPv6", "camel.PDPAddress_IPv6", - FT_IPv6, BASE_NONE, NULL, 0, - "IPAddress IPv6", HFILL }}, - { &hf_camel_cellGlobalIdOrServiceAreaIdFixedLength, + FT_IPv6, BASE_NONE, NULL, 0, + "IPAddress IPv6", HFILL }}, + { &hf_camel_cellGlobalIdOrServiceAreaIdFixedLength, { "CellGlobalIdOrServiceAreaIdFixedLength", "camel.CellGlobalIdOrServiceAreaIdFixedLength", FT_BYTES, BASE_HEX, NULL, 0, "LocationInformationGPRS/CellGlobalIdOrServiceAreaIdOrLAI", HFILL }}, - { &hf_camel_RP_Cause, + { &hf_camel_RP_Cause, { "RP Cause", "camel.RP_Cause", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC, NULL, 0, "RP Cause Value", HFILL }}, - { &hf_camel_CAMEL_AChBillingChargingCharacteristics, - { "CAMEL-AChBillingChargingCharacteristics", "camel.CAMEL_AChBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, VALS(camel_CAMEL_AChBillingChargingCharacteristics_vals), 0, - "CAMEL-AChBillingChargingCharacteristics", HFILL }}, + { &hf_camel_CAMEL_AChBillingChargingCharacteristics, + { "CAMEL-AChBillingChargingCharacteristics", "camel.CAMEL_AChBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, VALS(camel_CAMEL_AChBillingChargingCharacteristics_vals), 0, + "CAMEL-AChBillingChargingCharacteristics", HFILL }}, - { &hf_camel_CAMEL_FCIBillingChargingCharacteristics, - { "CAMEL-FCIBillingChargingCharacteristics", "camel.CAMEL_FCIBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCIBillingChargingCharacteristics_vals), 0, - "CAMEL-FCIBillingChargingCharacteristics", HFILL }}, - - { &hf_camel_CAMEL_FCIGPRSBillingChargingCharacteristics, - { "CAMEL-FCIGPRSBillingChargingCharacteristics", "camel.CAMEL_FCIGPRSBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, NULL, 0, - "CAMEL-FCIGPRSBillingChargingCharacteristics", HFILL }}, - - { &hf_camel_CAMEL_FCISMSBillingChargingCharacteristics, - { "CAMEL-FCISMSBillingChargingCharacteristics", "camel.CAMEL_FCISMSBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCISMSBillingChargingCharacteristics_vals), 0, - "CAMEL-FCISMSBillingChargingCharacteristics", HFILL }}, - - { &hf_camel_CAMEL_SCIBillingChargingCharacteristics, - { "CAMEL-SCIBillingChargingCharacteristics", "camel.CAMEL_SCIBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, VALS(camel_CAMEL_SCIBillingChargingCharacteristics_vals), 0, - "CAMEL-SCIBillingChargingCharacteristics", HFILL }}, - - { &hf_camel_CAMEL_SCIGPRSBillingChargingCharacteristics, - { "CAMEL-SCIGPRSBillingChargingCharacteristics", "camel.CAMEL_SCIGPRSBillingChargingCharacteristics", - FT_UINT32, BASE_DEC, NULL, 0, - "CAMEL-FSCIGPRSBillingChargingCharacteristics", HFILL }}, - - { &hf_camel_CAMEL_CallResult, - { "CAMEL-CAMEL_CallResult", "camel.CAMEL_CallResult", - FT_UINT32, BASE_DEC, VALS(camel_CAMEL_CallResult_vals), 0, - "CAMEL-CallResult", HFILL }}, + { &hf_camel_CAMEL_FCIBillingChargingCharacteristics, + { "CAMEL-FCIBillingChargingCharacteristics", "camel.CAMEL_FCIBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCIBillingChargingCharacteristics_vals), 0, + "CAMEL-FCIBillingChargingCharacteristics", HFILL }}, + + { &hf_camel_CAMEL_FCIGPRSBillingChargingCharacteristics, + { "CAMEL-FCIGPRSBillingChargingCharacteristics", "camel.CAMEL_FCIGPRSBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, NULL, 0, + "CAMEL-FCIGPRSBillingChargingCharacteristics", HFILL }}, + + { &hf_camel_CAMEL_FCISMSBillingChargingCharacteristics, + { "CAMEL-FCISMSBillingChargingCharacteristics", "camel.CAMEL_FCISMSBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCISMSBillingChargingCharacteristics_vals), 0, + "CAMEL-FCISMSBillingChargingCharacteristics", HFILL }}, + + { &hf_camel_CAMEL_SCIBillingChargingCharacteristics, + { "CAMEL-SCIBillingChargingCharacteristics", "camel.CAMEL_SCIBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, VALS(camel_CAMEL_SCIBillingChargingCharacteristics_vals), 0, + "CAMEL-SCIBillingChargingCharacteristics", HFILL }}, + + { &hf_camel_CAMEL_SCIGPRSBillingChargingCharacteristics, + { "CAMEL-SCIGPRSBillingChargingCharacteristics", "camel.CAMEL_SCIGPRSBillingChargingCharacteristics", + FT_UINT32, BASE_DEC, NULL, 0, + "CAMEL-FSCIGPRSBillingChargingCharacteristics", HFILL }}, + + { &hf_camel_CAMEL_CallResult, + { "CAMEL-CAMEL_CallResult", "camel.CAMEL_CallResult", + FT_UINT32, BASE_DEC, VALS(camel_CAMEL_CallResult_vals), 0, + "CAMEL-CallResult", HFILL }}, /* Camel Service Response Time */ { &hf_camelsrt_SessionId, @@ -684,7 +685,7 @@ void proto_register_camel(void) { FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "DeltaTime between EventReport(Disconnect) and Release Call", HFILL } }, - { &hf_camelsrt_DeltaTime80, + { &hf_camelsrt_DeltaTime80, { "Service Response Time", "camel.srt.deltatime80", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, @@ -719,14 +720,19 @@ void proto_register_camel(void) { rose_ctx_init(&camel_rose_ctx); /* Register dissector tables */ - camel_rose_ctx.arg_local_dissector_table = register_dissector_table("camel.ros.local.arg", "CAMEL Operation Argument (local opcode)", FT_UINT32, BASE_HEX); - camel_rose_ctx.res_local_dissector_table = register_dissector_table("camel.ros.local.res", "CAMEL Operation Result (local opcode)", FT_UINT32, BASE_HEX); - camel_rose_ctx.err_local_dissector_table = register_dissector_table("camel.ros.local.err", "CAMEL Error (local opcode)", FT_UINT32, BASE_HEX); + camel_rose_ctx.arg_local_dissector_table = register_dissector_table("camel.ros.local.arg", + "CAMEL Operation Argument (local opcode)", + FT_UINT32, BASE_HEX); + camel_rose_ctx.res_local_dissector_table = register_dissector_table("camel.ros.local.res", + "CAMEL Operation Result (local opcode)", + FT_UINT32, BASE_HEX); + camel_rose_ctx.err_local_dissector_table = register_dissector_table("camel.ros.local.err", + "CAMEL Error (local opcode)", + FT_UINT32, BASE_HEX); /* Register our configuration options, particularly our ssn:s */ /* Set default SSNs */ range_convert_str(&global_ssn_range, "6-9", MAX_SSN); - ssn_range = range_empty(); camel_module = prefs_register_protocol(proto_camel, proto_reg_handoff_camel); diff --git a/asn1/inap/packet-inap-template.c b/asn1/inap/packet-inap-template.c index a5153b8dba..0bd49a7d4e 100644 --- a/asn1/inap/packet-inap-template.c +++ b/asn1/inap/packet-inap-template.c @@ -61,7 +61,6 @@ int proto_inap = -1; #define MAX_SSN 254 static range_t *global_ssn_range; -static range_t *ssn_range; static dissector_handle_t inap_handle; @@ -167,19 +166,19 @@ static void range_add_callback(guint32 ssn) void proto_reg_handoff_inap(void) { - static int inap_prefs_initialized = FALSE; + static gboolean inap_prefs_initialized = FALSE; + static range_t *ssn_range; if (!inap_prefs_initialized) { inap_prefs_initialized = TRUE; - - inap_handle = create_dissector_handle(dissect_inap, proto_inap); + inap_handle = find_dissector("inap"); oid_add_from_string("Core-INAP-CS1-Codes","0.4.0.1.1.0.3.0"); } else { 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); @@ -218,7 +217,6 @@ void proto_register_inap(void) { /* Set default SSNs */ range_convert_str(&global_ssn_range, "106,241", MAX_SSN); - ssn_range = range_empty(); inap_module = prefs_register_protocol(proto_inap, proto_reg_handoff_inap); diff --git a/asn1/pcap/packet-pcap-template.c b/asn1/pcap/packet-pcap-template.c index 51cf740d0f..a2a1807479 100644 --- a/asn1/pcap/packet-pcap-template.c +++ b/asn1/pcap/packet-pcap-template.c @@ -58,13 +58,11 @@ #define MAX_SSN 254 static range_t *global_ssn_range; -static range_t *ssn_range; static dissector_table_t sccp_ssn_table; #include "packet-pcap-val.h" -static dissector_handle_t data_handle; static dissector_handle_t pcap_handle = NULL; /* Initialize the protocol and registered fields */ @@ -163,33 +161,24 @@ static void range_add_callback(guint32 ssn) } } - -static void init_pcap(void) { - if (ssn_range) { - range_foreach(ssn_range, range_delete_callback); - g_free(ssn_range); - } - - ssn_range = range_copy(global_ssn_range); - range_foreach(ssn_range, range_add_callback); -} - - /*--- proto_reg_handoff_pcap ---------------------------------------*/ void proto_reg_handoff_pcap(void) { - static gboolean prefs_initialized = FALSE; + static range_t *ssn_range; if (! prefs_initialized) { + pcap_handle = find_dissector("pcap"); sccp_ssn_table = find_dissector_table("sccp.ssn"); prefs_initialized = TRUE; - } - - data_handle = find_dissector("data"); - #include "packet-pcap-dis-tab.c" + } else { + range_foreach(ssn_range, range_delete_callback); + g_free(ssn_range); + } + ssn_range = range_copy(global_ssn_range); + range_foreach(ssn_range, range_add_callback); } /*--- proto_register_pcap -------------------------------------------*/ @@ -220,7 +209,6 @@ void proto_register_pcap(void) { /* Register dissector */ register_dissector("pcap", dissect_pcap, proto_pcap); - pcap_handle = find_dissector("pcap"); /* Register dissector tables */ pcap_ies_dissector_table = register_dissector_table("pcap.ies", "PCAP-PROTOCOL-IES", FT_UINT32, BASE_DEC); @@ -234,16 +222,12 @@ void proto_register_pcap(void) { /* Preferences */ - /* Set default SSNs */ + /* Set default SSNs */ range_convert_str(&global_ssn_range, "", MAX_SSN); - ssn_range = range_empty(); prefs_register_range_preference(pcap_module, "ssn", "SCCP SSNs", - "SCCP (and SUA) SSNs to decode as PCAP", - &global_ssn_range, MAX_SSN); - - - register_init_routine(&init_pcap); + "SCCP (and SUA) SSNs to decode as PCAP", + &global_ssn_range, MAX_SSN); } diff --git a/asn1/pkixcmp/packet-cmp-template.c b/asn1/pkixcmp/packet-cmp-template.c index a988ffca3e..79a9ba43cd 100644 --- a/asn1/pkixcmp/packet-cmp-template.c +++ b/asn1/pkixcmp/packet-cmp-template.c @@ -59,17 +59,9 @@ /* desegmentation of CMP over TCP */ static gboolean cmp_desegment = TRUE; -static dissector_handle_t cmp_http_handle; -static dissector_handle_t cmp_tcp_style_http_handle; -static dissector_handle_t cmp_tcp_handle; - -static gboolean inited = FALSE; static guint cmp_alternate_tcp_port = 0; -static guint cmp_alternate_tcp_port_prev = 0; static guint cmp_alternate_http_port = 0; -static guint cmp_alternate_http_port_prev = 0; static guint cmp_alternate_tcp_style_http_port = 0; -static guint cmp_alternate_tcp_style_http_port_prev = 0; /* Initialize the protocol and registered fields */ int proto_cmp = -1; @@ -406,6 +398,13 @@ void proto_register_cmp(void) { /*--- proto_reg_handoff_cmp -------------------------------------------*/ void proto_reg_handoff_cmp(void) { + static gboolean inited = FALSE; + static dissector_handle_t cmp_http_handle; + static dissector_handle_t cmp_tcp_style_http_handle; + static dissector_handle_t cmp_tcp_handle; + static guint cmp_alternate_tcp_port_prev = 0; + static guint cmp_alternate_http_port_prev = 0; + static guint cmp_alternate_tcp_style_http_port_prev = 0; if (!inited) { cmp_http_handle = new_create_dissector_handle(dissect_cmp_http, proto_cmp); |