Add support to create IKE fragments
All fragments currently use the same fragment ID (1) as that's what other implementations are doing.
This commit is contained in:
@@ -206,3 +206,20 @@ fragment_payload_t *fragment_payload_create()
|
||||
this->payload_length = get_header_length(this);
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
fragment_payload_t *fragment_payload_create_from_data(u_int8_t num, bool last,
|
||||
chunk_t data)
|
||||
{
|
||||
private_fragment_payload_t *this;
|
||||
|
||||
this = (private_fragment_payload_t*)fragment_payload_create();
|
||||
this->fragment_id = 1;
|
||||
this->fragment_number = num;
|
||||
this->flags |= (last ? LAST_FRAGMENT : 0);
|
||||
this->data = chunk_clone(data);
|
||||
this->payload_length = get_header_length(this) + data.len;
|
||||
return &this->public;
|
||||
}
|
||||
@@ -78,4 +78,17 @@ struct fragment_payload_t {
|
||||
*/
|
||||
fragment_payload_t *fragment_payload_create();
|
||||
|
||||
/**
|
||||
* Creates a fragment payload from the given data. All fragments currently
|
||||
* have the same fragment ID (1), which seems what other implementations are
|
||||
* doing.
|
||||
*
|
||||
* @param num fragment number (first one should be 1)
|
||||
* @param last TRUE to indicate that this is the last fragment
|
||||
* @param data fragment data (gets cloned)
|
||||
* @return fragment_payload_t object
|
||||
*/
|
||||
fragment_payload_t *fragment_payload_create_from_data(u_int8_t num, bool last,
|
||||
chunk_t data);
|
||||
|
||||
#endif /** FRAGMENT_PAYLOAD_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user