3ebb5c2a06af28b7a613d4fb750a46598b491edc
[strongswan.git] / src / libpts / pts / pts_file_meas.h
1 /*
2 * Copyright (C) 2011 Sansar Choinyambuu
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_file_meas pts_file_meas
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_FILE_MEAS_H_
22 #define PTS_FILE_MEAS_H_
23
24 #include <library.h>
25
26 typedef struct pts_file_meas_t pts_file_meas_t;
27
28 /**
29 * Class storing PTS File Measurements
30 */
31 struct pts_file_meas_t {
32
33 /**
34 * Get the ID of the PTS File Measurement Request
35 *
36 * @return ID of PTS File Measurement Request
37 */
38 u_int16_t (*get_request_id)(pts_file_meas_t *this);
39
40 /**
41 * Get the number of measured files
42 *
43 * @return Number of measured files
44 */
45 int (*get_file_count)(pts_file_meas_t *this);
46
47 /**
48 * Add a PTS File Measurement
49 *
50 * @param filename Name of measured file or directory
51 * @param measurement PTS Measurement hash
52 */
53 void (*add)(pts_file_meas_t *this, char *filename, chunk_t measurement);
54
55 /**
56 * Create a PTS File Measurement enumerator
57 *
58 * @return Enumerator returning filename and measurement
59 */
60 enumerator_t* (*create_enumerator)(pts_file_meas_t *this);
61
62 /**
63 * Verify stored hashes against PTS File Measurements
64 *
65 * @param e_hash Hash enumerator
66 * @paraem is_dir TRUE for directory contents hashes
67 * @return TRUE if all hashes match a measurement
68 */
69 bool (*verify)(pts_file_meas_t *this, enumerator_t *e_hash, bool is_dir);
70
71 /**
72 * Destroys a pts_file_meas_t object.
73 */
74 void (*destroy)(pts_file_meas_t *this);
75
76 };
77
78 /**
79 * Creates a pts_file_meas_t object
80 *
81 * @param request_id ID of PTS File Measurement Request
82 */
83 pts_file_meas_t* pts_file_meas_create(u_int16_t request_id);
84
85 #endif /** PTS_FILE_MEAS_H_ @}*/