diff options
author | Bill Meier <wmeier@newsguy.com> | 2008-11-04 21:48:25 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2008-11-04 21:48:25 +0000 |
commit | 5e4758e5e0fb59f50c48ee064946096b1013e597 (patch) | |
tree | 27bc1b876cd6c65833382847853bbfcd640e92b7 /asn1/h248 | |
parent | aea36789d479ac4868d678b0be48d8d19a77dee6 (diff) |
Move prefs processing from registered init fcn to proto_reg_handoff fcn
svn path=/trunk/; revision=26695
Diffstat (limited to 'asn1/h248')
-rw-r--r-- | asn1/h248/packet-h248-template.c | 80 |
1 files changed, 33 insertions, 47 deletions
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c index 4494d148d9..c62ee3e579 100644 --- a/asn1/h248/packet-h248-template.c +++ b/asn1/h248/packet-h248-template.c @@ -89,12 +89,9 @@ static emem_tree_t* trxs = NULL; static emem_tree_t* ctxs_by_trx = NULL; static emem_tree_t* ctxs = NULL; -static gboolean h248_prefs_initialized = FALSE; static gboolean keep_persistent_data = FALSE; -static guint32 udp_port = 2945; -static guint32 temp_udp_port = 2945; -static guint32 tcp_port = 2945; -static guint32 temp_tcp_port = 2945; +static guint global_udp_port = 2945; +static guint global_tcp_port = 2945; static gboolean h248_desegment = TRUE; @@ -1266,37 +1263,9 @@ dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } - -static void h248_init(void) { - - if (!h248_prefs_initialized) { - h248_prefs_initialized = TRUE; - } else { - if ( udp_port ) - dissector_delete("udp.port", udp_port, h248_handle); - - if ( tcp_port) - dissector_delete("tcp.port", tcp_port, h248_tpkt_handle); - } - - udp_port = temp_udp_port; - tcp_port = temp_tcp_port; - - if ( udp_port ) { - dissector_add("udp.port", udp_port, h248_handle); - } - - if ( tcp_port) { - dissector_add("tcp.port", tcp_port, h248_tpkt_handle); - } - - if (!h248_term_handle){ - h248_term_handle = find_dissector("h248term"); - } - -} - /*--- proto_register_h248 ----------------------------------------------*/ +void proto_reg_handoff_h248(void); + void proto_register_h248(void) { /* List of fields */ @@ -1405,7 +1374,7 @@ void proto_register_h248(void) { proto_register_field_array(proto_h248, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - h248_module = prefs_register_protocol(proto_h248, h248_init); + h248_module = prefs_register_protocol(proto_h248, proto_reg_handoff_h248); prefs_register_bool_preference(h248_module, "ctx_info", "Track Context", "Mantain relationships between transactions and contexts and display an extra tree showing context data", @@ -1414,20 +1383,17 @@ void proto_register_h248(void) { "UDP port", "Port to be decoded as h248", 10, - &temp_udp_port); + &global_udp_port); prefs_register_uint_preference(h248_module, "tcp_port", "TCP port", "Port to be decoded as h248", 10, - &temp_tcp_port); + &global_tcp_port); prefs_register_bool_preference(h248_module, "desegment", "Desegment H.248 over TCP", "Desegment H.248 messages that span more TCP segments", &h248_desegment); - - register_init_routine( &h248_init ); - msgs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_msgs"); trxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_trxs"); ctxs_by_trx = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs_by_trx"); @@ -1441,13 +1407,33 @@ void proto_register_h248(void) { /*--- proto_reg_handoff_h248 -------------------------------------------*/ void proto_reg_handoff_h248(void) { - h248_handle = find_dissector("h248"); - h248_tpkt_handle = find_dissector("h248.tpkt"); + static gboolean initialized = FALSE; + static guint32 udp_port; + static guint32 tcp_port; - dissector_add("mtp3.service_indicator", GATEWAY_CONTROL_PROTOCOL_USER_ID, h248_handle); - dissector_add("udp.port", udp_port, h248_handle); - dissector_add("tcp.port", tcp_port, h248_tpkt_handle); -} + if (!initialized) { + h248_handle = find_dissector("h248"); + h248_tpkt_handle = find_dissector("h248.tpkt"); + dissector_add("mtp3.service_indicator", GATEWAY_CONTROL_PROTOCOL_USER_ID, h248_handle); + h248_term_handle = find_dissector("h248term"); + initialized = TRUE; + } else { + if (udp_port != 0) + dissector_delete("udp.port", udp_port, h248_handle); + if (tcp_port != 0) + dissector_delete("tcp.port", tcp_port, h248_tpkt_handle); + } + + udp_port = global_udp_port; + tcp_port = global_tcp_port; + + if (udp_port != 0) { + dissector_add("udp.port", udp_port, h248_handle); + } + if (tcp_port != 0) { + dissector_add("tcp.port", tcp_port, h248_tpkt_handle); + } +} |