added package management to ipsec attest
[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 package to be queried
106 *
107 * @param product software package
108 * @param create if TRUE create database entry if it doesn't exist
109 * @return TRUE if successful
110 */
111 bool (*set_package)(attest_db_t *this, char *package, bool create);
112
113 /**
114 * Set primary key of the software package to be queried
115 *
116 * @param gid primary key of software package
117 * @return TRUE if successful
118 */
119 bool (*set_gid)(attest_db_t *this, int gid);
120
121 /**
122 * Set software product to be queried
123 *
124 * @param product software product
125 * @param create if TRUE create database entry if it doesn't exist
126 * @return TRUE if successful
127 */
128 bool (*set_product)(attest_db_t *this, char *product, bool create);
129
130 /**
131 * Set primary key of the software product to be queried
132 *
133 * @param pid primary key of software product
134 * @return TRUE if successful
135 */
136 bool (*set_pid)(attest_db_t *this, int pid);
137
138 /**
139 * Set software package version to be queried
140 *
141 * @param version software package version
142 * @return TRUE if successful
143 */
144 bool (*set_version)(attest_db_t *this, char *version);
145
146 /**
147 * Set measurement hash algorithm
148 *
149 * @param algo hash algorithm
150 */
151 void (*set_algo)(attest_db_t *this, pts_meas_algorithms_t algo);
152
153 /**
154 * Set that the IMA-specific SHA-1 template hash be computed
155 */
156 void (*set_ima)(attest_db_t *this);
157
158 /**
159 * Set that relative filenames are to be used
160 */
161 void (*set_relative)(attest_db_t *this);
162
163 /**
164 * Set the security vulnerability flag
165 */
166 void (*set_security)(attest_db_t *this);
167
168 /**
169 * Set the sequence number
170 */
171 void (*set_sequence)(attest_db_t *this, int seq_no);
172
173 /**
174 * Set owner [user/host] of an AIK
175 *
176 * @param owner user/host name
177 * @return TRUE if successful
178 */
179 void (*set_owner)(attest_db_t *this, char *owner);
180
181 /**
182 * List all packages stored in the database
183 */
184 void (*list_packages)(attest_db_t *this);
185
186 /**
187 * List all products stored in the database
188 */
189 void (*list_products)(attest_db_t *this);
190
191 /**
192 * List selected files stored in the database
193 */
194 void (*list_files)(attest_db_t *this);
195
196 /**
197 * List all components stored in the database
198 */
199 void (*list_components)(attest_db_t *this);
200
201 /**
202 * List all AIKs stored in the database
203 */
204 void (*list_keys)(attest_db_t *this);
205
206 /**
207 * List selected measurement hashes stored in the database
208 */
209 void (*list_hashes)(attest_db_t *this);
210
211 /**
212 * List selected component measurement stored in the database
213 */
214 void (*list_measurements)(attest_db_t *this);
215
216 /**
217 * Add an entry to the database
218 */
219 bool (*add)(attest_db_t *this);
220
221 /**
222 * Delete an entry from the database
223 */
224 bool (*delete)(attest_db_t *this);
225
226 /**
227 * Destroy attest_db_t object
228 */
229 void (*destroy)(attest_db_t *this);
230
231 };
232
233 /**
234 * Create an attest_db_t instance
235 *
236 * @param uri database URI
237 */
238 attest_db_t* attest_db_create(char *uri);
239
240 #endif /** ATTEST_DB_H_ @}*/