]> git.ipfire.org Git - people/ms/strongswan.git/blob - src/libimcv/imv/imv_session.h
Make access requestor IP address available to TNC server
[people/ms/strongswan.git] / src / libimcv / imv / imv_session.h
1 /*
2 * Copyright (C) 2013-2015 Andreas Steffen
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_session_t imv_session
19 * @{ @ingroup libimcv_imv
20 */
21
22 #ifndef IMV_SESSION_H_
23 #define IMV_SESSION_H_
24
25 #include "imv_workitem.h"
26 #include "imv_os_info.h"
27
28 #include <tncifimv.h>
29 #include <library.h>
30
31 #include <time.h>
32
33 typedef struct imv_session_t imv_session_t;
34
35 /**
36 * IMV session interface
37 */
38 struct imv_session_t {
39
40 /**
41 * Set unique session ID
42 *
43 * @param session_id primary key into sessions table
44 * @param pid primary key into products table
45 * @param did Primary key into devices table
46 */
47 void (*set_session_id)(imv_session_t *this, int session_id, int pid, int did);
48
49 /**
50 * Get unique session ID
51 *
52 * @param pid primary key into products table
53 * @param did Primary key into devices table
54 * @return primary key into sessions table
55 */
56 int (*get_session_id)(imv_session_t *this, int *pid, int *did);
57
58 /**
59 * Get TNCCS Connection ID
60 *
61 * @return TNCCS Connection ID
62 */
63 TNC_ConnectionID (*get_connection_id)(imv_session_t *this);
64
65 /**
66 * Get session creation time
67 *
68 * @return Session creation time
69 */
70 time_t (*get_creation_time)(imv_session_t *this);
71
72 /**
73 * Get list of Access Requestor identities
74 *
75 * @return List of Access Requestor identities
76 */
77 enumerator_t* (*create_ar_identities_enumerator)(imv_session_t *this);
78
79 /**
80 * Get OS Information
81 *
82 * @return OS info object
83 */
84 imv_os_info_t* (*get_os_info)(imv_session_t *this);
85
86 /**
87 * Set Device ID
88 *
89 * @param device_id Device ID
90 */
91 void (*set_device_id)(imv_session_t *this, chunk_t device_id);
92
93 /**
94 * Get Device ID
95 *
96 * @param device_id Device ID
97 * @return TRUE if Device ID has already been set
98 */
99 bool (*get_device_id)(imv_session_t *this, chunk_t *device_id);
100
101 /**
102 * Set trust into Device ID
103 *
104 * @param trusted TRUE if Device ID is trusted
105 */
106 void (*set_device_trust)(imv_session_t *this, bool trusted);
107
108
109 /**
110 * Get device ID trust (needed for TPM-based attestation)
111 *
112 * @return TRUE if Device ID is trusted
113 */
114 bool (*get_device_trust)(imv_session_t *this);
115
116 /**
117 * Set policy_started status
118 *
119 * @param start TRUE if policy started, FALSE if policy stopped
120 */
121 void (*set_policy_started)(imv_session_t *this, bool start);
122
123 /**
124 * Get policy_started status
125 *
126 * @return TRUE if policy started, FALSE if policy stopped
127 */
128 bool (*get_policy_started)(imv_session_t *this);
129
130 /**
131 * Insert workitem into list
132 *
133 * @param workitem Workitem to be inserted
134 */
135 void (*insert_workitem)(imv_session_t *this, imv_workitem_t *workitem);
136
137 /**
138 * Remove workitem from list
139 *
140 * @param enumerator Enumerator pointing to workitem to be removed
141 */
142 void (*remove_workitem)(imv_session_t *this, enumerator_t *enumerator);
143
144 /**
145 * Create workitem enumerator
146 *
147 */
148 enumerator_t* (*create_workitem_enumerator)(imv_session_t *this);
149
150 /**
151 * Get number of workitem allocated to a given IMV
152 *
153 * @param imv_id IMV ID
154 * @return Number of workitems assigned to given IMV
155 */
156 int (*get_workitem_count)(imv_session_t *this, TNC_IMVID imv_id);
157
158 /**
159 * Get reference to session
160 */
161 imv_session_t* (*get_ref)(imv_session_t*);
162
163 /**
164 * Destroys an imv_session_t object
165 */
166 void (*destroy)(imv_session_t *this);
167 };
168
169 /**
170 * Create an imv_session_t instance
171 *
172 * @param id Associated Connection ID
173 * @param created Session creation time
174 * @param ar_identities List of Access Requestor identities
175 */
176 imv_session_t* imv_session_create(TNC_ConnectionID id, time_t created,
177 linked_list_t *ar_identities);
178
179 #endif /** IMV_SESSION_H_ @}*/