Annotation of embedaddon/strongswan/src/libimcv/pts/pts_database.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2011-2014 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 pts_database pts_database
        !            18:  * @{ @ingroup pts
        !            19:  */
        !            20: 
        !            21: #ifndef PTS_DATABASE_H_
        !            22: #define PTS_DATABASE_H_
        !            23: 
        !            24: typedef struct pts_database_t pts_database_t;
        !            25: 
        !            26: #include "pts_meas_algo.h"
        !            27: #include "components/pts_comp_func_name.h"
        !            28: 
        !            29: #include <imv/imv_database.h>
        !            30: #include <library.h>
        !            31: 
        !            32: /**
        !            33:  * Class implementing the PTS File Measurement database
        !            34:  *
        !            35:  */
        !            36: struct pts_database_t {
        !            37: 
        !            38:        /**
        !            39:        * Get absolute pathname for file or directory measurement
        !            40:        *
        !            41:        * @param is_dir                 TRUE if dir, FALSE if file
        !            42:        * @param id                             Primary key into directories or files table
        !            43:        * @return                               Absolute pathname as a text string
        !            44:        */
        !            45:        char* (*get_pathname)(pts_database_t *this, bool is_dir, int id);
        !            46: 
        !            47:        /**
        !            48:        * Get stored measurement hash for single file or directory entries
        !            49:        *
        !            50:        * @param pid                    Primary key of software product in database
        !            51:        * @param algo                   Hash algorithm used for measurement
        !            52:        * @param is_dir                 TRUE if directory was measured
        !            53:        * @param id                             Primary key of measured file/directory
        !            54:        * @return                               Enumerator over all matching measurement hashes
        !            55:        */
        !            56:        enumerator_t* (*create_file_hash_enumerator)(pts_database_t *this,
        !            57:                                                                int pid, pts_meas_algorithms_t algo,
        !            58:                                                                bool is_dir, int id);
        !            59: 
        !            60:        /**
        !            61:        * Add PTS file measurement reference value
        !            62:        *
        !            63:        * @param pid                    Primary key of platform product
        !            64:        * @param vid                    Primary key of generic product version
        !            65:        * @return                               TRUE if successful
        !            66:        */
        !            67:        bool (*get_product_version)(pts_database_t *this, int pid, int *vid);
        !            68: 
        !            69:        /**
        !            70:        * Add PTS file measurement reference value
        !            71:        *
        !            72:        * @param vid                    Primary key of generic product version
        !            73:        * @param algo                   File measurement hash algorithm used
        !            74:        * @param measurement    File measurement hash
        !            75:        * @param filename               Optional name of the file to be checked
        !            76:        * @param is_dir                 TRUE if part of directory measurement
        !            77:        * @param id                             Primary key into directories/files table
        !            78:        * @return                               TRUE if successful
        !            79:        */
        !            80:        bool (*add_file_measurement)(pts_database_t *this, int vid,
        !            81:                                                                 pts_meas_algorithms_t algo,
        !            82:                                                                 chunk_t measurement, char *filename,
        !            83:                                                                 bool is_dir, int id);
        !            84: 
        !            85:        /**
        !            86:        * Get PTS measurement[s] for a given filename stored in database
        !            87:        *
        !            88:        * @param pid                    Primary key of software product in database
        !            89:        * @param algo                   File measurement hash algorithm used
        !            90:        * @param filename               Name of the file to be checked
        !            91:        * @return                               Enumerator over all matching measurement hashes
        !            92:        */
        !            93:        enumerator_t* (*create_file_meas_enumerator)(pts_database_t *this, int pid,
        !            94:                                                                                                 pts_meas_algorithms_t algo,
        !            95:                                                                                                 char *filename);
        !            96: 
        !            97:        /**
        !            98:        * Check a functional component measurement against value stored in database
        !            99:        *
        !           100:        * @param measurement    measurement hash
        !           101:        * @param cid                    Primary key of Component Functional Name entry
        !           102:        * @param aik_id                 Primary key of AIK entry in database
        !           103:        * @param seq_no                 Measurement sequence number
        !           104:        * @param prc                    Number of the PCR the measurement was extended into
        !           105:        * @param algo                   Hash algorithm used for measurement
        !           106:        * @return                               SUCCESS if check was successful
        !           107:        */
        !           108:        status_t (*check_comp_measurement)(pts_database_t *this, chunk_t measurement,
        !           109:                                                                           int cid, int aik_id, int seq_no, int pcr,
        !           110:                                                                           pts_meas_algorithms_t algo);
        !           111: 
        !           112:        /**
        !           113:        * Insert a functional component measurement into the database
        !           114:        *
        !           115:        * @param measurement    Measurement hash
        !           116:        * @param cid                    Primary key of Component Functional Name entry
        !           117:        * @param aik_id                 Primary key of AIK entry in database
        !           118:        * @param seq_no                 Measurement sequence number
        !           119:        * @param prc                    Number of the PCR the measurement was extended into
        !           120:        * @param algo                   Hash algorithm used for measurement
        !           121:        * @return                               SUCCESS if INSERT was successful
        !           122:        */
        !           123:        status_t (*insert_comp_measurement)(pts_database_t *this, chunk_t measurement,
        !           124:                                                                                int cid, int aik_id, int seq_no, int pcr,
        !           125:                                                                                pts_meas_algorithms_t algo);
        !           126: 
        !           127:        /**
        !           128:        * Delete functional component measurements from the database
        !           129:        *
        !           130:        * @param cid                    Primary key of Component Functional Name entry
        !           131:        * @param aik_id                 Primary key of AIK entry in database
        !           132:        * @return                               number of deleted measurement entries
        !           133:        */
        !           134:        int (*delete_comp_measurements)(pts_database_t *this, int cid, int aik_id);
        !           135: 
        !           136:        /**
        !           137:        * Get the number of measurements for a functional component and AIK
        !           138:        *
        !           139:        * @param comp_name              Component Functional Name
        !           140:        * @param aik_id                 Primary key of AIK entry in database
        !           141:        * @param algo                   Hash algorithm used for measurement
        !           142:        * @param cid                    Primary key of Component Functional Name entry
        !           143:        * @param count                  measurement count
        !           144:        * @return                               SUCCESS if COUNT was successful
        !           145:        */
        !           146:        status_t (*get_comp_measurement_count)(pts_database_t *this,
        !           147:                                                        pts_comp_func_name_t *comp_name, int aik_id,
        !           148:                                                        pts_meas_algorithms_t algo, int *cid, int *count);
        !           149: 
        !           150:        /**
        !           151:        * Destroys a pts_database_t object.
        !           152:        */
        !           153:        void (*destroy)(pts_database_t *this);
        !           154: 
        !           155: };
        !           156: 
        !           157: /**
        !           158:  * Creates an pts_database_t object
        !           159:  *
        !           160:  * @param imv_db                       Already attached IMV database
        !           161:  */
        !           162: pts_database_t* pts_database_create(imv_database_t *imv_db);
        !           163: 
        !           164: #endif /** PTS_DATABASE_H_ @}*/

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