- implemented compute length function

This commit is contained in:
Jan Hutter
2005-11-29 10:19:27 +00:00
parent 45c3d18680
commit 79b9c1d6c5
3 changed files with 32 additions and 1 deletions
@@ -146,6 +146,15 @@ static status_t verify(private_id_payload_t *this)
/* critical bit is set! */
return FAILED;
}
if ((this->id_type == 0) ||
(this->id_type == 4) ||
((this->id_type >= 6) && (this->id_type <= 8)) ||
((this->id_type >= 12) && (this->id_type <= 200)))
{
/* reserved IDs */
return FAILED;
}
return SUCCESS;
}
@@ -251,6 +260,14 @@ static void set_initiator (private_id_payload_t *this,bool is_initiator)
this->is_initiator = is_initiator;
}
/**
* Implementation of private_id_payload_t.compute_length.
*/
static void compute_length(private_id_payload_t *this)
{
this->payload_length = ID_PAYLOAD_HEADER_LENGTH + this->id_data.len;
}
/**
* Implementation of payload_t.destroy and id_payload_t.destroy.
*/
@@ -289,6 +306,9 @@ id_payload_t *id_payload_create(bool is_initiator)
this->public.get_initiator = (bool (*) (id_payload_t *)) get_initiator;
this->public.set_initiator = (void (*) (id_payload_t *,bool)) set_initiator;
/* private functions */
this->compute_length = compute_length;
/* private variables */
this->critical = FALSE;
this->next_payload = NO_PAYLOAD;