imc/imv->send_message() uses attr_list
[strongswan.git] / src / libpts / plugins / imv_attestation / attest_db.h
1 /*
2 * Copyright (C) 2011 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 *
18 * @defgroup attest_db_t attest_db
19 * @{ @ingroup attest_db
20 */
21
22 #ifndef ATTEST_DB_H_
23 #define ATTEST_DB_H_
24
25 #include <pts/pts_meas_algo.h>
26
27 #include <library.h>
28
29 typedef struct attest_db_t attest_db_t;
30
31 /**
32 * Attestation database object
33 */
34 struct attest_db_t {
35
36 /**
37 * Set functional component to be queried
38 *
39 * @param comp functional component
40 * @param create if TRUE create database entry if it doesn't exist
41 * @return TRUE if successful
42 */
43 bool (*set_component)(attest_db_t *this, char *comp, bool create);
44
45 /**
46 * Set primary key of the functional component to be queried
47 *
48 * @param fid primary key of functional component
49 * @return TRUE if successful
50 */
51 bool (*set_cid)(attest_db_t *this, int fid);
52
53 /**
54 * Set directory to be queried
55 *
56 * @param dir directory
57 * @param create if TRUE create database entry if it doesn't exist
58 * @return TRUE if successful
59 */
60 bool (*set_directory)(attest_db_t *this, char *dir, bool create);
61
62 /**
63 * Set primary key of the directory to be queried
64 *
65 * @param did primary key of directory
66 * @return TRUE if successful
67 */
68 bool (*set_did)(attest_db_t *this, int did);
69
70 /**
71 * Set measurement file to be queried
72 *
73 * @param file measurement file
74 * @param create if TRUE create database entry if it doesn't exist
75 * @return TRUE if successful
76 */
77 bool (*set_file)(attest_db_t *this, char *file, bool create);
78
79 /**
80 * Set primary key of the measurement file to be queried
81 *
82 * @param fid primary key of measurement file
83 * @return TRUE if successful
84 */
85 bool (*set_fid)(attest_db_t *this, int fid);
86
87 /**
88 * Set functional component to be queried
89 *
90 * @param key AIK
91 * @param create if TRUE create database entry if it doesn't exist
92 * @return TRUE if successful
93 */
94 bool (*set_key)(attest_db_t *this, chunk_t key, bool create);
95
96 /**
97 * Set primary key of the AIK to be queried
98 *
99 * @param kid primary key of AIK
100 * @return TRUE if successful
101 */
102 bool (*set_kid)(attest_db_t *this, int kid);
103
104 /**
105 * Set software product to be queried
106 *
107 * @param product software product
108 * @param create if TRUE create database entry if it doesn't exist
109 * @return TRUE if successful
110 */
111 bool (*set_product)(attest_db_t *this, char *product, bool create);
112
113 /**
114 * Set primary key of the software product to be queried
115 *
116 * @param pid primary key of software product
117 * @return TRUE if successful
118 */
119 bool (*set_pid)(attest_db_t *this, int pid);
120
121 /**
122 * Set measurement hash algorithm
123 *
124 * @param algo hash algorithm
125 */
126 void (*set_algo)(attest_db_t *this, pts_meas_algorithms_t algo);
127
128 /**
129 * Set owner [user/host] of an AIK
130 *
131 * @param owner user/host name
132 * @return TRUE if successful
133 */
134 void (*set_owner)(attest_db_t *this, char *owner);
135
136 /**
137 * List all products stored in the database
138 */
139 void (*list_products)(attest_db_t *this);
140
141 /**
142 * List selected files stored in the database
143 */
144 void (*list_files)(attest_db_t *this);
145
146 /**
147 * List all components stored in the database
148 */
149 void (*list_components)(attest_db_t *this);
150
151 /**
152 * List all AIKs stored in the database
153 */
154 void (*list_keys)(attest_db_t *this);
155
156 /**
157 * List selected measurement hashes stored in the database
158 */
159 void (*list_hashes)(attest_db_t *this);
160
161 /**
162 * List selected component measurement stored in the database
163 */
164 void (*list_measurements)(attest_db_t *this);
165
166 /**
167 * Add an entry to the database
168 */
169 bool (*add)(attest_db_t *this);
170
171 /**
172 * Delete an entry from the database
173 */
174 bool (*delete)(attest_db_t *this);
175
176 /**
177 * Destroy attest_db_t object
178 */
179 void (*destroy)(attest_db_t *this);
180
181 };
182
183 /**
184 * Create an attest_db_t instance
185 *
186 * @param uri database URI
187 */
188 attest_db_t* attest_db_create(char *uri);
189
190 #endif /** ATTEST_DB_H_ @}*/