Common spelling errors fixed.
[strongswan.git] / src / libpts / 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_error.h"
27 #include "pts_proto_caps.h"
28 #include "pts_meas_algo.h"
29 #include "pts_file_meas.h"
30
31 #include <library.h>
32
33 /**
34 * UTF-8 encoding of the character used to delimiter the filename
35 */
36 #define SOLIDUS_UTF 0x002F
37 #define REVERSE_SOLIDUS_UTF 0x005C
38
39 /**
40 * Class implementing the TCG Platform Trust System (PTS)
41 *
42 */
43 struct pts_t {
44
45 /**
46 * Get PTS Protocol Capabilities
47 *
48 * @return protocol capabilities flags
49 */
50 pts_proto_caps_flag_t (*get_proto_caps)(pts_t *this);
51
52 /**
53 * Set PTS Protocol Capabilities
54 *
55 * @param flags protocol capabilities flags
56 */
57 void (*set_proto_caps)(pts_t *this, pts_proto_caps_flag_t flags);
58
59 /**
60 * Get PTS Measurement Algorithm
61 *
62 * @return measurement algorithm
63 */
64 pts_meas_algorithms_t (*get_meas_algorithm)(pts_t *this);
65
66 /**
67 * Set PTS Measurement Algorithm
68 *
69 * @param algorithm measurement algorithm
70 */
71 void (*set_meas_algorithm)(pts_t *this, pts_meas_algorithms_t algorithm);
72
73 /**
74 * Get Platform and OS Info
75 *
76 * @return platform and OS info
77 */
78 char* (*get_platform_info)(pts_t *this);
79
80 /**
81 * Set Platform and OS Info
82 *
83 * @param info platform and OS info
84 */
85 void (*set_platform_info)(pts_t *this, char *info);
86
87 /**
88 * Get TPM 1.2 Version Info
89 *
90 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
91 * @return TRUE if TPM Version Info available
92 */
93 bool (*get_tpm_version_info)(pts_t *this, chunk_t *info);
94
95 /**
96 * Set TPM 1.2 Version Info
97 *
98 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
99 */
100 void (*set_tpm_version_info)(pts_t *this, chunk_t info);
101
102 /**
103 * Get Attestation Identity Certificate or Public Key
104 *
105 * @return AIK Certificate or Public Key
106 */
107 certificate_t* (*get_aik)(pts_t *this);
108
109 /**
110 * Set Attestation Identity Certificate or Public Key
111 *
112 * @param aik AIK Certificate or Public Key
113 */
114 void (*set_aik)(pts_t *this, certificate_t *aik);
115
116 /**
117 * Check whether path is valid file/directory on filesystem
118 *
119 * @param path Absolute path
120 * @param error_code Output variable for PTS error code
121 * @return TRUE if path is valid or file/directory doesn't exist
122 * or path is invalid
123 * FALSE if local error occurred within stat function
124 */
125 bool (*is_path_valid)(pts_t *this, char *path, pts_error_code_t *error_code);
126
127 /**
128 * Do PTS File Measurements
129 *
130 * @param request_id ID of PTS File Measurement Request
131 * @param pathname Absolute pathname of file to be measured
132 * @param is_directory if TRUE directory contents are measured
133 * @return PTS File Measurements of NULL if FAILED
134 */
135 pts_file_meas_t* (*do_measurements)(pts_t *this, u_int16_t request_id,
136 char *pathname, bool is_directory);
137
138 /**
139 * Destroys a pts_t object.
140 */
141 void (*destroy)(pts_t *this);
142
143 };
144
145 /**
146 * Creates an pts_t object
147 *
148 * @param is_imc TRUE if running on an IMC
149 */
150 pts_t* pts_create(bool is_imc);
151
152 #endif /** PTS_H_ @}*/