Add a separate hash table to the reassembly code for reassembled
[obnox/wireshark/wip.git] / 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: prefs-int.h,v 1.4 2001/11/04 02:50:19 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
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 notebook) */
32         void (*apply_cb)(void); /* routine to call when preferences applied */
33         GList   *prefs;         /* list of its preferences */
34         int     numprefs;       /* number of preferences */
35         gboolean prefs_changed; /* if TRUE, a preference has changed since we last checked */
36 };
37
38 /*
39  * PREF_OBSOLETE is used for preferences that a module used to support
40  * but no longer supports; we give different error messages for them.
41  */
42 typedef enum {
43         PREF_UINT,
44         PREF_BOOL,
45         PREF_ENUM,
46         PREF_STRING,
47         PREF_OBSOLETE
48 } pref_type_t;
49
50 struct preference {
51         const char *name;       /* name of preference */
52         const char *title;      /* title to use in GUI */
53         const char *description; /* human-readable description of preference */
54         int     ordinal;        /* ordinal number of this preference */
55         pref_type_t type;       /* type of that preference */
56         union {
57                 guint *uint;
58                 gboolean *bool;
59                 gint *enump;
60                 char **string;
61         } varp;                 /* pointer to variable storing the value */
62         union {
63                 guint uint;
64                 gboolean bool;
65                 gint enumval;
66                 char *string;
67         } saved_val;            /* original value, when editing from the GUI */
68         union {
69           guint base;                   /* input/output base, for PREF_UINT */
70           struct {
71             const enum_val_t *enumvals; /* list of name & values */
72             gboolean radio_buttons;     /* TRUE if it should be shown as
73                                            radio buttons rather than as an
74                                            option menu or combo box in
75                                            the preferences tab */
76           } enum_info;                  /* for PREF_ENUM */
77         } info;                 /* display/text file information */
78         void    *control;       /* handle for GUI control for this preference */
79 };
80
81 gint find_val_for_string(const char *needle, const enum_val_t *haystack,
82     gint default_value);
83
84 #endif /* prefs-int.h */