]>
Commit | Line | Data |
---|---|---|
4d2bac37 | 1 | /* |
8c40609f | 2 | * Copyright (C) 2013-2014 Andreas Steffen |
4d2bac37 AS |
3 | * HSR Hochschule fuer Technik Rapperswil |
4 | * | |
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>. | |
9 | * | |
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 | |
13 | * for more details. | |
14 | */ | |
15 | ||
16 | /** | |
17 | * @defgroup tcg_swid_attr_tag_inv tcg_swid_attr_tag_inv | |
18 | * @{ @ingroup tcg_attr | |
19 | */ | |
20 | ||
21 | #ifndef TCG_SWID_ATTR_TAG_INV_H_ | |
22 | #define TCG_SWID_ATTR_TAG_INV_H_ | |
23 | ||
24 | typedef struct tcg_swid_attr_tag_inv_t tcg_swid_attr_tag_inv_t; | |
25 | ||
26 | #include "tcg/tcg_attr.h" | |
27 | #include "swid/swid_tag.h" | |
4e2a1762 | 28 | #include "swid/swid_inventory.h" |
4d2bac37 AS |
29 | |
30 | #include <pa_tnc/pa_tnc_attr.h> | |
31 | ||
8c40609f AS |
32 | #define TCG_SWID_TAG_INV_MIN_SIZE 16 |
33 | ||
4d2bac37 AS |
34 | /** |
35 | * Class implementing the TCG SWID Tag Inventory attribute | |
36 | * | |
37 | */ | |
38 | struct tcg_swid_attr_tag_inv_t { | |
39 | ||
40 | /** | |
41 | * Public PA-TNC attribute interface | |
42 | */ | |
43 | pa_tnc_attr_t pa_tnc_attribute; | |
44 | ||
8c40609f AS |
45 | /** |
46 | * Add a Tag ID to the attribute | |
47 | * | |
2eef43f3 | 48 | * @param tag SWID Tag to be added |
8c40609f AS |
49 | */ |
50 | void (*add)(tcg_swid_attr_tag_inv_t *this, swid_tag_t *tag); | |
4d2bac37 AS |
51 | /** |
52 | * Get Request ID | |
53 | * | |
54 | * @return Request ID | |
55 | */ | |
8c40609f | 56 | uint32_t (*get_request_id)(tcg_swid_attr_tag_inv_t *this); |
4d2bac37 AS |
57 | |
58 | /** | |
59 | * Get Last Event ID | |
60 | * | |
61 | * @param eid_epoch Event ID Epoch | |
62 | * @return Last Event ID | |
63 | */ | |
8c40609f AS |
64 | uint32_t (*get_last_eid)(tcg_swid_attr_tag_inv_t *this, |
65 | uint32_t *eid_epoch); | |
4d2bac37 | 66 | |
903a4270 AS |
67 | /** |
68 | * Get count of remaining SWID tags | |
69 | * | |
70 | * @return SWID Tag count | |
71 | */ | |
72 | uint32_t (*get_tag_count)(tcg_swid_attr_tag_inv_t *this); | |
73 | ||
4d2bac37 | 74 | /** |
4e2a1762 | 75 | * Get Inventory of SWID tags |
4d2bac37 | 76 | * |
4e2a1762 | 77 | * @result SWID Tag Inventory |
4d2bac37 | 78 | */ |
4e2a1762 | 79 | swid_inventory_t* (*get_inventory)(tcg_swid_attr_tag_inv_t *this); |
4d2bac37 | 80 | |
903a4270 AS |
81 | /** |
82 | * Remove all SWID Tags from the Inventory | |
83 | */ | |
84 | void (*clear_inventory)(tcg_swid_attr_tag_inv_t *this); | |
85 | ||
4d2bac37 AS |
86 | }; |
87 | ||
88 | /** | |
89 | * Creates an tcg_swid_attr_tag_inv_t object | |
90 | * | |
91 | * @param request_id Copy of the Request ID | |
92 | * @param eid_epoch Event ID Epoch | |
93 | * @param eid Last Event ID | |
94 | */ | |
8c40609f AS |
95 | pa_tnc_attr_t* tcg_swid_attr_tag_inv_create(uint32_t request_id, |
96 | uint32_t eid_epoch, | |
97 | uint32_t eid); | |
4d2bac37 AS |
98 | |
99 | /** | |
100 | * Creates an tcg_swid_attr_tag_inv_t object from received data | |
101 | * | |
e77df5a1 AS |
102 | * @param length Total length of attribute value |
103 | * @param value Unparsed attribute value (might be a segment) | |
4d2bac37 | 104 | */ |
e77df5a1 AS |
105 | pa_tnc_attr_t* tcg_swid_attr_tag_inv_create_from_data(size_t length, |
106 | chunk_t value); | |
4d2bac37 AS |
107 | |
108 | #endif /** TCG_SWID_ATTR_TAG_INV_H_ @}*/ |