ikev1: Move defragmentation to message_t
This commit is contained in:
@@ -296,6 +296,26 @@ struct message_t {
|
||||
*/
|
||||
bool (*is_fragmented)(message_t *this);
|
||||
|
||||
/**
|
||||
* Add a fragment to the message if it was created with
|
||||
* message_create_defrag().
|
||||
*
|
||||
* Once the message is completed it should be processed like any other
|
||||
* inbound message.
|
||||
*
|
||||
* @note Only supported for IKEv1 at the moment.
|
||||
*
|
||||
* @param fragment fragment to add
|
||||
* @return
|
||||
* - SUCCESS if message was reassembled
|
||||
* - NEED_MORE if not all fragments have yet been received
|
||||
* - FAILED if reassembling failed
|
||||
* - INVALID_ARG if fragment is invalid for some reason
|
||||
* - INVALID_STATE if message was not created using
|
||||
* message_create_defrag()
|
||||
*/
|
||||
status_t (*add_fragment)(message_t *this, message_t *fragment);
|
||||
|
||||
/**
|
||||
* Gets the source host informations.
|
||||
*
|
||||
@@ -419,4 +439,14 @@ message_t *message_create_from_packet(packet_t *packet);
|
||||
*/
|
||||
message_t *message_create(int major, int minor);
|
||||
|
||||
/**
|
||||
* Creates a message_t object that is used to reassemble fragmented messages.
|
||||
*
|
||||
* Use add_fragment() to add fragments.
|
||||
*
|
||||
* @param fragment initial fragment (is not added)
|
||||
* @return message_t object, NULL if fragment is not actually one
|
||||
*/
|
||||
message_t *message_create_defrag(message_t *fragment);
|
||||
|
||||
#endif /** MESSAGE_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user