implemented Linux IMA functional component
[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 "components/pts_comp_func_name.h"
28 #include <library.h>
29
30 /**
31 * Class implementing the PTS File Measurement database
32 *
33 */
34 struct pts_database_t {
35
36 /**
37 * Get files/directories to be measured by PTS
38 *
39 * @param product Software product (os, vpn client, etc.)
40 * @return Enumerator over all matching files/directories
41 */
42 enumerator_t* (*create_file_meas_enumerator)(pts_database_t *this,
43 char *product);
44
45 /**
46 * Get files/directories to request metadata of
47 *
48 * @param product Software product (os, vpn client, etc.)
49 * @return Enumerator over all matching files/directories
50 */
51 enumerator_t* (*create_file_meta_enumerator)(pts_database_t *this,
52 char *product);
53
54 /**
55 * Get functional components to request evidence of
56 *
57 * @param product Software product (os, vpn client, etc.)
58 * @return Enumerator over all matching components
59 */
60 enumerator_t* (*create_comp_evid_enumerator)(pts_database_t *this,
61 char *product);
62
63 /**
64 * Get stored measurement hash for single file or directory entries
65 *
66 * @param product Software product (os, vpn client, etc.)
67 * @param algo Hash algorithm used for measurement
68 * @param id Primary key of measured file/directory
69 * @param is_dir TRUE if directory was measured
70 * @return Enumerator over all matching measurement hashes
71 */
72 enumerator_t* (*create_file_hash_enumerator)(pts_database_t *this,
73 char *product, pts_meas_algorithms_t algo,
74 int id, bool is_dir);
75
76 /**
77 * Check a functional component measurement against value stored in database
78 *
79 * @param measurement measurement hash
80 * @param comp_name Component Functional Name
81 * @param product Software product (os, vpn client, etc.)
82 * @param seq_no Measurement sequence number
83 * @param prc Number of the PCR the measurement was extended into
84 * @param algo Hash algorithm used for measurement
85 * @return return code
86 */
87 status_t (*check_comp_measurement)(pts_database_t *this, chunk_t measurement,
88 pts_comp_func_name_t *comp_name, char *product,
89 int seq_no, int pcr, pts_meas_algorithms_t algo);
90
91 /**
92 * Destroys a pts_database_t object.
93 */
94 void (*destroy)(pts_database_t *this);
95
96 };
97
98 /**
99 * Creates an pts_database_t object
100 *
101 * @param uri database uri
102 */
103 pts_database_t* pts_database_create(char *uri);
104
105 #endif /** PTS_DATABASE_H_ @}*/