diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-07 01:17:21 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-09 20:43:50 +0100 |
commit | e6b6fc881f70211a1510cf2a23230b6fc546e59c (patch) | |
tree | b34f098383803062b3de65ad4f5facd25f86ceab /src/libcharon/plugins/tnccs_20/tnccs_20.c | |
parent | 296636252b514846bd3ec83fbeff6fe40c301745 (diff) | |
download | strongswan-e6b6fc881f70211a1510cf2a23230b6fc546e59c.tar.bz2 strongswan-e6b6fc881f70211a1510cf2a23230b6fc546e59c.tar.xz |
implemented receive_message() function
Diffstat (limited to 'src/libcharon/plugins/tnccs_20/tnccs_20.c')
-rw-r--r-- | src/libcharon/plugins/tnccs_20/tnccs_20.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c index 5afc6e196..8f6f11e50 100644 --- a/src/libcharon/plugins/tnccs_20/tnccs_20.c +++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c @@ -63,6 +63,9 @@ METHOD(tnccs_t, send_message, void, METHOD(tls_t, process, status_t, private_tnccs_20_t *this, void *buf, size_t buflen) { + char *pos; + size_t len; + if (this->is_server && !this->connection_id) { this->connection_id = charon->tnccs->create_connection(charon->tnccs, @@ -73,14 +76,34 @@ METHOD(tls_t, process, status_t, DBG1(DBG_TNC, "received TNCCS Batch (%u bytes) for Connection ID %u", buflen, this->connection_id); DBG3(DBG_TNC, "%.*s", buflen, buf); - + pos = strchr(buf, '|'); + if (pos) + { + pos++; + len = buflen - ((char*)buf - pos); + } + else + { + pos = buf; + len = buflen; + } + if (this->is_server) + { + charon->imvs->receive_message(charon->imvs, this->connection_id, + pos, len, 0x0080ab31); + } + else + { + charon->imcs->receive_message(charon->imcs, this->connection_id, + pos, len, 0x0080ab31); + } return NEED_MORE; } METHOD(tls_t, build, status_t, private_tnccs_20_t *this, void *buf, size_t *buflen, size_t *msglen) { - char *msg = this->is_server ? "|tncs->tncc 2.0|" : "|tncc->tncs 2.0|"; + char *msg = this->is_server ? "tncs->tncc 2.0|" : "tncc->tncs 2.0|"; size_t len; this->batch = chunk_clone(chunk_create(msg, strlen(msg))); |