aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
diff options
context:
space:
mode:
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;