define pen_type_t as a vendor-specific type
This commit is contained in:
@@ -55,14 +55,9 @@ struct private_ietf_attr_attr_request_t {
|
||||
ietf_attr_attr_request_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
* Vendor-specific attribute type
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
pen_type_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
@@ -93,13 +88,7 @@ struct entry_t {
|
||||
u_int32_t type;
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_ietf_attr_attr_request_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
METHOD(pa_tnc_attr_t, get_type, pen_type_t,
|
||||
private_ietf_attr_attr_request_t *this)
|
||||
{
|
||||
return this->type;
|
||||
@@ -250,7 +239,6 @@ pa_tnc_attr_t *ietf_attr_attr_request_create(pen_t vendor_id, u_int32_t type)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
@@ -263,8 +251,7 @@ pa_tnc_attr_t *ietf_attr_attr_request_create(pen_t vendor_id, u_int32_t type)
|
||||
.add = _add,
|
||||
.create_enumerator = _create_enumerator,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_ATTRIBUTE_REQUEST,
|
||||
.type = { PEN_IETF, IETF_ATTR_ATTRIBUTE_REQUEST },
|
||||
.list = linked_list_create(),
|
||||
.ref = 1,
|
||||
);
|
||||
@@ -283,7 +270,6 @@ pa_tnc_attr_t *ietf_attr_attr_request_create_from_data(chunk_t data)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.build = _build,
|
||||
@@ -294,8 +280,7 @@ pa_tnc_attr_t *ietf_attr_attr_request_create_from_data(chunk_t data)
|
||||
.add = _add,
|
||||
.create_enumerator = _create_enumerator,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_ATTRIBUTE_REQUEST,
|
||||
.type = { PEN_IETF,IETF_ATTR_ATTRIBUTE_REQUEST },
|
||||
.value = chunk_clone(data),
|
||||
.list = linked_list_create(),
|
||||
.ref = 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
|
||||
* Copyright (C) 2011-2012 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -107,14 +108,9 @@ struct private_ietf_attr_pa_tnc_error_t {
|
||||
ietf_attr_pa_tnc_error_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
* Vendor-specific attribute type
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
pen_type_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
@@ -127,14 +123,9 @@ struct private_ietf_attr_pa_tnc_error_t {
|
||||
bool noskip_flag;
|
||||
|
||||
/**
|
||||
* Error code vendor ID
|
||||
* Vendor-specific error code
|
||||
*/
|
||||
pen_t error_vendor_id;
|
||||
|
||||
/**
|
||||
* Error code
|
||||
*/
|
||||
u_int32_t error_code;
|
||||
pen_type_t error_code;
|
||||
|
||||
/**
|
||||
* First 8 bytes of erroneous PA-TNC message
|
||||
@@ -157,13 +148,7 @@ struct private_ietf_attr_pa_tnc_error_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_ietf_attr_pa_tnc_error_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
METHOD(pa_tnc_attr_t, get_type, pen_type_t,
|
||||
private_ietf_attr_pa_tnc_error_t *this)
|
||||
{
|
||||
return this->type;
|
||||
@@ -198,13 +183,13 @@ METHOD(pa_tnc_attr_t, build, void,
|
||||
}
|
||||
writer = bio_writer_create(PA_ERROR_HEADER_SIZE + PA_ERROR_MSG_INFO_SIZE);
|
||||
writer->write_uint8 (writer, PA_ERROR_RESERVED);
|
||||
writer->write_uint24(writer, this->error_vendor_id);
|
||||
writer->write_uint32(writer, this->error_code);
|
||||
writer->write_uint24(writer, this->error_code.vendor_id);
|
||||
writer->write_uint32(writer, this->error_code.type);
|
||||
writer->write_data (writer, this->msg_info);
|
||||
|
||||
if (this->error_vendor_id == PEN_IETF)
|
||||
if (this->error_code.vendor_id == PEN_IETF)
|
||||
{
|
||||
switch (this->error_code)
|
||||
switch (this->error_code.type)
|
||||
{
|
||||
case PA_ERROR_INVALID_PARAMETER:
|
||||
writer->write_uint32(writer, this->error_offset);
|
||||
@@ -239,10 +224,10 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
||||
}
|
||||
reader = bio_reader_create(this->value);
|
||||
reader->read_uint8 (reader, &reserved);
|
||||
reader->read_uint24(reader, &this->error_vendor_id);
|
||||
reader->read_uint32(reader, &this->error_code);
|
||||
reader->read_uint24(reader, &this->error_code.vendor_id);
|
||||
reader->read_uint32(reader, &this->error_code.type);
|
||||
|
||||
if (this->error_vendor_id == PEN_IETF)
|
||||
if (this->error_code.vendor_id == PEN_IETF)
|
||||
{
|
||||
if (!reader->read_data(reader, PA_ERROR_MSG_INFO_SIZE, &this->msg_info))
|
||||
{
|
||||
@@ -253,7 +238,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
||||
}
|
||||
this->msg_info = chunk_clone(this->msg_info);
|
||||
|
||||
switch (this->error_code)
|
||||
switch (this->error_code.type)
|
||||
{
|
||||
case PA_ERROR_INVALID_PARAMETER:
|
||||
if (!reader->read_uint32(reader, &this->error_offset))
|
||||
@@ -309,13 +294,7 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
||||
}
|
||||
}
|
||||
|
||||
METHOD(ietf_attr_pa_tnc_error_t, get_error_vendor_id, pen_t,
|
||||
private_ietf_attr_pa_tnc_error_t *this)
|
||||
{
|
||||
return this->error_vendor_id;
|
||||
}
|
||||
|
||||
METHOD(ietf_attr_pa_tnc_error_t, get_error_code, u_int32_t,
|
||||
METHOD(ietf_attr_pa_tnc_error_t, get_error_code, pen_type_t,
|
||||
private_ietf_attr_pa_tnc_error_t *this)
|
||||
{
|
||||
return this->error_code;
|
||||
@@ -348,13 +327,12 @@ METHOD(ietf_attr_pa_tnc_error_t, get_offset, u_int32_t,
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
|
||||
u_int32_t error_code,
|
||||
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_type_t error_code,
|
||||
chunk_t msg_info)
|
||||
{
|
||||
private_ietf_attr_pa_tnc_error_t *this;
|
||||
|
||||
if (vendor_id == PEN_IETF)
|
||||
if (error_code.vendor_id == PEN_IETF)
|
||||
{
|
||||
msg_info.len = PA_ERROR_MSG_INFO_SIZE;
|
||||
}
|
||||
@@ -366,7 +344,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
@@ -376,16 +353,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
|
||||
.get_ref = _get_ref,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_vendor_id = _get_error_vendor_id,
|
||||
.get_error_code = _get_error_code,
|
||||
.get_msg_info = _get_msg_info,
|
||||
.get_attr_info = _get_attr_info,
|
||||
.set_attr_info = _set_attr_info,
|
||||
.get_offset = _get_offset,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PA_TNC_ERROR,
|
||||
.error_vendor_id = vendor_id,
|
||||
.type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
|
||||
.error_code = error_code,
|
||||
.msg_info = chunk_clone(msg_info),
|
||||
.ref = 1,
|
||||
@@ -397,8 +371,7 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
|
||||
u_int32_t error_code,
|
||||
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
|
||||
chunk_t msg_info,
|
||||
u_int32_t error_offset)
|
||||
{
|
||||
@@ -410,7 +383,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
@@ -420,16 +392,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
|
||||
.get_ref = _get_ref,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_vendor_id = _get_error_vendor_id,
|
||||
.get_error_code = _get_error_code,
|
||||
.get_msg_info = _get_msg_info,
|
||||
.get_attr_info = _get_attr_info,
|
||||
.set_attr_info = _set_attr_info,
|
||||
.get_offset = _get_offset,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PA_TNC_ERROR,
|
||||
.error_vendor_id = vendor_id,
|
||||
.type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
|
||||
.error_code = error_code,
|
||||
.msg_info = chunk_clone(msg_info),
|
||||
.error_offset = error_offset,
|
||||
@@ -449,7 +418,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_from_data(chunk_t data)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.build = _build,
|
||||
@@ -457,15 +425,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_from_data(chunk_t data)
|
||||
.get_ref = _get_ref,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_vendor_id = _get_error_vendor_id,
|
||||
.get_error_code = _get_error_code,
|
||||
.get_msg_info = _get_msg_info,
|
||||
.get_attr_info = _get_attr_info,
|
||||
.set_attr_info = _set_attr_info,
|
||||
.get_offset = _get_offset,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PA_TNC_ERROR,
|
||||
.type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
|
||||
.value = chunk_clone(data),
|
||||
.ref = 1,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Andreas Steffen
|
||||
* Copyright (C) 2011-2012 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -62,11 +62,11 @@ struct ietf_attr_pa_tnc_error_t {
|
||||
pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this);
|
||||
|
||||
/**
|
||||
* Get PA-TNC error code
|
||||
* Get Vendor-specific PA-TNC error code
|
||||
*
|
||||
* @return error code
|
||||
*/
|
||||
pa_tnc_error_code_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
|
||||
pen_type_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
|
||||
|
||||
/**
|
||||
* Get first 8 bytes of erroneous PA-TNC message
|
||||
@@ -101,26 +101,22 @@ struct ietf_attr_pa_tnc_error_t {
|
||||
/**
|
||||
* Creates an ietf_attr_pa_tnc_error_t object from an error code
|
||||
*
|
||||
* @param vendor_id PA-TNC error code vendor ID
|
||||
* @param error_code PA-TNC error code
|
||||
* @param error_code Vendor-specific PA-TNC error code
|
||||
* @param header PA-TNC message header (first 8 bytes)
|
||||
*
|
||||
*/
|
||||
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_t vendor_id,
|
||||
u_int32_t error_code,
|
||||
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_type_t error_code,
|
||||
chunk_t header);
|
||||
|
||||
/**
|
||||
* Creates an ietf_attr_pa_tnc_error_t object from an error code with offset
|
||||
*
|
||||
* @param vendor_id PA-TNC error code vendor ID
|
||||
* @param error_code PA-TNC error code
|
||||
* @param error_code Vendor-specifica PA-TNC error code
|
||||
* @param header PA-TNC message header (first 8 bytes)
|
||||
* @param error_offset PA-TNC error offset in bytes
|
||||
*
|
||||
*/
|
||||
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
|
||||
u_int32_t error_code,
|
||||
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
|
||||
chunk_t header,
|
||||
u_int32_t error_offset);
|
||||
|
||||
|
||||
@@ -58,14 +58,9 @@ struct private_ietf_attr_port_filter_t {
|
||||
ietf_attr_port_filter_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
* Vendor-specific attribute type
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
pen_type_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
@@ -88,13 +83,7 @@ struct private_ietf_attr_port_filter_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_ietf_attr_port_filter_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
METHOD(pa_tnc_attr_t, get_type, pen_type_t,
|
||||
private_ietf_attr_port_filter_t *this)
|
||||
{
|
||||
return this->type;
|
||||
@@ -236,7 +225,6 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
@@ -249,8 +237,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
|
||||
.add_port = _add_port,
|
||||
.create_port_enumerator = _create_port_enumerator,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PORT_FILTER,
|
||||
.type = { PEN_IETF, IETF_ATTR_PORT_FILTER },
|
||||
.ports = linked_list_create(),
|
||||
.ref = 1,
|
||||
);
|
||||
@@ -268,7 +255,6 @@ pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(chunk_t data)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.build = _build,
|
||||
@@ -279,8 +265,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(chunk_t data)
|
||||
.add_port = _add_port,
|
||||
.create_port_enumerator = _create_port_enumerator,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PORT_FILTER,
|
||||
.type = {PEN_IETF, IETF_ATTR_PORT_FILTER },
|
||||
.value = chunk_clone(data),
|
||||
.ports = linked_list_create(),
|
||||
.ref = 1,
|
||||
|
||||
@@ -46,14 +46,9 @@ struct private_ietf_attr_product_info_t {
|
||||
ietf_attr_product_info_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
* Vendor-specific attribute type
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
pen_type_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
@@ -86,13 +81,7 @@ struct private_ietf_attr_product_info_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_ietf_attr_product_info_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
METHOD(pa_tnc_attr_t, get_type, pen_type_t,
|
||||
private_ietf_attr_product_info_t *this)
|
||||
{
|
||||
return this->type;
|
||||
@@ -205,7 +194,6 @@ pa_tnc_attr_t *ietf_attr_product_info_create(pen_t vendor_id, u_int16_t id,
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
@@ -217,8 +205,7 @@ pa_tnc_attr_t *ietf_attr_product_info_create(pen_t vendor_id, u_int16_t id,
|
||||
},
|
||||
.get_info = _get_info,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PRODUCT_INFORMATION,
|
||||
.type = { PEN_IETF, IETF_ATTR_PRODUCT_INFORMATION },
|
||||
.product_vendor_id = vendor_id,
|
||||
.product_id = id,
|
||||
.product_name = strdup(name),
|
||||
@@ -238,7 +225,6 @@ pa_tnc_attr_t *ietf_attr_product_info_create_from_data(chunk_t data)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.build = _build,
|
||||
@@ -248,8 +234,7 @@ pa_tnc_attr_t *ietf_attr_product_info_create_from_data(chunk_t data)
|
||||
},
|
||||
.get_info = _get_info,
|
||||
},
|
||||
.vendor_id = PEN_IETF,
|
||||
.type = IETF_ATTR_PRODUCT_INFORMATION,
|
||||
.type = { PEN_IETF, IETF_ATTR_PRODUCT_INFORMATION },
|
||||
.value = chunk_clone(data),
|
||||
.ref = 1,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user