MXS-2205 Combine internal/modules.h with internal/modules.hh
This commit is contained in:
parent
b15f43bc81
commit
36792607d8
@ -15,7 +15,7 @@
|
||||
#include <maxscale/modutil.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
/**
|
||||
* @file authenticator.c - Authenticator module functions
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "internal/config.hh"
|
||||
#include "internal/event.hh"
|
||||
#include "internal/filter.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/service.hh"
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "internal/config.hh"
|
||||
#include "internal/filter.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/query_classifier.hh"
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include <maxscale/utils.h>
|
||||
#include <maxscale/routingworker.hh>
|
||||
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/session.h"
|
||||
|
||||
using maxscale::RoutingWorker;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <maxscale/json_api.h>
|
||||
|
||||
#include "internal/config.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/service.hh"
|
||||
|
||||
using std::string;
|
||||
|
@ -67,7 +67,7 @@
|
||||
#include "internal/admin.hh"
|
||||
#include "internal/config.hh"
|
||||
#include "internal/maxscale.h"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/poll.hh"
|
||||
#include "internal/service.hh"
|
||||
|
@ -1,158 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
||||
*
|
||||
* Change Date: 2022-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file modules.h Utilities for loading modules
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Module types
|
||||
*/
|
||||
#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */
|
||||
#define MODULE_AUTHENTICATOR "Authenticator" /**< An authenticator module type */
|
||||
#define MODULE_ROUTER "Router" /**< A router module type */
|
||||
#define MODULE_MONITOR "Monitor" /**< A database monitor module type */
|
||||
#define MODULE_FILTER "Filter" /**< A filter module type */
|
||||
#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */
|
||||
|
||||
|
||||
/**
|
||||
*@brief Load a module
|
||||
*
|
||||
* @param module Name of the module to load
|
||||
* @param type Type of module, used purely for registration
|
||||
* @return The module specific entry point structure or NULL
|
||||
*/
|
||||
void* load_module(const char* module, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Get a module
|
||||
*
|
||||
* @param name Name of the module
|
||||
* @param type The module type or NULL for any type
|
||||
* @return The loaded module or NULL if the module is not loaded
|
||||
*/
|
||||
const MXS_MODULE* get_module(const char* name, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Unload a module.
|
||||
*
|
||||
* No errors are returned since it is not clear that much can be done
|
||||
* to fix issues relating to unloading modules.
|
||||
*
|
||||
* @param module The name of the module
|
||||
*/
|
||||
void unload_module(const char* module);
|
||||
|
||||
/**
|
||||
* @brief Unload all modules
|
||||
*
|
||||
* Remove all the modules from the system, called during shutdown
|
||||
* to allow termination hooks to be called.
|
||||
*/
|
||||
void unload_all_modules();
|
||||
|
||||
/**
|
||||
* @brief Print Modules
|
||||
*
|
||||
* Diagnostic routine to display all the loaded modules
|
||||
*/
|
||||
void printModules();
|
||||
|
||||
/**
|
||||
* @brief Print Modules to a DCB
|
||||
*
|
||||
* Diagnostic routine to display all the loaded modules
|
||||
*/
|
||||
void dprintAllModules(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);
|
||||
|
||||
/**
|
||||
* @brief Convert module to JSON
|
||||
*
|
||||
* @param module Module to convert
|
||||
* @param host Hostname of this server
|
||||
*
|
||||
* @return The module in JSON format
|
||||
*/
|
||||
json_t* module_to_json(const MXS_MODULE* module, const char* host);
|
||||
|
||||
/**
|
||||
* @brief Convert all modules to JSON
|
||||
*
|
||||
* @param host The hostname of this server
|
||||
*
|
||||
* @return Array of modules in JSON format
|
||||
*/
|
||||
json_t* module_list_to_json(const char* host);
|
||||
|
||||
/**
|
||||
* @brief Return effective module name.
|
||||
*
|
||||
* The effective module name is the actual name of a module. In case
|
||||
* a module has been renamed (and the old name deprecated), the effective
|
||||
* name of a module may be different from the used one.
|
||||
*
|
||||
* @param name The name of a module.
|
||||
*
|
||||
* @return The effective name (may be the same).
|
||||
*/
|
||||
const char* mxs_module_get_effective_name(const char* name);
|
||||
|
||||
MXS_END_DECLS
|
@ -12,13 +12,148 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/resultset.hh>
|
||||
|
||||
/* Module types */
|
||||
#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */
|
||||
#define MODULE_AUTHENTICATOR "Authenticator" /**< An authenticator module type */
|
||||
#define MODULE_ROUTER "Router" /**< A router module type */
|
||||
#define MODULE_MONITOR "Monitor" /**< A database monitor module type */
|
||||
#define MODULE_FILTER "Filter" /**< A filter module type */
|
||||
#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */
|
||||
|
||||
/**
|
||||
* @brief Return a resultset that has the current set of modules in it
|
||||
*
|
||||
* @return A Result set
|
||||
*/
|
||||
std::unique_ptr<ResultSet> moduleGetList();
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
*@brief Load a module
|
||||
*
|
||||
* @param module Name of the module to load
|
||||
* @param type Type of module, used purely for registration
|
||||
* @return The module specific entry point structure or NULL
|
||||
*/
|
||||
void* load_module(const char* module, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Get a module
|
||||
*
|
||||
* @param name Name of the module
|
||||
* @param type The module type or NULL for any type
|
||||
* @return The loaded module or NULL if the module is not loaded
|
||||
*/
|
||||
const MXS_MODULE* get_module(const char* name, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Unload a module.
|
||||
*
|
||||
* No errors are returned since it is not clear that much can be done
|
||||
* to fix issues relating to unloading modules.
|
||||
*
|
||||
* @param module The name of the module
|
||||
*/
|
||||
void unload_module(const char* module);
|
||||
|
||||
/**
|
||||
* @brief Unload all modules
|
||||
*
|
||||
* Remove all the modules from the system, called during shutdown
|
||||
* to allow termination hooks to be called.
|
||||
*/
|
||||
void unload_all_modules();
|
||||
|
||||
/**
|
||||
* @brief Print Modules
|
||||
*
|
||||
* Diagnostic routine to display all the loaded modules
|
||||
*/
|
||||
void printModules();
|
||||
|
||||
/**
|
||||
* @brief Print Modules to a DCB
|
||||
*
|
||||
* Diagnostic routine to display all the loaded modules
|
||||
*/
|
||||
void dprintAllModules(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);
|
||||
|
||||
/**
|
||||
* @brief Convert module to JSON
|
||||
*
|
||||
* @param module Module to convert
|
||||
* @param host Hostname of this server
|
||||
*
|
||||
* @return The module in JSON format
|
||||
*/
|
||||
json_t* module_to_json(const MXS_MODULE* module, const char* host);
|
||||
|
||||
/**
|
||||
* @brief Convert all modules to JSON
|
||||
*
|
||||
* @param host The hostname of this server
|
||||
*
|
||||
* @return Array of modules in JSON format
|
||||
*/
|
||||
json_t* module_list_to_json(const char* host);
|
||||
|
||||
/**
|
||||
* @brief Return effective module name.
|
||||
*
|
||||
* The effective module name is the actual name of a module. In case
|
||||
* a module has been renamed (and the old name deprecated), the effective
|
||||
* name of a module may be different from the used one.
|
||||
*
|
||||
* @param name The name of a module.
|
||||
*
|
||||
* @return The effective name (may be the same).
|
||||
*/
|
||||
const char* mxs_module_get_effective_name(const char* name);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <maxscale/pcre2.h>
|
||||
|
||||
#include "internal/filter.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/monitor.hh"
|
||||
|
||||
/** Size of the error buffer */
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "internal/config.hh"
|
||||
#include "internal/externcmd.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
|
||||
/** Schema version, journals must have a matching version */
|
||||
#define MMB_SCHEMA_VERSION 2
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <maxscale/buffer.hh>
|
||||
|
||||
#include "internal/config_runtime.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/trxboundaryparser.hh"
|
||||
|
||||
// #define QC_TRACE_ENABLED
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "internal/filter.hh"
|
||||
#include "internal/httprequest.hh"
|
||||
#include "internal/httpresponse.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/query_classifier.hh"
|
||||
#include "internal/service.hh"
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <maxscale/statistics.hh>
|
||||
|
||||
#include "internal/dcb.h"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/poll.hh"
|
||||
#include "internal/service.hh"
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "internal/poll.hh"
|
||||
#include "internal/config.hh"
|
||||
#include "internal/service.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
|
||||
|
||||
using maxbase::Worker;
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
#include "internal/config.hh"
|
||||
#include "internal/filter.hh"
|
||||
#include "internal/modules.h"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/service.hh"
|
||||
#include "internal/maxscale.h"
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include "maxscale/filtermodule.hh"
|
||||
#include "../../../core/internal/modules.h"
|
||||
#include "../../../core/internal/modules.hh"
|
||||
|
||||
using std::auto_ptr;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "maxscale/module.hh"
|
||||
#include <string>
|
||||
#include "../../../core/internal/modules.h"
|
||||
#include "../../../core/internal/modules.hh"
|
||||
|
||||
using std::auto_ptr;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "maxscale/queryclassifiermodule.hh"
|
||||
#include "../../../core/internal/modules.h"
|
||||
#include "../../../core/internal/modules.hh"
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <maxscale/paths.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/utils.hh>
|
||||
#include "../../../../core/internal/modules.h"
|
||||
#include "../../../../core/internal/modules.hh"
|
||||
#include "../../../../core/internal/config.hh"
|
||||
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "../../../core/internal/config.hh"
|
||||
#include "../../../core/internal/config_runtime.hh"
|
||||
#include "../../../core/internal/maxscale.h"
|
||||
#include "../../../core/internal/modules.h"
|
||||
#include "../../../core/internal/modules.hh"
|
||||
#include "../../../core/internal/monitor.hh"
|
||||
#include "../../../core/internal/poll.hh"
|
||||
#include "../../../core/internal/session.h"
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <maxscale/users.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
|
||||
#include "../../../core/internal/modules.h"
|
||||
#include "../../../core/internal/modules.hh"
|
||||
#include "../../../core/internal/monitor.hh"
|
||||
#include "../../../core/internal/session.h"
|
||||
#include "../../../core/internal/session.hh"
|
||||
|
Loading…
x
Reference in New Issue
Block a user