2 * Copyright (C) 2012-2014 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup imv_os imv_os
18 * @ingroup libimcv_plugins
20 * @defgroup imv_os_state_t imv_os_state
24 #ifndef IMV_OS_STATE_H_
25 #define IMV_OS_STATE_H_
27 #include "os_info/os_info.h"
28 #include <imv/imv_state.h>
31 typedef struct imv_os_state_t imv_os_state_t
;
32 typedef enum imv_os_handshake_state_t imv_os_handshake_state_t
;
33 typedef enum os_settings_t os_settings_t
;
36 * IMV OS Handshake States (state machine)
38 enum imv_os_handshake_state_t
{
40 IMV_OS_STATE_ATTR_REQ
,
41 IMV_OS_STATE_POLICY_START
,
42 IMV_OS_STATE_WORKITEMS
,
47 * Flags for detected OS Settings
50 OS_SETTINGS_FWD_ENABLED
= (1<<0),
51 OS_SETTINGS_DEFAULT_PWD_ENABLED
= (1<<1),
52 OS_SETTINGS_UNKNOWN_SOURCE
= (1<<2)
56 * Internal state of an imv_os_t connection instance
58 struct imv_os_state_t
{
61 * imv_state_t interface
63 imv_state_t interface
;
66 * Set state of the handshake
68 * @param new_state the handshake state of IMV
70 void (*set_handshake_state
)(imv_os_state_t
*this,
71 imv_os_handshake_state_t new_state
);
74 * Get state of the handshake
76 * @return the handshake state of IMV
78 imv_os_handshake_state_t (*get_handshake_state
)(imv_os_state_t
*this);
81 * Set [or with multiple attributes increment] package counters
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
88 void (*set_count
)(imv_os_state_t
*this, int count
, int count_update
,
89 int count_blacklist
, int count_ok
);
92 * Set [or with multiple attributes increment] package counters
94 * @param count Number of processed packages
95 * @param count_update Number of not updated packages
96 * @param count_blacklist Number of blacklisted packages
97 * @param count_ok Number of whitelisted packages
99 void (*get_count
)(imv_os_state_t
*this, int *count
, int *count_update
,
100 int *count_blacklist
, int *count_ok
);
105 * @param settings OS settings
107 void (*set_os_settings
)(imv_os_state_t
*this, u_int settings
);
112 * @return OS settings
114 u_int (*get_os_settings
)(imv_os_state_t
*this);
117 * Set number of installed packages still missing
119 * @param missing Number of missing installed packages
121 void (*set_missing
)(imv_os_state_t
*this, uint16_t missing
);
124 * Get number of installed packages still missing
126 * @return Number of missing installed packages
128 uint16_t (*get_missing
)(imv_os_state_t
*this);
131 * Store a bad package that has to be updated or removed
133 * @param package Name of software package
134 * @param package_state Security state of software package
136 void (*add_bad_package
)(imv_os_state_t
*this, char *package
,
137 os_package_state_t package_state
);
142 * Create an imv_os_state_t instance
144 * @param id connection ID
146 imv_state_t
* imv_os_state_create(TNC_ConnectionID id
);
148 #endif /** IMV_OS_STATE_H_ @}*/