Add features support to eap-sim-pcsc plugin
This commit is contained in:
@@ -4,15 +4,16 @@ INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
|
|||||||
|
|
||||||
AM_CFLAGS = -rdynamic ${pcsclite_CFLAGS}
|
AM_CFLAGS = -rdynamic ${pcsclite_CFLAGS}
|
||||||
|
|
||||||
|
libstrongswan_eap_sim_pcsc_la_LDFLAGS = -module -avoid-version
|
||||||
|
libstrongswan_eap_sim_pcsc_la_LIBADD = ${pcsclite_LIBS}
|
||||||
|
|
||||||
if MONOLITHIC
|
if MONOLITHIC
|
||||||
noinst_LTLIBRARIES = libstrongswan-eap-sim-pcsc.la
|
noinst_LTLIBRARIES = libstrongswan-eap-sim-pcsc.la
|
||||||
else
|
else
|
||||||
plugin_LTLIBRARIES = libstrongswan-eap-sim-pcsc.la
|
plugin_LTLIBRARIES = libstrongswan-eap-sim-pcsc.la
|
||||||
|
libstrongswan_eap_sim_pcsc_la_LIBADD += $(top_builddir)/src/libsimaka/libsimaka.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libstrongswan_eap_sim_pcsc_la_SOURCES = \
|
libstrongswan_eap_sim_pcsc_la_SOURCES = \
|
||||||
eap_sim_pcsc_plugin.h eap_sim_pcsc_plugin.c \
|
eap_sim_pcsc_plugin.h eap_sim_pcsc_plugin.c \
|
||||||
eap_sim_pcsc_card.h eap_sim_pcsc_card.c
|
eap_sim_pcsc_card.h eap_sim_pcsc_card.c
|
||||||
|
|
||||||
libstrongswan_eap_sim_pcsc_la_LDFLAGS = -module -avoid-version
|
|
||||||
libstrongswan_eap_sim_pcsc_la_LIBADD = ${pcsclite_LIBS}
|
|
||||||
|
|||||||
@@ -41,16 +41,29 @@ METHOD(plugin_t, get_name, char*,
|
|||||||
return "eap-sim-pcsc";
|
return "eap-sim-pcsc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback providing our card to register
|
||||||
|
*/
|
||||||
|
static simaka_card_t* get_card(private_eap_sim_pcsc_plugin_t *this)
|
||||||
|
{
|
||||||
|
return &this->card->card;
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD(plugin_t, get_features, int,
|
||||||
|
private_eap_sim_pcsc_plugin_t *this, plugin_feature_t *features[])
|
||||||
|
{
|
||||||
|
static plugin_feature_t f[] = {
|
||||||
|
PLUGIN_CALLBACK(simaka_manager_register, get_card),
|
||||||
|
PLUGIN_PROVIDE(CUSTOM, "sim-card"),
|
||||||
|
PLUGIN_DEPENDS(CUSTOM, "sim-manager"),
|
||||||
|
};
|
||||||
|
*features = f;
|
||||||
|
return countof(f);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(plugin_t, destroy, void,
|
METHOD(plugin_t, destroy, void,
|
||||||
private_eap_sim_pcsc_plugin_t *this)
|
private_eap_sim_pcsc_plugin_t *this)
|
||||||
{
|
{
|
||||||
simaka_manager_t *mgr;
|
|
||||||
|
|
||||||
mgr = lib->get(lib, "sim-manager");
|
|
||||||
if (mgr)
|
|
||||||
{
|
|
||||||
mgr->remove_card(mgr, &this->card->card);
|
|
||||||
}
|
|
||||||
this->card->destroy(this->card);
|
this->card->destroy(this->card);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -61,24 +74,18 @@ METHOD(plugin_t, destroy, void,
|
|||||||
plugin_t *eap_sim_pcsc_plugin_create()
|
plugin_t *eap_sim_pcsc_plugin_create()
|
||||||
{
|
{
|
||||||
private_eap_sim_pcsc_plugin_t *this;
|
private_eap_sim_pcsc_plugin_t *this;
|
||||||
simaka_manager_t *mgr;
|
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.plugin = {
|
.plugin = {
|
||||||
.get_name = _get_name,
|
.get_name = _get_name,
|
||||||
.reload = (void*)return_false,
|
.get_features = _get_features,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.card = eap_sim_pcsc_card_create(),
|
.card = eap_sim_pcsc_card_create(),
|
||||||
);
|
);
|
||||||
|
|
||||||
mgr = lib->get(lib, "sim-manager");
|
|
||||||
if (mgr)
|
|
||||||
{
|
|
||||||
mgr->add_card(mgr, &this->card->card);
|
|
||||||
}
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user