diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ieee8021ah.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-kismet.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-llt.c | 33 | ||||
-rw-r--r-- | epan/dissectors/packet-m2pa.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-mgcp.c | 23 | ||||
-rw-r--r-- | epan/dissectors/packet-mp4ves.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-netsync.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-quake.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-rtp-events.c | 56 | ||||
-rw-r--r-- | epan/dissectors/packet-sip.c | 124 | ||||
-rw-r--r-- | epan/dissectors/packet-tipc.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-vnc.c | 64 |
12 files changed, 185 insertions, 192 deletions
diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c index e9c207996b..ba1f1a690d 100644 --- a/epan/dissectors/packet-ieee8021ah.c +++ b/epan/dissectors/packet-ieee8021ah.c @@ -45,7 +45,6 @@ void dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo, /* ethertype for 802.1ah tag - encapsulating an Ethernet packet */ static unsigned int ieee8021ah_ethertype = ETHERTYPE_IEEE_802_1AH; -static unsigned int old_ieee8021ah_ethertype; static int proto_ieee8021ah = -1; static int proto_ieee8021ad = -1; @@ -434,6 +433,7 @@ proto_reg_handoff_ieee8021ah(void) static gboolean prefs_initialized = FALSE; static dissector_handle_t ieee8021ah_handle; static dissector_handle_t ieee8021ad_handle; + static unsigned int old_ieee8021ah_ethertype; if (!prefs_initialized){ ieee8021ah_handle = create_dissector_handle(dissect_ieee8021ah, @@ -441,6 +441,7 @@ proto_reg_handoff_ieee8021ah(void) ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad, proto_ieee8021ad); + dissector_add("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle); prefs_initialized = TRUE; } @@ -451,5 +452,4 @@ proto_reg_handoff_ieee8021ah(void) old_ieee8021ah_ethertype = ieee8021ah_ethertype; dissector_add("ethertype", ieee8021ah_ethertype, ieee8021ah_handle); - dissector_add("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle); } diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index cb5bc26232..2402d597a2 100644 --- a/epan/dissectors/packet-kismet.c +++ b/epan/dissectors/packet-kismet.c @@ -49,7 +49,6 @@ static dissector_handle_t data_handle; #define TCP_PORT_KISMET 2501 static guint global_kismet_tcp_port = TCP_PORT_KISMET; -static guint tcp_port = 0; static gboolean response_is_continuation(const guchar * data); void proto_reg_handoff_kismet(void); @@ -323,11 +322,13 @@ proto_register_kismet(void) void proto_reg_handoff_kismet(void) { - static int kismet_prefs_initialized = FALSE; + static gboolean kismet_prefs_initialized = FALSE; static dissector_handle_t kismet_handle; + static guint tcp_port; if (!kismet_prefs_initialized) { kismet_handle = new_create_dissector_handle(dissect_kismet, proto_kismet); + data_handle = find_dissector("data"); kismet_prefs_initialized = TRUE; } else { dissector_delete("tcp.port", tcp_port, kismet_handle); @@ -337,5 +338,4 @@ proto_reg_handoff_kismet(void) tcp_port = global_kismet_tcp_port; dissector_add("tcp.port", global_kismet_tcp_port, kismet_handle); - data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-llt.c b/epan/dissectors/packet-llt.c index 71780c57a1..3b33f7547b 100644 --- a/epan/dissectors/packet-llt.c +++ b/epan/dissectors/packet-llt.c @@ -48,9 +48,6 @@ void proto_reg_handoff_llt(void); /* Variables for our preferences */ static guint preference_alternate_ethertype = 0x0; -/* Behind the scenes variable to keep track of the last preference setting */ -static guint preference_alternate_ethertype_last; - /* Initialize the protocol and registered fields */ static int proto_llt = -1; @@ -63,8 +60,6 @@ static int hf_llt_message_time = -1; /* Initialize the subtree pointers */ static gint ett_llt = -1; -static dissector_handle_t llt_handle; /* Declaring this here allows us to use it for re-registration throughout the handoff function */ - /* Code to actually dissect the packets */ static void dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -153,13 +148,25 @@ proto_register_llt(void) void proto_reg_handoff_llt(void) { - llt_handle = create_dissector_handle(dissect_llt, proto_llt); - dissector_add("ethertype", ETHERTYPE_LLT, llt_handle); - - if((preference_alternate_ethertype != ETHERTYPE_LLT) - && (preference_alternate_ethertype != 0x0)){ - dissector_delete("ethertype", preference_alternate_ethertype_last, llt_handle); - preference_alternate_ethertype_last = preference_alternate_ethertype; /* Save the setting to see if it has changed later */ - dissector_add("ethertype", preference_alternate_ethertype, llt_handle); /* Register the new ethertype setting */ + static gboolean initialized = FALSE; + static dissector_handle_t llt_handle; + static guint preference_alternate_ethertype_last = 0x0; + + if (!initialized) { + llt_handle = create_dissector_handle(dissect_llt, proto_llt); + dissector_add("ethertype", ETHERTYPE_LLT, llt_handle); + initialized = TRUE; + } else { + if (preference_alternate_ethertype_last != 0x0) { + dissector_delete("ethertype", preference_alternate_ethertype_last, llt_handle); + } + } + + /* Save the setting to see if it has changed later */ + preference_alternate_ethertype_last = preference_alternate_ethertype; + + if (preference_alternate_ethertype != 0x0) { + /* Register the new ethertype setting */ + dissector_add("ethertype", preference_alternate_ethertype, llt_handle); } } diff --git a/epan/dissectors/packet-m2pa.c b/epan/dissectors/packet-m2pa.c index 92a0c92431..0373299188 100644 --- a/epan/dissectors/packet-m2pa.c +++ b/epan/dissectors/packet-m2pa.c @@ -44,7 +44,6 @@ #define SCTP_PORT_M2PA 3565 static guint global_sctp_port = SCTP_PORT_M2PA; -static guint sctp_port = 0; void proto_reg_handoff_m2pa(void); @@ -76,7 +75,6 @@ static int hf_pri_spare = -1; static gint ett_m2pa = -1; static gint ett_m2pa_li = -1; -static int mtp3_proto_id; static dissector_handle_t mtp3_handle; typedef enum { @@ -596,14 +594,14 @@ proto_register_m2pa(void) void proto_reg_handoff_m2pa(void) { - static int prefs_initialized = FALSE; + static gboolean prefs_initialized = FALSE; static dissector_handle_t m2pa_handle; + static guint sctp_port; /* Port preferences code shamelessly copied from packet-beep.c */ if (!prefs_initialized) { + m2pa_handle = find_dissector("m2pa"); mtp3_handle = find_dissector("mtp3"); - mtp3_proto_id = proto_get_id_by_filter_name("mtp3"); - m2pa_handle = create_dissector_handle(dissect_m2pa, proto_m2pa); dissector_add("sctp.ppi", M2PA_PAYLOAD_PROTOCOL_ID, m2pa_handle); diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index 8c564c9246..5cde55eb60 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -254,15 +254,6 @@ static guint global_mgcp_callagent_udp_port = UDP_PORT_MGCP_CALLAGENT; static gboolean global_mgcp_raw_text = FALSE; static gboolean global_mgcp_message_count = FALSE; -/* - * Variables to allow for proper deletion of dissector registration when - * the user changes port from the gui. - */ -static int gateway_tcp_port = 0; -static int gateway_udp_port = 0; -static int callagent_tcp_port = 0; -static int callagent_udp_port = 0; - /* Some basic utility functions that are specific to this dissector */ static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const gchar **verb_name); static gboolean is_mgcp_rspcode(tvbuff_t *tvb, gint offset, gint maxlength); @@ -949,13 +940,21 @@ void proto_register_mgcp(void) /* The registration hand-off routine */ void proto_reg_handoff_mgcp(void) { - static int mgcp_prefs_initialized = FALSE; + static gboolean mgcp_prefs_initialized = FALSE; static dissector_handle_t mgcp_tpkt_handle; - /* Get a handle for the SDP dissector. */ - sdp_handle = find_dissector("sdp"); + /* + * Variables to allow for proper deletion of dissector registration when + * the user changes port from the gui. + */ + static int gateway_tcp_port; + static int gateway_udp_port; + static int callagent_tcp_port; + static int callagent_udp_port; if (!mgcp_prefs_initialized) { + /* Get a handle for the SDP dissector. */ + sdp_handle = find_dissector("sdp"); mgcp_handle = new_create_dissector_handle(dissect_mgcp, proto_mgcp); mgcp_tpkt_handle = new_create_dissector_handle(dissect_tpkt_mgcp, proto_mgcp); mgcp_prefs_initialized = TRUE; diff --git a/epan/dissectors/packet-mp4ves.c b/epan/dissectors/packet-mp4ves.c index 063f1ad050..96c045c23d 100644 --- a/epan/dissectors/packet-mp4ves.c +++ b/epan/dissectors/packet-mp4ves.c @@ -56,8 +56,7 @@ static int ett_mp4ves_config = -1; /* The dynamic payload type which will be dissected as MP4V-ES */ -static guint dynamic_payload_type = 0; -static guint temp_dynamic_payload_type = 0; +static guint global_dynamic_payload_type = 0; static const range_string mp4ves_startcode_vals[] = { @@ -220,25 +219,23 @@ dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_reg_handoff_mp4ves(void) { - dissector_handle_t mp4ves_handle; - static int mp4ves_prefs_initialized = FALSE; - - mp4ves_handle = create_dissector_handle(dissect_mp4ves, proto_mp4ves); + static dissector_handle_t mp4ves_handle; + static guint dynamic_payload_type; + static gboolean mp4ves_prefs_initialized = FALSE; if (!mp4ves_prefs_initialized) { + mp4ves_handle = find_dissector("mp4ves"); + dissector_add_string("rtp_dyn_payload_type","MP4V-ES", mp4ves_handle); mp4ves_prefs_initialized = TRUE; }else{ if ( dynamic_payload_type > 95 ) dissector_delete("rtp.pt", dynamic_payload_type, mp4ves_handle); } - dynamic_payload_type = temp_dynamic_payload_type; + dynamic_payload_type = global_dynamic_payload_type; if ( dynamic_payload_type > 95 ){ dissector_add("rtp.pt", dynamic_payload_type, mp4ves_handle); } - - dissector_add_string("rtp_dyn_payload_type","MP4V-ES", mp4ves_handle); - } void @@ -295,6 +292,6 @@ proto_register_mp4ves(void) "MP4V-ES dynamic payload type", "The dynamic payload type which will be interpreted as MP4V-ES", 10, - &temp_dynamic_payload_type); + &global_dynamic_payload_type); } diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c index 79420be680..6da713d2b1 100644 --- a/epan/dissectors/packet-netsync.c +++ b/epan/dissectors/packet-netsync.c @@ -161,10 +161,7 @@ static int ett_netsync = -1; * for monotone netsync */ -static dissector_handle_t netsync_handle; - static guint global_tcp_port_netsync = TCP_PORT_NETSYNC; -static guint tcp_port_netsync = TCP_PORT_NETSYNC; static gboolean netsync_desegment = TRUE; static gint dissect_uleb128( tvbuff_t *tvb, gint offset, guint* size) @@ -757,8 +754,6 @@ proto_register_netsync(void) proto_register_field_array(proto_netsync, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - netsync_handle = create_dissector_handle(dissect_netsync, proto_netsync); - netsync_module = prefs_register_protocol(proto_netsync, proto_reg_handoff_netsync); @@ -779,12 +774,15 @@ proto_register_netsync(void) void proto_reg_handoff_netsync(void) { - static gint initialized = 0; + static dissector_handle_t netsync_handle; + static guint tcp_port_netsync; + static gboolean initialized = FALSE; - if (initialized) { - dissector_delete("tcp.port", tcp_port_netsync, netsync_handle); + if (!initialized) { + netsync_handle = create_dissector_handle(dissect_netsync, proto_netsync); + initialized = TRUE; } else { - initialized = 1; + dissector_delete("tcp.port", tcp_port_netsync, netsync_handle); } tcp_port_netsync = global_tcp_port_netsync; diff --git a/epan/dissectors/packet-quake.c b/epan/dissectors/packet-quake.c index 9bec019ddc..506e2bae76 100644 --- a/epan/dissectors/packet-quake.c +++ b/epan/dissectors/packet-quake.c @@ -516,20 +516,21 @@ dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_reg_handoff_quake(void) { - static int Initialized=FALSE; - static int ServerPort=0; + static gboolean Initialized=FALSE; + static int ServerPort; - if (Initialized) { - dissector_delete("udp.port", ServerPort, quake_handle); - } else { + if (!Initialized) { + quake_handle = create_dissector_handle(dissect_quake, proto_quake); + data_handle = find_dissector("data"); Initialized=TRUE; + } else { + dissector_delete("udp.port", ServerPort, quake_handle); } /* set port for future deletes */ ServerPort=gbl_quakeServerPort; dissector_add("udp.port", gbl_quakeServerPort, quake_handle); - data_handle = find_dissector("data"); } @@ -655,8 +656,6 @@ proto_register_quake(void) proto_register_field_array(proto_quake, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - quake_handle = create_dissector_handle(dissect_quake, proto_quake); - /* Register a configuration option for port */ quake_module = prefs_register_protocol(proto_quake, proto_reg_handoff_quake); diff --git a/epan/dissectors/packet-rtp-events.c b/epan/dissectors/packet-rtp-events.c index 8e3411d3ec..d634d6b8dd 100644 --- a/epan/dissectors/packet-rtp-events.c +++ b/epan/dissectors/packet-rtp-events.c @@ -46,12 +46,8 @@ /* rtp_event_payload_type_value is the value used globally to set the appropriate payload type - saved_pt_value is a temporary place to save the value - so we can properly reinitialize when the settings - get changed */ static guint rtp_event_payload_type_value = 101; -static guint saved_payload_type_value; /* RTP Event Fields */ @@ -87,9 +83,9 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) guint8 octet; if ( check_col( pinfo->cinfo, COL_PROTOCOL ) ) - { + { col_set_str( pinfo->cinfo, COL_PROTOCOL, "RTP EVENT" ); - } + } if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO); @@ -109,23 +105,23 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) if ( check_col( pinfo->cinfo, COL_INFO) ) - { + { col_add_fstr( pinfo->cinfo, COL_INFO, "Payload type=RTP Event, %s", val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" )); - } + } - ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, FALSE ); - rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events ); + ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, FALSE ); + rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events ); - proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt); + proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt); - octet = tvb_get_guint8(tvb, offset +1 ); - proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset+1, 1, octet); - proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset+1, 1, octet); - proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset+1, 1, octet); + octet = tvb_get_guint8(tvb, offset +1 ); + proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset+1, 1, octet); + proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset+1, 1, octet); + proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset+1, 1, octet); - proto_tree_add_item ( rtp_events_tree, hf_rtp_events_duration, tvb, offset+2, 2, FALSE); + proto_tree_add_item ( rtp_events_tree, hf_rtp_events_duration, tvb, offset+2, 2, FALSE); /* set the end info for the tap */ if (octet & 0x80) @@ -136,11 +132,11 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) rtp_event_info.info_end = FALSE; } - /* Make end-of-event packets obvious in the info column */ - if ((octet & 0x80) && check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, " (end)"); - } + /* Make end-of-event packets obvious in the info column */ + if ((octet & 0x80) && check_col(pinfo->cinfo, COL_INFO)) + { + col_append_str(pinfo->cinfo, COL_INFO, " (end)"); + } tap_queue_packet(rtp_event_tap, pinfo, &rtp_event_info); } @@ -229,9 +225,9 @@ proto_register_rtp_events(void) proto_register_subtree_array(ett, array_length(ett)); - /* Register preferences */ - rtp_events_module = prefs_register_protocol (proto_rtp_events, proto_reg_handoff_rtp_events); - prefs_register_uint_preference (rtp_events_module, + /* Register preferences */ + rtp_events_module = prefs_register_protocol (proto_rtp_events, proto_reg_handoff_rtp_events); + prefs_register_uint_preference (rtp_events_module, "event_payload_type_value", "Payload Type for RFC2833 RTP Events", "This is the value of the Payload Type field" "that specifies RTP Events", 10, @@ -246,10 +242,15 @@ void proto_reg_handoff_rtp_events(void) { static dissector_handle_t rtp_events_handle; - static int rtp_events_prefs_initialized = FALSE; + /* saved_payload_type_value is a temporary place to save */ + /* the value so we can properly reinitialize when the */ + /* settings get changed. */ + static guint saved_payload_type_value; + static gboolean rtp_events_prefs_initialized = FALSE; if (!rtp_events_prefs_initialized) { - rtp_events_handle = create_dissector_handle(dissect_rtp_events, proto_rtp_events); + rtp_events_handle = find_dissector("rtpevent"); + dissector_add_string("rtp_dyn_payload_type", "telephone-event", rtp_events_handle); rtp_events_prefs_initialized = TRUE; } else { @@ -259,6 +260,5 @@ proto_reg_handoff_rtp_events(void) saved_payload_type_value = rtp_event_payload_type_value; /* rtp_event_payload_type_value is set from preferences */ - dissector_add("rtp.pt", saved_payload_type_value, rtp_events_handle); - dissector_add_string("rtp_dyn_payload_type", "telephone-event", rtp_events_handle); + dissector_add("rtp.pt", saved_payload_type_value, rtp_events_handle); } diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 3c707b7c8e..770f97f232 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -66,10 +66,6 @@ static gint sip_tap = -1; static dissector_handle_t sigcomp_handle; -/* Dissectors */ -static dissector_handle_t sip_handle = NULL; -static dissector_handle_t sip_tcp_handle = NULL; - /* Initialize the protocol and registered fields */ static gint proto_sip = -1; static gint proto_raw_sip = -1; @@ -552,10 +548,6 @@ static gboolean sip_desegment_headers = TRUE; */ static gboolean sip_desegment_body = TRUE; -/* Gloabl variables */ -static guint saved_sip_tcp_port; -static guint saved_sip_tls_port; - /* Forward declaration we need below */ void proto_reg_handoff_sip(void); static gboolean dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, @@ -2751,28 +2743,28 @@ static gint sip_is_known_sip_header(tvbuff_t *tvb, int offset, guint header_len) static void tvb_raw_text_add(tvbuff_t *tvb, int offset, int length, proto_tree *tree) { - proto_tree *raw_tree = NULL; - proto_item *ti = NULL; - int next_offset, linelen, end_offset; - - if (tree) { - ti = proto_tree_add_item(tree, proto_raw_sip, tvb, offset, length, FALSE); - raw_tree = proto_item_add_subtree(ti, ett_raw_text); - } - - end_offset = offset + length; - - while (offset < end_offset) { - tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); - linelen = next_offset - offset; - if (raw_tree) { - proto_tree_add_string_format(raw_tree, hf_raw_sip_line, tvb, offset, linelen, - tvb_format_text(tvb, offset, linelen), - "%s", - tvb_format_text(tvb, offset, linelen)); - } - offset = next_offset; - } + proto_tree *raw_tree = NULL; + proto_item *ti = NULL; + int next_offset, linelen, end_offset; + + if (tree) { + ti = proto_tree_add_item(tree, proto_raw_sip, tvb, offset, length, FALSE); + raw_tree = proto_item_add_subtree(ti, ett_raw_text); + } + + end_offset = offset + length; + + while (offset < end_offset) { + tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + linelen = next_offset - offset; + if (raw_tree) { + proto_tree_add_string_format(raw_tree, hf_raw_sip_line, tvb, offset, linelen, + tvb_format_text(tvb, offset, linelen), + "%s", + tvb_format_text(tvb, offset, linelen)); + } + offset = next_offset; + } } /* Check to see if this packet is a resent request. Return value is the frame number @@ -3418,7 +3410,7 @@ void proto_register_sip(void) "RFC 3327: Path Header", HFILL } }, - { &hf_header_array[POS_PRIORITY], + { &hf_header_array[POS_PRIORITY], { "Priority", "sip.Priority", FT_STRING, BASE_NONE,NULL,0x0, "RFC 3261: Priority Header", HFILL } @@ -3429,7 +3421,7 @@ void proto_register_sip(void) "Privacy Header", HFILL } }, - { &hf_header_array[POS_PROXY_AUTHENTICATE], + { &hf_header_array[POS_PROXY_AUTHENTICATE], { "Proxy-Authenticate", "sip.Proxy-Authenticate", FT_STRING, BASE_NONE,NULL,0x0, "RFC 3261: Proxy-Authenticate Header", HFILL } @@ -3440,7 +3432,7 @@ void proto_register_sip(void) "RFC 3261: Proxy-Authorization Header", HFILL } }, - { &hf_header_array[POS_PROXY_REQUIRE], + { &hf_header_array[POS_PROXY_REQUIRE], { "Proxy-Require", "sip.Proxy-Require", FT_STRING, BASE_NONE,NULL,0x0, "RFC 3261: Proxy-Require Header", HFILL } @@ -3510,7 +3502,7 @@ void proto_register_sip(void) FT_STRING, BASE_NONE,NULL,0x0, "RFC 3261: Route Header", HFILL } }, - { &hf_header_array[POS_RSEQ], + { &hf_header_array[POS_RSEQ], { "RSeq", "sip.RSeq", FT_UINT32, BASE_DEC,NULL,0x0, "RFC 3262: RSeq Header", HFILL } @@ -3865,9 +3857,7 @@ void proto_register_sip(void) proto_raw_sip = proto_register_protocol("Session Initiation Protocol (SIP as raw text)", "Raw_SIP", "raw_sip"); new_register_dissector("sip", dissect_sip, proto_sip); - sip_handle = find_dissector("sip"); register_dissector("sip.tcp", dissect_sip_tcp, proto_sip); - sip_tcp_handle = find_dissector("sip.tcp"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sip, hf, array_length(hf)); @@ -3877,16 +3867,13 @@ void proto_register_sip(void) /* Register raw_sip field(s) */ proto_register_field_array(proto_raw_sip, raw_hf, array_length(raw_hf)); - /* SIP content type and internet media type used by other dissectors are the same */ - media_type_dissector_table = find_dissector_table("media_type"); - sip_module = prefs_register_protocol(proto_sip, proto_reg_handoff_sip); - prefs_register_uint_preference(sip_module, "tcp.port", + prefs_register_uint_preference(sip_module, "tcp.port", "SIP TCP Port", "SIP Server TCP Port", 10, &sip_tcp_port); - prefs_register_uint_preference(sip_module, "tls.port", + prefs_register_uint_preference(sip_module, "tls.port", "SIP TLS Port", "SIP Server TLS Port", 10, &sip_tls_port); @@ -3921,7 +3908,7 @@ void proto_register_sip(void) &sip_desegment_body); register_init_routine(&sip_init_protocol); - register_heur_dissector_list("sip", &heur_subdissector_list); + register_heur_dissector_list("sip", &heur_subdissector_list); /* Register for tapping */ sip_tap = register_tap("sip"); } @@ -3929,26 +3916,35 @@ void proto_register_sip(void) void proto_reg_handoff_sip(void) { - static gboolean sip_prefs_initialized = FALSE; - - if (sip_prefs_initialized) { - dissector_delete("tcp.port", saved_sip_tcp_port, sip_tcp_handle); - ssl_dissector_delete(saved_sip_tls_port, "sip.tcp", TRUE); - } else { - sip_prefs_initialized = TRUE; - } - /* Set our port number for future use */ - saved_sip_tcp_port = sip_tcp_port; - dissector_add("tcp.port", saved_sip_tcp_port, sip_tcp_handle); - saved_sip_tls_port = sip_tls_port; - ssl_dissector_add(saved_sip_tls_port, "sip.tcp", TRUE); - - dissector_add("udp.port", UDP_PORT_SIP, sip_handle); - dissector_add_string("media_type", "message/sip", sip_handle); - sigcomp_handle = find_dissector("sigcomp"); - - heur_dissector_add("udp", dissect_sip_heur, proto_sip); - heur_dissector_add("tcp", dissect_sip_tcp_heur, proto_sip); - heur_dissector_add("sctp", dissect_sip_heur, proto_sip); - heur_dissector_add("stun2", dissect_sip_heur, proto_sip); + static dissector_handle_t sip_handle; + static dissector_handle_t sip_tcp_handle; + static guint saved_sip_tcp_port; + static guint saved_sip_tls_port; + static gboolean sip_prefs_initialized = FALSE; + + if (!sip_prefs_initialized) { + sip_handle = find_dissector("sip"); + sip_tcp_handle = find_dissector("sip.tcp"); + sigcomp_handle = find_dissector("sigcomp"); + /* SIP content type and internet media type used by other dissectors are the same */ + media_type_dissector_table = find_dissector_table("media_type"); + + dissector_add("udp.port", UDP_PORT_SIP, sip_handle); + dissector_add_string("media_type", "message/sip", sip_handle); + + heur_dissector_add("udp", dissect_sip_heur, proto_sip); + heur_dissector_add("tcp", dissect_sip_tcp_heur, proto_sip); + heur_dissector_add("sctp", dissect_sip_heur, proto_sip); + heur_dissector_add("stun2", dissect_sip_heur, proto_sip); + sip_prefs_initialized = TRUE; + } else { + dissector_delete("tcp.port", saved_sip_tcp_port, sip_tcp_handle); + ssl_dissector_delete(saved_sip_tls_port, "sip.tcp", TRUE); + } + /* Set our port number for future use */ + saved_sip_tcp_port = sip_tcp_port; + saved_sip_tls_port = sip_tls_port; + dissector_add("tcp.port", saved_sip_tcp_port, sip_tcp_handle); + ssl_dissector_add(saved_sip_tls_port, "sip.tcp", TRUE); + } diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c index ebfd70d663..1f88c1ea02 100644 --- a/epan/dissectors/packet-tipc.c +++ b/epan/dissectors/packet-tipc.c @@ -52,8 +52,6 @@ static int proto_tipc = -1; /* dissector handles */ -static dissector_handle_t tipc_handle; -static dissector_handle_t tipc_tcp_handle; static dissector_handle_t data_handle; static dissector_handle_t ip_handle; @@ -186,7 +184,6 @@ static gint ett_tipc = -1; static gint ett_tipc_data = -1; /* protocol preferences */ -static gboolean inited = FALSE; static gboolean tipc_defragment = TRUE; static gboolean dissect_tipc_data = TRUE; static gboolean try_heuristic_first = FALSE; @@ -195,7 +192,6 @@ static gboolean try_heuristic_first = FALSE; #define V2_AS_1_7 0x4 static gint handle_v2_as = V2_AS_ALL; static guint tipc_alternate_tcp_port = 0; -static guint tipc_alternate_tcp_port_prev = 0; static gboolean tipc_tcp_desegment = TRUE; /* this is used to find encapsulated protocols */ @@ -2969,6 +2965,11 @@ proto_register_tipc(void) void proto_reg_handoff_tipc(void) { + static gboolean inited = FALSE; + static dissector_handle_t tipc_handle; + static dissector_handle_t tipc_tcp_handle; + static guint tipc_alternate_tcp_port_prev = 0; + if (!inited) { tipc_handle = create_dissector_handle(dissect_tipc, proto_tipc); tipc_tcp_handle = new_create_dissector_handle(dissect_tipc_tcp, proto_tipc); diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 8bce57cf9e..1a2ced273f 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -238,12 +238,6 @@ static guint8 vnc_get_bytes_per_pixel(packet_info *pinfo); /* Variables for our preferences */ static guint vnc_preference_alternate_port = 0; -/* This is a behind the scenes variable that is not changed by the user. - * This stores last setting of the vnc_preference_alternate_port. Used to keep - * track of when the user has changed the setting so that we can delete - * and re-register with the new port number. */ -static guint vnc_preference_alternate_port_last = 0; - /* Initialize the protocol and registered fields */ static int proto_vnc = -1; /* Protocol subtree */ static int hf_vnc_padding = -1; @@ -411,8 +405,6 @@ static gint ett_vnc_zrle_subencoding = -1; static gint ett_vnc_colormap_num_groups = -1; static gint ett_vnc_colormap_color_group = -1; -static dissector_handle_t vnc_handle; - guint8 vnc_bytes_per_pixel; /* Global so it keeps its value between packets */ @@ -2397,11 +2389,16 @@ proto_register_vnc(void) void proto_reg_handoff_vnc(void) { - static gboolean inited = FALSE; + static gboolean inited = FALSE; + static dissector_handle_t vnc_handle; + /* This is a behind the scenes variable that is not changed by the user. + * This stores last setting of the vnc_preference_alternate_port. Used to keep + * track of when the user has changed the setting so that we can delete + * and re-register with the new port number. */ + static guint vnc_preference_alternate_port_last = 0; - if(!inited) { - vnc_handle = create_dissector_handle(dissect_vnc, - proto_vnc); + if(!inited) { + vnc_handle = create_dissector_handle(dissect_vnc, proto_vnc); dissector_add("tcp.port", 5500, vnc_handle); dissector_add("tcp.port", 5501, vnc_handle); @@ -2414,26 +2411,27 @@ proto_reg_handoff_vnc(void) * VNC port. */ inited = TRUE; + } else { /* only after preferences have been read/changed */ + if(vnc_preference_alternate_port != vnc_preference_alternate_port_last && + vnc_preference_alternate_port != 5500 && + vnc_preference_alternate_port != 5501 && + vnc_preference_alternate_port != 5900 && + vnc_preference_alternate_port != 5901) { + if (vnc_preference_alternate_port_last != 0) { + dissector_delete("tcp.port", + vnc_preference_alternate_port_last, + vnc_handle); + } + /* Save this setting to see if has changed later */ + vnc_preference_alternate_port_last = + vnc_preference_alternate_port; + + /* Register the new port setting */ + if (vnc_preference_alternate_port != 0) { + dissector_add("tcp.port", + vnc_preference_alternate_port, + vnc_handle); + } + } } - - if(vnc_preference_alternate_port != 5500 && - vnc_preference_alternate_port != 5501 && - vnc_preference_alternate_port != 5900 && - vnc_preference_alternate_port != 5901 && - vnc_preference_alternate_port != 0) { - - dissector_delete("tcp.port", - vnc_preference_alternate_port_last, - vnc_handle); - - /* Save this setting to see if has changed later */ - vnc_preference_alternate_port_last = - vnc_preference_alternate_port; - - /* Register the new port setting */ - dissector_add("tcp.port", vnc_preference_alternate_port, - vnc_handle); - - } - } |