Annotation of embedaddon/strongswan/src/libimcv/imv/imv_session.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2013-2015 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_session_t imv_session
                     19:  * @{ @ingroup libimcv_imv
                     20:  */
                     21: 
                     22: #ifndef  IMV_SESSION_H_
                     23: #define  IMV_SESSION_H_
                     24: 
                     25: #include "imv_workitem.h"
                     26: #include "imv_os_info.h"
                     27: 
                     28: #include <tncifimv.h>
                     29: #include <library.h>
                     30: 
                     31: #include <time.h>
                     32: 
                     33: typedef struct imv_session_t imv_session_t;
                     34: 
                     35: /**
                     36:  * IMV session interface
                     37:  */
                     38: struct imv_session_t {
                     39: 
                     40:        /**
                     41:         * Set unique session ID
                     42:         *
                     43:         * @param session_id    primary key into sessions table
                     44:         * @param pid                   primary key into products table
                     45:         * @param did                   Primary key into devices table
                     46:         */
                     47:        void (*set_session_id)(imv_session_t *this, int session_id, int pid, int did);
                     48: 
                     49:        /**
                     50:         * Get unique session ID
                     51:         *
                     52:         * @param pid                   primary key into products table
                     53:         * @param did                   Primary key into devices table
                     54:         * @return                              primary key into sessions table
                     55:         */
                     56:        int (*get_session_id)(imv_session_t *this, int *pid, int *did);
                     57: 
                     58:        /**
                     59:         * Get TNCCS Connection ID
                     60:         *
                     61:         * @return                              TNCCS Connection ID
                     62:         */
                     63:        TNC_ConnectionID (*get_connection_id)(imv_session_t *this);
                     64: 
                     65:        /**
                     66:         * Set session creation time
                     67:         *
                     68:         * @param created               Session creation time
                     69:         */
                     70:        void (*set_creation_time)(imv_session_t *this, time_t created);
                     71: 
                     72:        /**
                     73:         * Get session creation time
                     74:         *
                     75:         * @return                              Session creation time
                     76:         */
                     77:        time_t (*get_creation_time)(imv_session_t *this);
                     78: 
                     79:        /**
                     80:         * Get list of Access Requestor identities
                     81:         *
                     82:         * @return                              List of Access Requestor identities
                     83:         */
                     84:        enumerator_t* (*create_ar_identities_enumerator)(imv_session_t *this);
                     85: 
                     86:        /**
                     87:         * Get OS Information
                     88:         *
                     89:         * @return                              OS info object
                     90:         */
                     91:        imv_os_info_t* (*get_os_info)(imv_session_t *this);
                     92: 
                     93:        /**
                     94:         * Set Device ID
                     95:         *
                     96:         * @param device_id             Device ID
                     97:         */
                     98:        void (*set_device_id)(imv_session_t *this, chunk_t device_id);
                     99: 
                    100:        /**
                    101:         * Get Device ID
                    102:         *
                    103:         * @param device_id             Device ID
                    104:         * @return                              TRUE if Device ID has already been set
                    105:         */
                    106:        bool (*get_device_id)(imv_session_t *this, chunk_t *device_id);
                    107: 
                    108:        /**
                    109:         * Set trust into Device ID
                    110:         *
                    111:         * @param trusted               TRUE if Device ID is trusted
                    112:         */
                    113:        void (*set_device_trust)(imv_session_t *this, bool trusted);
                    114: 
                    115: 
                    116:        /**
                    117:         * Get device ID trust (needed for TPM-based attestation)
                    118:         *
                    119:         * @return                              TRUE if Device ID is trusted
                    120:         */
                    121:        bool (*get_device_trust)(imv_session_t *this);
                    122: 
                    123:        /**
                    124:         * Set policy_started status
                    125:         *
                    126:         * @param start                 TRUE if policy started, FALSE if policy stopped
                    127:         */
                    128:        void (*set_policy_started)(imv_session_t *this, bool start);
                    129: 
                    130:        /**
                    131:         * Get policy_started status
                    132:         *
                    133:         * @return                              TRUE if policy started, FALSE if policy stopped
                    134:         */
                    135:        bool (*get_policy_started)(imv_session_t *this);
                    136: 
                    137:        /**
                    138:         * Insert workitem into list
                    139:         *
                    140:         * @param workitem              Workitem to be inserted
                    141:         */
                    142:        void (*insert_workitem)(imv_session_t *this, imv_workitem_t *workitem);
                    143: 
                    144:        /**
                    145:         * Remove workitem from list
                    146:         *
                    147:         * @param enumerator    Enumerator pointing to workitem to be removed
                    148:         */
                    149:        void (*remove_workitem)(imv_session_t *this, enumerator_t *enumerator);
                    150: 
                    151:        /**
                    152:         * Create workitem enumerator
                    153:         *
                    154:         */
                    155:         enumerator_t* (*create_workitem_enumerator)(imv_session_t *this);
                    156: 
                    157:        /**
                    158:         * Get number of workitem allocated to a given IMV
                    159:         *
                    160:         * @param imv_id                IMV ID
                    161:         * @return                              Number of workitems assigned to given IMV
                    162:         */
                    163:         int (*get_workitem_count)(imv_session_t *this, TNC_IMVID imv_id);
                    164: 
                    165:        /**
                    166:         * Get reference to session
                    167:         */
                    168:        imv_session_t* (*get_ref)(imv_session_t*);
                    169: 
                    170:        /**
                    171:         * Destroys an imv_session_t object
                    172:         */
                    173:        void (*destroy)(imv_session_t *this);
                    174: };
                    175: 
                    176: /**
                    177:  * Create an imv_session_t instance
                    178:  *
                    179:  * @param id                           Associated Connection ID
                    180:  * @param ar_identities                List of Access Requestor identities
                    181:  */
                    182: imv_session_t* imv_session_create(TNC_ConnectionID id,
                    183:                                                                 linked_list_t *ar_identities);
                    184: 
                    185: #endif /**  IMV_SESSION_H_ @}*/

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