summaryrefslogtreecommitdiff
path: root/epan/prefs-int.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-10-01 08:33:53 +0000
committerGuy Harris <guy@alum.mit.edu>2004-10-01 08:33:53 +0000
commit92ee993e820d91225a6c97490eea0de189b10d34 (patch)
tree3467bd09881a56bf97d29bb9438249dd455240dc /epan/prefs-int.h
parentd6a9e37c97b9506693df2361377cb9521768bc00 (diff)
downloadwireshark-92ee993e820d91225a6c97490eea0de189b10d34.tar.gz
"prefs-int.h" belongs in epan, too.
svn path=/trunk/; revision=12168
Diffstat (limited to 'epan/prefs-int.h')
-rw-r--r--epan/prefs-int.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/epan/prefs-int.h b/epan/prefs-int.h
new file mode 100644
index 0000000000..055c980d06
--- /dev/null
+++ b/epan/prefs-int.h
@@ -0,0 +1,103 @@
+/* prefs-int.h
+ * Definitions for implementation of preference handling routines;
+ * used by "friends" of the preferences type.
+ *
+ * $Id$
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PREFS_INT_H__
+#define __PREFS_INT_H__
+
+struct pref_module {
+ const char *name; /* name of module */
+ const char *title; /* title of module (displayed in preferences notebook) */
+ gboolean is_subtree; /* if TRUE, this has other modules, not preferences, under it */
+ void (*apply_cb)(void); /* routine to call when preferences applied */
+ GList *prefs; /* list of its preferences or submodules */
+ int numprefs; /* number of non-obsolete preferences */
+ gboolean prefs_changed; /* if TRUE, a preference has changed since we last checked */
+ gboolean obsolete; /* if TRUE, this is a module that used to
+ exist but no longer does */
+};
+
+/*
+ * Module used for protocol preferences. With MSVC and a
+ * libethereal.dll, we need a special declaration.
+ */
+ETH_VAR_IMPORT module_t *protocols_module;
+
+/*
+ * PREF_OBSOLETE is used for preferences that a module used to support
+ * but no longer supports; we give different error messages for them.
+ */
+typedef enum {
+ PREF_UINT,
+ PREF_BOOL,
+ PREF_ENUM,
+ PREF_STRING,
+ PREF_OBSOLETE
+} pref_type_t;
+
+struct preference {
+ const char *name; /* name of preference */
+ const char *title; /* title to use in GUI */
+ const char *description; /* human-readable description of preference */
+ int ordinal; /* ordinal number of this preference */
+ pref_type_t type; /* type of that preference */
+ union {
+ guint *uint;
+ gboolean *boolp;
+ gint *enump;
+ char **string;
+ } varp; /* pointer to variable storing the value */
+ union {
+ guint uint;
+ gboolean boolval;
+ gint enumval;
+ char *string;
+ } saved_val; /* original value, when editing from the GUI */
+ union {
+ guint base; /* input/output base, for PREF_UINT */
+ struct {
+ const enum_val_t *enumvals; /* list of name & values */
+ gboolean radio_buttons; /* TRUE if it should be shown as
+ radio buttons rather than as an
+ option menu or combo box in
+ the preferences tab */
+ } enum_info; /* for PREF_ENUM */
+ } info; /* display/text file information */
+ void *control; /* handle for GUI control for this preference */
+};
+
+gint find_val_for_string(const char *needle, const enum_val_t *haystack,
+ gint default_value);
+
+
+/* read_prefs_file: read in a generic config file and do a callback to */
+/* pref_set_pair_fct() for every key/value pair found */
+typedef int (*pref_set_pair_cb) (gchar *key, gchar *value);
+
+int
+read_prefs_file(const char *pf_path, FILE *pf, pref_set_pair_cb pref_set_pair_fct);
+
+
+
+#endif /* prefs-int.h */