Simplify signature of get_encoding_rules(), make all rules static
This commit is contained in:
@@ -76,11 +76,10 @@ METHOD(listener_t, message, bool,
|
||||
if (type == payload->get_type(payload))
|
||||
{
|
||||
encoding_rule_t *rules;
|
||||
size_t count;
|
||||
u_int16_t *len;
|
||||
int i;
|
||||
int i, count;
|
||||
|
||||
payload->get_encoding_rules(payload, &rules, &count);
|
||||
count = payload->get_encoding_rules(payload, &rules);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (rules[i].type == PAYLOAD_LENGTH)
|
||||
|
||||
@@ -404,8 +404,7 @@ METHOD(generator_t, get_chunk, chunk_t,
|
||||
METHOD(generator_t, generate_payload, void,
|
||||
private_generator_t *this,payload_t *payload)
|
||||
{
|
||||
int i, offset_start;
|
||||
size_t rule_count;
|
||||
int i, offset_start, rule_count;
|
||||
encoding_rule_t *rules;
|
||||
payload_type_t payload_type;
|
||||
|
||||
@@ -418,7 +417,7 @@ METHOD(generator_t, generate_payload, void,
|
||||
payload_type_names, payload_type);
|
||||
|
||||
/* each payload has its own encoding rules */
|
||||
payload->get_encoding_rules(payload, &rules, &rule_count);
|
||||
rule_count = payload->get_encoding_rules(payload, &rules);
|
||||
|
||||
for (i = 0; i < rule_count;i++)
|
||||
{
|
||||
|
||||
@@ -363,11 +363,10 @@ METHOD(parser_t, parse_payload, status_t,
|
||||
{
|
||||
payload_t *pld;
|
||||
void *output;
|
||||
size_t rule_count;
|
||||
int payload_length = 0, spi_size = 0, attribute_length = 0;
|
||||
u_int16_t ts_type = 0;
|
||||
bool attribute_format = FALSE;
|
||||
int rule_number;
|
||||
int rule_number, rule_count;
|
||||
encoding_rule_t *rule;
|
||||
|
||||
/* create instance of the payload to parse */
|
||||
@@ -383,7 +382,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||
output = pld;
|
||||
|
||||
/* parse the payload with its own rulse */
|
||||
pld->get_encoding_rules(pld, &this->rules, &rule_count);
|
||||
rule_count = pld->get_encoding_rules(pld, &this->rules);
|
||||
for (rule_number = 0; rule_number < rule_count; rule_number++)
|
||||
{
|
||||
rule = &(this->rules[rule_number]);
|
||||
|
||||
@@ -74,7 +74,7 @@ struct private_auth_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_auth_payload_t.
|
||||
*/
|
||||
encoding_rule_t auth_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_auth_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -119,11 +119,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_auth_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_auth_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = auth_payload_encodings;
|
||||
*rule_count = countof(auth_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -95,7 +95,7 @@ struct private_cert_payload_t {
|
||||
* private_cert_payload_t.
|
||||
*
|
||||
*/
|
||||
encoding_rule_t cert_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_cert_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -166,11 +166,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_cert_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_cert_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = cert_payload_encodings;
|
||||
*rule_count = countof(cert_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -72,7 +72,7 @@ struct private_certreq_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_certreq_payload_t.
|
||||
*/
|
||||
encoding_rule_t certreq_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_certreq_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -122,11 +122,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_certreq_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_certreq_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = certreq_payload_encodings;
|
||||
*rule_count = countof(certreq_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -62,7 +62,7 @@ struct private_configuration_attribute_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_configuration_attribute_t.
|
||||
*/
|
||||
encoding_rule_t configuration_attribute_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 reserved bit */
|
||||
{ RESERVED_BIT, offsetof(private_configuration_attribute_t, reserved)},
|
||||
/* type of the attribute as 15 bit unsigned integer */
|
||||
@@ -154,12 +154,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_configuration_attribute_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_configuration_attribute_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = configuration_attribute_encodings;
|
||||
*rule_count = countof(configuration_attribute_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -83,7 +83,7 @@ struct private_cp_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_cp_payload_t.
|
||||
*/
|
||||
encoding_rule_t cp_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_cp_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -142,11 +142,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return status;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_cp_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_cp_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = cp_payload_encodings;
|
||||
*rule_count = countof(cp_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -79,7 +79,7 @@ struct private_delete_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_delete_payload_t.
|
||||
*/
|
||||
encoding_rule_t delete_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_delete_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -145,11 +145,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_delete_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_delete_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = delete_payload_encodings;
|
||||
*rule_count = countof(delete_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_payload_type, payload_type_t,
|
||||
|
||||
@@ -65,7 +65,7 @@ struct private_eap_payload_t {
|
||||
* private_eap_payload_t.
|
||||
*
|
||||
*/
|
||||
static encoding_rule_t eap_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_eap_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -143,11 +143,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_eap_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_eap_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = eap_payload_encodings;
|
||||
*rule_count = sizeof(eap_payload_encodings) / sizeof(encoding_rule_t);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_payload_type, payload_type_t,
|
||||
|
||||
@@ -79,7 +79,7 @@ struct private_encryption_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_encryption_payload_t.
|
||||
*/
|
||||
encoding_rule_t encryption_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_encryption_payload_t, next_payload) },
|
||||
/* Critical and 7 reserved bits, all stored for reconstruction */
|
||||
@@ -115,12 +115,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_encryption_payload_t *this, encoding_rule_t **rules,
|
||||
size_t *count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_encryption_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = encryption_payload_encodings;
|
||||
*count = countof(encryption_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -83,7 +83,7 @@ struct private_id_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_id_payload_t.
|
||||
*/
|
||||
encoding_rule_t id_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_id_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -134,11 +134,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_id_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_id_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = id_payload_encodings;
|
||||
*rule_count = countof(id_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -146,7 +146,7 @@ ENUM_END(exchange_type_names, EXCHANGE_TYPE_UNDEFINED);
|
||||
* The defined offsets are the positions in a object of type
|
||||
* ike_header_t.
|
||||
*/
|
||||
encoding_rule_t ike_header_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 8 Byte SPI, stored in the field initiator_spi */
|
||||
{ IKE_SPI, offsetof(private_ike_header_t, initiator_spi) },
|
||||
/* 8 Byte SPI, stored in the field responder_spi */
|
||||
@@ -244,11 +244,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_ike_header_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_ike_header_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = ike_header_encodings;
|
||||
*rule_count = sizeof(ike_header_encodings) / sizeof(encoding_rule_t);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -145,19 +145,16 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_ke_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_ke_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == KEY_EXCHANGE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
*rule_count = countof(encodings_v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
*rule_count = countof(encodings_v1);
|
||||
return countof(encodings_v2);
|
||||
}
|
||||
*rules = encodings_v1;
|
||||
return countof(encodings_v1);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -70,7 +70,7 @@ struct private_nonce_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_nonce_payload_t.
|
||||
*/
|
||||
encoding_rule_t nonce_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_nonce_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -110,11 +110,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_nonce_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_nonce_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = nonce_payload_encodings;
|
||||
*rule_count = countof(nonce_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -263,7 +263,7 @@ struct private_notify_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_notify_payload_t.
|
||||
*/
|
||||
encoding_rule_t notify_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_notify_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -423,11 +423,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_notify_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_notify_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = notify_payload_encodings;
|
||||
*rule_count = countof(notify_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -255,10 +255,9 @@ bool payload_is_known(payload_type_t type)
|
||||
void* payload_get_field(payload_t *payload, encoding_type_t type, u_int skip)
|
||||
{
|
||||
encoding_rule_t *rule;
|
||||
size_t count;
|
||||
int i;
|
||||
int i, count;
|
||||
|
||||
payload->get_encoding_rules(payload, &rule, &count);
|
||||
count = payload->get_encoding_rules(payload, &rule);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (rule[i].type == type && skip-- == 0)
|
||||
|
||||
@@ -271,10 +271,10 @@ struct payload_t {
|
||||
/**
|
||||
* Get encoding rules for this payload.
|
||||
*
|
||||
* @param rules location to store pointer of first rule
|
||||
* @param rule_count location to store number of rules
|
||||
* @param rules location to store pointer to rules
|
||||
* @return number of rules
|
||||
*/
|
||||
void (*get_encoding_rules) (payload_t *this, encoding_rule_t **rules, size_t *rule_count);
|
||||
int (*get_encoding_rules) (payload_t *this, encoding_rule_t **rules);
|
||||
|
||||
/**
|
||||
* Get type of payload.
|
||||
|
||||
@@ -296,20 +296,16 @@ METHOD(payload_t, verify, status_t,
|
||||
return status;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_proposal_substructure_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_proposal_substructure_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
*rule_count = countof(encodings_v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
*rule_count = countof(encodings_v1);
|
||||
return countof(encodings_v2);
|
||||
}
|
||||
*rules = encodings_v1;
|
||||
return countof(encodings_v1);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -202,19 +202,16 @@ METHOD(payload_t, verify, status_t,
|
||||
return status;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_sa_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_sa_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == SECURITY_ASSOCIATION_V1)
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
*rule_count = countof(encodings_v1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
*rule_count = countof(encodings_v2);
|
||||
return countof(encodings_v1);
|
||||
}
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -74,7 +74,7 @@ struct private_traffic_selector_substructure_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_traffic_selector_substructure_t.
|
||||
*/
|
||||
encoding_rule_t traffic_selector_substructure_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next ts type*/
|
||||
{ TS_TYPE, offsetof(private_traffic_selector_substructure_t, ts_type) },
|
||||
/* 1 Byte IP protocol id*/
|
||||
@@ -148,12 +148,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_traffic_selector_substructure_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_traffic_selector_substructure_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = traffic_selector_substructure_encodings;
|
||||
*rule_count = countof(traffic_selector_substructure_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -134,12 +134,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_transform_attribute_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_transform_attribute_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = encodings;
|
||||
*rule_count = countof(encodings);
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -162,20 +162,16 @@ METHOD(payload_t, verify, status_t,
|
||||
return status;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_transform_substructure_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_transform_substructure_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == TRANSFORM_ATTRIBUTE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
*rule_count = countof(encodings_v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
*rule_count = countof(encodings_v1);
|
||||
return countof(encodings_v2);
|
||||
}
|
||||
*rules = encodings_v1;
|
||||
return countof(encodings_v1);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -81,7 +81,7 @@ struct private_ts_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_ts_payload_t.
|
||||
*/
|
||||
encoding_rule_t ts_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_ts_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -145,11 +145,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return status;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_ts_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_ts_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = ts_payload_encodings;
|
||||
*rule_count = countof(ts_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
@@ -68,7 +68,7 @@ struct private_unknown_payload_t {
|
||||
* private_unknown_payload_t.
|
||||
*
|
||||
*/
|
||||
encoding_rule_t unknown_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_unknown_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -109,11 +109,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_unknown_payload_t *this, encoding_rule_t **rules, size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_unknown_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = unknown_payload_encodings;
|
||||
*rule_count = sizeof(unknown_payload_encodings) / sizeof(encoding_rule_t);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_payload_type, payload_type_t,
|
||||
|
||||
@@ -68,7 +68,7 @@ struct private_vendor_id_payload_t {
|
||||
* The defined offsets are the positions in a object of type
|
||||
* private_vendor_id_payload_t.
|
||||
*/
|
||||
encoding_rule_t vendor_id_payload_encodings[] = {
|
||||
static encoding_rule_t encodings[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
{ U_INT_8, offsetof(private_vendor_id_payload_t, next_payload) },
|
||||
/* the critical bit */
|
||||
@@ -105,12 +105,11 @@ METHOD(payload_t, verify, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_encoding_rules, void,
|
||||
private_vendor_id_payload_t *this, encoding_rule_t **rules,
|
||||
size_t *rule_count)
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_vendor_id_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
*rules = vendor_id_payload_encodings;
|
||||
*rule_count = countof(vendor_id_payload_encodings);
|
||||
*rules = encodings;
|
||||
return countof(encodings);
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
|
||||
Reference in New Issue
Block a user