1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* Copyright (C) 2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
*
* @defgroup imv_database_t imv_database
* @{ @ingroup libimcv_imv
*/
#ifndef IMV_DATABASE_H_
#define IMV_DATABASE_H_
#include "imv_session.h"
#include "imv_workitem.h"
#include <tncifimv.h>
#include <library.h>
typedef struct imv_database_t imv_database_t;
/**
* IMV database interface
*/
struct imv_database_t {
/**
* Create or get a session associated with a TNCCS connection
*
* @param conn_id TNCCS Connection ID
* @param ar_id_type Access Requestor identity type
* @param ar_id_value Access Requestor identity value
* @return Session associated with TNCCS Connection
*/
imv_session_t* (*add_session)(imv_database_t *this,
TNC_ConnectionID conn_id,
u_int32_t ar_id_type, chunk_t ar_id_value);
/**
* Remove and delete a session
*
* @param session Session
*/
void (*remove_session)(imv_database_t *this, imv_session_t *session);
/**
* Add final recommendation to a session database entry
*
* @param session Session
* @param rec Final recommendation
*/
void (*add_recommendation)(imv_database_t *this, imv_session_t *session,
TNC_IMV_Action_Recommendation rec);
/**
* Announce session start/stop to policy script
*
* @param session Session
* @param start TRUE if session start, FALSE if session stop
* @return TRUE if command successful, FALSE otherwise
*/
bool (*policy_script)(imv_database_t *this, imv_session_t *session,
bool start);
/**
* Finalize a workitem
*
* @param workitem Workitem to be finalized
*/
bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem);
/**
* Get database handle
*
* @return Database handle
*/
database_t* (*get_database)(imv_database_t *this);
/**
* Destroys an imv_database_t object
*/
void (*destroy)(imv_database_t *this);
};
/**
* Create an imv_database_t instance
*
* @param uri Database uri
* @param script Policy Manager script
*/
imv_database_t* imv_database_create(char *uri, char *script);
#endif /** IMV_DATABASE_H_ @}*/
|