*/
identification_t *server;
+ /**
+ * Peer identity
+ */
+ identification_t *peer;
+
/**
* TNCCS protocol handler constructor
*/
- tnccs_t*(*create)();
+ pt_tls_tnccs_constructor_t *create;
};
/**
}
METHOD(pt_tls_dispatcher_t, dispatch, void,
- private_pt_tls_dispatcher_t *this, tnccs_t*(*create)())
+ private_pt_tls_dispatcher_t *this,
+ pt_tls_tnccs_constructor_t *create)
{
while (TRUE)
{
continue;
}
- tnccs = create();
+ tnccs = create(this->server, this->peer);
if (!tnccs)
{
close(fd);
close(this->fd);
}
this->server->destroy(this->server);
+ this->peer->destroy(this->peer);
free(this);
}
.destroy = _destroy,
},
.server = id,
+ /* we currently don't authenticate the peer, use %any identity */
+ .peer = identification_create_from_encoding(ID_ANY, chunk_empty),
.fd = -1,
);
typedef struct pt_tls_dispatcher_t pt_tls_dispatcher_t;
+/**
+ * Constructor callback to create TNCCS to use within PT-TLS.
+ *
+ * @param server server identity
+ * @param peer peer identity
+ */
+typedef tnccs_t* (pt_tls_tnccs_constructor_t)(identification_t *server,
+ identification_t *peer);
+
/**
* PT-TLS dispatcher service, handles PT-TLS connections as a server.
*/
*
* @param create TNCCS constructor function to use
*/
- void (*dispatch)(pt_tls_dispatcher_t *this, tnccs_t*(*create)());
+ void (*dispatch)(pt_tls_dispatcher_t *this,
+ pt_tls_tnccs_constructor_t *create);
/**
* Destroy a pt_tls_dispatcher_t.