add overall recommendation to session database entry
[strongswan.git] / src / libimcv / imv / imv_database.h
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
25 #include "imv_session.h"
26 #include "imv_workitem.h"
27
28 #include <tncifimv.h>
29
30 #include <library.h>
31
32 typedef struct imv_database_t imv_database_t;
33
34 /**
35 * IMV database interface
36 */
37 struct imv_database_t {
38
39 /**
40 * Create or get a session associated with a TNCCS connection
41 *
42 * @param conn_id TNCCS Connection ID
43 * @param ar_id_type Access Requestor identity type
44 * @param ar_id_value Access Requestor identity value
45 * @return Session associated with TNCCS Connection
46 */
47 imv_session_t* (*get_session)(imv_database_t *this,
48 TNC_ConnectionID conn_id,
49 u_int32_t ar_id_type, chunk_t ar_id_value);
50
51 /**
52 * Add product information string to a session database entry
53 *
54 * @param session Session
55 * @param product Product information string
56 * @return Product ID
57 */
58 int (*add_product)(imv_database_t *this, imv_session_t *session,
59 char *product);
60
61 /**
62 * Add device identification to a session database entry
63 *
64 * @param session Session
65 * @param device Device identification
66 * @return Device ID
67 */
68 int (*add_device)(imv_database_t *this, imv_session_t *session,
69 chunk_t device);
70
71 /**
72 * Add final recommendation to a session database entry
73 *
74 * @param session Session
75 * @param rec Final recommendation
76 */
77 void (*add_recommendation)(imv_database_t *this, imv_session_t *session,
78 TNC_IMV_Action_Recommendation rec);
79
80 /**
81 * Announce session start/stop to policy script
82 *
83 * @param session Session
84 * @param start TRUE if session start, FALSE if session stop
85 * @return TRUE if command successful, FALSE otherwise
86 */
87 bool (*policy_script)(imv_database_t *this, imv_session_t *session,
88 bool start);
89
90 /**
91 * Finalize a workitem
92 *
93 * @param workitem Workitem to be finalized
94 */
95 bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem);
96
97 /**
98 * Get database handle
99 *
100 * @return Database handle
101 */
102 database_t* (*get_database)(imv_database_t *this);
103
104 /**
105 * Destroys an imv_database_t object
106 */
107 void (*destroy)(imv_database_t *this);
108 };
109
110 /**
111 * Create an imv_database_t instance
112 *
113 * @param uri Database uri
114 * @param script Policy Manager script
115 */
116 imv_database_t* imv_database_create(char *uri, char *script);
117
118 #endif /** IMV_DATABASE_H_ @}*/