change the signature that asn2wrs generates for functions to marm all parameters...
[obnox/wireshark/wip.git] / epan / prefs-int.h
1 /* prefs-int.h
2  * Definitions for implementation of preference handling routines;
3  * used by "friends" of the preferences type.
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __PREFS_INT_H__
27 #define __PREFS_INT_H__
28
29 struct pref_module {
30         const char *name;       /* name of module */
31         const char *title;      /* title of module (displayed in preferences list) */
32         const char *description;/* Description of module (displayed in preferences notebook) */
33         void (*apply_cb)(void); /* routine to call when preferences applied */
34         GList   *prefs;         /* list of its preferences */
35         GList   *submodules;    /* list of its submodules */
36         int     numprefs;       /* number of non-obsolete preferences */
37         gboolean prefs_changed; /* if TRUE, a preference has changed since we last checked */
38         gboolean obsolete;      /* if TRUE, this is a module that used to
39                                    exist but no longer does */
40 };
41
42 /*
43  * Module used for protocol preferences. 
44  * With MSVC and a libwireshark.dll, we need a special declaration.
45  */
46 WS_VAR_IMPORT module_t *protocols_module;
47
48 /*
49  * PREF_OBSOLETE is used for preferences that a module used to support
50  * but no longer supports; we give different error messages for them.
51  */
52 typedef enum {
53         PREF_UINT,
54         PREF_BOOL,
55         PREF_ENUM,
56         PREF_STRING,
57         PREF_RANGE,
58         PREF_STATIC_TEXT,
59         PREF_UAT,
60         PREF_OBSOLETE
61 } pref_type_t;
62
63 struct preference {
64         const char *name;       /* name of preference */
65         const char *title;      /* title to use in GUI */
66         const char *description; /* human-readable description of preference */
67         int     ordinal;        /* ordinal number of this preference */
68         pref_type_t type;       /* type of that preference */
69         union {
70                 guint *uint;
71                 gboolean *boolp;
72                 gint *enump;
73                 const char **string;
74                 range_t **range;
75                 void* uat;
76         } varp;                 /* pointer to variable storing the value */
77         union {
78                 guint uint;
79                 gboolean boolval;
80                 gint enumval;
81                 char *string;
82                 range_t *range;
83         } saved_val;            /* original value, when editing from the GUI */
84         union {
85           guint base;                   /* input/output base, for PREF_UINT */
86           guint32 max_value;            /* maximum value of a range */
87           struct {
88             const enum_val_t *enumvals; /* list of name & values */
89             gboolean radio_buttons;     /* TRUE if it should be shown as
90                                            radio buttons rather than as an
91                                            option menu or combo box in
92                                            the preferences tab */
93           } enum_info;                  /* for PREF_ENUM */
94         } info;                 /* display/text file information */
95         void    *control;       /* handle for GUI control for this preference */
96 };
97
98 gint find_val_for_string(const char *needle, const enum_val_t *haystack,
99     gint default_value);
100
101
102 /* read_prefs_file: read in a generic config file and do a callback to */
103 /* pref_set_pair_fct() for every key/value pair found */
104 typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, gchar *value, void *private_data);
105
106 int
107 read_prefs_file(const char *pf_path, FILE *pf, pref_set_pair_cb pref_set_pair_fct, void *private_data);
108
109
110
111 #endif /* prefs-int.h */