]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libimcv/tcg/swid/tcg_swid_attr_req.h
libimcv: SWIMA SW locator must be file URI
[thirdparty/strongswan.git] / src / libimcv / tcg / swid / tcg_swid_attr_req.h
1 /*
2 * Copyright (C) 2013-2017 Andreas Steffen
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_req tcg_swid_attr_req
18 * @{ @ingroup tcg_attr
19 */
20
21 #ifndef TCG_SWID_ATTR_REQ_H_
22 #define TCG_SWID_ATTR_REQ_H_
23
24 #define TCG_SWID_REQ_MIN_SIZE 12
25
26 typedef struct tcg_swid_attr_req_t tcg_swid_attr_req_t;
27 typedef enum tcg_swid_attr_req_flag_t tcg_swid_attr_req_flag_t;
28
29 enum tcg_swid_attr_req_flag_t {
30 TCG_SWID_ATTR_REQ_FLAG_NONE = 0,
31 TCG_SWID_ATTR_REQ_FLAG_C = (1 << 7),
32 TCG_SWID_ATTR_REQ_FLAG_S = (1 << 6),
33 TCG_SWID_ATTR_REQ_FLAG_R = (1 << 5)
34 };
35
36 #include "tcg/tcg_attr.h"
37 #include "swid/swid_tag_id.h"
38 #include "swid/swid_inventory.h"
39 #include "pa_tnc/pa_tnc_attr.h"
40
41 /**
42 * Class implementing the TCG SWID Request attribute
43 */
44 struct tcg_swid_attr_req_t {
45
46 /**
47 * Public PA-TNC attribute interface
48 */
49 pa_tnc_attr_t pa_tnc_attribute;
50
51 /**
52 * Get SWID request flags
53 *
54 * @return Flags
55 */
56 uint8_t (*get_flags)(tcg_swid_attr_req_t *this);
57
58 /**
59 * Get Request ID
60 *
61 * @return Request ID
62 */
63 uint32_t (*get_request_id)(tcg_swid_attr_req_t *this);
64
65 /**
66 * Get Earliest EID
67 *
68 * @return Event ID
69 */
70 uint32_t (*get_earliest_eid)(tcg_swid_attr_req_t *this);
71
72 /**
73 * Add Tag ID
74 *
75 * @param tag_id SWID Tag ID (is not cloned by constructor!)
76 */
77 void (*add_target)(tcg_swid_attr_req_t *this, swid_tag_id_t *tag_id);
78
79 /**
80 * Create Tag ID enumerator
81 *
82 * @return Get a list of target tag IDs
83 */
84 swid_inventory_t* (*get_targets)(tcg_swid_attr_req_t *this);
85
86 };
87
88 /**
89 * Creates an tcg_swid_attr_req_t object
90 *
91 * @param flags Sets the C|S|R flags
92 * @param request_id Request ID
93 * @param eid Earliest Event ID
94 */
95 pa_tnc_attr_t* tcg_swid_attr_req_create(uint8_t flags, uint32_t request_id,
96 uint32_t eid);
97
98 /**
99 * Creates an tcg_swid_attr_req_t object from received data
100 *
101 * @param length Total length of attribute value
102 * @param value Unparsed attribute value (might be a segment)
103 */
104 pa_tnc_attr_t* tcg_swid_attr_req_create_from_data(size_t length, chunk_t value);
105
106 #endif /** TCG_SWID_ATTR_REQ_H_ @}*/