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
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;
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,
.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,
);
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
.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,
/*
- * 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
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
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
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;
}
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);
}
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))
{
}
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))
}
}
-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;
/**
* 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;
}
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,
.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,
/**
* 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)
{
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,
.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,
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
.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,
);
/*
- * 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
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
/**
* 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);
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
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;
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,
.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,
);
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
.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,
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
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;
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,
},
.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),
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
},
.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,
);
ita_attr_command_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_ita_attr_command_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_ita_attr_command_t *this)
{
return this->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,
},
.get_command = _get_command,
},
- .vendor_id = PEN_ITA,
- .type = ITA_ATTR_COMMAND,
+ .type = { PEN_ITA, ITA_ATTR_COMMAND },
.command = strdup(command),
.ref = 1,
);
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
},
.get_command = _get_command,
},
- .vendor_id = PEN_ITA,
- .type = ITA_ATTR_COMMAND,
+ .type = {PEN_ITA, ITA_ATTR_COMMAND },
.value = chunk_clone(data),
.ref = 1,
);
ita_attr_dummy_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_ita_attr_dummy_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_ita_attr_dummy_t *this)
{
return this->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,
},
.get_size = _get_size,
},
- .vendor_id = PEN_ITA,
- .type = ITA_ATTR_DUMMY,
+ .type = { PEN_ITA, ITA_ATTR_DUMMY },
.size = size,
.ref = 1,
);
INIT(this,
.public = {
.pa_tnc_attribute = {
- .get_vendor_id = _get_vendor_id,
.get_type = _get_type,
.get_value = _get_value,
.build = _build,
},
.get_size = _get_size,
},
- .vendor_id = PEN_ITA,
- .type = ITA_ATTR_DUMMY,
+ .type = { PEN_ITA, ITA_ATTR_DUMMY },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * 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
struct pa_tnc_attr_t {
/**
- * Get the vendor ID of an PA-TNC attribute
+ * Get the vendor ID/type of an PA-TNC attribute
*
- * @return attribute vendor ID
+ * @return vendor-specific attribute type
*/
- u_int32_t (*get_vendor_id)(pa_tnc_attr_t *this);
-
- /**
- * Get the type of an PA-TNC attribute
- *
- * @return attribute type
- */
- u_int32_t (*get_type)(pa_tnc_attr_t *this);
+ pen_type_t (*get_type)(pa_tnc_attr_t *this);
/**
* Get the value of an PA-TNC attribute
enumerator_t *enumerator;
pa_tnc_attr_t *attr;
enum_name_t *pa_attr_names;
- pen_t vendor_id;
- u_int32_t type;
+ pen_type_t type;
u_int8_t flags;
chunk_t value;
nonce_gen_t *ng;
enumerator = this->attributes->create_enumerator(this->attributes);
while (enumerator->enumerate(enumerator, &attr))
{
- vendor_id = attr->get_vendor_id(attr);
- type = attr->get_type(attr);
+ type = attr->get_type(attr);
value = attr->get_value(attr);
flags = attr->get_noskip_flag(attr) ? PA_TNC_ATTR_FLAG_NOSKIP :
PA_TNC_ATTR_FLAG_NONE;
pa_attr_names = imcv_pa_tnc_attributes->get_names(imcv_pa_tnc_attributes,
- vendor_id);
+ type.vendor_id);
if (pa_attr_names)
{
DBG2(DBG_TNC, "creating PA-TNC attribute type '%N/%N' "
- "0x%06x/0x%08x", pen_names, vendor_id,
- pa_attr_names, type, vendor_id, type);
+ "0x%06x/0x%08x", pen_names, type.vendor_id,
+ pa_attr_names, type.type, type.vendor_id, type.type);
}
else
{
DBG2(DBG_TNC, "creating PA-TNC attribute type '%N' "
- "0x%06x/0x%08x", pen_names, vendor_id,
- vendor_id, type);
+ "0x%06x/0x%08x", pen_names, type.vendor_id,
+ type.vendor_id, type.type);
}
DBG3(DBG_TNC, "%B", &value);
writer->write_uint8 (writer, flags);
- writer->write_uint24(writer, vendor_id);
- writer->write_uint32(writer, type);
+ writer->write_uint24(writer, type.vendor_id);
+ writer->write_uint32(writer, type.type);
writer->write_uint32(writer, PA_TNC_ATTR_HEADER_SIZE + value.len);
writer->write_data (writer, value);
}
pa_tnc_attr_t *error;
u_int8_t version;
u_int32_t reserved, offset, attr_offset;
+ pen_type_t error_code;
/* process message header */
if (this->encoding.len < PA_TNC_HEADER_SIZE)
if (version != PA_TNC_VERSION)
{
+ pen_type_t error_code = { PEN_IETF, PA_ERROR_VERSION_NOT_SUPPORTED };
+
DBG1(DBG_TNC, "PA-TNC version %u not supported", version);
- error = ietf_attr_pa_tnc_error_create(PEN_IETF,
- PA_ERROR_VERSION_NOT_SUPPORTED, this->encoding);
+ error = ietf_attr_pa_tnc_error_create(error_code, this->encoding);
goto err;
}
pa_tnc_attr_t *attr;
enum_name_t *pa_attr_names;
ietf_attr_pa_tnc_error_t *error_attr;
+ pen_type_t error_code;
attr_info = reader->peek(reader);
attr_info.len = PA_TNC_ATTR_INFO_SIZE;
{
DBG1(DBG_TNC, "%u bytes too small for PA-TNC attribute length",
length);
- error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF,
- PA_ERROR_INVALID_PARAMETER, this->encoding,
- offset + PA_TNC_ATTR_INFO_SIZE);
+ error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
+ error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
+ this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
goto err;
}
if (!reader->read_data(reader, length - PA_TNC_ATTR_HEADER_SIZE, &value))
{
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value");
- error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF,
- PA_ERROR_INVALID_PARAMETER, this->encoding,
- offset + PA_TNC_ATTR_INFO_SIZE);
+ error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
+ error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
+ this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
goto err;
}
DBG3(DBG_TNC, "%B", &value);
if (flags & PA_TNC_ATTR_FLAG_NOSKIP)
{
DBG1(DBG_TNC, "unsupported PA-TNC attribute with NOSKIP flag");
- error = ietf_attr_pa_tnc_error_create(PEN_IETF,
- PA_ERROR_ATTR_TYPE_NOT_SUPPORTED, this->encoding);
+ error_code = pen_type_create(PEN_IETF,
+ PA_ERROR_ATTR_TYPE_NOT_SUPPORTED);
+ error = ietf_attr_pa_tnc_error_create(error_code,
+ this->encoding);
error_attr = (ietf_attr_pa_tnc_error_t*)error;
error_attr->set_attr_info(error_attr, attr_info);
goto err;
if (attr->process(attr, &attr_offset) != SUCCESS)
{
attr->destroy(attr);
- if (vendor_id == PEN_IETF && type == IETF_ATTR_PA_TNC_ERROR)
+ if (error_code.vendor_id == PEN_IETF &&
+ error_code.type == IETF_ATTR_PA_TNC_ERROR)
{
/* error while processing a PA-TNC error attribute - abort */
reader->destroy(reader);
return FAILED;
}
- error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF,
- PA_ERROR_INVALID_PARAMETER, this->encoding,
+ error_code = pen_type_create(PEN_IETF,
+ PA_ERROR_ATTR_TYPE_NOT_SUPPORTED);
+ error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
+ this->encoding,
offset + PA_TNC_ATTR_HEADER_SIZE + attr_offset);
goto err;
}
return SUCCESS;
}
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute header");
- error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF,
- PA_ERROR_INVALID_PARAMETER, this->encoding, offset);
+ error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
+ error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
+ this->encoding, offset);
err:
reader->destroy(reader);
{
enumerator_t *enumerator;
pa_tnc_attr_t *attr;
+ pen_type_t type;
bool fatal_error = FALSE;
enumerator = this->attributes->create_enumerator(this->attributes);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) == PEN_IETF &&
- attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR)
+ type = attr->get_type(attr);
+
+ if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PA_TNC_ERROR)
{
ietf_attr_pa_tnc_error_t *error_attr;
- pen_t error_vendor_id;
- pa_tnc_error_code_t error_code;
+ pen_type_t error_code;
chunk_t msg_info, attr_info;
u_int32_t offset;
error_attr = (ietf_attr_pa_tnc_error_t*)attr;
- error_vendor_id = error_attr->get_vendor_id(error_attr);
error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr);
/* skip errors from non-IETF namespaces */
- if (error_vendor_id != PEN_IETF)
+ if (error_code.vendor_id != PEN_IETF)
{
continue;
}
DBG1(DBG_IMC, "received PA-TNC error '%N' concerning message "
- "0x%08x/0x%08x", pa_tnc_error_code_names, error_code,
+ "0x%08x/0x%08x", pa_tnc_error_code_names, error_code.type,
untoh32(msg_info.ptr), untoh32(msg_info.ptr + 4));
- switch (error_code)
+ switch (error_code.type)
{
case PA_ERROR_INVALID_PARAMETER:
offset = error_attr->get_offset(error_attr);
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ pen_type_t attr_type;
imc_state_t *state;
enumerator_t *enumerator;
TNC_Result result;
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) != PEN_ITA)
+ attr_type = attr->get_type(attr);
+
+ if (attr_type.vendor_id != PEN_ITA)
{
continue;
}
- if (attr->get_type(attr) == ITA_ATTR_COMMAND)
+ if (attr_type.type == ITA_ATTR_COMMAND)
{
ita_attr_command_t *ita_attr;
DBG1(DBG_IMC, "received command '%s'",
ita_attr->get_command(ita_attr));
}
- else if (attr->get_type(attr) == ITA_ATTR_DUMMY)
+ else if (attr_type.type == ITA_ATTR_DUMMY)
{
ita_attr_dummy_t *ita_attr;
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ pen_type_t type;
imv_state_t *state;
enumerator_t *enumerator;
TNC_Result result;
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) == PEN_IETF &&
- attr->get_type(attr) == IETF_ATTR_PORT_FILTER)
+ type = attr->get_type(attr);
+
+ if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PORT_FILTER)
{
ietf_attr_port_filter_t *attr_port_filter;
enumerator_t *enumerator;
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ pen_type_t attr_type;
linked_list_t *attr_list;
imv_state_t *state;
imv_test_state_t *test_state;
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) != PEN_ITA)
+ attr_type = attr->get_type(attr);
+
+ if (attr_type.vendor_id != PEN_ITA)
{
continue;
}
- if (attr->get_type(attr) == ITA_ATTR_COMMAND)
+ if (attr_type.type == ITA_ATTR_COMMAND)
{
ita_attr_command_t *ita_attr;
char *command;
TNC_IMV_EVALUATION_RESULT_ERROR);
}
}
- else if (attr->get_type(attr) == ITA_ATTR_DUMMY)
+ else if (attr_type.type == ITA_ATTR_DUMMY)
{
ita_attr_dummy_t *ita_attr;
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ pen_type_t type;
linked_list_t *attr_list;
imc_state_t *state;
imc_attestation_state_t *attestation_state;
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) == PEN_IETF &&
- attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR)
+ type = attr->get_type(attr);
+
+ if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PA_TNC_ERROR)
{
ietf_attr_pa_tnc_error_t *error_attr;
- pen_t error_vendor_id;
- pa_tnc_error_code_t error_code;
+ pen_type_t error_code;
chunk_t msg_info;
error_attr = (ietf_attr_pa_tnc_error_t*)attr;
- error_vendor_id = error_attr->get_vendor_id(error_attr);
+ error_code = error_attr->get_error_code(error_attr);
- if (error_vendor_id == PEN_TCG)
+ if (error_code.vendor_id == PEN_TCG)
{
- error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr);
DBG1(DBG_IMC, "received TCG-PTS error '%N'",
- pts_error_code_names, error_code);
+ pts_error_code_names, error_code.type);
DBG1(DBG_IMC, "error information: %B", &msg_info);
result = TNC_RESULT_FATAL;
}
}
- else if (attr->get_vendor_id(attr) == PEN_TCG)
+ else if (type.vendor_id == PEN_TCG)
{
if (!imc_attestation_process(attr, attr_list, attestation_state,
supported_algorithms, supported_dh_groups))
chunk_t attr_info;
pts_t *pts;
pts_error_code_t pts_error;
+ pen_type_t attr_type;
bool valid_path;
pts = attestation_state->get_pts(attestation_state);
- switch (attr->get_type(attr))
+ attr_type = attr->get_type(attr);
+
+ switch (attr_type.type)
{
case TCG_PTS_REQ_PROTO_CAPS:
{
case TCG_PTS_GET_TPM_VERSION_INFO:
{
chunk_t tpm_version_info, attr_info;
+ pen_type_t error_code = { PEN_TCG, TCG_PTS_TPM_VERS_NOT_SUPPORTED };
if (!pts->get_tpm_version_info(pts, &tpm_version_info))
{
attr_info = attr->get_value(attr);
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_TPM_VERS_NOT_SUPPORTED, attr_info);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
bool is_directory;
u_int32_t delimiter;
pts_file_meas_t *measurements;
+ pen_type_t error_code;
attr_info = attr->get_value(attr);
attr_cast = (tcg_pts_attr_req_file_meas_t*)attr;
if (valid_path && pts_error)
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- pts_error, attr_info);
+ error_code = pen_type_create(PEN_TCG, pts_error);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF)
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_INVALID_DELIMITER, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_INVALID_DELIMITER);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
bool is_directory;
u_int8_t delimiter;
pts_file_meta_t *metadata;
+ pen_type_t error_code;
attr_info = attr->get_value(attr);
attr_cast = (tcg_pts_attr_req_file_meta_t*)attr;
valid_path = pts->is_path_valid(pts, pathname, &pts_error);
if (valid_path && pts_error)
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- pts_error, attr_info);
+ error_code = pen_type_create(PEN_TCG, pts_error);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
}
if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF)
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_INVALID_DELIMITER, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_INVALID_DELIMITER);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
pts_comp_func_name_t *name;
pts_comp_evidence_t *evid;
pts_component_t *comp;
+ pen_type_t error_code;
u_int32_t depth;
u_int8_t flags;
status_t status;
if (flags & PTS_REQ_FUNC_COMP_EVID_TTC)
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_UNABLE_DET_TTC, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_UNABLE_DET_TTC);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
if (flags & PTS_REQ_FUNC_COMP_EVID_VER &&
!(negotiated_caps & PTS_PROTO_CAPS_V))
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_UNABLE_LOCAL_VAL, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_UNABLE_LOCAL_VAL);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
if (flags & PTS_REQ_FUNC_COMP_EVID_CURR &&
!(negotiated_caps & PTS_PROTO_CAPS_C))
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_UNABLE_CUR_EVID, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_UNABLE_CUR_EVID);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
if (flags & PTS_REQ_FUNC_COMP_EVID_PCR &&
!(negotiated_caps & PTS_PROTO_CAPS_T))
{
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
- TCG_PTS_UNABLE_DET_PCR, attr_info);
+ error_code = pen_type_create(PEN_TCG,
+ TCG_PTS_UNABLE_DET_PCR);
+ attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr);
break;
}
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ pen_type_t type;
linked_list_t *attr_list;
imv_state_t *state;
imv_attestation_state_t *attestation_state;
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr))
{
- if (attr->get_vendor_id(attr) == PEN_IETF)
+ type = attr->get_type(attr);
+
+ if (type.vendor_id == PEN_IETF)
{
- if (attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR)
+ if (type.type == IETF_ATTR_PA_TNC_ERROR)
{
ietf_attr_pa_tnc_error_t *error_attr;
- pen_t error_vendor_id;
- pa_tnc_error_code_t error_code;
+ pen_type_t error_code;
chunk_t msg_info;
error_attr = (ietf_attr_pa_tnc_error_t*)attr;
- error_vendor_id = error_attr->get_vendor_id(error_attr);
+ error_code = error_attr->get_error_code(error_attr);
- if (error_vendor_id == PEN_TCG)
+ if (error_code.vendor_id == PEN_TCG)
{
- error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr);
DBG1(DBG_IMV, "received TCG-PTS error '%N'",
- pts_error_code_names, error_code);
+ pts_error_code_names, error_code.type);
DBG1(DBG_IMV, "error information: %B", &msg_info);
result = TNC_RESULT_FATAL;
}
}
- else if (attr->get_type(attr) == IETF_ATTR_PRODUCT_INFORMATION)
+ else if (type.type == IETF_ATTR_PRODUCT_INFORMATION)
{
ietf_attr_product_info_t *attr_cast;
char *platform_info;
pts->set_platform_info(pts, platform_info);
}
}
- else if (attr->get_vendor_id(attr) == PEN_TCG)
+ else if (type.vendor_id == PEN_TCG)
{
if (!imv_attestation_process(attr, attr_list, attestation_state,
supported_algorithms,supported_dh_groups, pts_db, pts_credmgr))
pts_database_t *pts_db,
credential_manager_t *pts_credmgr)
{
+ pen_type_t attr_type;
pts_t *pts;
-
+
pts = attestation_state->get_pts(attestation_state);
+ attr_type = attr->get_type(attr);
- switch (attr->get_type(attr))
+ switch (attr_type.type)
{
case TCG_PTS_PROTO_CAPS:
{
bio_writer_t *writer;
chunk_t msg_info;
pa_tnc_attr_t *attr;
+ pen_type_t error_code = { PEN_TCG, TCG_PTS_HASH_ALG_NOT_SUPPORTED };
writer = bio_writer_create(4);
writer->write_uint16(writer, 0x0000);
writer->write_uint16(writer, algorithms);
msg_info = writer->get_buf(writer);
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_HASH_ALG_NOT_SUPPORTED,
- msg_info);
+ attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
writer->destroy(writer);
return attr;
bio_writer_t *writer;
chunk_t msg_info;
pa_tnc_attr_t *attr;
+ pen_type_t error_code = { PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED };
writer = bio_writer_create(4);
writer->write_uint16(writer, 0x0000);
writer->write_uint16(writer, dh_groups);
msg_info = writer->get_buf(writer);
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED,
- msg_info);
+ attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
writer->destroy(writer);
return attr;
bio_writer_t *writer;
chunk_t msg_info;
pa_tnc_attr_t *attr;
+ pen_type_t error_code = { PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH };
writer = bio_writer_create(4);
writer->write_uint16(writer, min_nonce_len);
writer->write_uint16(writer, max_nonce_len);
msg_info = writer->get_buf(writer);
- attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH,
- msg_info);
+ attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
writer->destroy(writer);
return attr;
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_aik_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_aik_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_tcg_pts_attr_aik_t *this)
{
return this->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,
},
.get_aik = _get_aik,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_AIK,
+ .type = { PEN_TCG, TCG_PTS_AIK },
.aik = aik->get_ref(aik),
.ref = 1,
);
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,
},
.get_aik = _get_aik,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_AIK,
+ .type = { PEN_TCG, TCG_PTS_AIK },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_dh_nonce_finish_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_dh_nonce_finish_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_tcg_pts_attr_dh_nonce_finish_t *this)
{
return this->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,
.get_initiator_nonce = _get_initiator_nonce,
.get_initiator_value = _get_initiator_value,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_FINISH,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_FINISH },
.hash_algo = hash_algo,
.initiator_value = initiator_value,
.initiator_nonce = chunk_clone(initiator_nonce),
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,
.get_initiator_nonce = _get_initiator_nonce,
.get_initiator_value = _get_initiator_value,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_FINISH,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_FINISH },
.value = chunk_clone(value),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_dh_nonce_params_req_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_dh_nonce_params_req_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_tcg_pts_attr_dh_nonce_params_req_t *this)
{
return this->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,
.get_min_nonce_len = _get_min_nonce_len,
.get_dh_groups = _get_dh_groups,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_PARAMS_REQ,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_REQ },
.min_nonce_len = min_nonce_len,
.dh_groups = dh_groups,
.ref = 1,
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,
.get_min_nonce_len = _get_min_nonce_len,
.get_dh_groups = _get_dh_groups,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_PARAMS_REQ,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_REQ },
.value = chunk_clone(value),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_dh_nonce_params_resp_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_dh_nonce_params_resp_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_tcg_pts_attr_dh_nonce_params_resp_t *this)
{
return this->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,
.get_responder_nonce = _get_responder_nonce,
.get_responder_value = _get_responder_value,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_PARAMS_RESP,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_RESP },
.dh_group = dh_group,
.hash_algo_set = hash_algo_set,
.responder_nonce = chunk_clone(responder_nonce),
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,
.get_responder_nonce = _get_responder_nonce,
.get_responder_value = _get_responder_value,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_DH_NONCE_PARAMS_RESP,
+ .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_RESP },
.value = chunk_clone(value),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_file_meas_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_file_meas_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_tcg_pts_attr_file_meas_t *this)
{
return this->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,
},
.get_measurements = _get_measurements,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_FILE_MEAS,
+ .type = { PEN_TCG, TCG_PTS_FILE_MEAS },
.measurements = measurements,
.ref = 1,
);
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,
},
.get_measurements = _get_measurements,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_FILE_MEAS,
+ .type = { PEN_TCG, TCG_PTS_FILE_MEAS },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_gen_attest_evid_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_gen_attest_evid_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_tcg_pts_attr_gen_attest_evid_t *this)
{
return this->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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GEN_ATTEST_EVID,
+ .type = { PEN_TCG, TCG_PTS_GEN_ATTEST_EVID },
.ref = 1,
);
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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GEN_ATTEST_EVID,
+ .type = { PEN_TCG, TCG_PTS_GEN_ATTEST_EVID },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_get_aik_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_get_aik_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_tcg_pts_attr_get_aik_t *this)
{
return this->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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GET_AIK,
+ .type = { PEN_TCG, TCG_PTS_GET_AIK },
.ref = 1,
);
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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GET_AIK,
+ .type = { PEN_TCG, TCG_PTS_GET_AIK },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_get_tpm_version_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_get_tpm_version_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_tcg_pts_attr_get_tpm_version_info_t *this)
{
return this->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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GET_TPM_VERSION_INFO,
+ .type = { PEN_TCG, TCG_PTS_GET_TPM_VERSION_INFO },
.ref = 1,
);
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,
.destroy = _destroy,
},
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_GET_TPM_VERSION_INFO,
+ .type = { PEN_TCG, TCG_PTS_GET_TPM_VERSION_INFO },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_meas_algo_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_meas_algo_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_tcg_pts_attr_meas_algo_t *this)
{
return this->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,
},
.get_algorithms = _get_algorithms,
},
- .vendor_id = PEN_TCG,
- .type = selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO,
+ .type = { PEN_TCG,
+ selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO },
.algorithms = algorithms,
.ref = 1,
);
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,
},
.get_algorithms = _get_algorithms,
},
- .vendor_id = PEN_TCG,
- .type = selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO,
+ .type = { PEN_TCG,
+ selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_proto_caps_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_proto_caps_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_tcg_pts_attr_proto_caps_t *this)
{
return this->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,
},
.get_flags = _get_flags,
},
- .vendor_id = PEN_TCG,
- .type = request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS,
+ .type = { PEN_TCG,
+ request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS },
.flags = flags,
.ref = 1,
);
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,
},
.get_flags = _get_flags,
},
- .vendor_id = PEN_TCG,
- .type = request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS,
+ .type = { PEN_TCG,
+ request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_req_file_meas_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_req_file_meas_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_tcg_pts_attr_req_file_meas_t *this)
{
return this->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,
.get_delimiter = _get_delimiter,
.get_pathname = _get_pathname,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FILE_MEAS,
+ .type = { PEN_TCG, TCG_PTS_REQ_FILE_MEAS },
.directory_flag = directory_flag,
.request_id = request_id,
.delimiter = delimiter,
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,
.get_delimiter = _get_delimiter,
.get_pathname = _get_pathname,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FILE_MEAS,
+ .type = { PEN_TCG, TCG_PTS_REQ_FILE_MEAS },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_req_file_meta_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_req_file_meta_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_tcg_pts_attr_req_file_meta_t *this)
{
return this->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,
.get_delimiter = _get_delimiter,
.get_pathname = _get_pathname,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FILE_META,
+ .type = { PEN_TCG, TCG_PTS_REQ_FILE_META },
.directory_flag = directory_flag,
.delimiter = delimiter,
.pathname = strdup(pathname),
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,
.get_delimiter = _get_delimiter,
.get_pathname = _get_pathname,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FILE_META,
+ .type = { PEN_TCG, TCG_PTS_REQ_FILE_META },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_req_func_comp_evid_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
}
}
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_req_func_comp_evid_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_tcg_pts_attr_req_func_comp_evid_t *this)
{
return this->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,
.get_count = _get_count,
.create_enumerator = _create_enumerator,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FUNC_COMP_EVID,
+ .type = { PEN_TCG, TCG_PTS_REQ_FUNC_COMP_EVID },
.list = linked_list_create(),
.ref = 1,
);
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,
.get_count = _get_count,
.create_enumerator = _create_enumerator,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_REQ_FUNC_COMP_EVID,
+ .type = { PEN_TCG, TCG_PTS_REQ_FUNC_COMP_EVID },
.list = linked_list_create(),
.value = chunk_clone(data),
.ref = 1,
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_simple_comp_evid_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_simple_comp_evid_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_tcg_pts_attr_simple_comp_evid_t *this)
{
return this->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,
},
.get_comp_evidence = _get_comp_evidence,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_SIMPLE_COMP_EVID,
+ .type = { PEN_TCG, TCG_PTS_SIMPLE_COMP_EVID },
.evidence = evid,
.ref = 1,
);
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,
},
.get_comp_evidence = _get_comp_evidence,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_SIMPLE_COMP_EVID,
+ .type = { PEN_TCG, TCG_PTS_SIMPLE_COMP_EVID },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_simple_evid_final_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_simple_evid_final_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_tcg_pts_attr_simple_evid_final_t *this)
{
return this->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,
.get_evid_sig = _get_evid_sig,
.set_evid_sig = _set_evid_sig,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_SIMPLE_EVID_FINAL,
+ .type = { PEN_TCG, TCG_PTS_SIMPLE_EVID_FINAL },
.flags = flags,
.comp_hash_algorithm = comp_hash_algorithm,
.pcr_comp = pcr_comp,
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,
.get_evid_sig = _get_evid_sig,
.set_evid_sig = _set_evid_sig,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_SIMPLE_EVID_FINAL,
+ .type = { PEN_TCG, TCG_PTS_SIMPLE_EVID_FINAL },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_tpm_version_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_tpm_version_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_tcg_pts_attr_tpm_version_info_t *this)
{
return this->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,
.get_tpm_version_info = _get_tpm_version_info,
.set_tpm_version_info = _set_tpm_version_info,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_TPM_VERSION_INFO,
+ .type = { PEN_TCG, TCG_PTS_TPM_VERSION_INFO },
.tpm_version_info = chunk_clone(tpm_version_info),
.ref = 1,
);
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,
.get_tpm_version_info = _get_tpm_version_info,
.set_tpm_version_info = _set_tpm_version_info,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_TPM_VERSION_INFO,
+ .type = { PEN_TCG, TCG_PTS_TPM_VERSION_INFO },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * Copyright (C) 2011 Sansar Choinyambuu
+ * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
tcg_pts_attr_file_meta_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
refcount_t ref;
};
-METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
- private_tcg_pts_attr_file_meta_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_tcg_pts_attr_file_meta_t *this)
{
return this->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,
},
.get_metadata = _get_metadata,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_UNIX_FILE_META,
+ .type = { PEN_TCG, TCG_PTS_UNIX_FILE_META },
.metadata = metadata,
.ref = 1,
);
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,
},
.get_metadata = _get_metadata,
},
- .vendor_id = PEN_TCG,
- .type = TCG_PTS_UNIX_FILE_META,
+ .type = { PEN_TCG, TCG_PTS_UNIX_FILE_META },
.value = chunk_clone(data),
.ref = 1,
);
/*
- * 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
#include <library.h>
typedef enum pen_t pen_t;
+typedef struct pen_type_t pen_type_t;
enum pen_t {
PEN_IETF = 0x000000, /* 0 */
};
/**
+ * Vendor specific type
+ */
+struct pen_type_t {
+ pen_t vendor_id;
+ u_int32_t type;
+};
+
+/**
+ * Create a pen_type_t struct
+ */
+static inline pen_type_t pen_type_create(pen_t vendor_id, u_int32_t type)
+{
+ pen_type_t pen_type = {vendor_id, type};
+ return pen_type;
+}
+
+/**
* enum names for pen_t.
*/
extern enum_name_t *pen_names;