object oriented approach to pts functional components
[strongswan.git] / src / libpts / pts / components / ita / ita_comp_tboot.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen
3 *
4 * HSR Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include "ita_comp_tboot.h"
18 #include "ita_comp_func_name.h"
19
20 #include "pts/components/pts_component.h"
21
22 #include <debug.h>
23 #include <pen/pen.h>
24
25 typedef struct pts_ita_comp_tboot_t pts_ita_comp_tboot_t;
26
27 /**
28 * Private data of a pts_ita_comp_tboot_t object.
29 *
30 */
31 struct pts_ita_comp_tboot_t {
32
33 /**
34 * Public pts_component_manager_t interface.
35 */
36 pts_component_t public;
37
38 /**
39 * Component Functional Name
40 */
41 pts_comp_func_name_t *name;
42 };
43
44 METHOD(pts_component_t, get_comp_func_name, pts_comp_func_name_t*,
45 pts_ita_comp_tboot_t *this)
46 {
47 return this->name;
48 }
49
50 METHOD(pts_component_t, measure, bool,
51 pts_ita_comp_tboot_t *this)
52 {
53 /* TODO measure the tboot functional component */
54 return FALSE;
55 }
56
57 METHOD(pts_component_t, verify, bool,
58 pts_ita_comp_tboot_t *this)
59 {
60 /* TODO verify the measurement of the tboot functional component */
61 return FALSE;
62 }
63
64 METHOD(pts_component_t, destroy, void,
65 pts_ita_comp_tboot_t *this)
66 {
67 this->name->destroy(this->name);
68 free(this);
69 }
70
71 /**
72 * See header
73 */
74 pts_component_t *pts_ita_comp_tboot_create(u_int8_t qualifier)
75 {
76 pts_ita_comp_tboot_t *this;
77
78 INIT(this,
79 .public = {
80 .get_comp_func_name = _get_comp_func_name,
81 .measure = _measure,
82 .verify = _verify,
83 .destroy = _destroy,
84 },
85 .name = pts_comp_func_name_create(PEN_ITA, PTS_ITA_COMP_FUNC_NAME_TBOOT,
86 qualifier),
87 );
88
89 return &this->public;
90 }
91