Wireshark  4.3.0
The Wireshark network protocol analyzer
feature_list.h
Go to the documentation of this file.
1 
12 #ifndef __WSUTIL_FEATURE_LIST_H__
13 #define __WSUTIL_FEATURE_LIST_H__
14 
15 #include <glib.h>
16 #include "ws_symbol_export.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21 
22 /*
23  * Handle to a list of features/dependencies.
24  * Semi-opaque. Functions which gather the list of features
25  * will be passed one of these to use with
26  * `with_feature()`/`without_feature()` (below).
27  */
28 typedef GList **feature_list;
29 
30 /*
31  * The format of entries in a feature_list is a char* starting with a
32  * '+' or '-' character indicating if the feature is respectively
33  * present or absent, followed by the unchanged feature description.
34  * This allows the insert order of features to be preserved,
35  * while still preserving the present/absent status in a simple way.
36  */
37 
38 
39 /*
40  * Pointer to a function which gathers a list of features.
41  */
42 typedef void(*gather_feature_func)(feature_list l);
43 
44 /*
45  * Add an indicator to the given feature_list that the named
46  * feature is present.
47  */
48 WS_DLL_PUBLIC
49 void with_feature(feature_list l, const char *fmt, ...) G_GNUC_PRINTF(2,3);
50 
51 /*
52  * Add an indicator to the given feature_list that the named
53  * feature is absent.
54  */
55 WS_DLL_PUBLIC
56 void without_feature(feature_list l, const char *fmt, ...) G_GNUC_PRINTF(2,3);
57 
58 /*
59  * Sort the given feature list, alphabetically by feature name.
60  * (The leading '+' or '-' is not factored into the sort.)
61  * Currently unused.
62  */
63 WS_DLL_PUBLIC
64 void sort_features(feature_list l);
65 
66 /*
67  * Free the memory used by the feature list,
68  * and reset its pointer to NULL.
69  */
70 WS_DLL_PUBLIC
71 void free_features(feature_list l);
72 
73 #ifdef __cplusplus
74 }
75 #endif /* __cplusplus */
76 
77 #endif /* __WSUTIL_FEATURE_LIST_H__ */