Added component column in files table
[strongswan.git] / src / libpts / 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/directories to be measured by PTS
37 *
38 * @param product software product (os, vpn client, etc.)
39 * @return enumerator over all matching files/directories
40 */
41 enumerator_t* (*create_file_meas_enumerator)(pts_database_t *this,
42 char *product);
43
44 /**
45 * Get files/directories to request metadata of
46 *
47 * @param product software product (os, vpn client, etc.)
48 * @return enumerator over all matching files/directories
49 */
50 enumerator_t* (*create_file_meta_enumerator)(pts_database_t *this,
51 char *product);
52
53 /**
54 * Get functional components to request evidence of
55 *
56 * @param product software product (os, vpn client, etc.)
57 * @return enumerator over all matching components
58 */
59 enumerator_t* (*create_comp_evid_enumerator)(pts_database_t *this,
60 char *product);
61
62 /**
63 * Get stored measurement hash for single file or directory entries
64 *
65 * @param product software product (os, vpn client, etc.)
66 * @param algo hash algorithm used for measurement
67 * @param id primary key of measured file/directory
68 * @param is_dir TRUE if directory was measured
69 * @return enumerator over all matching measurement hashes
70 */
71 enumerator_t* (*create_hash_enumerator)(pts_database_t *this, char *product,
72 pts_meas_algorithms_t algo,
73 int id, bool is_dir);
74
75 /**
76 * Get stored measurement hash for functional component entries
77 *
78 * @param product software product (os, vpn client, etc.)
79 * @param algo hash algorithm used for measurement
80 * @param comp_name value of path column in files table
81 * @return enumerator over all matching measurement hashes
82 */
83 enumerator_t* (*create_comp_hash_enumerator)(pts_database_t *this, char *product,
84 pts_meas_algorithms_t algo, char *comp_name);
85
86 /**
87 * Destroys a pts_database_t object.
88 */
89 void (*destroy)(pts_database_t *this);
90
91 };
92
93 /**
94 * Creates an pts_database_t object
95 *
96 * @param uri database uri
97 */
98 pts_database_t* pts_database_create(char *uri);
99
100 #endif /** PTS_DATABASE_H_ @}*/