summaryrefslogtreecommitdiff
path: root/src/libimcv/tcg/swid/tcg_swid_attr_req.h
blob: fd2ccdc4f28b253ea96c28d2913da15533a6fd95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (C) 2013-2014 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
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

/**
 * @defgroup tcg_swid_attr_req tcg_swid_attr_req
 * @{ @ingroup tcg_attr
 */

#ifndef TCG_SWID_ATTR_REQ_H_
#define TCG_SWID_ATTR_REQ_H_

#define TCG_SWID_REQ_MIN_SIZE	12

typedef struct tcg_swid_attr_req_t tcg_swid_attr_req_t;
typedef enum tcg_swid_attr_req_flag_t tcg_swid_attr_req_flag_t;

enum tcg_swid_attr_req_flag_t {
	TCG_SWID_ATTR_REQ_FLAG_NONE = 0,
	TCG_SWID_ATTR_REQ_FLAG_R =   (1 << 7),
	TCG_SWID_ATTR_REQ_FLAG_S =   (1 << 6),
	TCG_SWID_ATTR_REQ_FLAG_C =   (1 << 5)
};

#include "tcg/tcg_attr.h"
#include "swid/swid_tag_id.h"
#include "swid/swid_inventory.h"
#include "pa_tnc/pa_tnc_attr.h"

/**
 * Class implementing the TCG SWID Request attribute
 */
struct tcg_swid_attr_req_t {

	/**
	 * Public PA-TNC attribute interface
	 */
	pa_tnc_attr_t pa_tnc_attribute;

	/**
	 * Get SWID request flags
	 *
	 * @return				Flags
	 */
	u_int8_t (*get_flags)(tcg_swid_attr_req_t *this);

	/**
	 * Get Request ID
	 *
	 * @return				Request ID
	 */
	u_int32_t (*get_request_id)(tcg_swid_attr_req_t *this);

	/**
	 * Get Earliest EID
	 *
	 * @return				Event ID
	 */
	u_int32_t (*get_earliest_eid)(tcg_swid_attr_req_t *this);

	/**
	 * Add Tag ID
	 *
	 * @param tag_id			SWID Tag ID (is not cloned by constructor!)
	 */
	void (*add_target)(tcg_swid_attr_req_t *this, swid_tag_id_t *tag_id);

	/**
	 * Create Tag ID enumerator
	 *
	 * @return					Get a list of target tag IDs
	 */
	swid_inventory_t* (*get_targets)(tcg_swid_attr_req_t *this);

};

/**
 * Creates an tcg_swid_attr_req_t object
 *
 * @param flags				Sets the C|S|R flags
 * @param request_id		Request ID
 * @param eid				Earliest Event ID
 */
pa_tnc_attr_t* tcg_swid_attr_req_create(u_int8_t flags, u_int32_t request_id,
										u_int32_t eid);

/**
 * Creates an tcg_swid_attr_req_t object from received data
 *
 * @param length			Total length of attribute value
 * @param value				Unparsed attribute value (might be a segment)
 */
pa_tnc_attr_t* tcg_swid_attr_req_create_from_data(size_t length, chunk_t value);

#endif /** TCG_SWID_ATTR_REQ_H_ @}*/