From f6ba78c370794ea8247b33752a8dbe930b19df1e Mon Sep 17 00:00:00 2001 From: Jan Hutter Date: Mon, 5 Dec 2005 12:21:38 +0000 Subject: - added payload CERT - cleaned code of different states - added additional notify handling --- Source/charon/encoding/message.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'Source/charon/encoding/message.c') diff --git a/Source/charon/encoding/message.c b/Source/charon/encoding/message.c index c46918ed3..8c7969042 100644 --- a/Source/charon/encoding/message.c +++ b/Source/charon/encoding/message.c @@ -36,6 +36,11 @@ #include #include +/** + * Max number of notify payloads per IKEv2 Message + */ +#define MAX_NOTIFY_PAYLOADS 10 + typedef struct supported_payload_entry_t supported_payload_entry_t; @@ -109,6 +114,7 @@ struct message_rule_t { */ static supported_payload_entry_t supported_ike_sa_init_i_payloads[] = { + {NOTIFY,0,MAX_NOTIFY_PAYLOADS,FALSE,FALSE}, {SECURITY_ASSOCIATION,1,1,FALSE,FALSE}, {KEY_EXCHANGE,1,1,FALSE,FALSE}, {NONCE,1,1,FALSE,FALSE}, @@ -119,7 +125,7 @@ static supported_payload_entry_t supported_ike_sa_init_i_payloads[] = */ static supported_payload_entry_t supported_ike_sa_init_r_payloads[] = { - {NOTIFY,0,1,FALSE,TRUE}, + {NOTIFY,0,MAX_NOTIFY_PAYLOADS,FALSE,TRUE}, {SECURITY_ASSOCIATION,1,1,FALSE,FALSE}, {KEY_EXCHANGE,1,1,FALSE,FALSE}, {NONCE,1,1,FALSE,FALSE}, @@ -130,6 +136,7 @@ static supported_payload_entry_t supported_ike_sa_init_r_payloads[] = */ static supported_payload_entry_t supported_ike_auth_i_payloads[] = { + {NOTIFY,0,MAX_NOTIFY_PAYLOADS,TRUE,FALSE}, {ID_INITIATOR,1,1,TRUE,FALSE}, {CERTIFICATE,0,1,TRUE,FALSE}, {CERTIFICATE_REQUEST,0,1,TRUE,FALSE}, @@ -145,7 +152,7 @@ static supported_payload_entry_t supported_ike_auth_i_payloads[] = */ static supported_payload_entry_t supported_ike_auth_r_payloads[] = { - {NOTIFY,0,1,TRUE,TRUE}, + {NOTIFY,0,MAX_NOTIFY_PAYLOADS,TRUE,TRUE}, {CERTIFICATE,0,1,TRUE,FALSE}, {ID_RESPONDER,1,1,TRUE,FALSE}, {AUTHENTICATION,1,1,TRUE,FALSE}, @@ -1215,3 +1222,24 @@ message_t *message_create() { return message_create_from_packet(NULL); } + +/* + * Described in Header. + */ +message_t *message_create_notify_reply(host_t *source, host_t *destination, exchange_type_t exchange_type, bool original_initiator,ike_sa_id_t *ike_sa_id,notify_message_type_t notify_type) +{ + message_t *message = message_create_from_packet(NULL); + notify_payload_t *payload; + + message->set_source(message, source->clone(source)); + message->set_destination(message, destination->clone(destination)); + message->set_exchange_type(message, exchange_type); + message->set_request(message, FALSE); + message->set_message_id(message,0); + message->set_ike_sa_id(message, ike_sa_id); + + payload = notify_payload_create_from_protocol_and_type(IKE,notify_type); + message->add_payload(message,(payload_t *) payload); + + return message; +} -- cgit v1.2.3