Annotation of embedaddon/strongswan/src/libimcv/plugins/imv_swima/imv_swima_state.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 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_swima imv_swima
                     18:  * @ingroup libimcv_plugins
                     19:  *
                     20:  * @defgroup imv_swima_state_t imv_swima_state
                     21:  * @{ @ingroup imv_swima
                     22:  */
                     23: 
                     24: #ifndef IMV_SWIMA_STATE_H_
                     25: #define IMV_SWIMA_STATE_H_
                     26: 
                     27: #include <imv/imv_state.h>
                     28: #include <swima/swima_inventory.h>
                     29: #include <swima/swima_events.h>
                     30: #include <library.h>
                     31: 
                     32: #include <json.h>
                     33: 
                     34: typedef struct imv_swima_state_t imv_swima_state_t;
                     35: typedef enum imv_swima_handshake_state_t imv_swima_handshake_state_t;
                     36: 
                     37: /**
                     38:  * IMV OS Handshake States (state machine)
                     39:  */
                     40: enum imv_swima_handshake_state_t {
                     41:        IMV_SWIMA_STATE_INIT,
                     42:        IMV_SWIMA_STATE_WORKITEMS,
                     43:        IMV_SWIMA_STATE_END
                     44: };
                     45: 
                     46: /**
                     47:  * Internal state of an imv_swima_t connection instance
                     48:  */
                     49: struct imv_swima_state_t {
                     50: 
                     51:        /**
                     52:         * imv_state_t interface
                     53:         */
                     54:        imv_state_t interface;
                     55: 
                     56:        /**
                     57:         * Set state of the handshake
                     58:         *
                     59:         * @param new_state                     the handshake state of IMV
                     60:         */
                     61:        void (*set_handshake_state)(imv_swima_state_t *this,
                     62:                                                                imv_swima_handshake_state_t new_state);
                     63: 
                     64:        /**
                     65:         * Get state of the handshake
                     66:         *
                     67:         * @return                                      the handshake state of IMV
                     68:         */
                     69:        imv_swima_handshake_state_t (*get_handshake_state)(imv_swima_state_t *this);
                     70: 
                     71:        /**
                     72:         * Set the SWID request ID
                     73:         *
                     74:         * @param request_id            SWID request ID to be set
                     75:         */
                     76:        void (*set_request_id)(imv_swima_state_t *this, uint32_t request_id);
                     77: 
                     78:        /**
                     79:         * Get the SWID request ID
                     80:         *
                     81:         * @return                                      SWID request ID
                     82:         */
                     83:        uint32_t (*get_request_id)(imv_swima_state_t *this);
                     84: 
                     85:        /**
                     86:         * Set or extend the SW ID inventory in the state
                     87:         *
                     88:         * @param inventory                     SW ID inventory to be added
                     89:         */
                     90:        void (*set_inventory)(imv_swima_state_t *this, swima_inventory_t *inventory);
                     91: 
                     92:        /**
                     93:         * Set or extend the SW ID events in the state
                     94:         *
                     95:         * @param events                        SW ID events to be added
                     96:         */
                     97:        void (*set_events)(imv_swima_state_t *this, swima_events_t *events);
                     98: 
                     99:        /**
                    100:         * Get the JSON encoding of the complete SW ID inventory or SW ID events
                    101:         *
                    102:         * @return                             JSON encoding
                    103:         */
                    104:        json_object* (*get_jrequest)(imv_swima_state_t *this);
                    105: 
                    106:        /**
                    107:         * Set the number of still missing SW [ID] records or envents
                    108:         *
                    109:         * @param count                         Number of missing SW [ID] records or envents
                    110:         */
                    111:        void (*set_missing)(imv_swima_state_t *this, uint32_t count);
                    112: 
                    113:        /**
                    114:         * Get the number of still missing SWID Tags or Tag IDs
                    115:         *
                    116:         * @result                                      Number of missing SWID Tags or Tag IDs
                    117:         */
                    118:        uint32_t (*get_missing)(imv_swima_state_t *this);
                    119: 
                    120:        /**
                    121:         * Set [or with multiple attributes increment] SWID Tag [ID] counters
                    122:         *
                    123:         * @param tag_id_count          Number of received SWID Tag IDs
                    124:         * @param tag_count                     Number of received SWID Tags
                    125:         * @param imc_id                        SWID IMC ID
                    126:         */
                    127:        void (*set_count)(imv_swima_state_t *this, int tag_id_count, int tag_count,
                    128:                                          TNC_UInt32 imc_id);
                    129: 
                    130:        /**
                    131:         * Set [or with multiple attributes increment] SWID Tag [ID] counters
                    132:         *
                    133:         * @param tag_id_count          Number of received SWID Tag IDs
                    134:         * @param tag_count                     Number of received SWID Tags
                    135:         */
                    136:        void (*get_count)(imv_swima_state_t *this, int *tag_id_count, int *tag_count);
                    137: 
                    138:        /**
                    139:         * Get SWID IMC ID
                    140:         *
                    141:         * @return                                      SWID IMC ID
                    142:         */
                    143:        TNC_UInt32 (*get_imc_id)(imv_swima_state_t *this);
                    144: 
                    145:        /**
                    146:         * Set or clear a subscription
                    147:         *
                    148:         * @param set                           TRUE sets and FALSE clears a subscripton
                    149:         */
                    150:        void (*set_subscription)(imv_swima_state_t *this, bool set);
                    151: 
                    152:        /**
                    153:         * Get the subscription status
                    154:         *
                    155:         * @return                                      TRUE if subscription is set
                    156:         */
                    157:        bool (*get_subscription)(imv_swima_state_t *this);
                    158: };
                    159: 
                    160: /**
                    161:  * Create an imv_swima_state_t instance
                    162:  *
                    163:  * @param id                   connection ID
                    164:  */
                    165: imv_state_t* imv_swima_state_create(TNC_ConnectionID id);
                    166: 
                    167: #endif /** IMV_SWIMA_STATE_H_ @}*/

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