2 * Copyright (C) 2013-2015 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
18 * @defgroup imv_session_t imv_session
19 * @{ @ingroup libimcv_imv
22 #ifndef IMV_SESSION_H_
23 #define IMV_SESSION_H_
25 #include "imv_workitem.h"
26 #include "imv_os_info.h"
33 typedef struct imv_session_t imv_session_t
;
36 * IMV session interface
38 struct imv_session_t
{
41 * Set unique session ID
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
47 void (*set_session_id
)(imv_session_t
*this, int session_id
, int pid
, int did
);
50 * Get unique session ID
52 * @param pid primary key into products table
53 * @param did Primary key into devices table
54 * @return primary key into sessions table
56 int (*get_session_id
)(imv_session_t
*this, int *pid
, int *did
);
59 * Get TNCCS Connection ID
61 * @return TNCCS Connection ID
63 TNC_ConnectionID (*get_connection_id
)(imv_session_t
*this);
66 * Get session creation time
68 * @return Session creation time
70 time_t (*get_creation_time
)(imv_session_t
*this);
73 * Get list of Access Requestor identities
75 * @return List of Access Requestor identities
77 enumerator_t
* (*create_ar_identities_enumerator
)(imv_session_t
*this);
82 * @return OS info object
84 imv_os_info_t
* (*get_os_info
)(imv_session_t
*this);
89 * @param device_id Device ID
91 void (*set_device_id
)(imv_session_t
*this, chunk_t device_id
);
96 * @param device_id Device ID
97 * @return TRUE if Device ID has already been set
99 bool (*get_device_id
)(imv_session_t
*this, chunk_t
*device_id
);
102 * Set trust into Device ID
104 * @param trusted TRUE if Device ID is trusted
106 void (*set_device_trust
)(imv_session_t
*this, bool trusted
);
110 * Get device ID trust (needed for TPM-based attestation)
112 * @return TRUE if Device ID is trusted
114 bool (*get_device_trust
)(imv_session_t
*this);
117 * Set policy_started status
119 * @param start TRUE if policy started, FALSE if policy stopped
121 void (*set_policy_started
)(imv_session_t
*this, bool start
);
124 * Get policy_started status
126 * @return TRUE if policy started, FALSE if policy stopped
128 bool (*get_policy_started
)(imv_session_t
*this);
131 * Insert workitem into list
133 * @param workitem Workitem to be inserted
135 void (*insert_workitem
)(imv_session_t
*this, imv_workitem_t
*workitem
);
138 * Remove workitem from list
140 * @param enumerator Enumerator pointing to workitem to be removed
142 void (*remove_workitem
)(imv_session_t
*this, enumerator_t
*enumerator
);
145 * Create workitem enumerator
148 enumerator_t
* (*create_workitem_enumerator
)(imv_session_t
*this);
151 * Get number of workitem allocated to a given IMV
153 * @param imv_id IMV ID
154 * @return Number of workitems assigned to given IMV
156 int (*get_workitem_count
)(imv_session_t
*this, TNC_IMVID imv_id
);
159 * Get reference to session
161 imv_session_t
* (*get_ref
)(imv_session_t
*);
164 * Destroys an imv_session_t object
166 void (*destroy
)(imv_session_t
*this);
170 * Create an imv_session_t instance
172 * @param id Associated Connection ID
173 * @param created Session creation time
174 * @param ar_identities List of Access Requestor identities
176 imv_session_t
* imv_session_create(TNC_ConnectionID id
, time_t created
,
177 linked_list_t
*ar_identities
);
179 #endif /** IMV_SESSION_H_ @}*/