Added a message_t option to disable automatic payload sorting
This commit is contained in:
parent
6260e6fe12
commit
363ec8986c
|
@ -489,6 +489,11 @@ struct private_message_t {
|
|||
*/
|
||||
bool is_request;
|
||||
|
||||
/**
|
||||
* Sorting of message disabled?
|
||||
*/
|
||||
bool sort_disabled;
|
||||
|
||||
/**
|
||||
* Message ID of this message.
|
||||
*/
|
||||
|
@ -1001,6 +1006,12 @@ static encryption_payload_t* wrap_payloads(private_message_t *this)
|
|||
return encryption;
|
||||
}
|
||||
|
||||
METHOD(message_t, disable_sort, void,
|
||||
private_message_t *this)
|
||||
{
|
||||
this->sort_disabled = TRUE;
|
||||
}
|
||||
|
||||
METHOD(message_t, generate, status_t,
|
||||
private_message_t *this, aead_t *aead, packet_t **packet)
|
||||
{
|
||||
|
@ -1039,7 +1050,10 @@ METHOD(message_t, generate, status_t,
|
|||
return NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
order_payloads(this);
|
||||
if (!this->sort_disabled)
|
||||
{
|
||||
order_payloads(this);
|
||||
}
|
||||
|
||||
DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str)));
|
||||
|
||||
|
@ -1445,6 +1459,7 @@ message_t *message_create_from_packet(packet_t *packet)
|
|||
.get_request = _get_request,
|
||||
.add_payload = _add_payload,
|
||||
.add_notify = _add_notify,
|
||||
.disable_sort = _disable_sort,
|
||||
.generate = _generate,
|
||||
.set_source = _set_source,
|
||||
.get_source = _get_source,
|
||||
|
|
|
@ -180,6 +180,11 @@ struct message_t {
|
|||
void (*add_notify) (message_t *this, bool flush, notify_type_t type,
|
||||
chunk_t data);
|
||||
|
||||
/**
|
||||
* Disable automatic payload sorting for this message.
|
||||
*/
|
||||
void (*disable_sort)(message_t *this);
|
||||
|
||||
/**
|
||||
* Parses header of message.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue