Finalized State class implementations for Attestation IMV/C
[strongswan.git] / src / libimcv / plugins / imv_attestation / imv_attestation_state.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 *
18 * @defgroup imv_attestation_state_t imv_attestation_state
19 * @{ @ingroup imv_attestation_state
20 */
21
22 #ifndef IMV_ATTESTATION_STATE_H_
23 #define IMV_ATTESTATION_STATE_H_
24
25 #include <imv/imv_state.h>
26 #include <library.h>
27
28 typedef struct imv_attestation_state_t imv_attestation_state_t;
29 typedef enum imv_attestation_handshake_state_t imv_attestation_handshake_state_t;
30
31 /**
32 * IMV Attestation Handshake States (state machine)
33 */
34 enum imv_attestation_handshake_state_t {
35 IMV_ATTESTATION_STATE_INIT,
36 IMV_ATTESTATION_STATE_PROTO_CAP,
37 IMV_ATTESTATION_STATE_MEAS_ALGO,
38 IMV_ATTESTATION_STATE_TPM_INFO,
39 IMV_ATTESTATION_STATE_AIK,
40 IMV_ATTESTATION_STATE_SIMPLE_COMP_EVID,
41 IMV_ATTESTATION_STATE_SIMPLE_EVID_FINAL,
42 IMV_ATTESTATION_STATE_FILE_METADATA,
43 IMV_ATTESTATION_STATE_FILE_MEAS,
44 IMV_ATTESTATION_STATE_IML,
45 };
46
47 /**
48 * Internal state of an imv_attestation_t connection instance
49 */
50 struct imv_attestation_state_t {
51
52 /**
53 * imv_state_t interface
54 */
55 imv_state_t interface;
56
57 /**
58 * get state of the handshake
59 *
60 * @return the handshake state of IMV
61 */
62 imv_attestation_handshake_state_t (*get_handshake_state)(imv_attestation_state_t *this);
63
64 /**
65 * get state of the handshake
66 *
67 * @param new_state the handshake state of IMV
68 */
69 void (*set_handshake_state)(imv_attestation_state_t *this, imv_attestation_handshake_state_t new_state);
70 };
71
72 /**
73 * Create an imv_attestation_state_t instance
74 *
75 * @param id connection ID
76 */
77 imv_state_t* imv_attestation_state_create(TNC_ConnectionID id);
78
79 #endif /** IMV_ATTESTATION_STATE_H_ @}*/