Whitespace cleanups in tnc code

This commit is contained in:
Martin Willi
2011-02-08 11:03:10 +01:00
parent c6c7c7001c
commit 6ccb23e80b
14 changed files with 124 additions and 125 deletions
@@ -61,7 +61,7 @@ METHOD(imc_manager_t, add, bool,
this->imcs->insert_last(this->imcs, imc); this->imcs->insert_last(this->imcs, imc);
this->next_imc_id++; this->next_imc_id++;
if (imc->provide_bind_function(imc->get_id(imc), TNC_TNCC_BindFunction) if (imc->provide_bind_function(imc->get_id(imc), TNC_TNCC_BindFunction)
!= TNC_RESULT_SUCCESS) != TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_TNC, "IMC \"%s\" failed to obtain bind function", DBG1(DBG_TNC, "IMC \"%s\" failed to obtain bind function",
@@ -229,7 +229,7 @@ imc_manager_t* tnc_imc_manager_create(void)
.receive_message = _receive_message, .receive_message = _receive_message,
.batch_ending = _batch_ending, .batch_ending = _batch_ending,
.destroy = _destroy, .destroy = _destroy,
}, },
.imcs = linked_list_create(), .imcs = linked_list_create(),
.next_imc_id = 1, .next_imc_id = 1,
); );
+15 -15
View File
@@ -108,19 +108,19 @@ METHOD(imv_t, type_supported, bool,
TNC_MessageSubtype msg_subtype, subtype; TNC_MessageSubtype msg_subtype, subtype;
int i; int i;
msg_vid = (message_type >> 8) & TNC_VENDORID_ANY; msg_vid = (message_type >> 8) & TNC_VENDORID_ANY;
msg_subtype = message_type & TNC_SUBTYPE_ANY; msg_subtype = message_type & TNC_SUBTYPE_ANY;
for (i = 0; i < this->type_count; i++) for (i = 0; i < this->type_count; i++)
{ {
vid = (this->supported_types[i] >> 8) & TNC_VENDORID_ANY; vid = (this->supported_types[i] >> 8) & TNC_VENDORID_ANY;
subtype = this->supported_types[i] & TNC_SUBTYPE_ANY; subtype = this->supported_types[i] & TNC_SUBTYPE_ANY;
if (this->supported_types[i] == message_type if (this->supported_types[i] == message_type
|| (subtype == TNC_SUBTYPE_ANY || (subtype == TNC_SUBTYPE_ANY
&& (msg_vid == vid || vid == TNC_VENDORID_ANY)) && (msg_vid == vid || vid == TNC_VENDORID_ANY))
|| (vid == TNC_VENDORID_ANY || (vid == TNC_VENDORID_ANY
&& (msg_subtype == subtype || subtype == TNC_SUBTYPE_ANY))) && (msg_subtype == subtype || subtype == TNC_SUBTYPE_ANY)))
{ {
return TRUE; return TRUE;
} }
@@ -153,7 +153,7 @@ imv_t* tnc_imv_create(char *name, char *path)
.set_message_types = _set_message_types, .set_message_types = _set_message_types,
.type_supported = _type_supported, .type_supported = _type_supported,
.destroy = _destroy, .destroy = _destroy,
}, },
.name = name, .name = name,
.path = path, .path = path,
); );
@@ -168,7 +168,7 @@ imv_t* tnc_imv_create(char *name, char *path)
this->public.initialize = dlsym(this->handle, "TNC_IMV_Initialize"); this->public.initialize = dlsym(this->handle, "TNC_IMV_Initialize");
if (!this->public.initialize) if (!this->public.initialize)
{ {
DBG1(DBG_TNC, "could not resolve TNC_IMV_Initialize in %s: %s\n", DBG1(DBG_TNC, "could not resolve TNC_IMV_Initialize in %s: %s\n",
path, dlerror()); path, dlerror());
dlclose(this->handle); dlclose(this->handle);
@@ -177,25 +177,25 @@ imv_t* tnc_imv_create(char *name, char *path)
} }
this->public.notify_connection_change = this->public.notify_connection_change =
dlsym(this->handle, "TNC_IMV_NotifyConnectionChange"); dlsym(this->handle, "TNC_IMV_NotifyConnectionChange");
this->public.solicit_recommendation = this->public.solicit_recommendation =
dlsym(this->handle, "TNC_IMV_SolicitRecommendation"); dlsym(this->handle, "TNC_IMV_SolicitRecommendation");
if (!this->public.solicit_recommendation) if (!this->public.solicit_recommendation)
{ {
DBG1(DBG_TNC, "could not resolve TNC_IMV_SolicitRecommendation in %s: %s\n", DBG1(DBG_TNC, "could not resolve TNC_IMV_SolicitRecommendation in %s: %s\n",
path, dlerror()); path, dlerror());
dlclose(this->handle); dlclose(this->handle);
free(this); free(this);
return NULL; return NULL;
} }
this->public.receive_message = this->public.receive_message =
dlsym(this->handle, "TNC_IMV_ReceiveMessage"); dlsym(this->handle, "TNC_IMV_ReceiveMessage");
this->public.batch_ending = this->public.batch_ending =
dlsym(this->handle, "TNC_IMV_BatchEnding"); dlsym(this->handle, "TNC_IMV_BatchEnding");
this->public.terminate = this->public.terminate =
dlsym(this->handle, "TNC_IMV_Terminate"); dlsym(this->handle, "TNC_IMV_Terminate");
this->public.provide_bind_function = this->public.provide_bind_function =
dlsym(this->handle, "TNC_IMV_ProvideBindFunction"); dlsym(this->handle, "TNC_IMV_ProvideBindFunction");
if (!this->public.provide_bind_function) if (!this->public.provide_bind_function)
{ {
DBG1(DBG_TNC, "could not resolve TNC_IMV_ProvideBindFunction in %s: %s\n", DBG1(DBG_TNC, "could not resolve TNC_IMV_ProvideBindFunction in %s: %s\n",
path, dlerror()); path, dlerror());
@@ -109,29 +109,29 @@ TNC_Result TNC_TNCS_BindFunction(TNC_IMVID id,
{ {
*function_pointer = (void*)TNC_TNCS_ReportMessageTypes; *function_pointer = (void*)TNC_TNCS_ReportMessageTypes;
} }
else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry")) else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry"))
{ {
*function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry; *function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry;
} }
else if (streq(function_name, "TNC_TNCS_SendMessage")) else if (streq(function_name, "TNC_TNCS_SendMessage"))
{ {
*function_pointer = (void*)TNC_TNCS_SendMessage; *function_pointer = (void*)TNC_TNCS_SendMessage;
} }
else if (streq(function_name, "TNC_TNCS_ProvideRecommendation")) else if (streq(function_name, "TNC_TNCS_ProvideRecommendation"))
{ {
*function_pointer = (void*)TNC_TNCS_ProvideRecommendation; *function_pointer = (void*)TNC_TNCS_ProvideRecommendation;
} }
else if (streq(function_name, "TNC_TNCS_GetAttribute")) else if (streq(function_name, "TNC_TNCS_GetAttribute"))
{ {
*function_pointer = (void*)TNC_TNCS_GetAttribute; *function_pointer = (void*)TNC_TNCS_GetAttribute;
} }
else if (streq(function_name, "TNC_TNCS_SetAttribute")) else if (streq(function_name, "TNC_TNCS_SetAttribute"))
{ {
*function_pointer = (void*)TNC_TNCS_SetAttribute; *function_pointer = (void*)TNC_TNCS_SetAttribute;
} }
else else
{ {
return TNC_RESULT_INVALID_PARAMETER; return TNC_RESULT_INVALID_PARAMETER;
} }
return TNC_RESULT_SUCCESS; return TNC_RESULT_SUCCESS;
} }
@@ -68,7 +68,7 @@ METHOD(imv_manager_t, add, bool,
this->imvs->insert_last(this->imvs, imv); this->imvs->insert_last(this->imvs, imv);
this->next_imv_id++; this->next_imv_id++;
if (imv->provide_bind_function(imv->get_id(imv), TNC_TNCS_BindFunction) if (imv->provide_bind_function(imv->get_id(imv), TNC_TNCS_BindFunction)
!= TNC_RESULT_SUCCESS) != TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_TNC, "IMV \"%s\" could failed to obtain bind function", DBG1(DBG_TNC, "IMV \"%s\" could failed to obtain bind function",
@@ -124,7 +124,7 @@ METHOD(imv_manager_t, enforce_recommendation, bool,
case TNC_IMV_ACTION_RECOMMENDATION_ALLOW: case TNC_IMV_ACTION_RECOMMENDATION_ALLOW:
DBG1(DBG_TNC, "TNC recommendation is allow"); DBG1(DBG_TNC, "TNC recommendation is allow");
group = "allow"; group = "allow";
break; break;
case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE: case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE:
DBG1(DBG_TNC, "TNC recommendation is isolate"); DBG1(DBG_TNC, "TNC recommendation is isolate");
group = "isolate"; group = "isolate";
@@ -280,7 +280,7 @@ imv_manager_t* tnc_imv_manager_create(void)
.receive_message = _receive_message, .receive_message = _receive_message,
.batch_ending = _batch_ending, .batch_ending = _batch_ending,
.destroy = _destroy, .destroy = _destroy,
}, },
.imvs = linked_list_create(), .imvs = linked_list_create(),
.next_imv_id = 1, .next_imv_id = 1,
); );
@@ -54,7 +54,7 @@ struct recommendation_entry_t {
/** /**
* Reason language provided by IMV instance * Reason language provided by IMV instance
*/ */
chunk_t reason_language; chunk_t reason_language;
}; };
/** /**
@@ -68,7 +68,7 @@ struct private_tnc_imv_recommendations_t {
recommendations_t public; recommendations_t public;
/** /**
* list of recommendations and evaluations provided by IMVs * list of recommendations and evaluations provided by IMVs
*/ */
linked_list_t *recs; linked_list_t *recs;
@@ -347,7 +347,7 @@ static bool reason_filter(void *null, recommendation_entry_t **entry,
else else
{ {
return FALSE; return FALSE;
} }
} }
METHOD(recommendations_t, create_reason_enumerator, enumerator_t*, METHOD(recommendations_t, create_reason_enumerator, enumerator_t*,
@@ -393,7 +393,7 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
.set_reason_language = _set_reason_language, .set_reason_language = _set_reason_language,
.create_reason_enumerator = _create_reason_enumerator, .create_reason_enumerator = _create_reason_enumerator,
.destroy = _destroy, .destroy = _destroy,
}, },
.recs = linked_list_create(), .recs = linked_list_create(),
); );
@@ -407,9 +407,9 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
entry->eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW; entry->eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
entry->reason = chunk_empty; entry->reason = chunk_empty;
entry->reason_language = chunk_empty; entry->reason_language = chunk_empty;
this->recs->insert_last(this->recs, entry); this->recs->insert_last(this->recs, entry);
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
return &this->public; return &this->public;
} }
@@ -38,7 +38,7 @@ struct private_tnccs_batch_t {
* Batch ID * Batch ID
*/ */
int batch_id; int batch_id;
/** /**
* TNCC if TRUE, TNCS if FALSE * TNCC if TRUE, TNCS if FALSE
*/ */
@@ -75,7 +75,7 @@ METHOD(tnccs_batch_t, add_msg, void,
private_tnccs_batch_t *this, tnccs_msg_t* msg) private_tnccs_batch_t *this, tnccs_msg_t* msg)
{ {
xmlNodePtr root; xmlNodePtr root;
DBG2(DBG_TNC, "adding %N message", tnccs_msg_type_names, DBG2(DBG_TNC, "adding %N message", tnccs_msg_type_names,
msg->get_type(msg)); msg->get_type(msg));
this->messages->insert_last(this->messages, msg); this->messages->insert_last(this->messages, msg);
@@ -86,13 +86,13 @@ METHOD(tnccs_batch_t, add_msg, void,
METHOD(tnccs_batch_t, build, void, METHOD(tnccs_batch_t, build, void,
private_tnccs_batch_t *this) private_tnccs_batch_t *this)
{ {
xmlChar *xmlbuf; xmlChar *xmlbuf;
int buf_size; int buf_size;
xmlDocDumpFormatMemory(this->doc, &xmlbuf, &buf_size, 1); xmlDocDumpFormatMemory(this->doc, &xmlbuf, &buf_size, 1);
this->encoding = chunk_create((u_char*)xmlbuf, buf_size); this->encoding = chunk_create((u_char*)xmlbuf, buf_size);
this->encoding = chunk_clone(this->encoding); this->encoding = chunk_clone(this->encoding);
xmlFree(xmlbuf); xmlFree(xmlbuf);
} }
METHOD(tnccs_batch_t, process, status_t, METHOD(tnccs_batch_t, process, status_t,
@@ -101,9 +101,9 @@ METHOD(tnccs_batch_t, process, status_t,
tnccs_msg_t *tnccs_msg, *msg; tnccs_msg_t *tnccs_msg, *msg;
tnccs_error_type_t error_type = TNCCS_ERROR_OTHER; tnccs_error_type_t error_type = TNCCS_ERROR_OTHER;
char *error_msg, buf[BUF_LEN]; char *error_msg, buf[BUF_LEN];
xmlNodePtr cur; xmlNodePtr cur;
xmlNsPtr ns; xmlNsPtr ns;
xmlChar *batchid, *recipient; xmlChar *batchid, *recipient;
int batch_id; int batch_id;
this->doc = xmlParseMemory(this->encoding.ptr, this->encoding.len); this->doc = xmlParseMemory(this->encoding.ptr, this->encoding.len);
@@ -116,7 +116,7 @@ METHOD(tnccs_batch_t, process, status_t,
/* check out the XML document */ /* check out the XML document */
cur = xmlDocGetRootElement(this->doc); cur = xmlDocGetRootElement(this->doc);
if (!cur) if (!cur)
{ {
error_type = TNCCS_ERROR_MALFORMED_BATCH; error_type = TNCCS_ERROR_MALFORMED_BATCH;
error_msg = "empty XML document"; error_msg = "empty XML document";
@@ -141,12 +141,12 @@ METHOD(tnccs_batch_t, process, status_t,
snprintf(buf, BUF_LEN, "wrong XML document type '%s', expected TNCCS-Batch", snprintf(buf, BUF_LEN, "wrong XML document type '%s', expected TNCCS-Batch",
cur->name); cur->name);
goto fatal; goto fatal;
} }
/* check presence of BatchID property */ /* check presence of BatchID property */
batchid = xmlGetProp(cur, (const xmlChar*)"BatchId"); batchid = xmlGetProp(cur, (const xmlChar*)"BatchId");
if (!batchid) if (!batchid)
{ {
error_type = TNCCS_ERROR_INVALID_BATCH_ID; error_type = TNCCS_ERROR_INVALID_BATCH_ID;
error_msg = "BatchId is missing"; error_msg = "BatchId is missing";
goto fatal; goto fatal;
@@ -180,7 +180,7 @@ METHOD(tnccs_batch_t, process, status_t,
error_msg = buf; error_msg = buf;
snprintf(buf, BUF_LEN, "message recipient expected '%s', got '%s'", snprintf(buf, BUF_LEN, "message recipient expected '%s', got '%s'",
this->is_server ? "TNCS" : "TNCC", (char*)recipient); this->is_server ? "TNCS" : "TNCC", (char*)recipient);
xmlFree(recipient); xmlFree(recipient);
goto fatal; goto fatal;
} }
xmlFree(recipient); xmlFree(recipient);
@@ -247,7 +247,7 @@ METHOD(tnccs_batch_t, destroy, void,
offsetof(tnccs_msg_t, destroy)); offsetof(tnccs_msg_t, destroy));
this->errors->destroy_offset(this->errors, this->errors->destroy_offset(this->errors,
offsetof(tnccs_msg_t, destroy)); offsetof(tnccs_msg_t, destroy));
xmlFreeDoc(this->doc); xmlFreeDoc(this->doc);
free(this->encoding.ptr); free(this->encoding.ptr);
free(this); free(this);
} }
@@ -56,7 +56,7 @@ struct private_imc_imv_msg_t {
}; };
/** /**
* Encodes message data into multiple base64-encoded lines * Encodes message data into multiple base64-encoded lines
*/ */
static chunk_t encode_base64(chunk_t data) static chunk_t encode_base64(chunk_t data)
{ {
@@ -98,7 +98,7 @@ static chunk_t encode_base64(chunk_t data)
} }
/** /**
* Decodes message data from multiple base64-encoded lines * Decodes message data from multiple base64-encoded lines
*/ */
static chunk_t decode_base64(chunk_t data) static chunk_t decode_base64(chunk_t data)
{ {
@@ -183,15 +183,15 @@ tnccs_msg_t *imc_imv_msg_create_from_node(xmlNodePtr node, linked_list_t *errors
if (streq((char*)cur->name, "Type") && cur->ns == ns) if (streq((char*)cur->name, "Type") && cur->ns == ns)
{ {
content = xmlNodeGetContent(cur); content = xmlNodeGetContent(cur);
this->msg_type = strtoul((char*)content, NULL, 16); this->msg_type = strtoul((char*)content, NULL, 16);
xmlFree(content); xmlFree(content);
} }
else if (streq((char*)cur->name, "Base64") && cur->ns == ns) else if (streq((char*)cur->name, "Base64") && cur->ns == ns)
{ {
content = xmlNodeGetContent(cur); content = xmlNodeGetContent(cur);
b64_body = chunk_create((char*)content, strlen((char*)content)); b64_body = chunk_create((char*)content, strlen((char*)content));
this->msg_body = decode_base64(b64_body); this->msg_body = decode_base64(b64_body);
xmlFree(content); xmlFree(content);
} }
cur = cur->next; cur = cur->next;
} }
@@ -220,7 +220,7 @@ tnccs_msg_t *imc_imv_msg_create(TNC_MessageType msg_type, chunk_t msg_body)
.get_msg_body = _get_msg_body, .get_msg_body = _get_msg_body,
}, },
.type = IMC_IMV_MSG, .type = IMC_IMV_MSG,
.node = xmlNewNode(NULL, BAD_CAST "IMC-IMV-Message"), .node = xmlNewNode(NULL, BAD_CAST "IMC-IMV-Message"),
.msg_type = msg_type, .msg_type = msg_type,
.msg_body = chunk_clone(msg_body), .msg_body = chunk_clone(msg_body),
); );
@@ -59,10 +59,10 @@ tnccs_msg_t* tnccs_msg_create_from_node(xmlNodePtr node, linked_list_t *errors)
{ {
if (streq((char*)cur->name, "Type") && cur->ns == ns) if (streq((char*)cur->name, "Type") && cur->ns == ns)
{ {
xmlChar *content = xmlNodeGetContent(cur); xmlChar *content = xmlNodeGetContent(cur);
type = strtol((char*)content, NULL, 16); type = strtol((char*)content, NULL, 16);
xmlFree(content); xmlFree(content);
found = TRUE; found = TRUE;
} }
else if (streq((char*)cur->name, "XML") && cur->ns == ns) else if (streq((char*)cur->name, "XML") && cur->ns == ns)
@@ -83,18 +83,18 @@ tnccs_msg_t* tnccs_msg_create_from_node(xmlNodePtr node, linked_list_t *errors)
} }
cur = xml_msg_node; cur = xml_msg_node;
/* skip empty and blank nodes */ /* skip empty and blank nodes */
while (cur && xmlIsBlankNode(cur)) while (cur && xmlIsBlankNode(cur))
{ {
cur = cur->next; cur = cur->next;
} }
if (!cur) if (!cur)
{ {
error_msg = "XML node is empty"; error_msg = "XML node is empty";
goto fatal; goto fatal;
} }
/* check if TNCCS message type and node name agree */ /* check if TNCCS message type and node name agree */
if (type >= TNCCS_MSG_RECOMMENDATION && type <= TNCCS_MSG_ROOF) if (type >= TNCCS_MSG_RECOMMENDATION && type <= TNCCS_MSG_ROOF)
{ {
DBG2(DBG_TNC, "processing %N message", tnccs_msg_type_names, type); DBG2(DBG_TNC, "processing %N message", tnccs_msg_type_names, type);
@@ -139,11 +139,11 @@ tnccs_msg_t *tnccs_reason_strings_msg_create(chunk_t reason, chunk_t language)
n2 = xmlNewNode(NULL, BAD_CAST enum_to_name(tnccs_msg_type_names, this->type)); n2 = xmlNewNode(NULL, BAD_CAST enum_to_name(tnccs_msg_type_names, this->type));
/* could add multiple reasons here, if we had them */ /* could add multiple reasons here, if we had them */
n3 = xmlNewNode(NULL, BAD_CAST "ReasonString"); n3 = xmlNewNode(NULL, BAD_CAST "ReasonString");
xmlNewProp(n3, BAD_CAST "xml:lang", BAD_CAST this->language.ptr); xmlNewProp(n3, BAD_CAST "xml:lang", BAD_CAST this->language.ptr);
xmlNodeSetContent(n3, BAD_CAST this->reason.ptr); xmlNodeSetContent(n3, BAD_CAST this->reason.ptr);
xmlAddChild(n2, n3); xmlAddChild(n2, n3);
return &this->public.tnccs_msg_interface; return &this->public.tnccs_msg_interface;
} }
@@ -100,7 +100,7 @@ tnccs_msg_t *tnccs_recommendation_msg_create_from_node(xmlNodePtr node,
{ {
error_msg = "type property in TNCCS-Recommendation is missing"; error_msg = "type property in TNCCS-Recommendation is missing";
goto fatal; goto fatal;
} }
else if (streq((char*)rec_string, "allow")) else if (streq((char*)rec_string, "allow"))
{ {
this->rec = TNC_IMV_ACTION_RECOMMENDATION_ALLOW; this->rec = TNC_IMV_ACTION_RECOMMENDATION_ALLOW;
@@ -122,7 +122,7 @@ tnccs_msg_t *tnccs_recommendation_msg_create_from_node(xmlNodePtr node,
goto fatal; goto fatal;
} }
xmlFree(rec_string); xmlFree(rec_string);
return &this->public.tnccs_msg_interface; return &this->public.tnccs_msg_interface;
fatal: fatal:
@@ -178,7 +178,7 @@ tnccs_msg_t *tnccs_recommendation_msg_create(TNC_IMV_Action_Recommendation rec)
} }
n2 = xmlNewNode(NULL, BAD_CAST enum_to_name(tnccs_msg_type_names, this->type)); n2 = xmlNewNode(NULL, BAD_CAST enum_to_name(tnccs_msg_type_names, this->type));
xmlNewProp(n2, BAD_CAST "type", BAD_CAST rec_string); xmlNewProp(n2, BAD_CAST "type", BAD_CAST rec_string);
xmlNodeSetContent(n2, ""); xmlNodeSetContent(n2, "");
xmlAddChild(n, n2); xmlAddChild(n, n2);
+3 -3
View File
@@ -371,7 +371,7 @@ METHOD(tls_t, build, status_t,
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE); this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
charon->imcs->begin_handshake(charon->imcs, this->connection_id); charon->imcs->begin_handshake(charon->imcs, this->connection_id);
} }
/* Do not allow any asynchronous IMCs or IMVs to add additional messages */ /* Do not allow any asynchronous IMCs or IMVs to add additional messages */
this->mutex->lock(this->mutex); this->mutex->lock(this->mutex);
@@ -399,7 +399,7 @@ METHOD(tls_t, build, status_t,
else else
{ {
*buflen = data.len; *buflen = data.len;
} }
memcpy(buf, data.ptr, *buflen); memcpy(buf, data.ptr, *buflen);
this->batch->destroy(this->batch); this->batch->destroy(this->batch);
this->batch = NULL; this->batch = NULL;
@@ -412,7 +412,7 @@ METHOD(tls_t, build, status_t,
} }
this->mutex->unlock(this->mutex); this->mutex->unlock(this->mutex);
return status; return status;
} }
METHOD(tls_t, is_server, bool, METHOD(tls_t, is_server, bool,
@@ -54,9 +54,9 @@ extern enum_name_t *pb_tnc_msg_type_names;
*/ */
struct pb_tnc_msg_info_t { struct pb_tnc_msg_info_t {
u_int32_t min_size; u_int32_t min_size;
bool exact_size; bool exact_size;
bool in_result_batch; bool in_result_batch;
bool has_noskip_flag; bool has_noskip_flag;
}; };
#define TRUE_OR_FALSE 2 #define TRUE_OR_FALSE 2
+5 -5
View File
@@ -92,8 +92,8 @@ METHOD(tnccs_t, send_msg, void,
TNC_UInt32 msg_len, TNC_UInt32 msg_len,
TNC_MessageType msg_type) TNC_MessageType msg_type)
{ {
TNC_MessageSubtype msg_sub_type; TNC_MessageSubtype msg_sub_type;
TNC_VendorID msg_vendor_id; TNC_VendorID msg_vendor_id;
pb_tnc_msg_t *pb_tnc_msg; pb_tnc_msg_t *pb_tnc_msg;
pb_tnc_batch_type_t batch_type; pb_tnc_batch_type_t batch_type;
@@ -285,7 +285,7 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
} }
/** /**
* Build a CRETRY or SRETRY batch * Build a CRETRY or SRETRY batch
*/ */
static void build_retry_batch(private_tnccs_20_t *this) static void build_retry_batch(private_tnccs_20_t *this)
{ {
@@ -324,7 +324,7 @@ METHOD(tls_t, process, status_t,
data = chunk_create(buf, buflen); data = chunk_create(buf, buflen);
DBG1(DBG_TNC, "received TNCCS batch (%u bytes) for Connection ID %u", DBG1(DBG_TNC, "received TNCCS batch (%u bytes) for Connection ID %u",
data.len, this->connection_id); data.len, this->connection_id);
DBG3(DBG_TNC, "%B", &data); DBG3(DBG_TNC, "%B", &data);
batch = pb_tnc_batch_create_from_data(this->is_server, data); batch = pb_tnc_batch_create_from_data(this->is_server, data);
status = batch->process(batch, this->state_machine); status = batch->process(batch, this->state_machine);
@@ -562,7 +562,7 @@ METHOD(tls_t, build, status_t,
else else
{ {
*buflen = data.len; *buflen = data.len;
} }
memcpy(buf, data.ptr, *buflen); memcpy(buf, data.ptr, *buflen);
status = ALREADY_DONE; status = ALREADY_DONE;
} }
+45 -46
View File
@@ -59,71 +59,70 @@ typedef TNC_UInt32 TNC_IMV_Action_Recommendation;
typedef TNC_UInt32 TNC_IMV_Evaluation_Result; typedef TNC_UInt32 TNC_IMV_Evaluation_Result;
typedef TNC_UInt32 TNC_AttributeID; typedef TNC_UInt32 TNC_AttributeID;
/* Function pointers */ /* Function pointers */
typedef TNC_Result (*TNC_IMV_InitializePointer)( typedef TNC_Result (*TNC_IMV_InitializePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_Version minVersion, TNC_Version minVersion,
TNC_Version maxVersion, TNC_Version maxVersion,
TNC_Version *pOutActualVersion); TNC_Version *pOutActualVersion);
typedef TNC_Result (*TNC_IMV_NotifyConnectionChangePointer)( typedef TNC_Result (*TNC_IMV_NotifyConnectionChangePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_ConnectionState newState); TNC_ConnectionState newState);
typedef TNC_Result (*TNC_IMV_ReceiveMessagePointer)( typedef TNC_Result (*TNC_IMV_ReceiveMessagePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_BufferReference message, TNC_BufferReference message,
TNC_UInt32 messageLength, TNC_UInt32 messageLength,
TNC_MessageType messageType); TNC_MessageType messageType);
typedef TNC_Result (*TNC_IMV_SolicitRecommendationPointer)( typedef TNC_Result (*TNC_IMV_SolicitRecommendationPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
typedef TNC_Result (*TNC_IMV_BatchEndingPointer)( typedef TNC_Result (*TNC_IMV_BatchEndingPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
typedef TNC_Result (*TNC_IMV_TerminatePointer)( typedef TNC_Result (*TNC_IMV_TerminatePointer)(
TNC_IMVID imvID); TNC_IMVID imvID);
typedef TNC_Result (*TNC_TNCS_ReportMessageTypesPointer)( typedef TNC_Result (*TNC_TNCS_ReportMessageTypesPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_MessageTypeList supportedTypes, TNC_MessageTypeList supportedTypes,
TNC_UInt32 typeCount); TNC_UInt32 typeCount);
typedef TNC_Result (*TNC_TNCS_SendMessagePointer)( typedef TNC_Result (*TNC_TNCS_SendMessagePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_BufferReference message, TNC_BufferReference message,
TNC_UInt32 messageLength, TNC_UInt32 messageLength,
TNC_MessageType messageType); TNC_MessageType messageType);
typedef TNC_Result (*TNC_TNCS_RequestHandshakeRetryPointer)( typedef TNC_Result (*TNC_TNCS_RequestHandshakeRetryPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_RetryReason reason); TNC_RetryReason reason);
typedef TNC_Result (*TNC_TNCS_ProvideRecommendationPointer)( typedef TNC_Result (*TNC_TNCS_ProvideRecommendationPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_IMV_Action_Recommendation recommendation, TNC_IMV_Action_Recommendation recommendation,
TNC_IMV_Evaluation_Result evaluation); TNC_IMV_Evaluation_Result evaluation);
typedef TNC_Result (*TNC_TNCS_GetAttributePointer)( typedef TNC_Result (*TNC_TNCS_GetAttributePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_AttributeID attributeID, TNC_AttributeID attributeID,
TNC_UInt32 bufferLength, TNC_UInt32 bufferLength,
TNC_BufferReference buffer, TNC_BufferReference buffer,
TNC_UInt32 *pOutValueLength); TNC_UInt32 *pOutValueLength);
typedef TNC_Result (*TNC_TNCS_SetAttributePointer)( typedef TNC_Result (*TNC_TNCS_SetAttributePointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
TNC_AttributeID attributeID, TNC_AttributeID attributeID,
TNC_UInt32 bufferLength, TNC_UInt32 bufferLength,
TNC_BufferReference buffer); TNC_BufferReference buffer);
typedef TNC_Result (*TNC_TNCS_BindFunctionPointer)( typedef TNC_Result (*TNC_TNCS_BindFunctionPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
char *functionName, char *functionName,
void **pOutfunctionPointer); void **pOutfunctionPointer);
typedef TNC_Result (*TNC_IMV_ProvideBindFunctionPointer)( typedef TNC_Result (*TNC_IMV_ProvideBindFunctionPointer)(
TNC_IMVID imvID, TNC_IMVID imvID,
TNC_TNCS_BindFunctionPointer bindFunction); TNC_TNCS_BindFunctionPointer bindFunction);
/* Version Numbers */ /* Version Numbers */