diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-09-30 23:34:00 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-09-30 23:34:00 +0200 |
commit | a00a43e0f69eed46900c72c85b12b7fcbf84c0d6 (patch) | |
tree | f5fc04d6f8d316b7ff2600bc73255861f5b54a98 /src | |
parent | cae4668ffb748da1105fe1cb7c81ea0c62ba6c3a (diff) | |
download | strongswan-a00a43e0f69eed46900c72c85b12b7fcbf84c0d6.tar.bz2 strongswan-a00a43e0f69eed46900c72c85b12b7fcbf84c0d6.tar.xz |
print XML as plaintext and process recieved TNCCS Batch
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/tnccs_11/tnccs_11.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/libcharon/plugins/tnccs_11/tnccs_11.c b/src/libcharon/plugins/tnccs_11/tnccs_11.c index ea5be8591..22b933bf6 100644 --- a/src/libcharon/plugins/tnccs_11/tnccs_11.c +++ b/src/libcharon/plugins/tnccs_11/tnccs_11.c @@ -60,17 +60,26 @@ struct private_tnccs_11_t { METHOD(tls_t, process, status_t, private_tnccs_11_t *this, void *buf, size_t buflen) { - chunk_t in = { buf, buflen }; - /* TODO */ - DBG1(DBG_IKE, "received TNCCS-Batch: %B", &in); + DBG1(DBG_IKE, "received TNCCS Batch with %u bytes:", buflen); + DBG1(DBG_IKE, "%.*s", buflen, buf); + + if (!this->is_server) + { + if (libtnc_tncc_ReceiveBatch(this->tncc_connection, buf, buflen) != + TNC_RESULT_SUCCESS) + { + DBG1(DBG_IKE, "TNCC ReceiveBatch failed"); + return FAILED; + } + } return NEED_MORE; } METHOD(tls_t, build, status_t, private_tnccs_11_t *this, void *buf, size_t *buflen, size_t *msglen) { - size_t len = *buflen; + size_t len; if (!this->is_server && !this->tncc_connection) { @@ -89,17 +98,26 @@ METHOD(tls_t, build, status_t, } } + len = *buflen; + len = min(len, tncc_output.len); + *buflen = len; if (msglen) { *msglen = tncc_output.len; } - DBG1(DBG_IKE, "sending TNCCS-Batch: %B", &tncc_output); - len = min(len, tncc_output.len); - memcpy(buf, tncc_output.ptr, len); - chunk_free(&tncc_output); - *buflen = len; - return ALREADY_DONE; + if (tncc_output.len) + { + DBG1(DBG_IKE, "sending TNCCS Batch with %d bytes:", tncc_output.len); + DBG1(DBG_IKE, "%.*s", tncc_output.len, tncc_output.ptr); + memcpy(buf, tncc_output.ptr, len); + chunk_free(&tncc_output); + return ALREADY_DONE; + } + else + { + return INVALID_STATE; + } } METHOD(tls_t, is_server, bool, @@ -117,7 +135,6 @@ METHOD(tls_t, get_purpose, tls_purpose_t, METHOD(tls_t, is_complete, bool, private_tnccs_11_t *this) { - /* TODO */ return FALSE; } |