MXS-1539: Assign capability bits for all module types
All modules now have an 8-bit range for capability flags. Currently only the client side authenticator and protocol capability bits are loaded due to the fact that backend versions of these modules don't relate to a particular service.
This commit is contained in:
@ -25,6 +25,19 @@
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Specifies capabilities specific for authenticators.
|
||||
*
|
||||
* @see enum routing_capability
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x000100000000
|
||||
* and 0x008000000000, that is, bits 32 to 39.
|
||||
*/
|
||||
typedef enum authenticator_capability
|
||||
{
|
||||
ACAP_TYPE_ASYNC = 0x000100000000/**< Supports asynchronous access */
|
||||
} authenticator_capability_t;
|
||||
|
||||
/** Maximum number of authenticator options */
|
||||
#define AUTHENTICATOR_MAX_OPTIONS 256
|
||||
|
||||
|
@ -286,16 +286,15 @@ void dListFilters(DCB *);
|
||||
* Specifies capabilities specific for filters. Common capabilities
|
||||
* are defined by @c routing_capability_t.
|
||||
*
|
||||
* @see routing_capability_t
|
||||
* @see enum routing_capability
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x000100000000
|
||||
* and 0x800000000000, that is, bits 32 to 47.
|
||||
* @note The values of the capabilities here *must* be between 0x80000000
|
||||
* and 0x01000000, that is, bits 24 to 31.
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef enum filter_capability
|
||||
{
|
||||
FCAP_TYPE_NONE = 0x0 // TODO: remove once filter capabilities are defined
|
||||
} filter_capability_t;
|
||||
*/
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -97,6 +97,19 @@ typedef struct mxs_monitor_object
|
||||
*/
|
||||
#define MXS_MONITOR_VERSION {3, 0, 0}
|
||||
|
||||
/**
|
||||
* Specifies capabilities specific for monitor.
|
||||
*
|
||||
* @see enum routing_capability
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x0001 0000 0000 0000
|
||||
* and 0x0080 0000 0000 0000, that is, bits 48 to 55.
|
||||
*/
|
||||
typedef enum monitor_capability
|
||||
{
|
||||
MCAP_TYPE_NONE = 0x0 // TODO: remove once monitor capabilities are defined
|
||||
} monitor_capability_t;
|
||||
|
||||
/** Monitor's poll frequency */
|
||||
#define MXS_MON_BASE_INTERVAL_MS 100
|
||||
|
||||
|
@ -78,4 +78,17 @@ typedef struct mxs_protocol
|
||||
*/
|
||||
#define MXS_PROTOCOL_VERSION {1, 1, 0}
|
||||
|
||||
/**
|
||||
* Specifies capabilities specific for protocol.
|
||||
*
|
||||
* @see enum routing_capability
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x010000000000
|
||||
* and 0x800000000000, that is, bits 40 to 47.
|
||||
*/
|
||||
typedef enum protocol_capability
|
||||
{
|
||||
PCAP_TYPE_NONE = 0x0 // TODO: remove once protocol capabilities are defined
|
||||
} protocol_capability_t;
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -224,10 +224,10 @@ typedef struct mxs_router_object
|
||||
* Specifies capabilities specific for routers. Common capabilities
|
||||
* are defined by @c routing_capability_t.
|
||||
*
|
||||
* @see routing_capability_t
|
||||
* @see enum routing_capability
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x00010000
|
||||
* and 0x80000000, that is, bits 16 to 31.
|
||||
* and 0x00800000, that is, bits 16 to 23.
|
||||
*/
|
||||
typedef enum router_capability
|
||||
{
|
||||
|
@ -24,6 +24,15 @@ MXS_BEGIN_DECLS
|
||||
* Routing capability type. Indicates what kind of input a router or
|
||||
* a filter accepts.
|
||||
*
|
||||
* The capability bit ranges are:
|
||||
* 0-15: general capability bits
|
||||
* 16-23: router specific bits
|
||||
* 24-31: filter specific bits
|
||||
* 32-39: authenticator specific bits
|
||||
* 40-47: protocol specific bits
|
||||
* 48-55: monitor specific bits
|
||||
* 56-63: reserved for future use
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x0000
|
||||
* and 0x8000, that is, bits 0 to 15.
|
||||
*/
|
||||
|
@ -156,7 +156,7 @@ typedef struct service
|
||||
struct service *next; /**< The next service in the linked list */
|
||||
bool retry_start; /**< If starting of the service should be retried later */
|
||||
bool log_auth_warnings; /**< Log authentication failures and warnings */
|
||||
uint64_t capabilities; /**< The capabilities of the service. */
|
||||
uint64_t capabilities; /**< The capabilities of the service, @see enum routing_capability */
|
||||
int max_retry_interval; /**< Maximum retry interval */
|
||||
} SERVICE;
|
||||
|
||||
|
@ -292,6 +292,12 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Add protocol and authenticator capabilities from the listener
|
||||
const MXS_MODULE* proto_mod = get_module(port->protocol, MODULE_PROTOCOL);
|
||||
const MXS_MODULE* auth_mod = get_module(authenticator_name, MODULE_AUTHENTICATOR);
|
||||
ss_dassert(proto_mod && auth_mod);
|
||||
service->capabilities |= proto_mod->module_capabilities | auth_mod->module_capabilities;
|
||||
|
||||
memcpy(&port->listener->authfunc, authfuncs, sizeof(MXS_AUTHENTICATOR));
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user