From Jeff Morriss: PREF_RANGE preference type, for ranges of integers.
[obnox/wireshark/wip.git] / epan / range.h
1 /* range.h
2  * Range routines
3  *
4  * $Id$
5  *
6  * Dick Gooris <gooris@lucent.com>
7  * Ulf Lamping <ulf.lamping@web.de>
8  *
9  * Ethereal - Network traffic analyzer
10  * By Gerald Combs <gerald@ethereal.com>
11  * Copyright 1998 Gerald Combs
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef __RANGE_H__
29 #define __RANGE_H__
30
31 #include <glib.h>
32
33 #include <epan/frame_data.h>
34
35 /* Range parser variables */
36 #define MaxRange  30
37
38 #define MAXRANGESTRING 255
39
40 typedef struct range_admin_tag {
41     guint32 low;
42     guint32 high;
43 } range_admin_t;
44
45 typedef struct range {
46     /* user specified range(s) */
47     guint           nranges;        /* number of entries in ranges (0 based) */
48     range_admin_t   ranges[MaxRange];
49 } range_t;
50
51 extern void range_init(range_t *range);
52
53 extern void range_convert_str(range_t *range, const gchar *es,
54     guint32 max_value);
55
56 extern gboolean value_is_in_range(range_t *range, guint32 val);
57
58 extern gboolean ranges_are_equal(range_t *a, range_t *b);
59
60 extern void range_foreach(range_t *range, void (*callback)(guint32 val));
61
62 extern char *range_convert_range(range_t *range, char *string);
63
64 #endif /* __RANGE_H__ */