moved attestation plugins to libpts in order to resolve circular reference with libimcv
[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 software product to be queried
38 *
39 * @param product software product
40 * @param create if TRUE create database entry if it doesn't exist
41 * @return TRUE if successful
42 */
43 bool (*set_product)(attest_db_t *this, char *product, bool create);
44
45 /**
46 * Set primary key of the software product to be queried
47 *
48 * @param pid primary key of software product
49 * @return TRUE if successful
50 */
51 bool (*set_pid)(attest_db_t *this, int pid);
52
53 /**
54 * Set measurement file to be queried
55 *
56 * @param file measurement file
57 * @param create if TRUE create database entry if it doesn't exist
58 * @return TRUE if successful
59 */
60 bool (*set_file)(attest_db_t *this, char *file, bool create);
61
62 /**
63 * Set primary key of the measurement file to be queried
64 *
65 * @param fid primary key of measurement file
66 * @return TRUE if successful
67 */
68 bool (*set_fid)(attest_db_t *this, int fid);
69
70 /**
71 * Set functional component to be queried
72 *
73 * @param comp functional component
74 * @param create if TRUE create database entry if it doesn't exist
75 * @return TRUE if successful
76 */
77 bool (*set_component)(attest_db_t *this, char *comp, bool create);
78
79 /**
80 * Set primary key of the functional component to be queried
81 *
82 * @param fid primary key of functional component
83 * @return TRUE if successful
84 */
85 bool (*set_cid)(attest_db_t *this, int fid);
86
87 /**
88 * Set directory to be queried
89 *
90 * @param dir directory
91 * @param create if TRUE create database entry if it doesn't exist
92 * @return TRUE if successful
93 */
94 bool (*set_directory)(attest_db_t *this, char *dir, bool create);
95
96 /**
97 * Set primary key of the directory to be queried
98 *
99 * @param did primary key of directory
100 * @return TRUE if successful
101 */
102 bool (*set_did)(attest_db_t *this, int did);
103
104 /**
105 * Set measurement hash algorithm
106 *
107 * @param algo hash algorithm
108 */
109 void (*set_algo)(attest_db_t *this, pts_meas_algorithms_t algo);
110
111 /**
112 * List all products stored in the database
113 */
114 void (*list_products)(attest_db_t *this);
115
116 /**
117 * List selected files stored in the database
118 */
119 void (*list_files)(attest_db_t *this);
120
121 /**
122 * List all components stored in the database
123 */
124 void (*list_components)(attest_db_t *this);
125
126 /**
127 * List selected measurement hashes stored in the database
128 */
129 void (*list_hashes)(attest_db_t *this);
130
131 /**
132 * Add an entry to the database
133 */
134 bool (*add)(attest_db_t *this);
135
136 /**
137 * Delete an entry from the database
138 */
139 bool (*delete)(attest_db_t *this);
140
141 /**
142 * Destroy attest_db_t object
143 */
144 void (*destroy)(attest_db_t *this);
145
146 };
147
148 /**
149 * Create an attest_db_t instance
150 *
151 * @param uri database URI
152 */
153 attest_db_t* attest_db_create(char *uri);
154
155 #endif /** ATTEST_DB_H_ @}*/