2 * Copyright (C) 2013-2014 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 typedef struct private_swid_tag_t private_swid_tag_t
;
21 * Private data of a swid_tag_t object.
24 struct private_swid_tag_t
{
27 * Public swid_tag_t interface.
32 * UTF-8 XML encoding of SWID tag
37 * Optional Tag Identifier Instance ID
47 METHOD(swid_tag_t
, get_encoding
, chunk_t
,
48 private_swid_tag_t
*this)
50 return this->encoding
;
53 METHOD(swid_tag_t
, get_instance_id
, chunk_t
,
54 private_swid_tag_t
*this)
56 return this->instance_id
;
59 METHOD(swid_tag_t
, get_ref
, swid_tag_t
*,
60 private_swid_tag_t
*this)
66 METHOD(swid_tag_t
, destroy
, void,
67 private_swid_tag_t
*this)
69 if (ref_put(&this->ref
))
71 free(this->encoding
.ptr
);
72 free(this->instance_id
.ptr
);
80 swid_tag_t
*swid_tag_create(chunk_t encoding
, chunk_t instance_id
)
82 private_swid_tag_t
*this;
86 .get_encoding
= _get_encoding
,
87 .get_instance_id
= _get_instance_id
,
91 .encoding
= chunk_clone(encoding
),
95 if (instance_id
.len
> 0)
97 this->instance_id
= chunk_clone(instance_id
);
100 return &this->public;