Added add_segment() method to IETF attributes
[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* (*add_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 * Remove and delete a session
53 *
54 * @param session Session
55 */
56 void (*remove_session)(imv_database_t *this, imv_session_t *session);
57
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
67 /**
68 * Announce session start/stop to policy script
69 *
70 * @param session Session
71 * @param start TRUE if session start, FALSE if session stop
72 * @return TRUE if command successful, FALSE otherwise
73 */
74 bool (*policy_script)(imv_database_t *this, imv_session_t *session,
75 bool start);
76
77 /**
78 * Finalize a workitem
79 *
80 * @param workitem Workitem to be finalized
81 */
82 bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem);
83
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 *
100 * @param uri Database uri
101 * @param script Policy Manager script
102 */
103 imv_database_t* imv_database_create(char *uri, char *script);
104
105 #endif /** IMV_DATABASE_H_ @}*/