aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-01-03 07:53:48 +0000
committerGuy Harris <guy@alum.mit.edu>2001-01-03 07:53:48 +0000
commit3613c121fe53a2bcd70a3004a589bc38ecc2864d (patch)
tree8b8fd854a5439a0fff7bcda55cebf9e519245b3c
parentfee98dd94462787123ec7fa0d660044a4b1800c4 (diff)
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
-rw-r--r--epan/plugins.c4
-rw-r--r--packet-bxxp.c4
-rw-r--r--packet-clnp.c4
-rw-r--r--packet-diameter.c4
-rw-r--r--packet-ip.c4
-rw-r--r--packet-ipsec.c4
-rw-r--r--packet-ldp.c16
-rw-r--r--packet-ncp.c4
-rw-r--r--packet-ppp.c4
-rw-r--r--packet-tcp.c4
-rw-r--r--plugins/mgcp/packet-mgcp.c16
-rw-r--r--plugins/plugin_api.c4
-rw-r--r--plugins/plugin_api.h4
-rw-r--r--plugins/plugin_table.h8
-rw-r--r--prefs.c14
-rw-r--r--prefs.h7
16 files changed, 61 insertions, 44 deletions
diff --git a/epan/plugins.c b/epan/plugins.c
index 7dba4a661f..7b0e54e5f2 100644
--- a/epan/plugins.c
+++ b/epan/plugins.c
@@ -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;
diff --git a/packet-bxxp.c b/packet-bxxp.c
index 73cd680d8b..37e22f4cd6 100644
--- a/packet-bxxp.c
+++ b/packet-bxxp.c
@@ -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"
diff --git a/packet-clnp.c b/packet-clnp.c
index b950521922..62a58f5189 100644
--- a/packet-clnp.c
+++ b/packet-clnp.c
@@ -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)",
diff --git a/packet-diameter.c b/packet-diameter.c
index 82eb602368..9e2348a0c6 100644
--- a/packet-diameter.c
+++ b/packet-diameter.c
@@ -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",
diff --git a/packet-ip.c b/packet-ip.c
index 00a792ea8b..be3d51c15b 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -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",
diff --git a/packet-ipsec.c b/packet-ipsec.c
index 54b75b7eba..3f6c1d3ad5 100644
--- a/packet-ipsec.c
+++ b/packet-ipsec.c
@@ -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",
diff --git a/packet-ldp.c b/packet-ldp.c
index ac73c02a19..4f0228e222 100644
--- a/packet-ldp.c
+++ b/packet-ldp.c
@@ -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 */
diff --git a/packet-ncp.c b/packet-ncp.c
index b0d3dd4ed5..b1f8b910e5 100644
--- a/packet-ncp.c
+++ b/packet-ncp.c
@@ -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",
diff --git a/packet-ppp.c b/packet-ppp.c
index 97acc34a63..2aa17a141c 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -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",
diff --git a/packet-tcp.c b/packet-tcp.c
index 9e50ec65af..44059d4b07 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -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",
diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c
index 76811fffd1..f94fe51f2c 100644
--- a/plugins/mgcp/packet-mgcp.c
+++ b/plugins/mgcp/packet-mgcp.c
@@ -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 */
diff --git a/plugins/plugin_api.c b/plugins/plugin_api.c
index 942c5cbbbe..a9c2ad7749 100644
--- a/plugins/plugin_api.c
+++ b/plugins/plugin_api.c
@@ -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;
diff --git a/plugins/plugin_api.h b/plugins/plugin_api.h
index 6b6e24cbff..379309137f 100644
--- a/plugins/plugin_api.h
+++ b/plugins/plugin_api.h
@@ -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)
diff --git a/plugins/plugin_table.h b/plugins/plugin_table.h
index f8507279c2..f26b867b4e 100644
--- a/plugins/plugin_table.h
+++ b/plugins/plugin_table.h
@@ -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;
diff --git a/prefs.c b/prefs.c
index 77131d4af2..d35c2f0299 100644
--- a/prefs.c
+++ b/prefs.c
@@ -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"
@@ -114,6 +115,17 @@ prefs_register_module(const char *name, const char *title,
}
/*
+ * 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.
*/
static gint
diff --git a/prefs.h b/prefs.h
index 154abd6904..4e25be8288 100644
--- a/prefs.h
+++ b/prefs.h
@@ -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>
@@ -79,6 +79,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.
*/
void prefs_module_foreach(module_cb callback, gpointer user_data);