summaryrefslogtreecommitdiffstats
path: root/src/H5PLpublic.h
blob: b345188cb550f1503f6bc69131de8bc0243311e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5. The full HDF5 copyright notice, including      *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 * This file contains public declarations for the H5PL module.
 */

#ifndef _H5PLpublic_H
#define _H5PLpublic_H

/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions                    */

/*******************/
/* Public Typedefs */
/*******************/

/* Special string to indicate no plugin loading.
 */
#define H5PL_NO_PLUGIN "::"

//! [H5PL_type_t_snip]

/**
 * Plugin type (bit-position) used by the plugin library
 */
typedef enum H5PL_type_t {
    H5PL_TYPE_ERROR  = -1, /**< Error                */
    H5PL_TYPE_FILTER = 0,  /**< Filter               */
    H5PL_TYPE_VOL    = 1,  /**< VOL driver           */
    H5PL_TYPE_NONE   = 2   /**< Sentinel: This must be last!   */
} H5PL_type_t;

//! [H5PL_type_t_snip]

/* Common dynamic plugin type flags used by the set/get_loading_state functions */
#define H5PL_FILTER_PLUGIN 0x0001
#define H5PL_VOL_PLUGIN    0x0002
#define H5PL_ALL_PLUGIN    0xFFFF

#ifdef __cplusplus
extern "C" {
#endif

/* plugin state */
/**
 * \ingroup H5PL
 * \brief Controls the loadability of dynamic plugin types
 *
 * \param[in] plugin_control_mask The list of dynamic plugin types to enable or disable.\n
 *                                A plugin bit set to 0 (zero) prevents use of that dynamic plugin.\n
 *                                A plugin bit set to 1 (one) enables use of that dynamic plugin.\n
 *                                Setting \p plugin_control_mask to a negative value enables all dynamic
 *                                plugin types.\n
 *                                Setting \p plugin_control_mask to 0 (zero) disables all dynamic plugin\n
 *                                types.
 * \return \herr_t
 *
 * \details H5PLset_loading_state() uses one argument to enable or disable individual plugin types.
 *
 * \details The \p plugin_control_mask parameter is an encoded integer in which each bit controls a specific
 *          plugin type. Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
 *          \snippet this H5PL_type_t_snip
 *
 *          A plugin bit set to 0 (zero) prevents the use of the dynamic plugin type corresponding to that bit
 *          position. A plugin bit set to 1 (one) allows the use of that dynamic plugin type.
 *
 *          All dynamic plugin types can be enabled by setting \p plugin_control_mask to a negative value. A
 *          value of 0 (zero) will disable all dynamic plugin types.
 *
 *          The loading of external dynamic plugins can be controlled during runtime with an environment
 *          variable, \c HDF5_PLUGIN_PRELOAD. H5PLset_loading_state() inspects the \c HDF5_PLUGIN_PRELOAD
 *          environment variable every time it is called. If the environment variable is set to the special
 *          \c :: string, all dynamic plugins are disabled.
 *
 * \warning The environment variable \c HDF5_PLUGIN_PRELOAD controls the loading of dynamic plugin types at
 *          runtime. If it is set to disable all plugin types, then it will disable them for \Emph{all}
 *          running programs that access the same variable instance.
 *
 * \since 1.8.15
 *
 */
H5_DLL herr_t  H5PLset_loading_state(unsigned int plugin_control_mask);
/**
 * \ingroup H5PL
 * \brief Queries the loadability of dynamic plugin types
 *
 * \param[out] plugin_control_mask List of dynamic plugin types that are enabled or disabled.\n
 *                                 A plugin bit set to 0 (zero) indicates that that the dynamic plugin type is
 *                                 disabled.\n
 *                                 A plugin bit set to 1 (one) indicates that that the dynamic plugin type is
 *                                 enabled.\n
 *                                 If the value of \p plugin_control_mask is negative, all dynamic plugin types
 *                                 are enabled.\n
 *                                 If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins
 *                                 are disabled.
 * \return \herr_t
 *
 * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins
 *          (e.g.: filters, VOL drivers) will be loaded by the HDF5 library.
 *
 *          Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
 *          \snippet this H5PL_type_t_snip
 *
 * \since 1.8.15
 *
 */
H5_DLL herr_t  H5PLget_loading_state(unsigned int *plugin_control_mask /*out*/);
/**
 * \ingroup H5PL
 * \brief Inserts a plugin path at the end of the plugin search path list
 *
 * \param[in] search_path A plugin path
 * \return \herr_t
 *
 * \details H5PLappend() inserts a plugin path at the end of the plugin search path list.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLappend(const char *search_path);
/**
 * \ingroup H5PL
 * \brief Inserts a plugin path at the beginning of the plugin search path list
 *
 * \param[in] search_path A plugin path
 * \return \herr_t
 *
 * \details H5PLprepend() inserts a plugin path at the end of the plugin search path list.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLprepend(const char *search_path);
/**
 * \ingroup H5PL
 * \brief Replaces the path at the specified index in the plugin search path list
 *
 * \param[in] search_path A plugin path
 * \param[in] index Index
 * \return \herr_t
 *
 * \details H5PLreplace() replaces a plugin path at the specified index in the plugin search path list.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLreplace(const char *search_path, unsigned int index);
/**
 * \ingroup H5PL
 * \brief Inserts a path at the specified index in the plugin search path list
 *
 * \param[in] search_path A plugin path
 * \param[in] index Index
 * \return \herr_t
 *
 * \details H5PLinsert() inserts a plugin path at the specified index in the plugin search path list,
 *          moving other paths after \p index.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLinsert(const char *search_path, unsigned int index);
/**
 * \ingroup H5PL
 * \brief Removes a plugin path at a specified index from the plugin search path list
 *
 * \param[in] index Index
 * \return \herr_t
 *
 * \details H5PLremove() removes a plugin path at the specified \p index and compacts the plugin search path
 *          list.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLremove(unsigned int index);
/**
 * \ingroup H5PL
 * \brief Queries the plugin search path list at the specified index
 *
 * \param[in] index Index
 * \param[out] path_buf Pathname
 * \param[in] buf_size Size of \p path_buf
 * \return Returns the length of the path, a non-negative value, if successful; otherwise returns a negative
 *         value.
 *
 * \details H5PLget() queries the plugin path at a specified index. If \p path_buf is non-NULL then it writes
 *          up to \p buf_size bytes into that buffer and always returns the length of the path name.
 *
 *          If \p path_buf is NULL, this function will simply return the number of characters required to
 *          store the path name, ignoring \p path_buf and \p buf_size.
 *
 *          If an error occurs then the buffer pointed to by \p path_buf (NULL or non-NULL) is unchanged and
 *          the function returns a negative value. If a zero is returned for the name's length, then there is
 *          no path name associated with the index. and the \p path_buf buffer will be unchanged.
 *
 * \since 1.10.1
 *
 */
H5_DLL ssize_t H5PLget(unsigned int index, char *path_buf /*out*/, size_t buf_size);
/**
 * \ingroup H5PL
 * \brief Retrieves the number of stored plugin paths
 *
 * \param[out] num_paths Current length of the plugin search path list
 * \return \herr_t
 *
 * \details H5PLsize() retrieves the number of paths stored in the plugin search path list.
 *
 * \since 1.10.1
 *
 */
H5_DLL herr_t  H5PLsize(unsigned int *num_paths /*out*/);

#ifdef __cplusplus
}
#endif

#endif /* _H5PLpublic_H */