moved imv_manager to libtnccs
[strongswan.git] / src / libtnccs / imv / imv_recommendations.h
1 /*
2 * Copyright (C) 2010 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 * @defgroup imv_recommendations imv_recommendations
18 * @{ @ingroup imv
19 */
20
21 #ifndef IMV_RECOMMENDATIONS_H_
22 #define IMV_RECOMMENDATIONS_H_
23
24 #include <tncifimv.h>
25 #include <library.h>
26
27 typedef enum recommendation_policy_t recommendation_policy_t;
28
29 enum recommendation_policy_t {
30 RECOMMENDATION_POLICY_DEFAULT,
31 RECOMMENDATION_POLICY_ANY,
32 RECOMMENDATION_POLICY_ALL
33 };
34
35 extern enum_name_t *recommendation_policy_names;
36
37
38 typedef struct recommendations_t recommendations_t;
39
40 /**
41 * Collection of all IMV action recommendations and evaluation results
42 */
43 struct recommendations_t {
44
45 /**
46 * Deliver an IMV action recommendation and IMV evaluation result to the TNCS
47 *
48 * @param imv_id ID of the IMV providing the recommendation
49 * @param rec action recommendation
50 * @param eval evaluation result
51 * @return return code
52 */
53 TNC_Result (*provide_recommendation)(recommendations_t *this,
54 TNC_IMVID imv_id,
55 TNC_IMV_Action_Recommendation rec,
56 TNC_IMV_Evaluation_Result eval);
57
58 /**
59 * If all IMVs provided a recommendation, derive a consolidated action
60 * recommendation and evaluation result based on a configured policy
61 *
62 * @param rec action recommendation
63 * @param eval evaluation result
64 * @return TRUE if all IMVs provided a recommendation
65 */
66 bool (*have_recommendation)(recommendations_t *this,
67 TNC_IMV_Action_Recommendation *rec,
68 TNC_IMV_Evaluation_Result *eval);
69
70 /**
71 * Get the preferred language for remediation messages
72 *
73 * @return preferred language
74 */
75 chunk_t (*get_preferred_language)(recommendations_t *this);
76
77 /**
78 * Set the preferred language for remediation messages
79 *
80 * @param pref_lang preferred language
81 */
82 void (*set_preferred_language)(recommendations_t *this, chunk_t pref_lang);
83
84 /**
85 * Set the reason string
86 *
87 * @param id ID of IMV setting the reason string
88 * @param reason reason string
89 * @result return code
90 */
91 TNC_Result (*set_reason_string)(recommendations_t *this, TNC_IMVID id,
92 chunk_t reason);
93
94 /**
95 * Set the language for reason strings
96 *
97 * @param id ID of IMV setting the reason language
98 * @param reason_lang reason language
99 * @result return code
100 */
101 TNC_Result (*set_reason_language)(recommendations_t *this, TNC_IMVID id,
102 chunk_t reason_lang);
103
104 /**
105 * Enumerates over all IMVs sending a reason string.
106 * Format: TNC_IMVID *id, chunk_t *reason, chunk_t *reason_language
107 *
108 * @return enumerator
109 */
110 enumerator_t* (*create_reason_enumerator)(recommendations_t *this);
111
112 /**
113 * Clears all reason entries
114 */
115 void (*clear_reasons)(recommendations_t *this);
116
117 /**
118 * Destroys an imv_t object.
119 */
120 void (*destroy)(recommendations_t *this);
121 };
122
123 #endif /** IMV_RECOMMENDATIONS_H_ @}*/