]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Added a message_t option to disable automatic payload sorting
authorMartin Willi <martin@revosec.ch>
Tue, 2 Nov 2010 13:21:38 +0000 (14:21 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 5 Jan 2011 15:45:41 +0000 (16:45 +0100)
src/libcharon/encoding/message.c
src/libcharon/encoding/message.h

index d41ad46979aed4532edb7bf82397fe5eda0a4fe4..b69a9f30c86244057a8b3007ba46c51c856dd2fd 100644 (file)
@@ -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,
index 8c1cbcd096115e3cacef24cc21e4a5cb33b4aff7..86c39ad7e305e4b3ce0123958e99305ff73dda05 100644 (file)
@@ -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.
         *