Annotation of embedaddon/strongswan/src/libimcv/plugins/imv_os/imv_os_state.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2012-2017 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_os imv_os
                     18:  * @ingroup libimcv_plugins
                     19:  *
                     20:  * @defgroup imv_os_state_t imv_os_state
                     21:  * @{ @ingroup imv_os
                     22:  */
                     23: 
                     24: #ifndef IMV_OS_STATE_H_
                     25: #define IMV_OS_STATE_H_
                     26: 
                     27: #include "os_info/os_info.h"
                     28: #include <imv/imv_state.h>
                     29: #include <library.h>
                     30: 
                     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;
                     34: 
                     35: /**
                     36:  * IMV OS Handshake States (state machine)
                     37:  */
                     38: enum imv_os_handshake_state_t {
                     39:        IMV_OS_STATE_INIT,
                     40:        IMV_OS_STATE_ATTR_REQ,
                     41:        IMV_OS_STATE_POLICY_START,
                     42:        IMV_OS_STATE_WORKITEMS,
                     43:        IMV_OS_STATE_END
                     44: };
                     45: 
                     46: /**
                     47:  * Flags for detected OS Settings
                     48:  */
                     49: enum os_settings_t {
                     50:        OS_SETTINGS_FWD_ENABLED =         (1<<0),
                     51:        OS_SETTINGS_DEFAULT_PWD_ENABLED = (1<<1),
                     52:        OS_SETTINGS_UNKNOWN_SOURCE =      (1<<2)
                     53: };
                     54: 
                     55: /**
                     56:  * Internal state of an imv_os_t connection instance
                     57:  */
                     58: struct imv_os_state_t {
                     59: 
                     60:        /**
                     61:         * imv_state_t interface
                     62:         */
                     63:        imv_state_t interface;
                     64: 
                     65:        /**
                     66:         * Set state of the handshake
                     67:         *
                     68:         * @param new_state                     the handshake state of IMV
                     69:         */
                     70:        void (*set_handshake_state)(imv_os_state_t *this,
                     71:                                                                imv_os_handshake_state_t new_state);
                     72: 
                     73:        /**
                     74:         * Get state of the handshake
                     75:         *
                     76:         * @return                                      the handshake state of IMV
                     77:         */
                     78:        imv_os_handshake_state_t (*get_handshake_state)(imv_os_state_t *this);
                     79: 
                     80:        /**
                     81:         * Set [or with multiple attributes increment] package counters
                     82:         *
                     83:         * @param count                         Number of processed packages
                     84:         * @param count_security        Number of vulnerable packages
                     85:         * @param count_blacklist       Number of blacklisted packages
                     86:         * @param count_ok                      Number of whitelisted packages
                     87:         */
                     88:        void (*set_count)(imv_os_state_t *this, int count, int count_security,
                     89:                                          int count_blacklist, int count_ok);
                     90: 
                     91:        /**
                     92:         * Set [or with multiple attributes increment] package counters
                     93:         *
                     94:         * @param count                         Number of processed packages
                     95:         * @param count_security        Number of vulnerable packages
                     96:         * @param count_blacklist       Number of blacklisted packages
                     97:         * @param count_ok                      Number of whitelisted packages
                     98:         */
                     99:        void (*get_count)(imv_os_state_t *this, int *count, int *count_security,
                    100:                                          int *count_blacklist, int *count_ok);
                    101: 
                    102:        /**
                    103:         * Set OS settings
                    104:         *
                    105:         * @param settings              OS settings
                    106:         */
                    107:        void (*set_os_settings)(imv_os_state_t *this, u_int settings);
                    108: 
                    109:        /**
                    110:         * Get OS settings
                    111:         *
                    112:         * @return                              OS settings
                    113:         */
                    114:        u_int (*get_os_settings)(imv_os_state_t *this);
                    115: 
                    116:        /**
                    117:         * Set number of installed packages still missing
                    118:         *
                    119:         * @param missing               Number of missing installed packages
                    120:         */
                    121:        void (*set_missing)(imv_os_state_t *this, uint16_t missing);
                    122: 
                    123:        /**
                    124:         * Get number of installed packages still missing
                    125:         *
                    126:         * @return                              Number of missing installed packages
                    127:         */
                    128:        uint16_t (*get_missing)(imv_os_state_t *this);
                    129: 
                    130:        /**
                    131:         * Store a bad package that has to be updated or removed
                    132:         *
                    133:         * @param package               Name of software package
                    134:         * @param package_state Security state of software package
                    135:         */
                    136:        void (*add_bad_package)(imv_os_state_t *this, char *package,
                    137:                                                        os_package_state_t package_state);
                    138: 
                    139: };
                    140: 
                    141: /**
                    142:  * Create an imv_os_state_t instance
                    143:  *
                    144:  * @param id                   connection ID
                    145:  */
                    146: imv_state_t* imv_os_state_create(TNC_ConnectionID id);
                    147: 
                    148: #endif /** IMV_OS_STATE_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>