Added add_segment() method to IETF attributes
[strongswan.git] / src / libimcv / plugins / imc_os / imc_os_state.c
index f49959a..139ab05 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2012 Andreas Steffen
+ * Copyright (C) 2012-2014 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -60,6 +60,11 @@ struct private_imc_os_state_t {
         * Maximum PA-TNC message size for this TNCCS connection
         */
        u_int32_t max_msg_len;
         * Maximum PA-TNC message size for this TNCCS connection
         */
        u_int32_t max_msg_len;
+
+       /**
+        * PA-TNC attribute segmentation contracts associated with TNCCS connection
+        */
+       seg_contract_manager_t *contracts;
 };
 
 METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
 };
 
 METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
@@ -99,6 +104,12 @@ METHOD(imc_state_t, get_max_msg_len, u_int32_t,
        return this->max_msg_len;
 }
 
        return this->max_msg_len;
 }
 
+METHOD(imc_state_t, get_contracts, seg_contract_manager_t*,
+       private_imc_os_state_t *this)
+{
+       return this->contracts;
+}
+
 METHOD(imc_state_t, change_state, void,
        private_imc_os_state_t *this, TNC_ConnectionState new_state)
 {
 METHOD(imc_state_t, change_state, void,
        private_imc_os_state_t *this, TNC_ConnectionState new_state)
 {
@@ -126,6 +137,7 @@ METHOD(imc_state_t, get_result, bool,
 METHOD(imc_state_t, destroy, void,
        private_imc_os_state_t *this)
 {
 METHOD(imc_state_t, destroy, void,
        private_imc_os_state_t *this)
 {
+       this->contracts->destroy(this->contracts);
        free(this);
 }
 
        free(this);
 }
 
@@ -145,6 +157,7 @@ imc_state_t *imc_os_state_create(TNC_ConnectionID connection_id)
                                .set_flags = _set_flags,
                                .set_max_msg_len = _set_max_msg_len,
                                .get_max_msg_len = _get_max_msg_len,
                                .set_flags = _set_flags,
                                .set_max_msg_len = _set_max_msg_len,
                                .get_max_msg_len = _get_max_msg_len,
+                               .get_contracts = _get_contracts,
                                .change_state = _change_state,
                                .set_result = _set_result,
                                .get_result = _get_result,
                                .change_state = _change_state,
                                .set_result = _set_result,
                                .get_result = _get_result,
@@ -154,6 +167,7 @@ imc_state_t *imc_os_state_create(TNC_ConnectionID connection_id)
                .state = TNC_CONNECTION_STATE_CREATE,
                .result = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
                .connection_id = connection_id,
                .state = TNC_CONNECTION_STATE_CREATE,
                .result = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
                .connection_id = connection_id,
+               .contracts = seg_contract_manager_create(),
        );
 
        return &this->public.interface;
        );
 
        return &this->public.interface;