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:
Tobias Brunner
2012-12-24 12:29:30 +01:00
parent c4daac2c0b
commit 07df944c9c
2 changed files with 30 additions and 0 deletions
@@ -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;
}