From 8c6ad121d8f9680a1a0042eb156ecd8df389e4f0 Mon Sep 17 00:00:00 2001 From: Luis Ontanon Date: Tue, 27 Mar 2007 22:56:07 +0000 Subject: megaco - replace #pragma for #include - move register function and remove prototype h248 - have dissector being called through megaco instead of registering to the same sctp.ppi svn path=/trunk/; revision=21234 --- asn1/h248/packet-h248-template.c | 1 - epan/dissectors/packet-h248.c | 1 - epan/dissectors/packet-megaco.c | 91 ++++++++++++++++------------------------ 3 files changed, 36 insertions(+), 57 deletions(-) diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c index 554bda9d95..b9fef3fe5f 100644 --- a/asn1/h248/packet-h248-template.c +++ b/asn1/h248/packet-h248-template.c @@ -1369,7 +1369,6 @@ void proto_reg_handoff_h248(void) { h248_tpkt_handle = find_dissector("h248.tpkt"); dissector_add("mtp3.service_indicator", GATEWAY_CONTROL_PROTOCOL_USER_ID, h248_handle); - dissector_add("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, h248_handle); dissector_add("udp.port", udp_port, h248_handle); dissector_add("tcp.port", tcp_port, h248_tpkt_handle); } diff --git a/epan/dissectors/packet-h248.c b/epan/dissectors/packet-h248.c index c8aa9b9c16..ea234553ca 100644 --- a/epan/dissectors/packet-h248.c +++ b/epan/dissectors/packet-h248.c @@ -7325,7 +7325,6 @@ void proto_reg_handoff_h248(void) { h248_tpkt_handle = find_dissector("h248.tpkt"); dissector_add("mtp3.service_indicator", GATEWAY_CONTROL_PROTOCOL_USER_ID, h248_handle); - dissector_add("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, h248_handle); dissector_add("udp.port", udp_port, h248_handle); dissector_add("tcp.port", tcp_port, h248_tpkt_handle); } diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index fa5350dfe1..e86ae3917e 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -63,17 +63,11 @@ #include #include +#include #define PORT_MEGACO_TXT 2944 #define PORT_MEGACO_BIN 2945 -#ifdef _MSC_VER -/* disable: warning C4013: 'xy' undefined; assuming extern returning int */ -#pragma warning(disable:4013) -#endif - -void proto_reg_handoff_megaco(void); - /* Define the megaco proto */ static int proto_megaco = -1; @@ -3243,6 +3237,41 @@ static void tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree){ } /* Register all the bits needed with the filtering engine */ +/* The registration hand-off routine */ +void +proto_reg_handoff_megaco(void) +{ + static int megaco_prefs_initialized = FALSE; + static dissector_handle_t megaco_text_tcp_handle; + + sdp_handle = find_dissector("sdp"); + h245_handle = find_dissector("h245dg"); + h248_handle = find_dissector("h248"); + + if (!megaco_prefs_initialized) { + megaco_text_handle = create_dissector_handle(dissect_megaco_text, + proto_megaco); + megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, + proto_megaco); + + megaco_prefs_initialized = TRUE; + } + else { + dissector_delete("tcp.port", txt_tcp_port, megaco_text_tcp_handle); + dissector_delete("udp.port", txt_udp_port, megaco_text_handle); + } + + /* Set our port number for future use */ + + txt_tcp_port = global_megaco_txt_tcp_port; + txt_udp_port = global_megaco_txt_udp_port; + + dissector_add("tcp.port", global_megaco_txt_tcp_port, megaco_text_tcp_handle); + dissector_add("udp.port", global_megaco_txt_udp_port, megaco_text_handle); + + dissector_add("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle); + +} void proto_register_megaco(void) @@ -3461,54 +3490,6 @@ proto_register_megaco(void) -/* The registration hand-off routine */ -void -proto_reg_handoff_megaco(void) -{ - static int megaco_prefs_initialized = FALSE; - static dissector_handle_t megaco_text_tcp_handle; - - sdp_handle = find_dissector("sdp"); - h245_handle = find_dissector("h245dg"); - h248_handle = find_dissector("h248"); - - if (!megaco_prefs_initialized) { - megaco_text_handle = create_dissector_handle(dissect_megaco_text, - proto_megaco); - megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, - proto_megaco); - - megaco_prefs_initialized = TRUE; - } - else { - dissector_delete("tcp.port", txt_tcp_port, megaco_text_tcp_handle); - dissector_delete("udp.port", txt_udp_port, megaco_text_handle); -#if 0 - dissector_delete("tcp.port", bin_tcp_port, megaco_text_tcp_handle); - dissector_delete("udp.port", bin_udp_port, megaco_bin_handle); -#endif - } - - /* Set our port number for future use */ - - txt_tcp_port = global_megaco_txt_tcp_port; - txt_udp_port = global_megaco_txt_udp_port; - -#if 0 - bin_tcp_port = global_megaco_bin_tcp_port; - bin_udp_port = global_megaco_bin_udp_port; -#endif - - dissector_add("tcp.port", global_megaco_txt_tcp_port, megaco_text_tcp_handle); - dissector_add("udp.port", global_megaco_txt_udp_port, megaco_text_handle); -#if 0 - dissector_add("tcp.port", global_megaco_bin_tcp_port, megaco_bin_handle); - dissector_add("udp.port", global_megaco_bin_udp_port, megaco_bin_handle); -#endif - /* XXX - text or binary? Does that depend on the port number? */ - dissector_add("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle); - -} /* * tvb_skip_wsp - Returns the position in tvb of the first non-whitespace -- cgit v1.2.1