H5PLpublic.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * All rights reserved. *
  4. * *
  5. * This file is part of HDF5. The full HDF5 copyright notice, including *
  6. * terms governing use, modification, and redistribution, is contained in *
  7. * the COPYING file, which can be found at the root of the source code *
  8. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  9. * If you do not have access to either file, you may request a copy from *
  10. * help@hdfgroup.org. *
  11. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  12. /*
  13. * This file contains public declarations for the H5PL module.
  14. */
  15. #ifndef H5PLpublic_H
  16. #define H5PLpublic_H
  17. /* Public headers needed by this file */
  18. #include "H5public.h" /* Generic Functions */
  19. /*******************/
  20. /* Public Typedefs */
  21. /*******************/
  22. /* Special string to indicate no plugin loading.
  23. */
  24. #define H5PL_NO_PLUGIN "::"
  25. //! <!-- [H5PL_type_t_snip] -->
  26. /**
  27. * Plugin type (bit-position) used by the plugin library
  28. */
  29. typedef enum H5PL_type_t {
  30. H5PL_TYPE_ERROR = -1, /**< Error */
  31. H5PL_TYPE_FILTER = 0, /**< Filter */
  32. H5PL_TYPE_VOL = 1, /**< VOL connector */
  33. H5PL_TYPE_VFD = 2, /**< VFD */
  34. H5PL_TYPE_NONE = 3 /**< Sentinel: This must be last! */
  35. } H5PL_type_t;
  36. //! <!-- [H5PL_type_t_snip] -->
  37. /* Common dynamic plugin type flags used by the set/get_loading_state functions */
  38. #define H5PL_FILTER_PLUGIN 0x0001
  39. #define H5PL_VOL_PLUGIN 0x0002
  40. #define H5PL_VFD_PLUGIN 0x0004
  41. #define H5PL_ALL_PLUGIN 0xFFFF
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. /* plugin state */
  46. /**
  47. * \ingroup H5PL
  48. * \brief Controls the loadability of dynamic plugin types
  49. *
  50. * \param[in] plugin_control_mask The list of dynamic plugin types to enable or disable.\n
  51. * A plugin bit set to 0 (zero) prevents use of that dynamic plugin.\n
  52. * A plugin bit set to 1 (one) enables use of that dynamic plugin.\n
  53. * Setting \p plugin_control_mask to a negative value enables all dynamic
  54. * plugin types.\n
  55. * Setting \p plugin_control_mask to 0 (zero) disables all dynamic plugin\n
  56. * types.
  57. * \return \herr_t
  58. *
  59. * \details H5PLset_loading_state() uses one argument to enable or disable individual plugin types.
  60. *
  61. * \details The \p plugin_control_mask parameter is an encoded integer in which each bit controls a specific
  62. * plugin type. Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
  63. * \snippet this H5PL_type_t_snip
  64. *
  65. * A plugin bit set to 0 (zero) prevents the use of the dynamic plugin type corresponding to that bit
  66. * position. A plugin bit set to 1 (one) allows the use of that dynamic plugin type.
  67. *
  68. * All dynamic plugin types can be enabled by setting \p plugin_control_mask to a negative value. A
  69. * value of 0 (zero) will disable all dynamic plugin types.
  70. *
  71. * The loading of external dynamic plugins can be controlled during runtime with an environment
  72. * variable, \c HDF5_PLUGIN_PRELOAD. H5PLset_loading_state() inspects the \c HDF5_PLUGIN_PRELOAD
  73. * environment variable every time it is called. If the environment variable is set to the special
  74. * \c :: string, all dynamic plugins are disabled.
  75. *
  76. * \warning The environment variable \c HDF5_PLUGIN_PRELOAD controls the loading of dynamic plugin types at
  77. * runtime. If it is set to disable all plugin types, then it will disable them for \Emph{all}
  78. * running programs that access the same variable instance.
  79. *
  80. * \since 1.8.15
  81. *
  82. */
  83. H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
  84. /**
  85. * \ingroup H5PL
  86. * \brief Queries the loadability of dynamic plugin types
  87. *
  88. * \param[out] plugin_control_mask List of dynamic plugin types that are enabled or disabled.\n
  89. * A plugin bit set to 0 (zero) indicates that that the dynamic plugin type is
  90. * disabled.\n
  91. * A plugin bit set to 1 (one) indicates that that the dynamic plugin type is
  92. * enabled.\n
  93. * If the value of \p plugin_control_mask is negative, all dynamic plugin
  94. * types are enabled.\n
  95. * If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins
  96. * are disabled.
  97. * \return \herr_t
  98. *
  99. * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins
  100. * (e.g.: filters, VOL drivers) will be loaded by the HDF5 library.
  101. *
  102. * Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
  103. * \snippet this H5PL_type_t_snip
  104. *
  105. * \since 1.8.15
  106. *
  107. */
  108. H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_control_mask /*out*/);
  109. /**
  110. * \ingroup H5PL
  111. * \brief Inserts a plugin path at the end of the plugin search path list
  112. *
  113. * \param[in] search_path A plugin path
  114. * \return \herr_t
  115. *
  116. * \details H5PLappend() inserts a plugin path at the end of the plugin search path list.
  117. *
  118. * \since 1.10.1
  119. *
  120. */
  121. H5_DLL herr_t H5PLappend(const char *search_path);
  122. /**
  123. * \ingroup H5PL
  124. * \brief Inserts a plugin path at the beginning of the plugin search path list
  125. *
  126. * \param[in] search_path A plugin path
  127. * \return \herr_t
  128. *
  129. * \details H5PLprepend() inserts a plugin path at the end of the plugin search path list.
  130. *
  131. * \since 1.10.1
  132. *
  133. */
  134. H5_DLL herr_t H5PLprepend(const char *search_path);
  135. /**
  136. * \ingroup H5PL
  137. * \brief Replaces the path at the specified index in the plugin search path list
  138. *
  139. * \param[in] search_path A plugin path
  140. * \param[in] index Index
  141. * \return \herr_t
  142. *
  143. * \details H5PLreplace() replaces a plugin path at the specified index in the plugin search path list.
  144. *
  145. * \since 1.10.1
  146. *
  147. */
  148. H5_DLL herr_t H5PLreplace(const char *search_path, unsigned int index);
  149. /**
  150. * \ingroup H5PL
  151. * \brief Inserts a path at the specified index in the plugin search path list
  152. *
  153. * \param[in] search_path A plugin path
  154. * \param[in] index Index
  155. * \return \herr_t
  156. *
  157. * \details H5PLinsert() inserts a plugin path at the specified index in the plugin search path list,
  158. * moving other paths after \p index.
  159. *
  160. * \since 1.10.1
  161. *
  162. */
  163. H5_DLL herr_t H5PLinsert(const char *search_path, unsigned int index);
  164. /**
  165. * \ingroup H5PL
  166. * \brief Removes a plugin path at a specified index from the plugin search path list
  167. *
  168. * \param[in] index Index
  169. * \return \herr_t
  170. *
  171. * \details H5PLremove() removes a plugin path at the specified \p index and compacts the plugin search path
  172. * list.
  173. *
  174. * \since 1.10.1
  175. *
  176. */
  177. H5_DLL herr_t H5PLremove(unsigned int index);
  178. /**
  179. * \ingroup H5PL
  180. * \brief Queries the plugin search path list at the specified index
  181. *
  182. * \param[in] index Index
  183. * \param[out] path_buf Pathname
  184. * \param[in] buf_size Size of \p path_buf
  185. * \return Returns the length of the path, a non-negative value, if successful; otherwise returns a negative
  186. * value.
  187. *
  188. * \details H5PLget() queries the plugin path at a specified index. If \p path_buf is non-NULL then it writes
  189. * up to \p buf_size bytes into that buffer and always returns the length of the path name.
  190. *
  191. * If \p path_buf is NULL, this function will simply return the number of characters required to
  192. * store the path name, ignoring \p path_buf and \p buf_size.
  193. *
  194. * If an error occurs then the buffer pointed to by \p path_buf (NULL or non-NULL) is unchanged and
  195. * the function returns a negative value. If a zero is returned for the name's length, then there is
  196. * no path name associated with the index. and the \p path_buf buffer will be unchanged.
  197. *
  198. * \since 1.10.1
  199. *
  200. */
  201. H5_DLL ssize_t H5PLget(unsigned int index, char *path_buf /*out*/, size_t buf_size);
  202. /**
  203. * \ingroup H5PL
  204. * \brief Retrieves the number of stored plugin paths
  205. *
  206. * \param[out] num_paths Current length of the plugin search path list
  207. * \return \herr_t
  208. *
  209. * \details H5PLsize() retrieves the number of paths stored in the plugin search path list.
  210. *
  211. * \since 1.10.1
  212. *
  213. */
  214. H5_DLL herr_t H5PLsize(unsigned int *num_paths /*out*/);
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218. #endif /* H5PLpublic_H */