2 * Copyright (C) 2011 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup pts_database pts_database
21 #ifndef PTS_DATABASE_H_
22 #define PTS_DATABASE_H_
24 typedef struct pts_database_t pts_database_t
;
26 #include "pts_meas_algo.h"
27 #include "components/pts_comp_func_name.h"
31 * Class implementing the PTS File Measurement database
34 struct pts_database_t
{
37 * Get files/directories to be measured by PTS
39 * @param product Software product (os, vpn client, etc.)
40 * @return Enumerator over all matching files/directories
42 enumerator_t
* (*create_file_meas_enumerator
)(pts_database_t
*this,
46 * Get files/directories to request metadata of
48 * @param product Software product (os, vpn client, etc.)
49 * @return Enumerator over all matching files/directories
51 enumerator_t
* (*create_file_meta_enumerator
)(pts_database_t
*this,
55 * Get functional components to request evidence of
57 * @param product Software product (os, vpn client, etc.)
58 * @return Enumerator over all matching components
60 enumerator_t
* (*create_comp_evid_enumerator
)(pts_database_t
*this,
64 * Get stored measurement hash for single file or directory entries
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
72 enumerator_t
* (*create_file_hash_enumerator
)(pts_database_t
*this,
73 char *product
, pts_meas_algorithms_t algo
,
77 * Check a functional component measurement against value stored in database
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
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
);
92 * Destroys a pts_database_t object.
94 void (*destroy
)(pts_database_t
*this);
99 * Creates an pts_database_t object
101 * @param uri database uri
103 pts_database_t
* pts_database_create(char *uri
);
105 #endif /** PTS_DATABASE_H_ @}*/