Home | History | Annotate | Download | only in eap_server

Lines Matching defs:tncs

2  * EAP-TNC - TNCS (IF-IMV, IF-TNCCS, and IF-TNCCS-SOH)
15 #include "tncs.h"
20 /* TODO: TNCS must be thread-safe; review the code and add locking etc. if
28 "<TNCCS-Batch BatchId=\"%d\" Recipient=\"TNCS\" " \
123 struct tncs_data *tncs;
128 tncs = tncs_global_data->connections;
129 while (tncs) {
130 if (tncs->connectionID == connectionID)
131 return tncs;
132 tncs = tncs->next;
142 /* TNCS functions that IMVs can call */
183 struct tncs_data *tncs;
196 tncs = tncs_get_conn(connectionID);
197 if (tncs == NULL)
204 os_free(tncs->imv_data[imvID].imv_send);
205 tncs->imv_data[imvID].imv_send_len = 0;
206 tncs->imv_data[imvID].imv_send = os_zalloc(b64len + 100);
207 if (tncs->imv_data[imvID].imv_send == NULL) {
212 tncs->imv_data[imvID].imv_send_len =
213 os_snprintf((char *) tncs->imv_data[imvID].imv_send,
242 struct tncs_data *tncs;
252 tncs = tncs_get_conn(connectionID);
253 if (tncs == NULL)
256 tncs->imv_data[imvID].recommendation = recommendation;
257 tncs->imv_data[imvID].recommendation_set = 1;
513 static void tncs_send_to_imvs(struct tncs_data *tncs, unsigned int type,
521 for (imv = tncs->imv; imv; imv = imv->next) {
528 res = imv->ReceiveMessage(imv->imvID, tncs->connectionID,
537 static void tncs_batch_ending(struct tncs_data *tncs)
542 for (imv = tncs->imv; imv; imv = imv->next) {
548 res = imv->BatchEnding(imv->imvID, tncs->connectionID);
555 static void tncs_solicit_recommendation(struct tncs_data *tncs)
560 for (imv = tncs->imv; imv; imv = imv->next) {
561 if (tncs->imv_data[imv->imvID].recommendation_set)
567 tncs->connectionID);
574 void tncs_init_connection(struct tncs_data *tncs)
579 for (imv = tncs->imv; imv; imv = imv->next) {
581 imv, tncs->connectionID, TNC_CONNECTION_STATE_CREATE);
583 imv, tncs->connectionID,
588 os_free(tncs->imv_data[i].imv_send);
589 tncs->imv_data[i].imv_send = NULL;
590 tncs->imv_data[i].imv_send_len = 0;
595 size_t tncs_total_send_len(struct tncs_data *tncs)
601 len += tncs->imv_data[i].imv_send_len;
602 if (tncs->tncs_message)
603 len += os_strlen(tncs->tncs_message);
608 u8 * tncs_copy_send_buf(struct tncs_data *tncs, u8 *pos)
613 if (tncs->imv_data[i].imv_send == NULL)
616 os_memcpy(pos, tncs->imv_data[i].imv_send,
617 tncs->imv_data[i].imv_send_len);
618 pos += tncs->imv_data[i].imv_send_len;
619 os_free(tncs->imv_data[i].imv_send);
620 tncs->imv_data[i].imv_send = NULL;
621 tncs->imv_data[i].imv_send_len = 0;
624 if (tncs->tncs_message) {
625 size_t len = os_strlen(tncs->tncs_message);
626 os_memcpy(pos, tncs->tncs_message, len);
628 os_free(tncs->tncs_message);
629 tncs->tncs_message = NULL;
636 char * tncs_if_tnccs_start(struct tncs_data *tncs)
641 tncs->last_batchid++;
642 os_snprintf(buf, 1000, IF_TNCCS_START, tncs->last_batchid);
694 static enum tncs_process_res tncs_derive_recommendation(struct tncs_data *tncs)
703 if (tncs->done)
706 tncs_solicit_recommendation(tncs);
710 for (imv = tncs->imv; imv; imv = imv->next) {
712 irec = tncs->imv_data[imv->imvID].recommendation;
724 tncs->recommendation = rec;
725 tncs->done = 1;
748 os_free(tncs->tncs_message);
749 tncs->tncs_message = os_zalloc(200);
750 if (tncs->tncs_message) {
751 os_snprintf(tncs->tncs_message, 199,
752 "<TNCC-TNCS-Message><Type>%08X</Type>"
755 "</TNCC-TNCS-Message>",
760 for (imv = tncs->imv; imv; imv = imv->next) {
761 tncs_imv_notify_connection_change(imv, tncs->connectionID,
780 enum tncs_process_res tncs_process_if_tnccs(struct tncs_data *tncs,
816 if (batch_id != tncs->last_batchid + 1) {
819 batch_id, tncs->last_batchid + 1);
823 tncs->last_batchid = batch_id;
870 tncs_send_to_imvs(tncs, type, decoded, decoded_len);
878 * <TNCC-TNCS-Message>
882 * </TNCC-TNCS-Message>
890 pos = os_strstr(start, "<TNCC-TNCS-Message>");
894 end = os_strstr(start, "</TNCC-TNCS-Message>");
906 wpa_printf(MSG_DEBUG, "TNC: TNCC-TNCS-Message Type 0x%x",
935 "TNC: TNCC-TNCS-Message Base64",
942 "TNC: TNCC-TNCS-Message XML",
952 tncs_batch_ending(tncs);
954 if (tncs_total_send_len(tncs) == 0)
955 return tncs_derive_recommendation(tncs);
1067 struct tncs_data *tncs;
1072 tncs = os_zalloc(sizeof(*tncs));
1073 if (tncs == NULL)
1075 tncs->imv = tncs_global_data->imv;
1076 tncs->connectionID = tncs_global_data->next_conn_id++;
1077 tncs->next = tncs_global_data->connections;
1078 tncs_global_data->connections = tncs;
1080 return tncs;
1084 void tncs_deinit(struct tncs_data *tncs)
1089 if (tncs == NULL)
1093 os_free(tncs->imv_data[i].imv_send);
1098 if (conn == tncs) {
1100 prev->next = tncs->next;
1102 tncs_global_data->connections = tncs->next;
1109 os_free(tncs->tncs_message);
1110 os_free(tncs);