Removed unnecessary struct
[strongswan.git] / src / libimcv / tcg / pts / pts.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 pts
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_H_
22 #define PTS_H_
23
24 typedef struct pts_t pts_t;
25
26 #include "pts_proto_caps.h"
27 #include "pts_meas_algo.h"
28 #include <utils/linked_list.h>
29
30 #include <library.h>
31
32 typedef struct measurement_req_entry_t measurement_req_entry_t;
33 typedef struct file_meas_entry_t file_meas_entry_t;
34
35 /**
36 * File Measurement entry
37 */
38 struct file_meas_entry_t {
39 chunk_t measurement;
40 u_int16_t file_name_len;
41 chunk_t file_name;
42 };
43
44 /**
45 * Class implementing the TCG Platform Trust System (PTS)
46 *
47 */
48 struct pts_t {
49
50 /**
51 * Get PTS Protocol Capabilities
52 *
53 * @return protocol capabilities flags
54 */
55 pts_proto_caps_flag_t (*get_proto_caps)(pts_t *this);
56
57 /**
58 * Set PTS Protocol Capabilities
59 *
60 * @param flags protocol capabilities flags
61 */
62 void (*set_proto_caps)(pts_t *this, pts_proto_caps_flag_t flags);
63
64 /**
65 * Get PTS Measurement Algorithm
66 *
67 * @return measurement algorithm
68 */
69 pts_meas_algorithms_t (*get_meas_algorithm)(pts_t *this);
70
71 /**
72 * Set PTS Measurement Algorithm
73 *
74 * @param algorithm measurement algorithm
75 */
76 void (*set_meas_algorithm)(pts_t *this, pts_meas_algorithms_t algorithm);
77
78 /**
79 * Get TPM 1.2 Version Info
80 *
81 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
82 * @return TRUE if TPM Version Info available
83 */
84 bool (*get_tpm_version_info)(pts_t *this, chunk_t *info);
85
86 /**
87 * Set TPM 1.2 Version Info
88 *
89 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
90 */
91 void (*set_tpm_version_info)(pts_t *this, chunk_t info);
92
93 /**
94 * Hash the given file
95 *
96 * @param path absolute path to file to be hashed
97 * @param out hash output value of a given file
98 * @return TRUE if hashing file was successful
99 */
100 bool (*hash_file)(pts_t *this, char *path, char *out);
101
102 /**
103 * Hash the given directory
104 *
105 * @param path absolute path to directory to be hashed
106 * @param file_measurements list of hash output values of files in a given folder
107 * @return TRUE if hashing directory was successful
108 */
109 bool (*hash_directory)(pts_t *this, char *path, linked_list_t *file_measurements);
110
111 /**
112 * Destroys a pts_t object.
113 */
114 void (*destroy)(pts_t *this);
115
116 };
117
118 /**
119 * Creates an pts_t object
120 *
121 * @param is_imc TRUE if running on an IMC
122 */
123 pts_t* pts_create(bool is_imc);
124
125 #endif /** PTS_H_ @}*/