Provide access to modules

With the provided functions it is possible to iterate over all loaded
modules or over all modules of a specific type.
This commit is contained in:
Johan Wikman
2017-01-05 09:33:58 +02:00
parent 2abe956056
commit 6a695c9407
2 changed files with 82 additions and 0 deletions

View File

@ -121,4 +121,44 @@ void module_feedback_send(void*);
*/
void moduleShowFeedbackReport(DCB *dcb);
typedef struct mxs_module_iterator
{
const char* type;
void* position;
} MXS_MODULE_ITERATOR;
/**
* @brief Returns an iterator to modules.
*
* @attention It is unspecified whether a module loaded after the iterator
* was created, will be returned by the iterator. The behaviour
* is undefined if a module is unloaded while an iteration is
* being performed.
*
* @param type The type of modules that should be returned. If NULL,
* then all modules are returned.
*
* @return An iterator.
*/
MXS_MODULE_ITERATOR mxs_module_iterator_get(const char* type);
/**
* @brief Indicates whether the iterator has a module to return.
*
* @param iterator An iterator
*
* @return True if a subsequent call to @c mxs_module_iterator_get
* will return a module.
*/
bool mxs_module_iterator_has_next(const MXS_MODULE_ITERATOR* iterator);
/**
* @brief Returns the next module and advances the iterator.
*
* @param iterator An iterator.
*
* @return A module if there was a module to return, NULL otherwise.
*/
MXS_MODULE* mxs_module_iterator_get_next(MXS_MODULE_ITERATOR* iterator);
MXS_END_DECLS