aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2013-10-09 19:03:07 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2013-10-09 19:03:07 +0200
commit3588299fb8a14c4b260c30fc4dd6419cb74a8159 (patch)
tree883517ce462f43189973df8e181a5e3e49967a54 /src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
parent3e3db3743e1c11200f58a91f2b6745364cb42c5c (diff)
downloadstrongswan-3588299fb8a14c4b260c30fc4dd6419cb74a8159.tar.bz2
strongswan-3588299fb8a14c4b260c30fc4dd6419cb74a8159.tar.xz
Keep a copy of the tnccs instance for PT-TLS handover
Diffstat (limited to 'src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c')
-rw-r--r--src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c b/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
index a52ffedbb..e08236eb7 100644
--- a/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
+++ b/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
@@ -61,6 +61,11 @@ struct private_tnccs_dynamic_t {
*/
tnccs_cb_t callback;
+ /**
+ * reference count
+ */
+ refcount_t ref;
+
};
/**
@@ -173,10 +178,13 @@ METHOD(tls_t, get_eap_msk, chunk_t,
METHOD(tls_t, destroy, void,
private_tnccs_dynamic_t *this)
{
- DESTROY_IF(this->tls);
- this->server->destroy(this->server);
- this->peer->destroy(this->peer);
- free(this);
+ if (ref_put(&this->ref))
+ {
+ DESTROY_IF(this->tls);
+ this->server->destroy(this->server);
+ this->peer->destroy(this->peer);
+ free(this);
+ }
}
METHOD(tnccs_t, get_transport, tnc_ift_type_t,
@@ -203,6 +211,21 @@ METHOD(tnccs_t, set_auth_type, void,
this->auth_type = auth_type;
}
+METHOD(tnccs_t, get_pdp_server, chunk_t,
+ private_tnccs_dynamic_t *this, u_int16_t *port)
+{
+ tnccs_t *tnccs = (tnccs_t*)this->tls;
+
+ return tnccs->get_pdp_server(tnccs, port);
+}
+
+METHOD(tnccs_t, get_ref, tnccs_t*,
+ private_tnccs_dynamic_t *this)
+{
+ ref_get(&this->ref);
+ return &this->public;
+}
+
/**
* See header
*/
@@ -230,11 +253,14 @@ tnccs_t* tnccs_dynamic_create(bool is_server,
.set_transport = _set_transport,
.get_auth_type = _get_auth_type,
.set_auth_type = _set_auth_type,
+ .get_pdp_server = _get_pdp_server,
+ .get_ref = _get_ref,
},
.server = server->clone(server),
.peer = peer->clone(peer),
.transport = transport,
.callback = cb,
+ .ref = 1,
);
return &this->public;