Make IKE/EAP IDs available to TNC server/client
This commit is contained in:
parent
98063d8187
commit
ebb87f08f7
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2012 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -172,7 +172,8 @@ static eap_tnc_t *eap_tnc_create(identification_t *server,
|
|||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
tnccs = tnc->tnccs->create_instance(tnc->tnccs, type, is_server);
|
||||
tnccs = tnc->tnccs->create_instance(tnc->tnccs, type, is_server,
|
||||
server, peer);
|
||||
this->tls_eap = tls_eap_create(EAP_TNC, (tls_t*)tnccs,
|
||||
EAP_TNC_MAX_MESSAGE_LEN,
|
||||
max_msg_count, FALSE);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2012 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -158,7 +158,8 @@ METHOD(tnccs_manager_t, remove_method, void,
|
|||
}
|
||||
|
||||
METHOD(tnccs_manager_t, create_instance, tnccs_t*,
|
||||
private_tnc_tnccs_manager_t *this, tnccs_type_t type, bool is_server)
|
||||
private_tnc_tnccs_manager_t *this, tnccs_type_t type, bool is_server,
|
||||
identification_t *server, identification_t *peer)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
tnccs_entry_t *entry;
|
||||
|
@ -170,7 +171,7 @@ METHOD(tnccs_manager_t, create_instance, tnccs_t*,
|
|||
{
|
||||
if (type == entry->type)
|
||||
{
|
||||
protocol = entry->constructor(is_server);
|
||||
protocol = entry->constructor(is_server, server, peer);
|
||||
if (protocol)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2012 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -52,6 +52,16 @@ struct private_tnccs_11_t {
|
|||
*/
|
||||
bool is_server;
|
||||
|
||||
/**
|
||||
* Server identity
|
||||
*/
|
||||
identification_t *server;
|
||||
|
||||
/**
|
||||
* Client identity
|
||||
*/
|
||||
identification_t *peer;
|
||||
|
||||
/**
|
||||
* Connection ID assigned to this TNCCS connection
|
||||
*/
|
||||
|
@ -528,6 +538,8 @@ METHOD(tls_t, destroy, void,
|
|||
{
|
||||
tnc->tnccs->remove_connection(tnc->tnccs, this->connection_id,
|
||||
this->is_server);
|
||||
this->server->destroy(this->server);
|
||||
this->peer->destroy(this->peer);
|
||||
this->mutex->destroy(this->mutex);
|
||||
DESTROY_IF(this->batch);
|
||||
free(this);
|
||||
|
@ -536,7 +548,8 @@ METHOD(tls_t, destroy, void,
|
|||
/**
|
||||
* See header
|
||||
*/
|
||||
tls_t *tnccs_11_create(bool is_server)
|
||||
tls_t *tnccs_11_create(bool is_server, identification_t *server,
|
||||
identification_t *peer)
|
||||
{
|
||||
private_tnccs_11_t *this;
|
||||
|
||||
|
@ -551,6 +564,8 @@ tls_t *tnccs_11_create(bool is_server)
|
|||
.destroy = _destroy,
|
||||
},
|
||||
.is_server = is_server,
|
||||
.server = server->clone(server),
|
||||
.peer = peer->clone(peer),
|
||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||
.max_msg_len = lib->settings->get_int(lib->settings,
|
||||
"%s.plugins.tnccs-11.max_message_size", 45000,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,9 +28,12 @@
|
|||
/**
|
||||
* Create an instance of the TNC IF-TNCCS 1.1 protocol handler.
|
||||
*
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @return TNC_IF_TNCCS 1.1 protocol stack
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @param server Server identity
|
||||
* @param peer Client identity
|
||||
* @return TNC_IF_TNCCS 1.1 protocol stack
|
||||
*/
|
||||
tls_t *tnccs_11_create(bool is_server);
|
||||
tls_t *tnccs_11_create(bool is_server, identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
#endif /** TNCCS_11_H_ @}*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Sansar Choinyanbuu
|
||||
* Copyright (C) 2010-2012 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -57,6 +57,16 @@ struct private_tnccs_20_t {
|
|||
*/
|
||||
bool is_server;
|
||||
|
||||
/**
|
||||
* Server identity
|
||||
*/
|
||||
identification_t *server;
|
||||
|
||||
/**
|
||||
* Client identity
|
||||
*/
|
||||
identification_t *peer;
|
||||
|
||||
/**
|
||||
* PB-TNC State Machine
|
||||
*/
|
||||
|
@ -792,6 +802,8 @@ METHOD(tls_t, destroy, void,
|
|||
{
|
||||
tnc->tnccs->remove_connection(tnc->tnccs, this->connection_id,
|
||||
this->is_server);
|
||||
this->server->destroy(this->server);
|
||||
this->peer->destroy(this->peer);
|
||||
this->state_machine->destroy(this->state_machine);
|
||||
this->mutex->destroy(this->mutex);
|
||||
this->messages->destroy_offset(this->messages,
|
||||
|
@ -802,7 +814,8 @@ METHOD(tls_t, destroy, void,
|
|||
/**
|
||||
* See header
|
||||
*/
|
||||
tls_t *tnccs_20_create(bool is_server)
|
||||
tls_t *tnccs_20_create(bool is_server, identification_t *server,
|
||||
identification_t *peer)
|
||||
{
|
||||
private_tnccs_20_t *this;
|
||||
|
||||
|
@ -817,6 +830,8 @@ tls_t *tnccs_20_create(bool is_server)
|
|||
.destroy = _destroy,
|
||||
},
|
||||
.is_server = is_server,
|
||||
.server = server->clone(server),
|
||||
.peer = peer->clone(peer),
|
||||
.state_machine = pb_tnc_state_machine_create(is_server),
|
||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||
.messages = linked_list_create(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,9 +28,12 @@
|
|||
/**
|
||||
* Create an instance of the TNC IF-TNCCS 2.0 protocol handler.
|
||||
*
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @return TNC_IF_TNCCS 2.0 protocol stack
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @param server Server identity
|
||||
* @param peer Client identity
|
||||
* @return TNC_IF_TNCCS 2.0 protocol stack
|
||||
*/
|
||||
tls_t *tnccs_20_create(bool is_server);
|
||||
tls_t *tnccs_20_create(bool is_server, identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
#endif /** TNCCS_20_H_ @}*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Andreas Steffen
|
||||
* Copyright (C) 2011-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -31,6 +31,16 @@ struct private_tnccs_dynamic_t {
|
|||
*/
|
||||
tls_t public;
|
||||
|
||||
/**
|
||||
* Server identity
|
||||
*/
|
||||
identification_t *server;
|
||||
|
||||
/**
|
||||
* Client identity
|
||||
*/
|
||||
identification_t *peer;
|
||||
|
||||
/**
|
||||
* Detected TNC IF-TNCCS stack
|
||||
*/
|
||||
|
@ -76,7 +86,8 @@ METHOD(tls_t, process, status_t,
|
|||
type = determine_tnccs_protocol(*(char*)buf);
|
||||
DBG1(DBG_TNC, "%N protocol detected dynamically",
|
||||
tnccs_type_names, type);
|
||||
this->tls = (tls_t*)tnc->tnccs->create_instance(tnc->tnccs, type, TRUE);
|
||||
this->tls = (tls_t*)tnc->tnccs->create_instance(tnc->tnccs, type, TRUE,
|
||||
this->server, this->peer);
|
||||
if (!this->tls)
|
||||
{
|
||||
DBG1(DBG_TNC, "N% protocol not supported", tnccs_type_names, type);
|
||||
|
@ -120,13 +131,16 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* See header
|
||||
*/
|
||||
tls_t *tnccs_dynamic_create(bool is_server)
|
||||
tls_t *tnccs_dynamic_create(bool is_server, identification_t *server,
|
||||
identification_t *peer)
|
||||
{
|
||||
private_tnccs_dynamic_t *this;
|
||||
|
||||
|
@ -140,6 +154,8 @@ tls_t *tnccs_dynamic_create(bool is_server)
|
|||
.get_eap_msk = _get_eap_msk,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.server = server->clone(server),
|
||||
.peer = peer->clone(peer),
|
||||
);
|
||||
|
||||
return &this->public;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Andreas Steffen
|
||||
* Copyright (C) 2011-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,9 +28,12 @@
|
|||
/**
|
||||
* Create an instance of a dynamic TNC IF-TNCCS protocol handler.
|
||||
*
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @return dynamic TNC IF-TNCCS protocol stack
|
||||
* @param is_server TRUE to act as TNC Server, FALSE for TNC Client
|
||||
* @param server Server identity
|
||||
* @param peer Client identity
|
||||
* @return dynamic TNC IF-TNCCS protocol stack
|
||||
*/
|
||||
tls_t *tnccs_dynamic_create(bool is_server);
|
||||
tls_t *tnccs_dynamic_create(bool is_server, identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
#endif /** TNCCS_DYNAMIC_H_ @}*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2011 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -54,9 +54,13 @@ extern enum_name_t *tnccs_type_names;
|
|||
* Constructor definition for a pluggable TNCCS protocol implementation.
|
||||
*
|
||||
* @param is_server TRUE if TNC Server, FALSE if TNC Client
|
||||
* @param server Server identity
|
||||
* @param peer Client identity
|
||||
* @return implementation of the tnccs_t interface
|
||||
*/
|
||||
typedef tnccs_t *(*tnccs_constructor_t)(bool is_server);
|
||||
typedef tnccs_t *(*tnccs_constructor_t)(bool is_server,
|
||||
identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
/**
|
||||
* Callback function adding a message to a TNCCS batch
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Andreas Steffen
|
||||
* Copyright (C) 2010-2013 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -56,10 +56,13 @@ struct tnccs_manager_t {
|
|||
*
|
||||
* @param type type of the TNCCS protocol
|
||||
* @param is_server TRUE if TNC Server, FALSE if TNC Client
|
||||
* @param server Server identity
|
||||
* @param peer Client identity
|
||||
* @return TNCCS protocol instance, NULL if no constructor found
|
||||
*/
|
||||
tnccs_t* (*create_instance)(tnccs_manager_t *this, tnccs_type_t type,
|
||||
bool is_server);
|
||||
bool is_server, identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
/**
|
||||
* Create a TNCCS connection and assign a unique connection ID as well a
|
||||
|
|
Loading…
Reference in New Issue