Annotation of embedaddon/strongswan/src/libimcv/pts/pts_file_meas.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2011 Sansar Choinyambuu
                      3:  * Copyright (C) 2014 Andreas Steffen
                      4:  * HSR Hochschule fuer Technik Rapperswil
                      5:  *
                      6:  * This program is free software; you can redistribute it and/or modify it
                      7:  * under the terms of the GNU General Public License as published by the
                      8:  * Free Software Foundation; either version 2 of the License, or (at your
                      9:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                     10:  *
                     11:  * This program is distributed in the hope that it will be useful, but
                     12:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     13:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     14:  * for more details.
                     15:  */
                     16: 
                     17: /**
                     18:  * @defgroup pts_file_meas pts_file_meas
                     19:  * @{ @ingroup pts
                     20:  */
                     21: 
                     22: #ifndef PTS_FILE_MEAS_H_
                     23: #define PTS_FILE_MEAS_H_
                     24: 
                     25: #include "pts/pts_database.h"
                     26: 
                     27: #include <library.h>
                     28: 
                     29: typedef struct pts_file_meas_t pts_file_meas_t;
                     30: 
                     31: /**
                     32:  * Class storing PTS File Measurements
                     33:  */
                     34: struct pts_file_meas_t {
                     35: 
                     36:        /**
                     37:         * Get the ID of the PTS File Measurement Request
                     38:         *
                     39:         * @return                              ID of PTS File Measurement Request
                     40:         */
                     41:        uint16_t (*get_request_id)(pts_file_meas_t *this);
                     42: 
                     43:        /**
                     44:         * Get the number of measured files
                     45:         *
                     46:         * @return                              Number of measured files
                     47:         */
                     48:        int (*get_file_count)(pts_file_meas_t *this);
                     49: 
                     50:        /**
                     51:         * Add a PTS File Measurement
                     52:         *
                     53:         * @param filename              Name of measured file or directory
                     54:         * @param measurement   PTS Measurement hash
                     55:         */
                     56:        void (*add)(pts_file_meas_t *this, char *filename, chunk_t measurement);
                     57: 
                     58:        /**
                     59:          * Create a PTS File Measurement enumerator
                     60:          *
                     61:          * @return                             Enumerator returning filename and measurement
                     62:          */
                     63:        enumerator_t* (*create_enumerator)(pts_file_meas_t *this);
                     64: 
                     65:        /**
                     66:         * Check PTS File Measurements against reference value in the database
                     67:         *
                     68:         * @param db                    PTS Measurement database
                     69:         * @param pid                   Primary key of software product in database
                     70:         * @param algo                  PTS Measurement algorithm used
                     71:         * @return                              TRUE if all measurements agreed
                     72:         */
                     73:        bool (*check)(pts_file_meas_t *this, pts_database_t *db, int pid,
                     74:                                  pts_meas_algorithms_t algo);
                     75: 
                     76:        /**
                     77:         * Verify stored hashes against PTS File Measurements
                     78:         *
                     79:         * @param e_hash                Hash enumerator
                     80:         * @param is_dir                TRUE for directory contents hashes
                     81:         * @return                              TRUE if all hashes match a measurement
                     82:         */
                     83:        bool (*verify)(pts_file_meas_t *this, enumerator_t *e_hash, bool is_dir);
                     84: 
                     85:        /**
                     86:         * Destroys a pts_file_meas_t object.
                     87:         */
                     88:        void (*destroy)(pts_file_meas_t *this);
                     89: 
                     90: };
                     91: 
                     92: /**
                     93:  * Creates a pts_file_meas_t object
                     94:  *
                     95:  * @param request_id           ID of PTS File Measurement Request
                     96:  */
                     97: pts_file_meas_t* pts_file_meas_create(uint16_t request_id);
                     98: 
                     99: /**
                    100:  * Creates a pts_file_meas_t object measuring a file/directory
                    101:  *
                    102:  * @param request_id           ID of PTS File Measurement Request
                    103:  * @param pathname                     Absolute file or directory pathname
                    104:  * @param is_dir                       TRUE if directory path
                    105:  * @param use_rel_name         TRUE if relative filenames are to be used
                    106:  * @param alg                          PTS hash measurement algorithm to be used
                    107:  */
                    108: pts_file_meas_t* pts_file_meas_create_from_path(uint16_t request_id,
                    109:                                                        char* pathname, bool is_dir, bool use_rel_name,
                    110:                                                        pts_meas_algorithms_t alg);
                    111: 
                    112: #endif /** PTS_FILE_MEAS_H_ @}*/

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