improved control when an attribute request is sent
[strongswan.git] / src / libimcv / plugins / imv_os / imv_os_state.h
1 /*
2 * Copyright (C) 2012 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_os_state_t imv_os_state
19 * @{ @ingroup imv_os_state
20 */
21
22 #ifndef IMV_OS_STATE_H_
23 #define IMV_OS_STATE_H_
24
25 #include "os_info/os_info.h"
26 #include <imv/imv_state.h>
27 #include <library.h>
28
29 typedef struct imv_os_state_t imv_os_state_t;
30 typedef enum os_settings_t os_settings_t;
31
32 enum os_settings_t {
33 OS_SETTINGS_FWD_ENABLED = 1,
34 OS_SETTINGS_DEFAULT_PWD_ENABLED = 2,
35 OS_SETTINGS_NON_MARKET_APPS = 4
36 };
37
38 /**
39 * Internal state of an imv_os_t connection instance
40 */
41 struct imv_os_state_t {
42
43 /**
44 * imv_state_t interface
45 */
46 imv_state_t interface;
47
48 /**
49 * Set OS Product Information
50 *
51 * @param type OS type (enumerated)
52 * @param name OS name (string)
53 * @param version OS version
54 */
55 void (*set_info)(imv_os_state_t *this, os_type_t os_type,
56 chunk_t name, chunk_t version);
57
58 /**
59 * Get OS Product Information
60 *
61 * @param type OS type (enumerated)
62 * @param name OS name (string)
63 * @param version OS version
64 * @return OS name & version as a concatenated string
65 */
66 char* (*get_info)(imv_os_state_t *this, os_type_t *os_type,
67 chunk_t *name, chunk_t *version);
68
69 /**
70 * Set [or with multiple attributes increment] package counters
71 *
72 * @param count Number of processed packages
73 * @param count_update Number of not updated packages
74 * @param count_blacklist Number of blacklisted packages
75 * @param count_ok Number of whitelisted packages
76 */
77 void (*set_count)(imv_os_state_t *this, int count, int count_update,
78 int count_blacklist, int count_ok);
79
80 /**
81 * Set [or with multiple attributes increment] package counters
82 *
83 * @param count Number of processed packages
84 * @param count_update Number of not updated packages
85 * @param count_blacklist Number of blacklisted packages
86 * @param count_ok Number of whitelisted packages
87 */
88 void (*get_count)(imv_os_state_t *this, int *count, int *count_update,
89 int *count_blacklist, int *count_ok);
90
91 /**
92 * Set/reset attribute request status
93 *
94 * @param set TRUE to set, FALSE to clear
95 */
96 void (*set_attribute_request)(imv_os_state_t *this, bool set);
97
98 /**
99 * Get attribute request status
100 *
101 * @return TRUE if set, FALSE if unset
102 */
103 bool (*get_attribute_request)(imv_os_state_t *this);
104
105 /**
106 * Set/reset OS Installed Packages request status
107 *
108 * @param set TRUE to set, FALSE to clear
109 */
110 void (*set_package_request)(imv_os_state_t *this, bool set);
111
112 /**
113 * Get OS Installed Packages request status
114 *
115 * @return TRUE if set, FALSE if unset
116 */
117 bool (*get_package_request)(imv_os_state_t *this);
118
119 /**
120 * Set device ID
121 *
122 * @param device_id Device ID primary database key
123 */
124 void (*set_device_id)(imv_os_state_t *this, int id);
125
126 /**
127 * Get device ID
128 *
129 * @return Device ID primary database key
130 */
131 int (*get_device_id)(imv_os_state_t *this);
132
133 /**
134 * Set OS settings
135 *
136 * @param settings OS settings
137 */
138 void (*set_os_settings)(imv_os_state_t *this, u_int settings);
139
140 /**
141 * Get OS settings
142 *
143 * @return OS settings
144 */
145 u_int (*get_os_settings)(imv_os_state_t *this);
146
147 /**
148 * Increase/Decrease the ITA Angel count
149 *
150 * @param start TRUE increases and FALSE decreases count by one
151 */
152 void (*set_angel_count)(imv_os_state_t *this, bool start);
153
154 /**
155 * Get the ITA Angel count
156 *
157 * @return ITA Angel count
158 */
159 int (*get_angel_count)(imv_os_state_t *this);
160
161 /**
162 * Store a bad package that has to be updated or removed
163 *
164 * @param package Name of software package
165 * @param package_state Security state of software package
166 */
167 void (*add_bad_package)(imv_os_state_t *this, char *package,
168 os_package_state_t package_state);
169
170 };
171
172 /**
173 * Create an imv_os_state_t instance
174 *
175 * @param id connection ID
176 */
177 imv_state_t* imv_os_state_create(TNC_ConnectionID id);
178
179 #endif /** IMV_OS_STATE_H_ @}*/