aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2011-01-09 10:00:54 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-01-09 10:00:54 +0100
commit5fee822a93ce175ad6ef9d61b7adb0cfd7878356 (patch)
tree3cd06d6b88444ca298b7756bb263268294f421aa /src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
parent33749b879c5db7ef28a611fc99e9b7bb5b2d0691 (diff)
downloadstrongswan-5fee822a93ce175ad6ef9d61b7adb0cfd7878356.tar.bz2
strongswan-5fee822a93ce175ad6ef9d61b7adb0cfd7878356.tar.xz
implemented parsing of TNCCS 1.1 messages
Diffstat (limited to 'src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c')
-rw-r--r--src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c b/src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
index d44645d70..fbcb1337b 100644
--- a/src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
+++ b/src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
@@ -106,8 +106,6 @@ METHOD(tnccs_batch_t, process, status_t,
xmlChar *batchid, *recipient;
int batch_id;
- status_t status;
-
this->doc = xmlParseMemory(this->encoding.ptr, this->encoding.len);
if (!this->doc)
{
@@ -206,30 +204,28 @@ METHOD(tnccs_batch_t, process, status_t,
continue;
}
- tnccs_msg = tnccs_msg_create_from_node(cur);
- if (!tnccs_msg)
+ tnccs_msg = tnccs_msg_create_from_node(cur, this->errors);
+
+ /* exit if a message parsing error occurred */
+ if (this->errors->get_count(this->errors) > 0)
{
- continue;
+ return FAILED;
}
- DBG2(DBG_TNC, "processing %N message", tnccs_msg_type_names,
- tnccs_msg->get_type(tnccs_msg));
- status = tnccs_msg->process(tnccs_msg);
- if (status == FAILED)
+ /* ignore unrecognized messages */
+ if (!tnccs_msg)
{
- tnccs_msg->destroy(tnccs_msg);
- return FAILED;
+ continue;
}
+
this->messages->insert_last(this->messages, tnccs_msg);
}
return SUCCESS;
fatal:
- DBG1(DBG_TNC, "%s", error_msg);
msg = tnccs_error_msg_create(error_type, error_msg);
this->errors->insert_last(this->errors, msg);
return FAILED;
-
}
METHOD(tnccs_batch_t, create_msg_enumerator, enumerator_t*,
@@ -238,6 +234,12 @@ METHOD(tnccs_batch_t, create_msg_enumerator, enumerator_t*,
return this->messages->create_enumerator(this->messages);
}
+METHOD(tnccs_batch_t, create_error_enumerator, enumerator_t*,
+ private_tnccs_batch_t *this)
+{
+ return this->errors->create_enumerator(this->errors);
+}
+
METHOD(tnccs_batch_t, destroy, void,
private_tnccs_batch_t *this)
{
@@ -267,6 +269,7 @@ tnccs_batch_t* tnccs_batch_create(bool is_server, int batch_id)
.build = _build,
.process = _process,
.create_msg_enumerator = _create_msg_enumerator,
+ .create_error_enumerator = _create_error_enumerator,
.destroy = _destroy,
},
.is_server = is_server,
@@ -305,6 +308,7 @@ tnccs_batch_t* tnccs_batch_create_from_data(bool is_server, int batch_id, chunk_
.build = _build,
.process = _process,
.create_msg_enumerator = _create_msg_enumerator,
+ .create_error_enumerator = _create_error_enumerator,
.destroy = _destroy,
},
.is_server = is_server,