Files
MaxScale/include/maxscale/modinfo.h
Markus Mäkelä c96bd64aa8 Rename MODULE_INFO to MXS_MODULE
The MODULE_INFO is now the main object which is used by modules to convey
information to the MaxScale core. The MXS_MODULE name is more apt as it
now contains the actual module definition.

The old MODULES structure was moved into load_utils.c as an internal
implementation and was renamed so that it is not confused with the new
MODULE structure.
2017-01-03 18:01:14 +02:00

124 lines
3.1 KiB
C

#pragma once
/*
* Copyright (c) 2016 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/bsl.
*
* Change Date: 2019-07-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.
*/
/**
* @file modinfo.h The module information interface
*
* @verbatim
* Revision History
*
* Date Who Description
* 02/06/14 Mark Riddoch Initial implementation
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
/**
* The status of the module. This gives some idea of the module
* maturity.
*/
typedef enum
{
MXS_MODULE_IN_DEVELOPMENT = 0,
MXS_MODULE_ALPHA_RELEASE,
MXS_MODULE_BETA_RELEASE,
MXS_MODULE_GA,
MXS_MODULE_EXPERIMENTAL
} MXS_MODULE_STATUS;
/**
* The API implemented by the module
*/
typedef enum
{
MXS_MODULE_API_PROTOCOL = 0,
MXS_MODULE_API_ROUTER,
MXS_MODULE_API_MONITOR,
MXS_MODULE_API_FILTER,
MXS_MODULE_API_AUTHENTICATOR,
MXS_MODULE_API_QUERY_CLASSIFIER,
} MXS_MODULE_API;
/**
* The module version structure.
*
* The rules for changing these values are:
*
* Any change that affects an inexisting call in the API in question,
* making the new API no longer compatible with the old,
* must increment the major version.
*
* Any change that adds to the API, but does not alter the existing API
* calls, must increment the minor version.
*
* Any change that is purely cosmetic and does not affect the calling
* conventions of the API must increment only the patch version number.
*/
typedef struct
{
int major;
int minor;
int patch;
} MXS_MODULE_VERSION;
/**
* The module information structure
*/
typedef struct
{
MXS_MODULE_API modapi; /**< Module API type */
MXS_MODULE_STATUS status; /**< Module development status */
MXS_MODULE_VERSION api_version; /**< Module API version */
const char *description; /**< Module description */
const char *version; /**< Module version */
void *module_object; /**< Module type specific API implementation */
} MXS_MODULE;
/**
* Name of the module entry point
*
* All modules should declare the module entry point in the following style:
*
* @code{.cpp}
*
* MODULE* MXS_CREATE_MODULE()
* {
* // Module specific API implementation
* static FILTER_OBJECT my_object = { ... };
*
* // An implementation of the MODULE structure
* static MODULE info = { ... };
*
* // Any global initialization should be done here
*
* return &info;
* }
*
* @endcode
*
* The @c module_object field of the MODULE structure should point to
* the module type specific API implementation. In the above example, the @c info
* would declare a pointer to @c my_object as the last member of the struct.
*/
#define MXS_CREATE_MODULE mxs_get_module_object
/** Name of the symbol that MaxScale will load */
#define MXS_MODULE_SYMBOL_NAME "mxs_get_module_object"
MXS_END_DECLS