diff options
author | Martin Willi <martin@strongswan.org> | 2008-03-27 11:45:49 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-03-27 11:45:49 +0000 |
commit | 52a61742e73a3a3b5f32c12d67140cb61c2d7893 (patch) | |
tree | 63d36ee084238058517b9b61838b8bf0d82d4846 /src | |
parent | cf4caefab12b9e7b4ac3a74f893a2ccf80b9c5fc (diff) | |
download | strongswan-52a61742e73a3a3b5f32c12d67140cb61c2d7893.tar.bz2 strongswan-52a61742e73a3a3b5f32c12d67140cb61c2d7893.tar.xz |
reusing generic shared_key_t implementation in med_db
Diffstat (limited to 'src')
-rw-r--r-- | src/charon/plugins/med_db/med_db_creds.c | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/src/charon/plugins/med_db/med_db_creds.c b/src/charon/plugins/med_db/med_db_creds.c index cd1058aa5..ad6e6665f 100644 --- a/src/charon/plugins/med_db/med_db_creds.c +++ b/src/charon/plugins/med_db/med_db_creds.c @@ -70,60 +70,6 @@ static void data_destroy(data_t *this) } /** - * Implementation of shared_key_t.get_type. - */ -static shared_key_type_t get_type(private_shared_key_t *this) -{ - return SHARED_IKE; -} - -/** - * Implementation of shared_key_t.get_ref. - */ -static private_shared_key_t* get_ref(private_shared_key_t *this) -{ - ref_get(&this->ref); - return this; -} - -/** - * Implementation of shared_key_t.destroy - */ -static void shared_key_destroy(private_shared_key_t *this) -{ - if (ref_put(&this->ref)) - { - chunk_free(&this->key); - free(this); - } -} - -/** - * Implementation of shared_key_t.get_key. - */ -static chunk_t get_key(private_shared_key_t *this) -{ - return this->key; -} - -/** - * create a shared key - */ -static shared_key_t *shared_key_create(chunk_t key) -{ - private_shared_key_t *this = malloc_thing(private_shared_key_t); - - this->public.get_type = (shared_key_type_t(*)(shared_key_t*))get_type; - this->public.get_key = (chunk_t(*)(shared_key_t*))get_key; - this->public.get_ref = (shared_key_t*(*)(shared_key_t*))get_ref; - this->public.destroy = (void(*)(shared_key_t*))shared_key_destroy; - - this->key = chunk_clone(key); - this->ref = 1; - return &this->public; -} - -/** * filter for enumerator, returns for each SQL result a shared key and match */ static bool filter(data_t *this, chunk_t *chunk, shared_key_t **out, @@ -131,7 +77,7 @@ static bool filter(data_t *this, chunk_t *chunk, shared_key_t **out, void **unused2, id_match_t *match_other) { DESTROY_IF(this->current); - this->current = shared_key_create(*chunk); + this->current = shared_key_create(SHARED_IKE, *chunk); *out = this->current; /* we have unique matches only, but do not compare own ID */ if (match_me) |