Use get_notify() to look up single notifies

This commit is contained in:
Martin Willi
2009-09-03 17:32:01 +02:00
parent 3e15f99189
commit 9beb83868f
4 changed files with 35 additions and 104 deletions
+7 -21
View File
@@ -62,31 +62,17 @@ static void add_auth_lifetime(private_ike_auth_lifetime_t *this, message_t *mess
*/
static void process_payloads(private_ike_auth_lifetime_t *this, message_t *message)
{
enumerator_t *enumerator;
payload_t *payload;
notify_payload_t *notify;
chunk_t data;
u_int32_t lifetime;
enumerator = message->create_payload_enumerator(message);
while (enumerator->enumerate(enumerator, &payload))
notify = message->get_notify(message, AUTH_LIFETIME);
if (notify)
{
if (payload->get_type(payload) == NOTIFY)
{
notify = (notify_payload_t*)payload;
switch (notify->get_notify_type(notify))
{
case AUTH_LIFETIME:
{
chunk_t data = notify->get_notification_data(notify);
u_int32_t lifetime = ntohl(*(u_int32_t*)data.ptr);
this->ike_sa->set_auth_lifetime(this->ike_sa, lifetime);
break;
}
default:
break;
}
}
data = notify->get_notification_data(notify);
lifetime = ntohl(*(u_int32_t*)data.ptr);
this->ike_sa->set_auth_lifetime(this->ike_sa, lifetime);
}
enumerator->destroy(enumerator);
}
/**