payload: Use common prefixes for all payload type identifiers
[strongswan.git] / src / libcharon / encoding / payloads / encryption_payload.c
index 6a9f9c3..5784562 100644 (file)
@@ -74,7 +74,7 @@ struct private_encryption_payload_t {
        linked_list_t *payloads;
 
        /**
-        * Type of payload, ENCRYPTED or ENCRYPTED_V1
+        * Type of payload, PLV2_ENCRYPTED or PLV1_ENCRYPTED
         */
        payload_type_t type;
 };
@@ -145,7 +145,7 @@ METHOD(payload_t, verify, status_t,
 METHOD(payload_t, get_encoding_rules, int,
        private_encryption_payload_t *this, encoding_rule_t **rules)
 {
-       if (this->type == ENCRYPTED)
+       if (this->type == PLV2_ENCRYPTED)
        {
                *rules = encodings_v2;
                return countof(encodings_v2);
@@ -157,7 +157,7 @@ METHOD(payload_t, get_encoding_rules, int,
 METHOD(payload_t, get_header_length, int,
        private_encryption_payload_t *this)
 {
-       if (this->type == ENCRYPTED)
+       if (this->type == PLV2_ENCRYPTED)
        {
                return 4;
        }
@@ -241,7 +241,7 @@ METHOD(encryption_payload_t, add_payload, void,
        {
                this->next_payload = payload->get_type(payload);
        }
-       payload->set_next_type(payload, NO_PAYLOAD);
+       payload->set_next_type(payload, PL_NONE);
        this->payloads->insert_last(this->payloads, payload);
        compute_length(this);
 }
@@ -281,7 +281,7 @@ static chunk_t generate(private_encryption_payload_t *this,
                        generator->generate_payload(generator, current);
                        current = next;
                }
-               current->set_next_type(current, NO_PAYLOAD);
+               current->set_next_type(current, PL_NONE);
                generator->generate_payload(generator, current);
 
                chunk = generator->get_chunk(generator, &lenpos);
@@ -447,7 +447,7 @@ static status_t parse(private_encryption_payload_t *this, chunk_t plain)
 
        parser = parser_create(plain);
        type = this->next_payload;
-       while (type != NO_PAYLOAD)
+       while (type != PL_NONE)
        {
                payload_t *payload;
 
@@ -618,13 +618,13 @@ encryption_payload_t *encryption_payload_create(payload_type_t type)
                        .decrypt = _decrypt,
                        .destroy = _destroy,
                },
-               .next_payload = NO_PAYLOAD,
+               .next_payload = PL_NONE,
                .payloads = linked_list_create(),
                .type = type,
        );
        this->payload_length = get_header_length(this);
 
-       if (type == ENCRYPTED_V1)
+       if (type == PLV1_ENCRYPTED)
        {
                this->public.encrypt = _encrypt_v1;
                this->public.decrypt = _decrypt_v1;