Pass type of requested key in the callback credential set

This commit is contained in:
Martin Willi
2010-08-04 09:26:21 +02:00
parent af007ed68a
commit 0d08ebe7ac
4 changed files with 25 additions and 4 deletions
@@ -49,6 +49,8 @@ typedef struct {
enumerator_t public;
/* backref to this */
private_callback_cred_t *this;
/* type if requested key */
shared_key_type_t type;
/* own identity to match */
identification_t *me;
/* other identity to match */
@@ -62,7 +64,7 @@ METHOD(enumerator_t, shared_enumerate, bool,
id_match_t *match_me, id_match_t *match_other)
{
DESTROY_IF(this->current);
this->current = this->this->cb.shared(this->this->data,
this->current = this->this->cb.shared(this->this->data, this->type,
this->me, this->other, match_me, match_other);
if (this->current)
{
@@ -91,6 +93,7 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
.destroy = _shared_destroy,
},
.this = this,
.type = type,
.me = me,
.other = other,
);
@@ -28,12 +28,14 @@ typedef struct callback_cred_t callback_cred_t;
/**
* Callback function to get shared keys.
*
* @param type type of requested shared key
* @param me own identity
* @param other other identity
* @param match_me match result of own identity
* @param match_other match result of other identity
*/
typedef shared_key_t* (*callback_cred_shared_cb_t)(void *data,
typedef shared_key_t* (*callback_cred_shared_cb_t)(
void *data, shared_key_type_t type,
identification_t *me, identification_t *other,
id_match_t *match_me, id_match_t *match_other);