diff options
author | Bill Meier <wmeier@newsguy.com> | 2008-11-04 22:01:35 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2008-11-04 22:01:35 +0000 |
commit | 017f36d61bd8f72f3eb06f962245385dc0a5ed38 (patch) | |
tree | 285f9e57641612fd7549f040ef082a42a7c34c26 /asn1/h225 | |
parent | 92a9b695a49890ba962794753669551a2871ac3f (diff) |
Minor cleanup mostly related to proto_reg_handoff
Remove code for unused handles;
Localize handles to proto_reg_handoff as appropriate;
Localize "saved_prefs" to proto_reg_handoff;
In some cases: move "once-only" code in proto_reg_handoff
so that it's executed only the first time thru
proto_reg_handoff;
Properly delete/add port when pref changed (packet_ulp);
svn path=/trunk/; revision=26697
Diffstat (limited to 'asn1/h225')
-rw-r--r-- | asn1/h225/packet-h225-template.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c index 17646e0ef7..e2d3ad9d84 100644 --- a/asn1/h225/packet-h225-template.c +++ b/asn1/h225/packet-h225-template.c @@ -77,8 +77,6 @@ static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H225 messaages static int pi_current=0; h225_packet_info *h225_pi=&pi_arr[0]; -static dissector_handle_t h225ras_handle; -static dissector_handle_t H323UserInformation_handle; static dissector_handle_t data_handle; /* Subdissector tables */ static dissector_table_t nsp_object_dissector_table; @@ -121,7 +119,6 @@ static gboolean h225_h245_in_tree = TRUE; static gboolean h225_tp_in_tree = TRUE; /* Global variables */ -static guint saved_h225_tls_port; static guint32 ipv4_address; static guint32 ipv4_port; guint32 T38_manufacturer_code; @@ -151,15 +148,15 @@ dissect_h225_H323UserInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_tree *tr; int offset = 0; - pi_current++; - if(pi_current==5){ - pi_current=0; - } - h225_pi=&pi_arr[pi_current]; + pi_current++; + if(pi_current==5){ + pi_current=0; + } + h225_pi=&pi_arr[pi_current]; /* Init struct for collecting h225_packet_info */ - reset_h225_packet_info(h225_pi); - h225_pi->msg_type = H225_CS; + reset_h225_packet_info(h225_pi); + h225_pi->msg_type = H225_CS; next_tvb_init(&h245_list); next_tvb_init(&tp_list); @@ -194,15 +191,15 @@ dissect_h225_h225_RasMessage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree *tr; guint32 offset=0; - pi_current++; - if(pi_current==5){ - pi_current=0; - } - h225_pi=&pi_arr[pi_current]; + pi_current++; + if(pi_current==5){ + pi_current=0; + } + h225_pi=&pi_arr[pi_current]; /* Init struct for collecting h225_packet_info */ - reset_h225_packet_info(h225_pi); - h225_pi->msg_type = H225_RAS; + reset_h225_packet_info(h225_pi); + h225_pi->msg_type = H225_RAS; if (check_col(pinfo->cinfo, COL_PROTOCOL)){ col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); @@ -304,27 +301,25 @@ void proto_reg_handoff_h225(void) { static gboolean h225_prefs_initialized = FALSE; + static dissector_handle_t h225ras_handle; + static guint saved_h225_tls_port; + + if (!h225_prefs_initialized) { + h225ras_handle=find_dissector("h225.ras"); + dissector_add("udp.port", UDP_PORT_RAS1, h225ras_handle); + dissector_add("udp.port", UDP_PORT_RAS2, h225ras_handle); + + h245_handle = find_dissector("h245"); + h245dg_handle = find_dissector("h245dg"); + h4501_handle = find_dissector("h4501"); + data_handle = find_dissector("data"); + h225_prefs_initialized = TRUE; + } else { + ssl_dissector_delete(saved_h225_tls_port, "q931.tpkt", TRUE); + } - if (h225_prefs_initialized) { - ssl_dissector_delete(saved_h225_tls_port, "q931.tpkt", TRUE); - } else { - h225_prefs_initialized = TRUE; - } - - saved_h225_tls_port = h225_tls_port; - ssl_dissector_add(saved_h225_tls_port, "q931.tpkt", TRUE); - - h225ras_handle=new_create_dissector_handle(dissect_h225_h225_RasMessage, proto_h225); - dissector_add("udp.port", UDP_PORT_RAS1, h225ras_handle); - dissector_add("udp.port", UDP_PORT_RAS2, h225ras_handle); - - H323UserInformation_handle=find_dissector("h323ui"); - - h245_handle = find_dissector("h245"); - h245dg_handle = find_dissector("h245dg"); - h4501_handle = find_dissector("h4501"); - data_handle = find_dissector("data"); - + saved_h225_tls_port = h225_tls_port; + ssl_dissector_add(saved_h225_tls_port, "q931.tpkt", TRUE); } |