implemented receive_message() function

This commit is contained in:
Andreas Steffen
2010-11-09 20:43:50 +01:00
parent 296636252b
commit e6b6fc881f
9 changed files with 172 additions and 2 deletions
+25 -2
View File
@@ -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)));