/* 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;
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,
ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad,
proto_ieee8021ad);
+ dissector_add("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle);
prefs_initialized = TRUE;
}
old_ieee8021ah_ethertype = ieee8021ah_ethertype;
dissector_add("ethertype", ieee8021ah_ethertype, ieee8021ah_handle);
- dissector_add("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_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);
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);
tcp_port = global_kismet_tcp_port;
dissector_add("tcp.port", global_kismet_tcp_port, kismet_handle);
- data_handle = find_dissector("data");
}
/* 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;
/* 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)
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);
}
}
#define SCTP_PORT_M2PA 3565
static guint global_sctp_port = SCTP_PORT_M2PA;
-static guint sctp_port = 0;
void proto_reg_handoff_m2pa(void);
static gint ett_m2pa = -1;
static gint ett_m2pa_li = -1;
-static int mtp3_proto_id;
static dissector_handle_t mtp3_handle;
typedef enum {
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);
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);
/* 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;
/* 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[] = {
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
"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);
}
* 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)
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);
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;
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");
}
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);
/* 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 */
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);
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)
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);
}
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,
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 {
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);
}
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;
*/
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,
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
"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 }
"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 }
"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 }
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 }
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));
/* 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);
&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");
}
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);
+
}
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;
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;
#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 */
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);
/* 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;
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 */
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);
* 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);
-
- }
-
}