Verification of directory contents measurements implemented
[strongswan.git] / src / libimcv / tcg / pts / pts_database.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 * @defgroup pts_database pts_database
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_DATABASE_H_
22 #define PTS_DATABASE_H_
23
24 typedef struct pts_database_t pts_database_t;
25
26 #include "pts_meas_algo.h"
27 #include <library.h>
28
29 /**
30 * Class implementing the PTS File Measurement database
31 *
32 */
33 struct pts_database_t {
34
35 /**
36 * Get files to be measured by PTS
37 *
38 * @product software product (os, vpn client, etc.)
39 * @return enumerator over all files matching a given release
40 */
41 enumerator_t* (*create_file_enumerator)(pts_database_t *this, char *product);
42
43 /**
44 * Get if file with given id is directory
45 *
46 * @id primary key in files table
47 * @is_directory TRUE if entry with given ID has type of directory
48 * @return TRUE if query is not failed
49 */
50 bool (*is_directory)(pts_database_t *this, int id, bool *is_directory);
51
52 /**
53 * Get Enumerator over files in a given directory with measurements
54 *
55 * @id primary key in files table, directory column in file_hashes table
56 * @return enumerator over all measurements matching a given release
57 */
58 enumerator_t* (*create_files_in_dir_enumerator)(pts_database_t *this, int id);
59
60 /**
61 * Get Hash measurement of a file with given id and hashing algorithm type
62 *
63 * @product software product (os, vpn client, etc.)
64 * @id primary key in files table
65 * @algorithm measurement algorithm type
66 * @return enumerator over all measurements matching a given release
67 */
68 enumerator_t* (*create_file_meas_enumerator)(pts_database_t *this, char *product,
69 int id, pts_meas_algorithms_t algorithm);
70 /**
71 * Get Hash measurement of a file in a folder with given id and hashing algorithm type
72 *
73 * @product software product (os, vpn client, etc.)
74 * @id primary key in files table
75 * @file_name path in files table
76 * @algorithm measurement algorithm type
77 * @return enumerator over all measurements matching a given release
78 */
79 enumerator_t* (*create_dir_meas_enumerator)(pts_database_t *this, char *product,
80 int id, char *file_name, pts_meas_algorithms_t algorithm);
81
82
83 /**
84 * Destroys a pts_database_t object.
85 */
86 void (*destroy)(pts_database_t *this);
87
88 };
89
90 /**
91 * Creates an pts_database_t object
92 *
93 * @param ur database uri
94 */
95 pts_database_t* pts_database_create(char *uri);
96
97 #endif /** PTS_DATABASE_H_ @}*/