Add a payload.get_header_length() method, remove header length definitions
This commit is contained in:
@@ -126,6 +126,12 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_auth_payload_t *this)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_auth_payload_t *this)
|
||||
{
|
||||
@@ -167,7 +173,7 @@ METHOD(auth_payload_t, set_data, void,
|
||||
{
|
||||
free(this->auth_data.ptr);
|
||||
this->auth_data = chunk_clone(data);
|
||||
this->payload_length = AUTH_PAYLOAD_HEADER_LENGTH + this->auth_data.len;
|
||||
this->payload_length = get_header_length(this) + this->auth_data.len;
|
||||
}
|
||||
|
||||
METHOD(auth_payload_t, get_data, chunk_t,
|
||||
@@ -195,6 +201,7 @@ auth_payload_t *auth_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,
|
||||
@@ -208,7 +215,7 @@ auth_payload_t *auth_payload_create()
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.payload_length = AUTH_PAYLOAD_HEADER_LENGTH,
|
||||
.payload_length = get_header_length(this),
|
||||
);
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user