Replaced DH_NONCE state with TPM_INIT state
[strongswan.git] / src / libimcv / plugins / imv_attestation / imv_attestation_state.h
index 94307fd..45d382b 100644 (file)
@@ -23,6 +23,7 @@
 #define IMV_ATTESTATION_STATE_H_
 
 #include <imv/imv_state.h>
+#include <pts/pts.h>
 #include <library.h>
 
 typedef struct imv_attestation_state_t imv_attestation_state_t;
@@ -33,15 +34,10 @@ typedef enum imv_attestation_handshake_state_t imv_attestation_handshake_state_t
  */
 enum imv_attestation_handshake_state_t {
        IMV_ATTESTATION_STATE_INIT,
-       IMV_ATTESTATION_STATE_PROTO_CAP,
-       IMV_ATTESTATION_STATE_MEAS_ALGO,
-       IMV_ATTESTATION_STATE_TPM_INFO,
-       IMV_ATTESTATION_STATE_AIK,
-       IMV_ATTESTATION_STATE_SIMPLE_COMP_EVID,
-       IMV_ATTESTATION_STATE_SIMPLE_EVID_FINAL,
-       IMV_ATTESTATION_STATE_FILE_METADATA,
-       IMV_ATTESTATION_STATE_FILE_MEAS,
-       IMV_ATTESTATION_STATE_IML,
+       IMV_ATTESTATION_STATE_TPM_INIT,
+       IMV_ATTESTATION_STATE_MEAS,
+       IMV_ATTESTATION_STATE_COMP_EVID,
+       IMV_ATTESTATION_STATE_END,
 };
 
 /**
@@ -55,24 +51,61 @@ struct imv_attestation_state_t {
        imv_state_t interface;
 
        /**
-        * get state of the handshake
+        * Get state of the handshake
         *
-        * @return                              the handshake state of IMV
+        * @return                                      the handshake state of IMV
         */
        imv_attestation_handshake_state_t (*get_handshake_state)(imv_attestation_state_t *this);
        
        /**
-        * get state of the handshake
+        * Set state of the handshake
         *
         * @param new_state                     the handshake state of IMV
         */
-       void (*set_handshake_state)(imv_attestation_state_t *this, imv_attestation_handshake_state_t new_state);
+       void (*set_handshake_state)(imv_attestation_state_t *this,
+                                                               imv_attestation_handshake_state_t new_state);
+
+       /**
+        * Get the PTS object
+        *
+        * @return                                      PTS object
+        */
+       pts_t* (*get_pts)(imv_attestation_state_t *this);
+
+       /**
+        * Add an entry to the list of pending file/directory measurement requests
+        *
+        * @param file_id                       primary key into file table
+        * @param is_dir                        TRUE if directory
+        * @return                                      unique request ID
+        */
+       u_int16_t (*add_request)(imv_attestation_state_t *this, int file_id,
+                                                        bool is_dir);
+
+       /**
+        * Returns the number of pending file/directory measurement requests
+        *
+        * @return                                      number of pending requests
+        */
+       int (*get_request_count)(imv_attestation_state_t *this);
+
+       /**
+        * Check for presence of request_id and if found remove it from the list
+        *
+        * @param id                            unique request ID
+        * @param file_id                       primary key into file table
+        * @param is_dir                        return TRUE if request was for a directory
+        * @return                                      TRUE if request ID found, FALSE otherwise
+        */
+       bool (*check_off_request)(imv_attestation_state_t *this, u_int16_t id,
+                                                         int *file_id, bool *is_dir);
+
 };
 
 /**
  * Create an imv_attestation_state_t instance
  *
- * @param id           connection ID
+ * @param id                                   connection ID
  */
 imv_state_t* imv_attestation_state_create(TNC_ConnectionID id);