MSWSP: make printing of type optional in str_CBaseStorageVariant()
[wireshark-wip.git] / conditions.h
blob79c2cfad3d2dfae83066717c8c9321cd77d2f72f
1 /* conditions.h
2 * Header for condition handler.
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef CONDITIONS_H
26 #define CONDITIONS_H
28 #include <stdarg.h>
30 #include <glib.h>
32 /* forward declaration for type 'condition' */
33 typedef struct condition condition;
35 /* condition evaluation handler type */
36 typedef gboolean (*_cnd_eval)(condition*, va_list);
38 /* condition reset handler type */
39 typedef void (*_cnd_reset)(condition*);
41 /* condition class constructor type */
42 typedef condition* (*_cnd_constr)(condition*, va_list);
44 /* condition class destructor type */
45 typedef void (*_cnd_destr)(condition*);
48 * Conditions must be created with this function. They can be created for
49 * registered classes only.
51 * parameter: const char* - Identification of a registered condition class.
52 * ... - Any number of class specific initial values.
53 * returns: Pointer to a initialized condition of the particular class on
54 * success or NULL on failure.
56 condition* cnd_new(const char*, ...);
59 * Conditions must be deleted with this function when not used anymore.
61 * parameter: condition* - Pointer to a condition created with 'cnd_new()'.
62 * returns: -
64 void cnd_delete(condition*);
67 * Call this function to check whether or not a particular condition is true.
69 * parameter: condition* - Pointer to an initialized condition.
70 * ... - Any number of condition specific arguments.
71 * returns: TRUE - Condition is true.
72 * FALSE - Condition is false.
74 gboolean cnd_eval(condition*, ...);
77 * Call this function to reset this condition to its initial state, i.e. the
78 * state it was in right after creation.
80 * parameter: condition* - Pointer to an initialized condition.
81 * returns: -
83 void cnd_reset(condition*);
86 * Register a new conditon class.
87 * New conditions of this class can be created by calling 'cnd_new()' and
88 * supplying the appropriate class id.
90 * parameter: const char* - The class id.
91 * _cnd_constr - User supplied constructor function for this
92 * class.
93 * _cnd_destr - User supplied destructor function for this
94 * class.
95 * _cnd_eval - User supplied evaluation handler function for this
96 class.
97 * _cnd_reset - User supplied reset handler for this class.
98 * returns: TRUE - Success.
99 * FALSE - Failure.
101 gboolean cnd_register_class(const char*,
102 _cnd_constr,
103 _cnd_destr,
104 _cnd_eval,
105 _cnd_reset);
108 * Unregister a previously registered conditon class. After unregistration
109 * of a class it is no longer possible to create conditions of this kind by
110 * calling 'cnd_new()'.
112 * parameter: const char* - An identification for this condition class.
113 * returns: -
115 void cnd_unregister_class(const char*);
118 * This function returns the user data of the condition.
120 * parameter: condition* - Pointer to an initialized condition.
121 * returns: void* - Pointer to user data of this condition.
123 void* cnd_get_user_data(condition*);
126 * This function sets the user data of the condition.
128 * parameter: condition* - Pointer to an initialized condition.
129 * void* - Pointer to user specified data structure.
130 * returns: -
132 void cnd_set_user_data(condition*, void*);
134 #endif /* CONDITIONS_H */