From: Andreas Steffen Date: Fri, 9 Dec 2011 10:25:53 +0000 (+0100) Subject: store the long and excl flags in the connection state X-Git-Tag: 4.6.2~123 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4e291d49963c41437cfc8d9ad8ccf46e263cbd2;p=thirdparty%2Fstrongswan.git store the long and excl flags in the connection state --- diff --git a/src/libimcv/imc/imc_agent.c b/src/libimcv/imc/imc_agent.c index d1d4073feb..a39b4b7ccf 100644 --- a/src/libimcv/imc/imc_agent.c +++ b/src/libimcv/imc/imc_agent.c @@ -309,6 +309,8 @@ METHOD(imc_agent_t, create_state, TNC_Result, t_p = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_PROTOCOL); t_v = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_VERSION); + state->set_flags(state, has_long, has_excl); + DBG2(DBG_IMC, "IMC %u \"%s\" created a state for Connection ID %u: " "%s %s with %slong %sexcl %ssoh over %s %s", this->id, this->name, conn_id, tnccs_p ? tnccs_p:"?", diff --git a/src/libimcv/imc/imc_state.h b/src/libimcv/imc/imc_state.h index 73013f8ce0..f1b0358c9b 100644 --- a/src/libimcv/imc/imc_state.h +++ b/src/libimcv/imc/imc_state.h @@ -33,12 +33,36 @@ typedef struct imc_state_t imc_state_t; struct imc_state_t { /** - * Get the TNCS connection ID attached to the state + * Get the TNCS connection I +D attached to the state * * @return TNCS connection ID of the state */ TNC_ConnectionID (*get_connection_id)(imc_state_t *this); + /** + * Checks if long message types are supported for this TNCCS connection + * + * @return TRUE if set, FALSE otherwise + */ + bool (*has_long)(imc_state_t *this); + + /** + * Checks if the exclusive delivery is supported for this TNCCS connection + * + * @return TRUE if set, FALSE otherwise + */ + bool (*has_excl)(imc_state_t *this); + + /** + * Sets the long message types and exclusive flags for this TNCCS connection + * + * @param has_long TNCCS connection supports long message types + * @param has_excl TNCCS connection supports exclusive delivery + * @return TRUE if set, FALSE otherwise + */ + void (*set_flags)(imc_state_t *this, bool has_long, bool has_excl); + /** * Change the connection state * diff --git a/src/libimcv/imv/imv_agent.c b/src/libimcv/imv/imv_agent.c index 503b80346f..f7ec0e674c 100644 --- a/src/libimcv/imv/imv_agent.c +++ b/src/libimcv/imv/imv_agent.c @@ -328,6 +328,8 @@ METHOD(imv_agent_t, create_state, TNC_Result, t_p = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_PROTOCOL); t_v = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_VERSION); + state->set_flags(state, has_long, has_excl); + DBG2(DBG_IMV, "IMV %u \"%s\" created a state for Connection ID %u: " "%s %s with %slong %sexcl %ssoh over %s %s", this->id, this->name, conn_id, tnccs_p ? tnccs_p:"?", diff --git a/src/libimcv/imv/imv_state.h b/src/libimcv/imv/imv_state.h index 26d07bb021..9e7a29a9fe 100644 --- a/src/libimcv/imv/imv_state.h +++ b/src/libimcv/imv/imv_state.h @@ -39,6 +39,29 @@ struct imv_state_t { */ TNC_ConnectionID (*get_connection_id)(imv_state_t *this); + /** + * Checks if long message types are supported for this TNCCS connection + * + * @return TRUE if set, FALSE otherwise + */ + bool (*has_long)(imv_state_t *this); + + /** + * Checks if the exclusive delivery is supported for this TNCCS connection + * + * @return TRUE if set, FALSE otherwise + */ + bool (*has_excl)(imv_state_t *this); + + /** + * Sets the long message types and exclusive flags for this TNCCS connection + * + * @param has_long TNCCS connection supports long message types + * @param has_excl TNCCS connection supports exclusive delivery + * @return TRUE if set, FALSE otherwise + */ + void (*set_flags)(imv_state_t *this, bool has_long, bool has_excl); + /** * Change the connection state * diff --git a/src/libimcv/plugins/imc_scanner/imc_scanner_state.c b/src/libimcv/plugins/imc_scanner/imc_scanner_state.c index dce7bca135..5631055484 100644 --- a/src/libimcv/plugins/imc_scanner/imc_scanner_state.c +++ b/src/libimcv/plugins/imc_scanner/imc_scanner_state.c @@ -37,6 +37,17 @@ struct private_imc_scanner_state_t { * TNCCS connection state */ TNC_ConnectionState state; + + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + }; METHOD(imc_state_t, get_connection_id, TNC_ConnectionID, @@ -45,6 +56,25 @@ METHOD(imc_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imc_state_t, has_long, bool, + private_imc_scanner_state_t *this) +{ + return this->has_long; +} + +METHOD(imc_state_t, has_excl, bool, + private_imc_scanner_state_t *this) +{ + return this->has_excl; +} + +METHOD(imc_state_t, set_flags, void, + private_imc_scanner_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imc_state_t, change_state, void, private_imc_scanner_state_t *this, TNC_ConnectionState new_state) { @@ -68,6 +98,9 @@ imc_state_t *imc_scanner_state_create(TNC_ConnectionID connection_id) .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .destroy = _destroy, }, diff --git a/src/libimcv/plugins/imc_test/imc_test_state.c b/src/libimcv/plugins/imc_test/imc_test_state.c index cc7e18a4dc..d0cae883fe 100644 --- a/src/libimcv/plugins/imc_test/imc_test_state.c +++ b/src/libimcv/plugins/imc_test/imc_test_state.c @@ -38,6 +38,16 @@ struct private_imc_test_state_t { */ TNC_ConnectionState state; + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + /** * Command to transmit to IMV */ @@ -60,6 +70,25 @@ METHOD(imc_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imc_state_t, has_long, bool, + private_imc_test_state_t *this) +{ + return this->has_long; +} + +METHOD(imc_state_t, has_excl, bool, + private_imc_test_state_t *this) +{ + return this->has_excl; +} + +METHOD(imc_state_t, set_flags, void, + private_imc_test_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imc_state_t, change_state, void, private_imc_test_state_t *this, TNC_ConnectionState new_state) { @@ -123,6 +152,9 @@ imc_state_t *imc_test_state_create(TNC_ConnectionID connection_id, .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .destroy = _destroy, }, diff --git a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c index a9b048bcb6..422cb980d2 100644 --- a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c +++ b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c @@ -39,6 +39,16 @@ struct private_imv_scanner_state_t { */ TNC_ConnectionState state; + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + /** * IMV action recommendation */ @@ -86,6 +96,25 @@ METHOD(imv_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imv_state_t, has_long, bool, + private_imv_scanner_state_t *this) +{ + return this->has_long; +} + +METHOD(imv_state_t, has_excl, bool, + private_imv_scanner_state_t *this) +{ + return this->has_excl; +} + +METHOD(imv_state_t, set_flags, void, + private_imv_scanner_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imv_state_t, change_state, void, private_imv_scanner_state_t *this, TNC_ConnectionState new_state) { @@ -191,6 +220,9 @@ imv_state_t *imv_scanner_state_create(TNC_ConnectionID connection_id) .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .get_recommendation = _get_recommendation, .set_recommendation = _set_recommendation, diff --git a/src/libimcv/plugins/imv_test/imv_test_state.c b/src/libimcv/plugins/imv_test/imv_test_state.c index 930da93e4e..9df117a270 100644 --- a/src/libimcv/plugins/imv_test/imv_test_state.c +++ b/src/libimcv/plugins/imv_test/imv_test_state.c @@ -39,6 +39,16 @@ struct private_imv_test_state_t { */ TNC_ConnectionState state; + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + /** * IMV action recommendation */ @@ -82,6 +92,25 @@ METHOD(imv_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imv_state_t, has_long, bool, + private_imv_test_state_t *this) +{ + return this->has_long; +} + +METHOD(imv_state_t, has_excl, bool, + private_imv_test_state_t *this) +{ + return this->has_excl; +} + +METHOD(imv_state_t, set_flags, void, + private_imv_test_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imv_state_t, change_state, void, private_imv_test_state_t *this, TNC_ConnectionState new_state) { @@ -177,6 +206,9 @@ imv_state_t *imv_test_state_create(TNC_ConnectionID connection_id) .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .get_recommendation = _get_recommendation, .set_recommendation = _set_recommendation, diff --git a/src/libpts/plugins/imc_attestation/imc_attestation_state.c b/src/libpts/plugins/imc_attestation/imc_attestation_state.c index d900224a0c..72a55f60ea 100644 --- a/src/libpts/plugins/imc_attestation/imc_attestation_state.c +++ b/src/libpts/plugins/imc_attestation/imc_attestation_state.c @@ -40,6 +40,16 @@ struct private_imc_attestation_state_t { */ TNC_ConnectionState state; + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + /** * PTS object */ @@ -58,6 +68,25 @@ METHOD(imc_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imc_state_t, has_long, bool, + private_imc_attestation_state_t *this) +{ + return this->has_long; +} + +METHOD(imc_state_t, has_excl, bool, + private_imc_attestation_state_t *this) +{ + return this->has_excl; +} + +METHOD(imc_state_t, set_flags, void, + private_imc_attestation_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imc_state_t, change_state, void, private_imc_attestation_state_t *this, TNC_ConnectionState new_state) { @@ -103,6 +132,9 @@ imc_state_t *imc_attestation_state_create(TNC_ConnectionID connection_id) .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .destroy = _destroy, }, diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.c b/src/libpts/plugins/imv_attestation/imv_attestation_state.c index d2e5211ffd..a58fd3ec31 100644 --- a/src/libpts/plugins/imv_attestation/imv_attestation_state.c +++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.c @@ -51,6 +51,16 @@ struct private_imv_attestation_state_t { */ TNC_ConnectionState state; + /** + * Does the TNCCS connection support long message types? + */ + bool has_long; + + /** + * Does the TNCCS connection support exclusive delivery? + */ + bool has_excl; + /** * IMV Attestation handshake state */ @@ -121,6 +131,25 @@ METHOD(imv_state_t, get_connection_id, TNC_ConnectionID, return this->connection_id; } +METHOD(imv_state_t, has_long, bool, + private_imv_attestation_state_t *this) +{ + return this->has_long; +} + +METHOD(imv_state_t, has_excl, bool, + private_imv_attestation_state_t *this) +{ + return this->has_excl; +} + +METHOD(imv_state_t, set_flags, void, + private_imv_attestation_state_t *this, bool has_long, bool has_excl) +{ + this->has_long = has_long; + this->has_excl = has_excl; +} + METHOD(imv_state_t, change_state, void, private_imv_attestation_state_t *this, TNC_ConnectionState new_state) { @@ -335,6 +364,9 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id) .public = { .interface = { .get_connection_id = _get_connection_id, + .has_long = _has_long, + .has_excl = _has_excl, + .set_flags = _set_flags, .change_state = _change_state, .get_recommendation = _get_recommendation, .set_recommendation = _set_recommendation,