Replace void* with struct mxs_filter

Using an empty struct instead of void* to represent the opaque
filter and filter session types, means that C++ filter types
simply can derive from them. That brings conceptual clarity and
also means that the C++ instances can be returned from the module
callbacks without casts. When provided as argument they can be
downcast using static_cast instead of reinterpret_cast.

Similar types to be provided for routers.
This commit is contained in:
Johan Wikman
2017-02-27 09:31:24 +02:00
parent 9aa22c6eb4
commit 6406f6b4e1

View File

@ -33,7 +33,9 @@ MXS_BEGIN_DECLS
* from the @c createInstance function of a filter module and subsequently * from the @c createInstance function of a filter module and subsequently
* passing it back to the API functions of the filter. * passing it back to the API functions of the filter.
*/ */
typedef void *MXS_FILTER; typedef struct mxs_filter
{
} MXS_FILTER;
/** /**
* MXS_FILTER_SESSION is an opaque type representing the session related * MXS_FILTER_SESSION is an opaque type representing the session related
@ -43,7 +45,9 @@ typedef void *MXS_FILTER;
* from the @c newSession function of a filter module and subsequently * from the @c newSession function of a filter module and subsequently
* passing it back to the API functions of the filter. * passing it back to the API functions of the filter.
*/ */
typedef void *MXS_FILTER_SESSION; typedef struct mxs_filter_session
{
} MXS_FILTER_SESSION;
/** /**
* @verbatim * @verbatim