760df78358c7c2de31e1205ebc1e4f01e671c7f6
[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
31 /**
32 * Internal state of an imv_os_t connection instance
33 */
34 struct imv_os_state_t {
35
36 /**
37 * imv_state_t interface
38 */
39 imv_state_t interface;
40
41 /**
42 * Set OS Product Information
43 *
44 * @param type OS type (enumerated)
45 * @param name OS name (string)
46 * @param version OS version
47 */
48 void (*set_info)(imv_os_state_t *this, os_type_t os_type,
49 chunk_t name, chunk_t version);
50
51 /**
52 * Get OS Product Information
53 *
54 * @param type OS type (enumerated)
55 * @param name OS name (string)
56 * @param version OS version
57 * @return OS name & version as a concatenated string
58 */
59 char* (*get_info)(imv_os_state_t *this, os_type_t *os_type,
60 chunk_t *name, chunk_t *version);
61
62 /**
63 * Set [or with multiple attributes increment] package counters
64 *
65 * @param count Number of processed packages
66 * @param count_update Number of not updated packages
67 * @param count_blacklist Number of blacklisted packages
68 * @param count_ok Number of whitelisted packages
69 */
70 void (*set_count)(imv_os_state_t *this, int count, int count_update,
71 int count_blacklist, int count_ok);
72
73 /**
74 * Set [or with multiple attributes increment] package counters
75 *
76 * @param count Number of processed packages
77 * @param count_update Number of not updated packages
78 * @param count_blacklist Number of blacklisted packages
79 * @param count_ok Number of whitelisted packages
80 */
81 void (*get_count)(imv_os_state_t *this, int *count, int *count_update,
82 int *count_blacklist, int *count_ok);
83 /**
84 * Set/reset OS Installed Packages request status
85 *
86 * @param set TRUE to set, FALSE to clear
87 */
88 void (*set_package_request)(imv_os_state_t *this, bool set);
89
90 /**
91 * Get OS Installed Packages request status
92 *
93 * @return TRUE if set, FALSE if unset
94 */
95 bool (*get_package_request)(imv_os_state_t *this);
96
97 /**
98 * Increase/Decrease the ITA Angel count
99 *
100 * @param start TRUE increases and FALSE decreases count by one
101 */
102 void (*set_angel_count)(imv_os_state_t *this, bool start);
103
104 /**
105 * Get the ITA Angel count
106 *
107 * @return ITA Angel count
108 */
109 int (*get_angel_count)(imv_os_state_t *this);
110
111 /**
112 * Store a bad package that has to be updated or removed
113 *
114 * @param package Name of software package
115 * @param package_state Security state of software package
116 */
117 void (*add_bad_package)(imv_os_state_t *this, char *package,
118 os_package_state_t package_state);
119
120 };
121
122 /**
123 * Create an imv_os_state_t instance
124 *
125 * @param id connection ID
126 */
127 imv_state_t* imv_os_state_create(TNC_ConnectionID id);
128
129 #endif /** IMV_OS_STATE_H_ @}*/