Add a new "prefs_register_protocol()" routine, which is like

"prefs_register_module()" except that it takes a protocol index as
returned by "proto_register_protocol()" as its first argument, rather
than taking two character strings as arguments as its first two
arguments, and uses the protocol's abbreviation as the name to use for
preferences in the preferences file and the "-o" flag and uses the
protocol's short name as the name to use in the tabs in the
"Edit->Preferences" window.

svn path=/trunk/; revision=2812
This commit is contained in:
Guy Harris 2001-01-03 07:53:48 +00:00
parent fee98dd944
commit 3613c121fe
16 changed files with 61 additions and 44 deletions

View File

@ -1,7 +1,7 @@
/* plugins.c
* plugin routines
*
* $Id: plugins.c,v 1.14 2000/11/29 09:10:03 guy Exp $
* $Id: plugins.c,v 1.15 2001/01/03 07:53:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -760,7 +760,7 @@ init_plugins(const char *plugin_dir)
patable.p_tvb_bytes_to_str = tvb_bytes_to_str;
patable.p_prefs_register_module = prefs_register_module;
patable.p_prefs_register_protocol = prefs_register_protocol;
patable.p_prefs_register_uint_preference = prefs_register_uint_preference;
patable.p_prefs_register_bool_preference = prefs_register_bool_preference;
patable.p_prefs_register_enum_preference = prefs_register_enum_preference;

View File

@ -1,7 +1,7 @@
/* packet-bxxp.c
* Routines for BXXP packet disassembly
*
* $Id: packet-bxxp.c,v 1.13 2001/01/03 06:55:27 guy Exp $
* $Id: packet-bxxp.c,v 1.14 2001/01/03 07:53:43 guy Exp $
*
* Copyright (c) 2000 by Richard Sharpe <rsharpe@ns.aus.com>
*
@ -1222,7 +1222,7 @@ proto_register_bxxp(void)
/* Register our configuration options for BXXP, particularly our port */
bxxp_module = prefs_register_module("bxxp", "BXXP", proto_reg_handoff_bxxp);
bxxp_module = prefs_register_protocol(proto_bxxp, proto_reg_handoff_bxxp);
prefs_register_uint_preference(bxxp_module, "tcp.port", "BXXP TCP Port",
"Set the port for BXXP messages (if other"

View File

@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
* $Id: packet-clnp.c,v 1.20 2001/01/03 06:55:27 guy Exp $
* $Id: packet-clnp.c,v 1.21 2001/01/03 07:53:43 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@ -1877,7 +1877,7 @@ void proto_register_clnp(void)
proto_register_field_array(proto_clnp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
clnp_module = prefs_register_module("clnp", "CLNP", NULL);
clnp_module = prefs_register_protocol(proto_clnp, NULL);
prefs_register_uint_preference(clnp_module, "tp_nsap_selector",
"NSAP selector for Transport Protocol (last byte in hexa)",
"NSAP selector for Transport Protocol (last byte in hexa)",

View File

@ -1,7 +1,7 @@
/* packet-diameter.c
* Routines for DIAMETER packet disassembly
*
* $Id: packet-diameter.c,v 1.9 2001/01/03 06:55:27 guy Exp $
* $Id: packet-diameter.c,v 1.10 2001/01/03 07:53:43 guy Exp $
*
* Copyright (c) 2000 by David Frascone <chaos@mindspring.com>
*
@ -704,7 +704,7 @@ proto_register_diameter(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register a configuration option for port */
diameter_module = prefs_register_module("Diameter", "diameter",
diameter_module = prefs_register_protocol(proto_diameter,
proto_reg_handoff_diameter);
prefs_register_uint_preference(diameter_module, "udp.port",
"DIAMETER UDP Port",

View File

@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
* $Id: packet-ip.c,v 1.116 2001/01/03 06:55:29 guy Exp $
* $Id: packet-ip.c,v 1.117 2001/01/03 07:53:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -1465,7 +1465,7 @@ proto_register_ip(void)
ip_dissector_table = register_dissector_table("ip.proto");
/* Register a configuration option for decoding TOS as DSCP */
ip_module = prefs_register_module("ip", "IP", NULL);
ip_module = prefs_register_protocol(proto_ip, NULL);
prefs_register_bool_preference(ip_module, "decode_tos_as_diffserv",
"Decode IPv4 TOS field as DiffServ field",
"Whether the IPv4 type-of-service field should be decoded as a Differentiated Services field",

View File

@ -1,7 +1,7 @@
/* packet-ipsec.c
* Routines for IPsec/IPComp packet disassembly
*
* $Id: packet-ipsec.c,v 1.23 2001/01/03 06:55:29 guy Exp $
* $Id: packet-ipsec.c,v 1.24 2001/01/03 07:53:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -356,7 +356,7 @@ proto_register_ipsec(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register a configuration option for placement of AH payload dissection */
ah_module = prefs_register_module("ah", "AH", NULL);
ah_module = prefs_register_protocol(proto_ah, NULL);
prefs_register_bool_preference(ah_module, "place_ah_payload_in_subtree",
"Place AH payload in subtree",
"Whether the AH payload decode should be placed in a subtree",

View File

@ -1,7 +1,7 @@
/* packet-ldp.c
* Routines for ldp packet disassembly
*
* $Id: packet-ldp.c,v 1.11 2001/01/03 06:55:29 guy Exp $
* $Id: packet-ldp.c,v 1.12 2001/01/03 07:53:43 guy Exp $
*
* Copyright (c) November 2000 by Richard Sharpe <rsharpe@ns.aus.com>
*
@ -789,9 +789,15 @@ proto_register_ldp(void)
};
module_t *ldp_module;
proto_ldp = proto_register_protocol("Label Distribution Protocol",
"LDP", "ldp");
proto_register_field_array(proto_ldp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Register our configuration options for , particularly our port */
ldp_module = prefs_register_module("ldp", "LDP", proto_reg_handoff_ldp);
ldp_module = prefs_register_protocol(proto_ldp, proto_reg_handoff_ldp);
prefs_register_uint_preference(ldp_module, "tcp.port", "LDP TCP Port",
"Set the port for messages (if other"
@ -803,12 +809,6 @@ proto_register_ldp(void)
" than the default of 646)",
10, &global_ldp_udp_port);
proto_ldp = proto_register_protocol("Label Distribution Protocol",
"LDP", "ldp");
proto_register_field_array(proto_ldp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
/* The registration hand-off routine */

View File

@ -3,7 +3,7 @@
* Gilbert Ramirez <gram@xiexie.org>
* Modified to allow NCP over TCP/IP decodes by James Coe <jammer@cin.net>
*
* $Id: packet-ncp.c,v 1.43 2001/01/03 06:55:30 guy Exp $
* $Id: packet-ncp.c,v 1.44 2001/01/03 07:53:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -388,7 +388,7 @@ proto_register_ncp(void)
register_init_routine(&ncp_init_protocol);
/* Register a configuration option for initial size of NCP hash */
ncp_module = prefs_register_module("ncp", "NCP", NULL);
ncp_module = prefs_register_protocol(proto_ncp, NULL);
prefs_register_uint_preference(ncp_module, "initial_hash_size",
"Initial Hash Size",
"Number of entries initially allocated for NCP hash",

View File

@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
* $Id: packet-ppp.c,v 1.49 2001/01/03 06:55:31 guy Exp $
* $Id: packet-ppp.c,v 1.50 2001/01/03 07:53:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -1429,7 +1429,7 @@ proto_register_ppp(void)
register_dissector("payload_ppp", dissect_payload_ppp);
/* Register the preferences for the ppp protocol */
ppp_module = prefs_register_module("ppp", "PPP", NULL);
ppp_module = prefs_register_protocol(proto_ppp, NULL);
prefs_register_enum_preference(ppp_module,
"ppp_fcs",

View File

@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
* $Id: packet-tcp.c,v 1.94 2001/01/03 06:55:33 guy Exp $
* $Id: packet-tcp.c,v 1.95 2001/01/03 07:53:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -755,7 +755,7 @@ proto_register_tcp(void)
register_heur_dissector_list("tcp", &heur_subdissector_list);
/* Register configuration preferences */
tcp_module = prefs_register_module("tcp", "TCP", NULL);
tcp_module = prefs_register_protocol(proto_tcp, NULL);
prefs_register_bool_preference(tcp_module, "tcp_summary_in_tree",
"Show TCP summary in protocol tree",
"Whether the TCP summary line should be shown in the protocol tree",

View File

@ -2,7 +2,7 @@
* Routines for mgcp packet disassembly
* RFC 2705
*
* $Id: packet-mgcp.c,v 1.12 2001/01/03 06:56:03 guy Exp $
* $Id: packet-mgcp.c,v 1.13 2001/01/03 07:53:48 guy Exp $
*
* Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
*
@ -430,9 +430,15 @@ proto_register_mgcp(void)
};
module_t *mgcp_module;
proto_mgcp = proto_register_protocol("Media Gateway Control Protocol",
"MGCP", "mgcp");
proto_register_field_array(proto_mgcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Register our configuration options for , particularly our ports */
mgcp_module = prefs_register_module("mgcp", "MGCP", proto_reg_handoff_mgcp);
mgcp_module = prefs_register_protocol(proto_mgcp, proto_reg_handoff_mgcp);
prefs_register_uint_preference(mgcp_module, "tcp.gateway_port",
"MGCP Gateway TCP Port",
@ -475,12 +481,6 @@ proto_register_mgcp(void)
"raw text",
&global_mgcp_dissect_tree);
proto_mgcp = proto_register_protocol("Media Gateway Control Protocol",
"MGCP", "mgcp");
proto_register_field_array(proto_mgcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
/* The registration hand-off routine */

View File

@ -1,7 +1,7 @@
/* plugin_api.c
* Routines for Ethereal plugins.
*
* $Id: plugin_api.c,v 1.13 2000/11/15 07:07:49 guy Exp $
* $Id: plugin_api.c,v 1.14 2001/01/03 07:53:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
@ -135,7 +135,7 @@ plugin_address_table_init(plugin_address_table_t *pat)
p_tvb_strneql = pat->p_tvb_strneql;
p_tvb_strncaseeql = pat->p_tvb_strncaseeql;
p_tvb_bytes_to_str = pat->p_tvb_bytes_to_str;
p_prefs_register_module = pat->p_prefs_register_module;
p_prefs_register_protocol = pat->p_prefs_register_protocol;
p_prefs_register_uint_preference = pat->p_prefs_register_uint_preference;
p_prefs_register_bool_preference = pat->p_prefs_register_bool_preference;
p_prefs_register_enum_preference = pat->p_prefs_register_enum_preference;

View File

@ -1,7 +1,7 @@
/* plugin_api.h
* Routines for Ethereal plugins.
*
* $Id: plugin_api.h,v 1.13 2000/11/29 09:49:27 guy Exp $
* $Id: plugin_api.h,v 1.14 2001/01/03 07:53:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
@ -153,7 +153,7 @@
#define tvb_bytes_to_str (*p_tvb_bytes_to_str)
#define prefs_register_module (*p_prefs_register_module)
#define prefs_register_protocol (*p_prefs_register_protocol)
#define prefs_register_uint_preference (*p_prefs_register_uint_preference)
#define prefs_register_bool_preference (*p_prefs_register_bool_preference)
#define prefs_register_enum_preference (*p_prefs_register_enum_preference)

View File

@ -1,7 +1,7 @@
/* plugin_table.h
* Table of exported addresses for Ethereal plugins.
*
* $Id: plugin_table.h,v 1.12 2001/01/03 07:37:29 guy Exp $
* $Id: plugin_table.h,v 1.13 2001/01/03 07:53:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
@ -163,8 +163,8 @@ typedef gint (*addr_tvb_strncaseeql)(tvbuff_t*, gint, const guint8 *, gint);
typedef gchar *(*addr_tvb_bytes_to_str)(tvbuff_t*, gint, gint len);
typedef struct pref_module *(*addr_prefs_register_module)(const char *,
const char *, void (*)(void));
typedef struct pref_module *(*addr_prefs_register_protocol)(int,
void (*)(void));
typedef void (*addr_prefs_register_uint_preference)(struct pref_module *,
const char *, const char *, const char *, guint, guint *);
typedef void (*addr_prefs_register_bool_preference)(struct pref_module *,
@ -295,7 +295,7 @@ typedef struct {
addr_tvb_bytes_to_str p_tvb_bytes_to_str;
addr_prefs_register_module p_prefs_register_module;
addr_prefs_register_protocol p_prefs_register_protocol;
addr_prefs_register_uint_preference p_prefs_register_uint_preference;
addr_prefs_register_bool_preference p_prefs_register_bool_preference;
addr_prefs_register_enum_preference p_prefs_register_enum_preference;

14
prefs.c
View File

@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
* $Id: prefs.c,v 1.45 2001/01/03 06:55:35 guy Exp $
* $Id: prefs.c,v 1.46 2001/01/03 07:53:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -53,6 +53,7 @@
#include "packet.h"
#include "file.h"
#include "prefs.h"
#include "proto.h"
#include "column.h"
#include "print.h"
#include "util.h"
@ -113,6 +114,17 @@ prefs_register_module(const char *name, const char *title,
return module;
}
/*
* Register that a protocol has preferences.
*/
module_t *
prefs_register_protocol(int id, void (*apply_cb)(void))
{
return prefs_register_module(proto_get_protocol_filter_name(id),
proto_get_protocol_short_name(id),
apply_cb);
}
/*
* Find a module, given its name.
*/

View File

@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
* $Id: prefs.h,v 1.26 2000/11/21 23:54:08 guy Exp $
* $Id: prefs.h,v 1.27 2001/01/03 07:53:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -78,6 +78,11 @@ module_t *prefs_register_module(const char *name, const char *title,
typedef void (*module_cb)(module_t *module, gpointer user_data);
/*
* Register that a protocol has preferences.
*/
module_t *prefs_register_protocol(int id, void (*apply_cb)(void));
/*
* Call a callback function, with a specified argument, for each module.
*/