2 * Header for condition handler.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 /* forward declaration for type 'condition' */
31 typedef struct condition condition;
33 /* condition evaluation handler type */
34 typedef gboolean (*_cnd_eval)(condition *, va_list);
36 /* condition reset handler type */
37 typedef void (*_cnd_reset)(condition *);
39 /* condition class constructor type */
40 typedef condition *(*_cnd_constr)(condition *, va_list);
42 /* condition class destructor type */
43 typedef void (*_cnd_destr)(condition *);
46 * Conditions must be created with this function. They can be created for
47 * registered classes only.
49 * parameter: const char * - Identification of a registered condition class.
50 * ... - Any number of class specific initial values.
51 * returns: Pointer to a initialized condition of the particular class on
52 * success or NULL on failure.
54 condition *cnd_new(const char *, ...);
57 * Conditions must be deleted with this function when not used anymore.
59 * parameter: condition * - Pointer to a condition created with 'cnd_new()'.
62 void cnd_delete(condition *);
65 * Call this function to check whether or not a particular condition is true.
67 * parameter: condition * - Pointer to an initialized condition.
68 * ... - Any number of condition specific arguments.
69 * returns: TRUE - Condition is true.
70 * FALSE - Condition is false.
72 gboolean cnd_eval(condition *, ...);
75 * Call this function to reset this condition to its initial state, i.e. the
76 * state it was in right after creation.
78 * parameter: condition * - Pointer to an initialized condition.
81 void cnd_reset(condition *);
84 * Register a new conditon class.
85 * New conditions of this class can be created by calling 'cnd_new()' and
86 * supplying the appropriate class id.
88 * parameter: const char * - The class id.
89 * _cnd_constr - User supplied constructor function for this
91 * _cnd_destr - User supplied destructor function for this
93 * _cnd_eval - User supplied evaluation handler function for this
95 * _cnd_reset - User supplied reset handler for this class.
96 * returns: TRUE - Success.
99 gboolean cnd_register_class(const char *,
106 * Unregister a previously registered conditon class. After unregistration
107 * of a class it is no longer possible to create conditions of this kind by
108 * calling 'cnd_new()'.
110 * parameter: const char * - An identification for this condition class.
113 void cnd_unregister_class(const char *);
116 * This function returns the user data of the condition.
118 * parameter: condition * - Pointer to an initialized condition.
119 * returns: void * - Pointer to user data of this condition.
121 void* cnd_get_user_data(condition*);
124 * This function sets the user data of the condition.
126 * parameter: condition * - Pointer to an initialized condition.
127 * void * - Pointer to user specified data structure.
130 void cnd_set_user_data(condition *, void *);
132 #endif /* CONDITIONS_H */
135 * Editor modelines - http://www.wireshark.org/tools/modelines.html
140 * indent-tabs-mode: nil
143 * vi: set shiftwidth=4 tabstop=8 expandtab:
144 * :indentSize=4:tabSize=8:noTabs=true: