]>
Commit | Line | Data |
---|---|---|
b8db66de AS |
1 | /* |
2 | * Copyright (C) 2013 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_database_t imv_database | |
19 | * @{ @ingroup libimcv_imv | |
20 | */ | |
21 | ||
22 | #ifndef IMV_DATABASE_H_ | |
23 | #define IMV_DATABASE_H_ | |
24 | ||
a6266485 AS |
25 | #include "imv_session.h" |
26 | #include "imv_workitem.h" | |
27 | ||
28 | #include <tncifimv.h> | |
b8db66de AS |
29 | |
30 | #include <library.h> | |
31 | ||
32 | typedef struct imv_database_t imv_database_t; | |
33 | ||
34 | /** | |
b9949e98 | 35 | * IMV database interface |
b8db66de AS |
36 | */ |
37 | struct imv_database_t { | |
38 | ||
39 | /** | |
a6266485 | 40 | * Create or get a session associated with a TNCCS connection |
b8db66de | 41 | * |
a6266485 | 42 | * @param conn_id TNCCS Connection ID |
b8db66de AS |
43 | * @param ar_id_type Access Requestor identity type |
44 | * @param ar_id_value Access Requestor identity value | |
a6266485 | 45 | * @return Session associated with TNCCS Connection |
b8db66de | 46 | */ |
b1da8368 | 47 | imv_session_t* (*add_session)(imv_database_t *this, |
a6266485 | 48 | TNC_ConnectionID conn_id, |
b12c53ce | 49 | uint32_t ar_id_type, chunk_t ar_id_value); |
b8db66de | 50 | |
b1da8368 AS |
51 | /** |
52 | * Remove and delete a session | |
53 | * | |
54 | * @param session Session | |
55 | */ | |
56 | void (*remove_session)(imv_database_t *this, imv_session_t *session); | |
57 | ||
29645621 AS |
58 | /** |
59 | * Add final recommendation to a session database entry | |
60 | * | |
61 | * @param session Session | |
62 | * @param rec Final recommendation | |
63 | */ | |
64 | void (*add_recommendation)(imv_database_t *this, imv_session_t *session, | |
65 | TNC_IMV_Action_Recommendation rec); | |
66 | ||
bb9d8b18 AS |
67 | /** |
68 | * Announce session start/stop to policy script | |
69 | * | |
a6266485 | 70 | * @param session Session |
bb9d8b18 AS |
71 | * @param start TRUE if session start, FALSE if session stop |
72 | * @return TRUE if command successful, FALSE otherwise | |
73 | */ | |
a6266485 AS |
74 | bool (*policy_script)(imv_database_t *this, imv_session_t *session, |
75 | bool start); | |
bb9d8b18 | 76 | |
4f9aabbf | 77 | /** |
a6266485 | 78 | * Finalize a workitem |
4f9aabbf | 79 | * |
a6266485 | 80 | * @param workitem Workitem to be finalized |
4f9aabbf | 81 | */ |
a6266485 | 82 | bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem); |
4f9aabbf | 83 | |
b8db66de AS |
84 | /** |
85 | * Get database handle | |
86 | * | |
87 | * @return Database handle | |
88 | */ | |
89 | database_t* (*get_database)(imv_database_t *this); | |
90 | ||
91 | /** | |
92 | * Destroys an imv_database_t object | |
93 | */ | |
94 | void (*destroy)(imv_database_t *this); | |
95 | }; | |
96 | ||
97 | /** | |
98 | * Create an imv_database_t instance | |
99 | * | |
a6266485 AS |
100 | * @param uri Database uri |
101 | * @param script Policy Manager script | |
b8db66de | 102 | */ |
a6266485 | 103 | imv_database_t* imv_database_create(char *uri, char *script); |
b8db66de AS |
104 | |
105 | #endif /** IMV_DATABASE_H_ @}*/ |