Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
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
19extern "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 */
28typedef 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 */
42typedef 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 */
48WS_DLL_PUBLIC
49void 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 */
55WS_DLL_PUBLIC
56void 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 */
63WS_DLL_PUBLIC
64void sort_features(feature_list l);
65
66/*
67 * Separate input list l into output lists with_list and without_list
68 * (which should be empty when first called).
69 * Note: output list members DO keep the leading '+'/'-' prefix.
70 */
71WS_DLL_PUBLIC
72void separate_features(feature_list l, feature_list with_list, feature_list without_list);
73
74/*
75 * Free the memory used by the feature list,
76 * and reset its pointer to NULL.
77 */
78WS_DLL_PUBLIC
79void free_features(feature_list l);
80
81#ifdef __cplusplus
82}
83#endif /* __cplusplus */
84
85#endif /* __WSUTIL_FEATURE_LIST_H__ */