diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c index 8154cd0500..6efe0ca905 100644 --- a/epan/dissectors/packet-amr.c +++ b/epan/dissectors/packet-amr.c @@ -85,7 +85,7 @@ static int ett_amr_toc = -1; /* The dynamic payload type which will be dissected as AMR */ -static guint global_dynamic_payload_type = 0; +static guint temp_dynamic_payload_type = 0; static gint amr_encoding_type = 0; static gint amr_mode = AMR_NB; @@ -560,18 +560,20 @@ void proto_reg_handoff_amr(void) { static dissector_handle_t amr_handle; - static dissector_handle_t amr_name_handle; - static guint saved_dynamic_payload_type; + static guint dynamic_payload_type; static gboolean amr_prefs_initialized = FALSE; - amr_capability_t *ftr; if (!amr_prefs_initialized) { + dissector_handle_t amr_name_handle; + amr_capability_t *ftr; + amr_handle = find_dissector("amr"); - amr_name_handle = create_dissector_handle(dissect_amr_name, proto_amr); dissector_add_string("rtp_dyn_payload_type","AMR", amr_handle); + /* * Register H.245 Generic parameter name(s) */ + amr_name_handle = create_dissector_handle(dissect_amr_name, proto_amr); for (ftr=amr_capability_tab; ftr->id; ftr++) { if (ftr->name) dissector_add_string("h245.gef.name", ftr->id, amr_name_handle); @@ -583,14 +585,15 @@ proto_reg_handoff_amr(void) */ amr_prefs_initialized = TRUE; } else { - if ( saved_dynamic_payload_type > 95 ) - dissector_delete("rtp.pt", saved_dynamic_payload_type, amr_handle); + if ( dynamic_payload_type > 95 ) + dissector_delete("rtp.pt", dynamic_payload_type, amr_handle); } - if ( global_dynamic_payload_type > 95 ){ - dissector_add("rtp.pt", global_dynamic_payload_type, amr_handle); + dynamic_payload_type = temp_dynamic_payload_type; + + if ( dynamic_payload_type > 95 ){ + dissector_add("rtp.pt", dynamic_payload_type, amr_handle); } - saved_dynamic_payload_type = global_dynamic_payload_type; } @@ -752,7 +755,7 @@ proto_register_amr(void) "The dynamic payload type which will be interpreted as AMR" "; The value must be greater than 95", 10, - &global_dynamic_payload_type); + &temp_dynamic_payload_type); prefs_register_enum_preference(amr_module, "encoding.version", "Type of AMR encoding of the payload", diff --git a/epan/dissectors/packet-h263p.c b/epan/dissectors/packet-h263p.c index ae983984a1..d37604ce91 100644 --- a/epan/dissectors/packet-h263p.c +++ b/epan/dissectors/packet-h263p.c @@ -68,7 +68,6 @@ static gint ett_h263P_data = -1; /* The dynamic payload type which will be dissected as H.263-1998/H263-2000 */ -static guint dynamic_payload_type = 0; static guint temp_dynamic_payload_type = 0; /* RFC 4629 */ @@ -211,12 +210,14 @@ dissect_h263P( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) void proto_reg_handoff_h263P(void) { - dissector_handle_t h263P_handle; - static int h263P_prefs_initialized = FALSE; - - h263P_handle = create_dissector_handle(dissect_h263P, proto_h263P); + static dissector_handle_t h263P_handle; + static guint dynamic_payload_type; + static gboolean h263P_prefs_initialized = FALSE; if (!h263P_prefs_initialized) { + h263P_handle = find_dissector("h263P"); + dissector_add_string("rtp_dyn_payload_type","H263-1998", h263P_handle); + dissector_add_string("rtp_dyn_payload_type","H263-2000", h263P_handle); h263P_prefs_initialized = TRUE; } else { @@ -228,9 +229,6 @@ proto_reg_handoff_h263P(void) if ( dynamic_payload_type > 95 ){ dissector_add("rtp.pt", dynamic_payload_type, h263P_handle); } - - dissector_add_string("rtp_dyn_payload_type","H263-1998", h263P_handle); - dissector_add_string("rtp_dyn_payload_type","H263-2000", h263P_handle); } @@ -408,10 +406,11 @@ proto_register_h263P(void) h263P_module = prefs_register_protocol(proto_h263P, proto_reg_handoff_h263P); prefs_register_uint_preference(h263P_module, "dynamic.payload.type", - "H263-1998 and H263-2000 dynamic payload type", - "The dynamic payload type which will be interpreted as H264", - 10, - &temp_dynamic_payload_type); + "H263-1998 and H263-2000 dynamic payload type", + "The dynamic payload type which will be interpreted as H264" + "; The value must be greater than 95", + 10, + &temp_dynamic_payload_type); register_dissector("h263P", dissect_h263P, proto_h263P); diff --git a/epan/dissectors/packet-h264.c b/epan/dissectors/packet-h264.c index cb1d3bfa67..ef6940d256 100644 --- a/epan/dissectors/packet-h264.c +++ b/epan/dissectors/packet-h264.c @@ -187,7 +187,6 @@ static int ett_h264_par_ProfileIOP = -1; /* The dynamic payload type which will be dissected as H.264 */ -static guint dynamic_payload_type = 0; static guint temp_dynamic_payload_type = 0; /* syntax tables in subclause 7.3 is equal to @@ -1752,36 +1751,35 @@ dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree) void proto_reg_handoff_h264(void) { - dissector_handle_t h264_handle; - dissector_handle_t h264_name_handle; - h264_capability_t *ftr; - + static dissector_handle_t h264_handle; + static guint dynamic_payload_type; static int h264_prefs_initialized = FALSE; - - h264_handle = create_dissector_handle(dissect_h264, proto_h264); if (!h264_prefs_initialized) { + dissector_handle_t h264_name_handle; + h264_capability_t *ftr; + + h264_handle = find_dissector("h264"); + dissector_add_string("rtp_dyn_payload_type","H264", h264_handle); + + h264_name_handle = create_dissector_handle(dissect_h264_name, proto_h264); + for (ftr=h264_capability_tab; ftr->id; ftr++) { + if (ftr->name) + dissector_add_string("h245.gef.name", ftr->id, h264_name_handle); + if (ftr->content_pdu) + dissector_add_string("h245.gef.content", ftr->id, new_create_dissector_handle(ftr->content_pdu, proto_h264)); + } h264_prefs_initialized = TRUE; } else { - if ( dynamic_payload_type > 95 ) - dissector_delete("rtp.pt", dynamic_payload_type, h264_handle); + if ( dynamic_payload_type > 95 ) + dissector_delete("rtp.pt", dynamic_payload_type, h264_handle); } - dynamic_payload_type = temp_dynamic_payload_type; + dynamic_payload_type = temp_dynamic_payload_type; if ( dynamic_payload_type > 95 ){ dissector_add("rtp.pt", dynamic_payload_type, h264_handle); } - dissector_add_string("rtp_dyn_payload_type","H264", h264_handle); - - h264_name_handle = create_dissector_handle(dissect_h264_name, proto_h264); - for (ftr=h264_capability_tab; ftr->id; ftr++) { - if (ftr->name) - dissector_add_string("h245.gef.name", ftr->id, h264_name_handle); - if (ftr->content_pdu) - dissector_add_string("h245.gef.content", ftr->id, new_create_dissector_handle(ftr->content_pdu, proto_h264)); - } - } /* this format is require because a script is used to build the C function @@ -2342,67 +2340,66 @@ proto_register_h264(void) FT_UINT8, BASE_DEC, NULL, 0x0, "frame_num", HFILL } }, - - { &hf_h264_par_profile, - { "Profile", "h264.profile", - FT_UINT8, BASE_HEX, NULL, 0x00, - NULL, HFILL}}, - { &hf_h264_par_profile_b, - { "Baseline Profile", "h264.profile.base", - FT_BOOLEAN, 8, NULL, 0x40, - NULL, HFILL}}, - { &hf_h264_par_profile_m, - { "Main Profile", "h264.profile.main", - FT_BOOLEAN, 8, NULL, 0x20, - NULL, HFILL}}, - { &hf_h264_par_profile_e, - { "Extended Profile.", "h264.profile.ext", - FT_BOOLEAN, 8, NULL, 0x10, - NULL, HFILL}}, - { &hf_h264_par_profile_h, - { "High Profile", "h264.profile.high", - FT_BOOLEAN, 8, NULL, 0x08, - NULL, HFILL}}, - { &hf_h264_par_profile_h10, - { "High 10 Profile", "h264.profile.high10", - FT_BOOLEAN, 8, NULL, 0x04, - NULL, HFILL}}, - { &hf_h264_par_profile_h4_2_2, - { "High 4:2:2 Profile", "h264.profile.high4_2_2", - FT_BOOLEAN, 8, NULL, 0x02, - NULL, HFILL}}, - { &hf_h264_par_profile_h4_4_4, - { "High 4:4:4 Profile", "h264.profile.high4_4_4", - FT_BOOLEAN, 8, NULL, 0x01, - NULL, HFILL}}, - { &hf_h264_par_AdditionalModesSupported, - { "AdditionalModesSupported", "h264.AdditionalModesSupported", - FT_UINT8, BASE_HEX, NULL, 0x00, - NULL, HFILL}}, - { &hf_h264_par_add_mode_sup, - { "Additional Modes Supported", "h264.add_mode_sup", - FT_UINT8, BASE_HEX, NULL, 0x00, - NULL, HFILL}}, - { &hf_h264_par_add_mode_sup_rcdo, - { "Reduced Complexity Decoding Operation (RCDO) support", "h264.add_mode_sup.rcdo", - FT_BOOLEAN, 8, NULL, 0x40, - NULL, HFILL}}, - { &hf_h264_par_ProfileIOP, - { "ProfileIOP", "h264.ProfileIOP", - FT_UINT8, BASE_HEX, NULL, 0x00, - NULL, HFILL}}, - { &hf_h264_par_constraint_set0_flag, - { "constraint_set0_flag", "h264.par.constraint_set0_flag", - FT_BOOLEAN, 8, NULL, 0x80, - NULL, HFILL}}, - { &hf_h264_par_constraint_set1_flag, - { "constraint_set1_flag", "h264.par.constraint_set1_flag", - FT_BOOLEAN, 8, NULL, 0x40, - NULL, HFILL}}, - { &hf_h264_par_constraint_set2_flag, - { "constraint_set2_flag", "h264.par.constraint_set2_flag", - FT_BOOLEAN, 8, NULL, 0x20, - NULL, HFILL}}, + { &hf_h264_par_profile, + { "Profile", "h264.profile", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL}}, + { &hf_h264_par_profile_b, + { "Baseline Profile", "h264.profile.base", + FT_BOOLEAN, 8, NULL, 0x40, + NULL, HFILL}}, + { &hf_h264_par_profile_m, + { "Main Profile", "h264.profile.main", + FT_BOOLEAN, 8, NULL, 0x20, + NULL, HFILL}}, + { &hf_h264_par_profile_e, + { "Extended Profile.", "h264.profile.ext", + FT_BOOLEAN, 8, NULL, 0x10, + NULL, HFILL}}, + { &hf_h264_par_profile_h, + { "High Profile", "h264.profile.high", + FT_BOOLEAN, 8, NULL, 0x08, + NULL, HFILL}}, + { &hf_h264_par_profile_h10, + { "High 10 Profile", "h264.profile.high10", + FT_BOOLEAN, 8, NULL, 0x04, + NULL, HFILL}}, + { &hf_h264_par_profile_h4_2_2, + { "High 4:2:2 Profile", "h264.profile.high4_2_2", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL}}, + { &hf_h264_par_profile_h4_4_4, + { "High 4:4:4 Profile", "h264.profile.high4_4_4", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL}}, + { &hf_h264_par_AdditionalModesSupported, + { "AdditionalModesSupported", "h264.AdditionalModesSupported", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL}}, + { &hf_h264_par_add_mode_sup, + { "Additional Modes Supported", "h264.add_mode_sup", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL}}, + { &hf_h264_par_add_mode_sup_rcdo, + { "Reduced Complexity Decoding Operation (RCDO) support", "h264.add_mode_sup.rcdo", + FT_BOOLEAN, 8, NULL, 0x40, + NULL, HFILL}}, + { &hf_h264_par_ProfileIOP, + { "ProfileIOP", "h264.ProfileIOP", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL}}, + { &hf_h264_par_constraint_set0_flag, + { "constraint_set0_flag", "h264.par.constraint_set0_flag", + FT_BOOLEAN, 8, NULL, 0x80, + NULL, HFILL}}, + { &hf_h264_par_constraint_set1_flag, + { "constraint_set1_flag", "h264.par.constraint_set1_flag", + FT_BOOLEAN, 8, NULL, 0x40, + NULL, HFILL}}, + { &hf_h264_par_constraint_set2_flag, + { "constraint_set2_flag", "h264.par.constraint_set2_flag", + FT_BOOLEAN, 8, NULL, 0x20, + NULL, HFILL}}, }; /* Setup protocol subtree array */ @@ -2429,10 +2426,11 @@ proto_register_h264(void) h264_module = prefs_register_protocol(proto_h264, proto_reg_handoff_h264); prefs_register_uint_preference(h264_module, "dynamic.payload.type", - "H264 dynamic payload type", - "The dynamic payload type which will be interpreted as H264", - 10, - &temp_dynamic_payload_type); + "H264 dynamic payload type", + "The dynamic payload type which will be interpreted as H264" + "; The value must be greater than 95", + 10, + &temp_dynamic_payload_type); register_dissector("h264", dissect_h264, proto_h264); diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c index 596fed6e5c..7dd358a728 100644 --- a/epan/dissectors/packet-netflow.c +++ b/epan/dissectors/packet-netflow.c @@ -84,20 +84,10 @@ static dissector_handle_t netflow_handle; * global_netflow_ports : holds the configured range of ports for netflow */ static range_t *global_netflow_ports = NULL; -/* - * netflow_ports : holds the currently used range of ports for netflow - */ -static range_t *netflow_ports = NULL; - /* * global_ipfix_ports : holds the configured range of ports for IPFIX */ static range_t *global_ipfix_ports = NULL; -/* - * ipfix_ports : holds the currently used range of ports for IPFIX - */ -static range_t *ipfix_ports = NULL; - /* * pdu identifiers & sizes @@ -3176,6 +3166,19 @@ ipfix_add_callback(guint32 port) static void netflow_reinit(void) { + /* XXX: registered as an "init" routine and also called whenever a netflow pref */ + /* is changed. The result thus appears to be that netflow_reinit is called */ + /* twice whenever a netflow pref is changed. */ + + /* + * netflow_ports : holds the currently used range of ports for netflow + */ + static range_t *netflow_ports = NULL; + /* + * ipfix_ports : holds the currently used range of ports for IPFIX + */ + static range_t *ipfix_ports = NULL; + int i; /* @@ -4326,7 +4329,7 @@ proto_register_netflow(void) void proto_reg_handoff_netflow(void) { - static int netflow_prefs_initialized = FALSE; + static gboolean netflow_prefs_initialized = FALSE; if (!netflow_prefs_initialized) { netflow_handle = new_create_dissector_handle(dissect_netflow, diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index 2424a194d3..6b6c348112 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -43,7 +43,6 @@ #define NSIP_LITTLE_ENDIAN 0 static range_t *global_nsip_udp_port_range; -static range_t *nsip_udp_port_range; #define DEFAULT_NSIP_PORT_RANGE "2157,19999" void proto_reg_handoff_nsip(void); @@ -1117,7 +1116,6 @@ proto_register_nsip(void) /* Set default UDP ports */ range_convert_str(&global_nsip_udp_port_range, DEFAULT_NSIP_PORT_RANGE, MAX_UDP_PORT); - nsip_udp_port_range = range_empty(); /* Register configuration options */ nsip_module = prefs_register_protocol(proto_nsip, proto_reg_handoff_nsip); @@ -1143,19 +1141,20 @@ range_add_callback(guint32 port) void proto_reg_handoff_nsip(void) { - static int nsip_prefs_initialized = FALSE; + static gboolean nsip_prefs_initialized = FALSE; + static range_t *nsip_udp_port_range; if (!nsip_prefs_initialized) { - nsip_handle = create_dissector_handle(dissect_nsip, proto_nsip); + nsip_handle = find_dissector("nsip"); + bssgp_handle = find_dissector("bssgp"); nsip_prefs_initialized = TRUE; } else { range_foreach(nsip_udp_port_range, range_delete_callback); + g_free(nsip_udp_port_range); } - g_free(nsip_udp_port_range); nsip_udp_port_range = range_copy(global_nsip_udp_port_range); range_foreach(nsip_udp_port_range, range_add_callback); - bssgp_handle = find_dissector("bssgp"); } diff --git a/epan/dissectors/packet-prp.c b/epan/dissectors/packet-prp.c index e24f2ef065..9d9d462865 100644 --- a/epan/dissectors/packet-prp.c +++ b/epan/dissectors/packet-prp.c @@ -360,7 +360,7 @@ void proto_register_prp(void) void proto_reg_handoff_prp(void) { - static int prefs_initialized = FALSE; + static gboolean prefs_initialized = FALSE; if (!prefs_initialized) { dissector_handle_t prp_supervision_frame_handle;