Annotation of embedaddon/strongswan/src/libtnccs/tnc/imc/imc_manager.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2010 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 imc_manager imc_manager
        !            18:  * @{ @ingroup imc
        !            19:  */
        !            20: 
        !            21: #ifndef IMC_MANAGER_H_
        !            22: #define IMC_MANAGER_H_
        !            23: 
        !            24: typedef struct imc_manager_t imc_manager_t;
        !            25: 
        !            26: #include "imc.h"
        !            27: 
        !            28: #include <library.h>
        !            29: 
        !            30: /**
        !            31:  * The IMC manager controls all IMC instances.
        !            32:  */
        !            33: struct imc_manager_t {
        !            34: 
        !            35:        /**
        !            36:         * Add an IMC instance
        !            37:         *
        !            38:         * @param imc                           IMC instance
        !            39:         * @return                                      TRUE if initialization successful
        !            40:         */
        !            41:         bool (*add)(imc_manager_t *this, imc_t *imc);
        !            42: 
        !            43:        /**
        !            44:         * Remove an IMC instance from the list and return it
        !            45:         *
        !            46:         * @param id                            ID of IMC instance
        !            47:         * @return                                      removed IMC instance
        !            48:         */
        !            49:        imc_t* (*remove)(imc_manager_t *this, TNC_IMCID id);
        !            50: 
        !            51:        /**
        !            52:         * Load and initialize an IMC as a dynamic library and add it to the list
        !            53:         *
        !            54:         * @param name                          name of the IMC to be loaded
        !            55:         * @param path                          path of the IMC dynamic library file
        !            56:         * @return                                      TRUE if loading succeeded
        !            57:         */
        !            58:        bool (*load)(imc_manager_t *this, char *name, char *path);
        !            59: 
        !            60:        /**
        !            61:         * Load and initialize an IMC from a set of TNC IMC functions.
        !            62:         *
        !            63:         * @param name                                          name of the IMC
        !            64:         * @param initialize                            TNC_IMC_InitializePointer
        !            65:         * @param notify_connection_change      TNC_IMC_NotifyConnectionChangePointer
        !            66:         * @param begin_handshake                       TNC_IMC_BeginHandshakePointer
        !            67:         * @param receive_message                       TNC_IMC_ReceiveMessagePointer
        !            68:         * @param receive_message_long          TNC_IMC_ReceiveMessageLongPointer
        !            69:         * @param batch_ending                          TNC_IMC_BatchEndingPointer
        !            70:         * @param terminate                                     TNC_IMC_TerminatePointer
        !            71:         * @param provide_bind_function         TNC_IMC_ProvideBindFunctionPointer
        !            72:         * @return                                                      TRUE if loading succeeded
        !            73:         */
        !            74:        bool (*load_from_functions)(imc_manager_t *this, char *name,
        !            75:                                TNC_IMC_InitializePointer initialize,
        !            76:                                TNC_IMC_NotifyConnectionChangePointer notify_connection_change,
        !            77:                                TNC_IMC_BeginHandshakePointer begin_handshake,
        !            78:                                TNC_IMC_ReceiveMessagePointer receive_message,
        !            79:                                TNC_IMC_ReceiveMessageLongPointer receive_message_long,
        !            80:                                TNC_IMC_BatchEndingPointer batch_ending,
        !            81:                                TNC_IMC_TerminatePointer terminate,
        !            82:                                TNC_IMC_ProvideBindFunctionPointer provide_bind_function);
        !            83: 
        !            84:        /**
        !            85:         * Check if an IMC with a given ID is registered with the IMC manager
        !            86:         *
        !            87:         * @param id                            ID of IMC instance
        !            88:         * @return                                      TRUE if registered
        !            89:         */
        !            90:        bool (*is_registered)(imc_manager_t *this, TNC_IMCID id);
        !            91: 
        !            92:        /**
        !            93:         * Reserve an additional ID for an IMC
        !            94:         *
        !            95:         * @param id                            ID of IMC instance
        !            96:         * @param new_id                        reserved ID assigned to IMC
        !            97:         * @return                                      TRUE if primary IMC ID was used
        !            98:         */
        !            99:        bool (*reserve_id)(imc_manager_t *this, TNC_IMCID id, TNC_UInt32 *new_id);
        !           100: 
        !           101:        /**
        !           102:         * Return the preferred language for recommendations
        !           103:         *
        !           104:         * @return                                      preferred language string
        !           105:         */
        !           106:        char* (*get_preferred_language)(imc_manager_t *this);
        !           107: 
        !           108:        /**
        !           109:         * Notify all IMC instances
        !           110:         *
        !           111:         * @param state                 communicate the state a connection has reached
        !           112:         */
        !           113:        void (*notify_connection_change)(imc_manager_t *this,
        !           114:                                                                         TNC_ConnectionID id,
        !           115:                                                                         TNC_ConnectionState state);
        !           116: 
        !           117:        /**
        !           118:         * Begin a handshake between the IMCs and a connection
        !           119:         *
        !           120:         * @param id                                    connection ID
        !           121:         */
        !           122:        void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id);
        !           123: 
        !           124:        /**
        !           125:         * Sets the supported message types reported by a given IMC
        !           126:         *
        !           127:         * @param id                                    ID of reporting IMC
        !           128:         * @param supported_types               list of messages type supported by IMC
        !           129:         * @param type_count                    number of supported message types
        !           130:         * @return                                              TNC result code
        !           131:         */
        !           132:        TNC_Result (*set_message_types)(imc_manager_t *this,
        !           133:                                                                        TNC_IMCID id,
        !           134:                                                                        TNC_MessageTypeList supported_types,
        !           135:                                                                        TNC_UInt32 type_count);
        !           136: 
        !           137:        /**
        !           138:         * Sets the supported long message types reported by a given IMC
        !           139:         *
        !           140:         * @param id                                    ID of reporting IMC
        !           141:         * @param supported_vids                list of vendor IDs supported by IMC
        !           142:         * @param supported_subtypes    list of messages type supported by IMC
        !           143:         * @param type_count                    number of supported message types
        !           144:         * @return                                              TNC result code
        !           145:         */
        !           146:        TNC_Result (*set_message_types_long)(imc_manager_t *this,
        !           147:                                                                        TNC_IMCID id,
        !           148:                                                                        TNC_VendorIDList supported_vids,
        !           149:                                                                        TNC_MessageSubtypeList supported_subtypes,
        !           150:                                                                        TNC_UInt32 type_count);
        !           151: 
        !           152:        /**
        !           153:         * Delivers a message to interested IMCs.
        !           154:         *
        !           155:         * @param connection_id                 connection ID
        !           156:         * @param excl                                  exclusive message flag
        !           157:         * @param msg                                   message
        !           158:         * @param msg_len                               message length
        !           159:         * @param msg_vid                               message Vendor ID
        !           160:         * @param msg_subtype                   message subtype
        !           161:         * @param src_imv_id                    source IMV ID
        !           162:         * @param dst_imc_id                    destination IMC ID
        !           163:         */
        !           164:        void (*receive_message)(imc_manager_t *this,
        !           165:                                                        TNC_ConnectionID connection_id,
        !           166:                                                        bool excl,
        !           167:                                                        TNC_BufferReference msg,
        !           168:                                                        TNC_UInt32 msg_len,
        !           169:                                                        TNC_VendorID msg_vid,
        !           170:                                                        TNC_MessageSubtype msg_subtype,
        !           171:                                                        TNC_UInt32 src_imv_id,
        !           172:                                                        TNC_UInt32 dst_imc_id);
        !           173: 
        !           174:        /**
        !           175:         * Notify all IMCs that all IMV messages received in a batch have been
        !           176:         * delivered and this is the IMCs last chance to send a message in the
        !           177:         * batch of IMC messages currently being collected.
        !           178:         *
        !           179:         * @param id                            connection ID
        !           180:         */
        !           181:        void (*batch_ending)(imc_manager_t *this, TNC_ConnectionID id);
        !           182: 
        !           183:        /**
        !           184:         * Destroy an IMC manager and all its controlled instances.
        !           185:         */
        !           186:        void (*destroy)(imc_manager_t *this);
        !           187: };
        !           188: 
        !           189: #endif /** IMC_MANAGER_H_ @}*/

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