improved performance of database access by caching primary keys
[strongswan.git] / src / libpts / pts / pts_database.h
index dd87a5b..a9f5fa4 100644 (file)
@@ -77,41 +77,40 @@ struct pts_database_t {
        * Check a functional component measurement against value stored in database
        *
        * @param measurement    measurement hash
-       * @param comp_name              Component Functional Name
-       * @param keyid                  SHA-1 hash of AIK public key info
+       * @param cid                    Primary key of Component Functional Name entry
+       * @param kid                    Primary key of AIK entry in keys table
        * @param seq_no                 Measurement sequence number
        * @param prc                    Number of the PCR the measurement was extended into
        * @param algo                   Hash algorithm used for measurement
        * @return                               SUCCESS if check was successful
        */
        status_t (*check_comp_measurement)(pts_database_t *this, chunk_t measurement,
-                                                       pts_comp_func_name_t *comp_name, chunk_t keyid,
-                                                       int seq_no, int pcr, pts_meas_algorithms_t algo);
+                                                                          int cid, int kid, int seq_no, int pcr,
+                                                                          pts_meas_algorithms_t algo);
 
        /**
        * Insert a functional component measurement into the database
        *
-       * @param measurement    measurement hash
-       * @param comp_name              Component Functional Name
-       * @param keyid                  SHA-1 hash of AIK public key info
+       * @param measurement    Measurement hash
+       * @param cid                    Primary key of Component Functional Name entry
+       * @param kid                    Primary key of AIK entry in keys table
        * @param seq_no                 Measurement sequence number
        * @param prc                    Number of the PCR the measurement was extended into
        * @param algo                   Hash algorithm used for measurement
        * @return                               SUCCESS if INSERT was successful
        */
        status_t (*insert_comp_measurement)(pts_database_t *this, chunk_t measurement,
-                                                       pts_comp_func_name_t *comp_name, chunk_t keyid,
-                                                       int seq_no, int pcr, pts_meas_algorithms_t algo);
+                                                                               int cid, int kid, int seq_no, int pcr,
+                                                                               pts_meas_algorithms_t algo);
 
        /**
        * Delete functional component measurements from the database
        *
-       * @param comp_name              Component Functional Name
-       * @param keyid                  SHA-1 hash of AIK public key info
+       * @param cid                    Primary key of Component Functional Name entry
+       * @param kid                    Primary key of AIK entry in keys table
        * @return                               number of deleted measurement entries
        */
-       int (*delete_comp_measurements)(pts_database_t *this,
-                                                       pts_comp_func_name_t *comp_name, chunk_t keyid);
+       int (*delete_comp_measurements)(pts_database_t *this, int cid, int kid);
 
        /**
        * Get the number of measurements for a functional component and AIK
@@ -119,12 +118,15 @@ struct pts_database_t {
        * @param comp_name              Component Functional Name
        * @param keyid                  SHA-1 hash of AIK public key info
        * @param algo                   Hash algorithm used for measurement
+       * @param cid                    Primary key of Component Functional Name entry
+       * @param kid                    Primary key of AIK entry in keys table
        * @param count                  measurement count
        * @return                               SUCCESS if COUNT was successful
        */
        status_t (*get_comp_measurement_count)(pts_database_t *this,
                                                        pts_comp_func_name_t *comp_name, chunk_t keyid,
-                                                       pts_meas_algorithms_t algo, int *count);
+                                                       pts_meas_algorithms_t algo, int *cid, int *kid,
+                                                       int *count);
 
        /**
        * Destroys a pts_database_t object.