Migrated all SIM/AKA code to libsimaka, use SIM and AKA backend managers registered by name

This commit is contained in:
Martin Willi
2011-08-08 13:36:56 +02:00
parent 4c199e6f81
commit efee3ed80f
62 changed files with 674 additions and 440 deletions
@@ -1,6 +1,6 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon
-I$(top_srcdir)/src/libcharon -I$(top_srcdir)/src/libsimaka
AM_CFLAGS = -rdynamic -DIPSEC_CONFDIR=\"${sysconfdir}\"
@@ -35,7 +35,7 @@ struct private_eap_sim_file_card_t {
eap_sim_file_triplets_t *triplets;
};
METHOD(sim_card_t, get_triplet, bool,
METHOD(simaka_card_t, get_triplet, bool,
private_eap_sim_file_card_t *this, identification_t *id,
char rand[SIM_RAND_LEN], char sres[SIM_SRES_LEN], char kc[SIM_KC_LEN])
{
@@ -66,7 +66,7 @@ METHOD(sim_card_t, get_triplet, bool,
return FALSE;
}
METHOD(sim_card_t, get_quintuplet, status_t,
METHOD(simaka_card_t, get_quintuplet, status_t,
private_eap_sim_file_card_t *this, identification_t *id,
char rand[AKA_RAND_LEN], char autn[AKA_AUTN_LEN], char ck[AKA_CK_LEN],
char ik[AKA_IK_LEN], char res[AKA_RES_MAX], int *res_len)
@@ -23,7 +23,7 @@
#include "eap_sim_file_triplets.h"
#include <sa/authenticators/eap/sim_manager.h>
#include <simaka_card.h>
typedef struct eap_sim_file_card_t eap_sim_file_card_t;
@@ -33,9 +33,9 @@ typedef struct eap_sim_file_card_t eap_sim_file_card_t;
struct eap_sim_file_card_t {
/**
* Implements sim_card_t interface
* Implements simaka_card_t interface
*/
sim_card_t card;
simaka_card_t card;
/**
* Destroy a eap_sim_file_card_t.
@@ -59,8 +59,14 @@ METHOD(plugin_t, get_name, char*,
METHOD(plugin_t, destroy, void,
private_eap_sim_file_t *this)
{
charon->sim->remove_card(charon->sim, &this->card->card);
charon->sim->remove_provider(charon->sim, &this->provider->provider);
simaka_manager_t *mgr;
mgr = lib->get(lib, "sim-manager");
if (mgr)
{
mgr->remove_card(mgr, &this->card->card);
mgr->remove_provider(mgr, &this->provider->provider);
}
this->card->destroy(this->card);
this->provider->destroy(this->provider);
this->triplets->destroy(this->triplets);
@@ -73,6 +79,7 @@ METHOD(plugin_t, destroy, void,
plugin_t *eap_sim_file_plugin_create()
{
private_eap_sim_file_t *this;
simaka_manager_t *mgr;
INIT(this,
.public = {
@@ -94,9 +101,12 @@ plugin_t *eap_sim_file_plugin_create()
}
this->card = eap_sim_file_card_create(this->triplets);
charon->sim->add_card(charon->sim, &this->card->card);
charon->sim->add_provider(charon->sim, &this->provider->provider);
mgr = lib->get(lib, "sim-manager");
if (mgr)
{
mgr->add_card(mgr, &this->card->card);
mgr->add_provider(mgr, &this->provider->provider);
}
return &this->public.plugin;
}
@@ -35,7 +35,7 @@ struct private_eap_sim_file_provider_t {
eap_sim_file_triplets_t *triplets;
};
METHOD(sim_provider_t, get_triplet, bool,
METHOD(simaka_provider_t, get_triplet, bool,
private_eap_sim_file_provider_t *this, identification_t *id,
char rand[SIM_RAND_LEN], char sres[SIM_SRES_LEN], char kc[SIM_KC_LEN])
{
@@ -23,6 +23,8 @@
#include "eap_sim_file_triplets.h"
#include <simaka_provider.h>
typedef struct eap_sim_file_provider_t eap_sim_file_provider_t;
/**
@@ -31,9 +33,9 @@ typedef struct eap_sim_file_provider_t eap_sim_file_provider_t;
struct eap_sim_file_provider_t {
/**
* Implements sim_provider_t interface.
* Implements simaka_provider_t interface.
*/
sim_provider_t provider;
simaka_provider_t provider;
/**
* Destroy a eap_sim_file_provider_t.
@@ -21,6 +21,7 @@
#include <daemon.h>
#include <utils/linked_list.h>
#include <threading/mutex.h>
#include <simaka_manager.h>
typedef struct private_eap_sim_file_triplets_t private_eap_sim_file_triplets_t;
@@ -21,7 +21,7 @@
#ifndef EAP_SIM_FILE_TRIPLETS_H_
#define EAP_SIM_FILE_TRIPLETS_H_
#include <sa/authenticators/eap/sim_manager.h>
#include <utils/enumerator.h>
typedef struct eap_sim_file_triplets_t eap_sim_file_triplets_t;