Move module object inside MODULE_INFO

This allows modules to only expose one entry point with a consistent
signature. In the future, this could be used to implement declarations of
module parameters.
This commit is contained in:
Markus Mäkelä
2017-01-03 14:04:20 +02:00
parent 6c53999c97
commit ae0577c695
53 changed files with 1346 additions and 1483 deletions

View File

@ -15,15 +15,6 @@
#include <maxscale/router.h>
#include <maxscale/modinfo.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_IN_DEVELOPMENT,
ROUTER_VERSION,
"A test router - not for use in real systems",
"V1.0.0"
};
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
static void closeSession(ROUTER *instance, void *session);
@ -39,20 +30,6 @@ static void handleError(ROUTER *instance,
error_action_t action,
bool *succp);
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
typedef struct
{
} TESTROUTER;
@ -69,10 +46,33 @@ typedef struct
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_IN_DEVELOPMENT,
ROUTER_VERSION,
"A test router - not for use in real systems",
"V1.0.0",
&MyObject
};
return &info;
}
/**