plugin-feature: Add vendor specific EAP method registration macros
Vendor specific EAP methods may be registered with: PLUGIN_CALLBACK(eap_method_register, <constructor>), PLUGIN_PROVIDE(EAP_SERVER_VENDOR, <type>, <vendor>), Same for client implementations via EAP_PEER_VENDOR. References #969.
This commit is contained in:
parent
39afe6e9d0
commit
d6f70ff689
|
@ -30,7 +30,8 @@ bool eap_method_register(plugin_t *plugin, plugin_feature_t *feature,
|
|||
{
|
||||
if (reg)
|
||||
{
|
||||
charon->eap->add_method(charon->eap, feature->arg.eap, 0,
|
||||
charon->eap->add_method(charon->eap, feature->arg.eap.type,
|
||||
feature->arg.eap.vendor,
|
||||
feature->type == FEATURE_EAP_SERVER ? EAP_SERVER : EAP_PEER,
|
||||
(eap_constructor_t)data);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2013 Tobias Brunner
|
||||
* Copyright (C) 2012-2015 Tobias Brunner
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* Copyright (C) 2011 Martin Willi
|
||||
|
@ -185,7 +185,8 @@ bool plugin_feature_matches(plugin_feature_t *a, plugin_feature_t *b)
|
|||
return a->arg.container == b->arg.container;
|
||||
case FEATURE_EAP_SERVER:
|
||||
case FEATURE_EAP_PEER:
|
||||
return a->arg.eap == b->arg.eap;
|
||||
return a->arg.eap.vendor == b->arg.eap.vendor &&
|
||||
a->arg.eap.type == b->arg.eap.type;
|
||||
case FEATURE_DATABASE:
|
||||
return a->arg.database == DB_ANY ||
|
||||
a->arg.database == b->arg.database;
|
||||
|
@ -368,8 +369,15 @@ char* plugin_feature_get_string(plugin_feature_t *feature)
|
|||
break;
|
||||
case FEATURE_EAP_SERVER:
|
||||
case FEATURE_EAP_PEER:
|
||||
if (asprintf(&str, "%N:%N", plugin_feature_names, feature->type,
|
||||
eap_type_short_names, feature->arg.eap) > 0)
|
||||
if (feature->arg.eap.vendor &&
|
||||
asprintf(&str, "%N:%d-%d", plugin_feature_names, feature->type,
|
||||
feature->arg.eap.type, feature->arg.eap.vendor) > 0)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
else if (!feature->arg.eap.vendor &&
|
||||
asprintf(&str, "%N:%N", plugin_feature_names, feature->type,
|
||||
eap_type_short_names, feature->arg.eap.type) > 0)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2013 Tobias Brunner
|
||||
* Copyright (C) 2012-2015 Tobias Brunner
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* Copyright (C) 2011 Martin Willi
|
||||
|
@ -196,7 +196,7 @@ struct plugin_feature_t {
|
|||
/** FEATURE_CONTAINER_DECODE/ENCODE */
|
||||
container_type_t container;
|
||||
/** FEATURE_EAP_SERVER/CLIENT */
|
||||
eap_type_t eap;
|
||||
eap_vendor_type_t eap;
|
||||
/** FEATURE_DATABASE */
|
||||
db_driver_t database;
|
||||
/** FEATURE_FETCHER */
|
||||
|
@ -292,8 +292,10 @@ struct plugin_feature_t {
|
|||
#define _PLUGIN_FEATURE_CERT_ENCODE(kind, type) __PLUGIN_FEATURE(kind, CERT_ENCODE, .cert = type)
|
||||
#define _PLUGIN_FEATURE_CONTAINER_DECODE(kind, type) __PLUGIN_FEATURE(kind, CONTAINER_DECODE, .container = type)
|
||||
#define _PLUGIN_FEATURE_CONTAINER_ENCODE(kind, type) __PLUGIN_FEATURE(kind, CONTAINER_ENCODE, .container = type)
|
||||
#define _PLUGIN_FEATURE_EAP_SERVER(kind, type) __PLUGIN_FEATURE(kind, EAP_SERVER, .eap = type)
|
||||
#define _PLUGIN_FEATURE_EAP_PEER(kind, type) __PLUGIN_FEATURE(kind, EAP_PEER, .eap = type)
|
||||
#define _PLUGIN_FEATURE_EAP_SERVER(kind, type) _PLUGIN_FEATURE_EAP_SERVER_VENDOR(kind, type, 0)
|
||||
#define _PLUGIN_FEATURE_EAP_PEER(kind, type) _PLUGIN_FEATURE_EAP_PEER_VENDOR(kind, type, 0)
|
||||
#define _PLUGIN_FEATURE_EAP_SERVER_VENDOR(kind, type, vendor)__PLUGIN_FEATURE(kind, EAP_SERVER, .eap = { type, vendor })
|
||||
#define _PLUGIN_FEATURE_EAP_PEER_VENDOR(kind, type, vendor) __PLUGIN_FEATURE(kind, EAP_PEER, .eap = { type, vendor })
|
||||
#define _PLUGIN_FEATURE_DATABASE(kind, type) __PLUGIN_FEATURE(kind, DATABASE, .database = type)
|
||||
#define _PLUGIN_FEATURE_FETCHER(kind, type) __PLUGIN_FEATURE(kind, FETCHER, .fetcher = type)
|
||||
#define _PLUGIN_FEATURE_RESOLVER(kind, ...) __PLUGIN_FEATURE(kind, RESOLVER, .custom = NULL)
|
||||
|
|
Loading…
Reference in New Issue