summaryrefslogtreecommitdiff
path: root/src/libpts/tcg/tcg_pts_attr_req_file_meta.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpts/tcg/tcg_pts_attr_req_file_meta.c')
-rw-r--r--src/libpts/tcg/tcg_pts_attr_req_file_meta.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/libpts/tcg/tcg_pts_attr_req_file_meta.c b/src/libpts/tcg/tcg_pts_attr_req_file_meta.c
index bef6b5db6..eb5114172 100644
--- a/src/libpts/tcg/tcg_pts_attr_req_file_meta.c
+++ b/src/libpts/tcg/tcg_pts_attr_req_file_meta.c
@@ -1,5 +1,5 @@
/*
- * 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
@@ -52,14 +52,9 @@ struct private_tcg_pts_attr_req_file_meta_t {
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
@@ -92,13 +87,7 @@ struct private_tcg_pts_attr_req_file_meta_t {
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;
@@ -129,6 +118,10 @@ METHOD(pa_tnc_attr_t, build, void,
chunk_t pathname;
bio_writer_t *writer;
+ if (this->value.ptr)
+ {
+ return;
+ }
if (this->directory_flag)
{
flags |= DIRECTORY_CONTENTS_FLAG;
@@ -226,7 +219,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create(bool directory_flag,
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,
@@ -240,8 +232,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create(bool directory_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),
@@ -262,7 +253,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_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,
.get_noskip_flag = _get_noskip_flag,
@@ -276,8 +266,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create_from_data(chunk_t data)
.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,
);