Removed len argument from proposal_get_token()
[strongswan.git] / src / conftest / hooks / set_critical.c
index b1b39c5..8ec84e1 100644 (file)
@@ -47,15 +47,16 @@ struct private_set_critical_t {
 
 METHOD(listener_t, message, bool,
        private_set_critical_t *this, ike_sa_t *ike_sa, message_t *message,
-       bool incoming)
+       bool incoming, bool plain)
 {
-       if (!incoming &&
+       if (!incoming && plain &&
                message->get_request(message) == this->req &&
                message->get_message_id(message) == this->id)
        {
                enumerator_t *msg, *types;
                payload_t *payload;
                payload_type_t type;
+               bool *critical;
                char *name;
 
                types = enumerator_create_token(this->payloads, " ", "");
@@ -76,17 +77,10 @@ METHOD(listener_t, message, bool,
                        {
                                if (type == payload->get_type(payload))
                                {
-                                       encoding_rule_t *rules;
-                                       size_t count;
-                                       int i;
-
-                                       payload->get_encoding_rules(payload, &rules, &count);
-                                       for (i = 0; i < count; i++)
+                                       critical = payload_get_field(payload, FLAG, 0);
+                                       if (critical)
                                        {
-                                               if (rules[i].type == FLAG)
-                                               {
-                                                       *(bool*)(((void*)payload) + rules[i].offset) = TRUE;
-                                               }
+                                               *critical = TRUE;
                                        }
                                }
                        }