2 * Header for condition handler.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
18 /* forward declaration for type 'condition' */
19 typedef struct condition condition;
21 /* condition evaluation handler type */
22 typedef gboolean (*_cnd_eval)(condition *, va_list);
24 /* condition reset handler type */
25 typedef void (*_cnd_reset)(condition *);
27 /* condition class constructor type */
28 typedef condition *(*_cnd_constr)(condition *, va_list);
30 /* condition class destructor type */
31 typedef void (*_cnd_destr)(condition *);
34 * Conditions must be created with this function. They can be created for
35 * registered classes only.
37 * parameter: const char * - Identification of a registered condition class.
38 * ... - Any number of class specific initial values.
39 * returns: Pointer to a initialized condition of the particular class on
40 * success or NULL on failure.
42 condition *cnd_new(const char *, ...);
45 * Conditions must be deleted with this function when not used anymore.
47 * parameter: condition * - Pointer to a condition created with 'cnd_new()'.
50 void cnd_delete(condition *);
53 * Call this function to check whether or not a particular condition is true.
55 * parameter: condition * - Pointer to an initialized condition.
56 * ... - Any number of condition specific arguments.
57 * returns: TRUE - Condition is true.
58 * FALSE - Condition is false.
60 gboolean cnd_eval(condition *, ...);
63 * Call this function to reset this condition to its initial state, i.e. the
64 * state it was in right after creation.
66 * parameter: condition * - Pointer to an initialized condition.
69 void cnd_reset(condition *);
72 * Register a new conditon class.
73 * New conditions of this class can be created by calling 'cnd_new()' and
74 * supplying the appropriate class id.
76 * parameter: const char * - The class id.
77 * _cnd_constr - User supplied constructor function for this
79 * _cnd_destr - User supplied destructor function for this
81 * _cnd_eval - User supplied evaluation handler function for this
83 * _cnd_reset - User supplied reset handler for this class.
84 * returns: TRUE - Success.
87 gboolean cnd_register_class(const char *,
94 * Unregister a previously registered conditon class. After unregistration
95 * of a class it is no longer possible to create conditions of this kind by
96 * calling 'cnd_new()'.
98 * parameter: const char * - An identification for this condition class.
101 void cnd_unregister_class(const char *);
104 * This function returns the user data of the condition.
106 * parameter: condition * - Pointer to an initialized condition.
107 * returns: void * - Pointer to user data of this condition.
109 void* cnd_get_user_data(condition*);
112 * This function sets the user data of the condition.
114 * parameter: condition * - Pointer to an initialized condition.
115 * void * - Pointer to user specified data structure.
118 void cnd_set_user_data(condition *, void *);
120 #endif /* CONDITIONS_H */
123 * Editor modelines - http://www.wireshark.org/tools/modelines.html
128 * indent-tabs-mode: nil
131 * vi: set shiftwidth=4 tabstop=8 expandtab:
132 * :indentSize=4:tabSize=8:noTabs=true: