summaryrefslogtreecommitdiff
path: root/src/libtnccs/tnc/imv/imv_recommendations.h
blob: e7fe355f7829430c89a3241049c5d29213f1ba23 (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright (C) 2010 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_recommendations imv_recommendations
 * @{ @ingroup imv
 */

#ifndef IMV_RECOMMENDATIONS_H_
#define IMV_RECOMMENDATIONS_H_

#include <tncifimv.h>
#include <library.h>

typedef enum recommendation_policy_t recommendation_policy_t;

enum recommendation_policy_t {
	RECOMMENDATION_POLICY_DEFAULT,
	RECOMMENDATION_POLICY_ANY,
	RECOMMENDATION_POLICY_ALL
};

extern enum_name_t *recommendation_policy_names;


typedef struct recommendations_t recommendations_t;

/**
 * Collection of all IMV action recommendations and evaluation results
 */
struct recommendations_t {

	/**
	 * Deliver an IMV action recommendation and IMV evaluation result to the TNCS
	 *
	 * @param imv_id		ID of the IMV providing the recommendation
	 * @param rec			action recommendation
	 * @param eval			evaluation result
	 * @return				return code
	 */
	TNC_Result (*provide_recommendation)(recommendations_t *this,
										 TNC_IMVID imv_id,
										 TNC_IMV_Action_Recommendation rec,
										 TNC_IMV_Evaluation_Result eval);

	/**
	 * If all IMVs provided a recommendation, derive a consolidated action
	 * recommendation and evaluation result based on a configured policy
	 *
	 * @param rec			action recommendation
	 * @param eval			evaluation result
	 * @return				TRUE if all IMVs provided a recommendation
	 */
	bool (*have_recommendation)(recommendations_t *this,
								TNC_IMV_Action_Recommendation *rec,
								TNC_IMV_Evaluation_Result *eval);

	/**
	 * Clear all recommendation information
	 */
	void (*clear_recommendation)(recommendations_t *this);

	/**
	 * Get the preferred language for remediation messages
	 *
	 * @return				preferred language
	 */
	chunk_t (*get_preferred_language)(recommendations_t *this);

	/**
	 * Set the preferred language for remediation messages
	 *
	 * @param pref_lang		preferred language
	 */
	void (*set_preferred_language)(recommendations_t *this, chunk_t pref_lang);

	/**
	 * Set the reason string
	 *
	 * @param id			ID of IMV setting the reason string
	 * @param reason		reason string
	 * @result				return code
	 */
	TNC_Result (*set_reason_string)(recommendations_t *this, TNC_IMVID id,
									chunk_t reason);

	/**
	 * Set the language for reason strings
	 *
	 * @param id			ID of IMV setting the reason language
	 * @param reason_lang	reason language
	 * @result				return code
	 */
	TNC_Result (*set_reason_language)(recommendations_t *this, TNC_IMVID id,
									  chunk_t reason_lang);

	/**
	 * Enumerates over all IMVs sending a reason string.
	 * Format:  TNC_IMVID *id, chunk_t *reason, chunk_t *reason_language
	 *
	 * @return				enumerator
	 */
	enumerator_t* (*create_reason_enumerator)(recommendations_t *this);

	/**
	 * Destroys an imv_t object.
	 */
	void (*destroy)(recommendations_t *this);
};

#endif /** IMV_RECOMMENDATIONS_H_ @}*/