diff options
Diffstat (limited to 'Source/charon/payloads/notify_payload.c')
-rw-r--r-- | Source/charon/payloads/notify_payload.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Source/charon/payloads/notify_payload.c b/Source/charon/payloads/notify_payload.c index 3526038d7..1593662a3 100644 --- a/Source/charon/payloads/notify_payload.c +++ b/Source/charon/payloads/notify_payload.c @@ -128,6 +128,46 @@ encoding_rule_t notify_payload_encodings[] = { { NOTIFICATION_DATA, offsetof(private_notify_payload_t, notification_data) } }; +/* + 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + ! Next Payload !C! RESERVED ! Payload Length ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + ! Protocol ID ! SPI Size ! Notify Message Type ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + ! ! + ~ Security Parameter Index (SPI) ~ + ! ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + ! ! + ~ Notification Data ~ + ! ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +*/ + +/** + * Implements payload_t's verify function. + * See #payload_s.verify for description. + */ +static status_t verify(private_notify_payload_t *this) +{ + if (this->critical) + { + /* critical bit is set! */ + return FAILED; + } + if (this->protocol_id > 3) + { + /* reserved for future use */ + return FAILED; + } + + /* notify message types and data is not getting checked in here */ + + return SUCCESS; +} + /** * Implements payload_t's and notify_payload_t's destroy function. * See #payload_s.destroy or notify_payload_s.destroy for description. @@ -341,6 +381,7 @@ notify_payload_t *notify_payload_create() return NULL; } /* interface functions */ + this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; this->public.payload_interface.get_encoding_rules = (status_t (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; |