Add a payload.get_header_length() method, remove header length definitions
This commit is contained in:
@@ -173,6 +173,12 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_cert_payload_t *this)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_cert_payload_t *this)
|
||||
{
|
||||
@@ -270,6 +276,7 @@ cert_payload_t *cert_payload_create()
|
||||
.payload_interface = {
|
||||
.verify = _verify,
|
||||
.get_encoding_rules = _get_encoding_rules,
|
||||
.get_header_length = _get_header_length,
|
||||
.get_length = _get_length,
|
||||
.get_next_type = _get_next_type,
|
||||
.set_next_type = _set_next_type,
|
||||
@@ -283,7 +290,7 @@ cert_payload_t *cert_payload_create()
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.payload_length = CERT_PAYLOAD_HEADER_LENGTH,
|
||||
.payload_length = get_header_length(this),
|
||||
);
|
||||
return &this->public;
|
||||
}
|
||||
@@ -312,7 +319,7 @@ cert_payload_t *cert_payload_create_from_cert(certificate_t *cert)
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
|
||||
this->payload_length = get_header_length(this) + this->data.len;
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
@@ -325,7 +332,7 @@ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url)
|
||||
|
||||
this->encoding = ENC_X509_HASH_AND_URL;
|
||||
this->data = chunk_cat("cc", hash, chunk_create(url, strlen(url)));
|
||||
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
|
||||
this->payload_length = get_header_length(this) + this->data.len;
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
@@ -338,6 +345,6 @@ cert_payload_t *cert_payload_create_custom(cert_encoding_t type, chunk_t data)
|
||||
|
||||
this->encoding = type;
|
||||
this->data = data;
|
||||
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
|
||||
this->payload_length = get_header_length(this) + this->data.len;
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user