From Lars Roland: Move timestamp_type into libethereal and provide accessor
[obnox/wireshark/wip.git] / epan / value_string.h
1 /* value_string.h
2  * Definitions for value_string structures and routines
3  *
4  * $Id: value_string.h,v 1.5 2004/02/22 22:45:21 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
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 __VALUE_STRING_H__
27 #define __VALUE_STRING_H__
28
29 #include <glib.h>
30
31 /* Struct for the match_strval function */
32
33 typedef struct _value_string {
34   guint32  value;
35   gchar   *strptr;
36 } value_string;
37
38 #define VS_DEF(x) { x, #x }
39 #define VS_END    { 0, NULL }
40
41 extern gchar*     match_strval(guint32, const value_string*);
42
43 extern gchar*     val_to_str(guint32, const value_string *, const char *);
44 extern const char *decode_enumerated_bitfield(guint32 val, guint32 mask,
45   int width, const value_string *tab, const char *fmt);
46 extern const char *decode_enumerated_bitfield_shifted(guint32 val, guint32 mask,
47   int width, const value_string *tab, const char *fmt);
48
49 #endif /* __VALUE_STRING_H__ */