Minor cleanup mostly related to proto_reg_handoff

svn path=/trunk/; revision=26236
This commit is contained in:
Bill Meier 2008-09-19 17:39:44 +00:00
parent 8451a2b829
commit a3e6eb8071
6 changed files with 53 additions and 62 deletions

View File

@ -263,7 +263,7 @@ static guint gbl_diameterSctpPort=SCTP_PORT_DIAMETER;
static dissector_handle_t diameter_tcp_handle;
static range_t *global_diameter_tcp_port_range;
static range_t *diameter_tcp_port_range;
#define DEFAULT_DIAMETER_PORT_RANGE "3868,3868"
#define DEFAULT_DIAMETER_PORT_RANGE "3868"
/* desegmentation of Diameter over TCP */
static gboolean gbl_diameter_desegment = TRUE;
@ -711,7 +711,7 @@ dissect_diameter_common(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree)
col_add_fstr(pinfo->cinfo, COL_INFO,
"cmd=%s%s(%d) flags=%s %s=%s(%d) h2h=%x e2e=%x",
cmd_str,
((flags_bits>>4)&0x08) ? "Request" : "Answer",
((flags_bits>>4)&0x08) ? "Request" : "Answer",
cmd,
msgflags_str[((flags_bits>>4)&0x0f)],
c->version_rfc ? "appl" : "vend",
@ -1248,17 +1248,19 @@ range_add_callback(guint32 port)
void
proto_reg_handoff_diameter(void)
{
static int Initialized=FALSE;
static int SctpPort=0;
static gboolean Initialized=FALSE;
static guint SctpPort;
static dissector_handle_t diameter_handle;
data_handle = find_dissector("data");
if (!Initialized) {
diameter_handle = find_dissector("diameter");
diameter_tcp_handle = create_dissector_handle(dissect_diameter_tcp,
proto_diameter);
diameter_handle = new_create_dissector_handle(dissect_diameter,
proto_diameter);
data_handle = find_dissector("data");
/* Register special decoding for some AVP:s */
/* AVP Code: 266 Vendor-Id */
dissector_add("diameter.base", 266,
new_create_dissector_handle(dissect_diameter_vedor_id, proto_diameter));
Initialized=TRUE;
} else {
range_foreach(diameter_tcp_port_range, range_delete_callback);
@ -1275,9 +1277,6 @@ proto_reg_handoff_diameter(void)
dissector_add("sctp.port", gbl_diameterSctpPort, diameter_handle);
/* Register special decoding for some AVP:s */
/* AVP Code: 266 Vendor-Id */
dissector_add("diameter.base", 266, new_create_dissector_handle(dissect_diameter_vedor_id, proto_diameter));
}

View File

@ -4417,7 +4417,7 @@ void proto_reg_handoff_dmp (void)
static gboolean dmp_prefs_initialized = FALSE;
if (!dmp_prefs_initialized) {
dmp_handle = create_dissector_handle (dissect_dmp, proto_dmp);
dmp_handle = find_dissector(PFNAME);
dmp_prefs_initialized = TRUE;
} else {
range_foreach (dmp_port_range, range_delete_callback);

View File

@ -54,7 +54,7 @@ static module_t *hilscher_module;
* This is done separately from the disabled protocols list mainly so
* we can disable it by default. XXX Maybe there's a better way.
*/
static int hilscher_enable_dissector = FALSE;
static gboolean hilscher_enable_dissector = FALSE;
void proto_reg_handoff_hilscher(void);
@ -182,7 +182,7 @@ dissect_hilscher_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void proto_register_hilscher(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_information_type,
{ "Hilscher information block type", "hilscher.information_type",
FT_UINT8, BASE_HEX, VALS(information_type), 0x0, "", HFILL }
@ -195,20 +195,17 @@ void proto_register_hilscher(void)
{ "Event type", "hilscher.net_analyzer.gpio_edge", FT_UINT8,
BASE_HEX, VALS(gpio_edge), 0x0, "", HFILL }
},
};
};
static gint *ett[] = {
static gint *ett[] = {
&ett_information_type,
&ett_gpio_number,
&ett_gpio_edge,
};
};
if (proto_hilscher == -1)
{
proto_hilscher = proto_register_protocol ("Hilscher analyzer dissector", /* name */
"Hilscher", /* short name */
"hilscher"); /* abbrev */
}
proto_hilscher = proto_register_protocol ("Hilscher analyzer dissector", /* name */
"Hilscher", /* short name */
"hilscher"); /* abbrev */
hilscher_module = prefs_register_protocol(proto_hilscher, proto_reg_handoff_hilscher);
@ -223,11 +220,12 @@ void proto_register_hilscher(void)
void proto_reg_handoff_hilscher(void)
{
static int prefs_initialized = FALSE;
static gboolean prefs_initialized = FALSE;
if (!prefs_initialized) {
/* add heuristic dissector */
heur_dissector_add("eth", dissect_hilscher_heur, proto_hilscher);
prefs_initialized = TRUE;
}
proto_set_decoding(proto_hilscher, hilscher_enable_dissector);

View File

@ -46,8 +46,7 @@
void proto_reg_handoff_newmail(void);
/* Variables for preferences */
guint preference_default_port = 0;
guint preference_default_port_last = 0;
static guint preference_default_port = 0;
/* Initialize the protocol and registered fields */
static int proto_newmail = -1;
@ -129,28 +128,21 @@ void
proto_reg_handoff_newmail(void)
{
static gboolean inited = FALSE;
dissector_handle_t newmail_handle;
newmail_handle = find_dissector("newmail");
static dissector_handle_t newmail_handle;
static guint preference_default_port_last;
if(!inited) {
dissector_add("udp.port", preference_default_port, newmail_handle);
preference_default_port_last = preference_default_port;
newmail_handle = find_dissector("newmail");
dissector_add_handle("udp.port", newmail_handle); /* for 'decode-as' */
inited = TRUE;
}
if(preference_default_port != preference_default_port_last) {
/* Unregister the last setting */
dissector_delete("udp.port", preference_default_port_last,
newmail_handle);
/* Save the last setting so we can unregister it later */
preference_default_port_last = preference_default_port;
/* Register the new setting */
} else {
if (preference_default_port_last != 0) {
dissector_delete("udp.port", preference_default_port_last, newmail_handle);
}
}
if(preference_default_port != 0) {
dissector_add("udp.port", preference_default_port, newmail_handle);
}
preference_default_port_last = preference_default_port;
}

View File

@ -1393,10 +1393,10 @@ static void range_add_callback (guint32 port)
void proto_reg_handoff_p_mul (void)
{
static int p_mul_prefs_initialized = FALSE;
static gboolean p_mul_prefs_initialized = FALSE;
if (!p_mul_prefs_initialized) {
p_mul_handle = create_dissector_handle (dissect_p_mul, proto_p_mul);
p_mul_handle = find_dissector(PFNAME);
p_mul_prefs_initialized = TRUE;
} else {
range_foreach (p_mul_port_range, range_delete_callback);

View File

@ -2279,15 +2279,16 @@ proto_reg_handoff_sigcomp(void)
{
static dissector_handle_t sigcomp_handle;
static dissector_handle_t sigcomp_tcp_handle;
static int Initialized=FALSE;
static int udp_port1 = 5555;
static int udp_port2 = 6666;
static int tcp_port1 = 5555;
static int tcp_port2 = 6666;
static gboolean Initialized=FALSE;
static guint udp_port1;
static guint udp_port2;
static guint tcp_port1;
static guint tcp_port2;
if (!Initialized) {
sigcomp_handle = new_create_dissector_handle(dissect_sigcomp,proto_sigcomp);
sigcomp_handle = find_dissector("sigcomp");
sigcomp_tcp_handle = new_create_dissector_handle(dissect_sigcomp_tcp,proto_sigcomp);
sip_handle = find_dissector("sip");
Initialized=TRUE;
}else{
dissector_delete("udp.port", udp_port1, sigcomp_handle);
@ -2307,9 +2308,6 @@ proto_reg_handoff_sigcomp(void)
dissector_add("tcp.port", SigCompTCPPort1, sigcomp_tcp_handle);
dissector_add("tcp.port", SigCompTCPPort2, sigcomp_tcp_handle);
sip_handle = find_dissector("sip");
}
/* this format is require because a script is used to build the C function
@ -2706,7 +2704,8 @@ proto_register_sigcomp(void)
prefs_register_bool_preference(sigcomp_module, "display.bytecode",
"Display the bytecode of operands",
"preference whether to display the bytecode in UDVM operands or not",
"preference whether to display the bytecode in "
"UDVM operands or not",
&display_udvm_bytecode);
prefs_register_bool_preference(sigcomp_module, "decomp.msg",
"Decompress message",
@ -2714,12 +2713,15 @@ proto_register_sigcomp(void)
&decompress);
prefs_register_bool_preference(sigcomp_module, "display.decomp.msg.as.txt",
"Displays the decompressed message as text",
"preference whether to display the decompressed message as raw text or not",
"preference whether to display the decompressed message "
"as raw text or not",
&display_raw_txt);
prefs_register_enum_preference(sigcomp_module, "show.udvm.execution",
"Level of detail of UDVM execution",
"0 = UDVM executes silently, then increasing detail about execution of UDVM instructions, Warning! CPU intense at high detail",
&udvm_print_detail_level, udvm_detail_vals, FALSE);
prefs_register_enum_preference(sigcomp_module, "show.udvm.execution",
"Level of detail of UDVM execution:",
"'No-Printout' = UDVM executes silently, then increasing detail "
"about execution of UDVM instructions; "
"Warning! CPU intense at high detail",
&udvm_print_detail_level, udvm_detail_vals, FALSE);
register_init_routine(&sigcomp_init_protocol);