Lines Matching refs:tncs

123 	struct tncs_data *tncs;  in tncs_get_conn()  local
128 tncs = tncs_global_data->connections; in tncs_get_conn()
129 while (tncs) { in tncs_get_conn()
130 if (tncs->connectionID == connectionID) in tncs_get_conn()
131 return tncs; in tncs_get_conn()
132 tncs = tncs->next; in tncs_get_conn()
181 struct tncs_data *tncs; in TNC_TNCS_SendMessage() local
194 tncs = tncs_get_conn(connectionID); in TNC_TNCS_SendMessage()
195 if (tncs == NULL) in TNC_TNCS_SendMessage()
202 os_free(tncs->imv_data[imvID].imv_send); in TNC_TNCS_SendMessage()
203 tncs->imv_data[imvID].imv_send_len = 0; in TNC_TNCS_SendMessage()
204 tncs->imv_data[imvID].imv_send = os_zalloc(b64len + 100); in TNC_TNCS_SendMessage()
205 if (tncs->imv_data[imvID].imv_send == NULL) { in TNC_TNCS_SendMessage()
210 tncs->imv_data[imvID].imv_send_len = in TNC_TNCS_SendMessage()
211 os_snprintf((char *) tncs->imv_data[imvID].imv_send, in TNC_TNCS_SendMessage()
240 struct tncs_data *tncs; in TNC_TNCS_ProvideRecommendation() local
250 tncs = tncs_get_conn(connectionID); in TNC_TNCS_ProvideRecommendation()
251 if (tncs == NULL) in TNC_TNCS_ProvideRecommendation()
254 tncs->imv_data[imvID].recommendation = recommendation; in TNC_TNCS_ProvideRecommendation()
255 tncs->imv_data[imvID].recommendation_set = 1; in TNC_TNCS_ProvideRecommendation()
511 static void tncs_send_to_imvs(struct tncs_data *tncs, unsigned int type, in tncs_send_to_imvs() argument
519 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_send_to_imvs()
526 res = imv->ReceiveMessage(imv->imvID, tncs->connectionID, in tncs_send_to_imvs()
535 static void tncs_batch_ending(struct tncs_data *tncs) in tncs_batch_ending() argument
540 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_batch_ending()
546 res = imv->BatchEnding(imv->imvID, tncs->connectionID); in tncs_batch_ending()
553 static void tncs_solicit_recommendation(struct tncs_data *tncs) in tncs_solicit_recommendation() argument
558 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_solicit_recommendation()
559 if (tncs->imv_data[imv->imvID].recommendation_set) in tncs_solicit_recommendation()
565 tncs->connectionID); in tncs_solicit_recommendation()
572 void tncs_init_connection(struct tncs_data *tncs) in tncs_init_connection() argument
577 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_init_connection()
579 imv, tncs->connectionID, TNC_CONNECTION_STATE_CREATE); in tncs_init_connection()
581 imv, tncs->connectionID, in tncs_init_connection()
586 os_free(tncs->imv_data[i].imv_send); in tncs_init_connection()
587 tncs->imv_data[i].imv_send = NULL; in tncs_init_connection()
588 tncs->imv_data[i].imv_send_len = 0; in tncs_init_connection()
593 size_t tncs_total_send_len(struct tncs_data *tncs) in tncs_total_send_len() argument
599 len += tncs->imv_data[i].imv_send_len; in tncs_total_send_len()
600 if (tncs->tncs_message) in tncs_total_send_len()
601 len += os_strlen(tncs->tncs_message); in tncs_total_send_len()
606 u8 * tncs_copy_send_buf(struct tncs_data *tncs, u8 *pos) in tncs_copy_send_buf() argument
611 if (tncs->imv_data[i].imv_send == NULL) in tncs_copy_send_buf()
614 os_memcpy(pos, tncs->imv_data[i].imv_send, in tncs_copy_send_buf()
615 tncs->imv_data[i].imv_send_len); in tncs_copy_send_buf()
616 pos += tncs->imv_data[i].imv_send_len; in tncs_copy_send_buf()
617 os_free(tncs->imv_data[i].imv_send); in tncs_copy_send_buf()
618 tncs->imv_data[i].imv_send = NULL; in tncs_copy_send_buf()
619 tncs->imv_data[i].imv_send_len = 0; in tncs_copy_send_buf()
622 if (tncs->tncs_message) { in tncs_copy_send_buf()
623 size_t len = os_strlen(tncs->tncs_message); in tncs_copy_send_buf()
624 os_memcpy(pos, tncs->tncs_message, len); in tncs_copy_send_buf()
626 os_free(tncs->tncs_message); in tncs_copy_send_buf()
627 tncs->tncs_message = NULL; in tncs_copy_send_buf()
634 char * tncs_if_tnccs_start(struct tncs_data *tncs) in tncs_if_tnccs_start() argument
639 tncs->last_batchid++; in tncs_if_tnccs_start()
640 os_snprintf(buf, 1000, IF_TNCCS_START, tncs->last_batchid); in tncs_if_tnccs_start()
692 static enum tncs_process_res tncs_derive_recommendation(struct tncs_data *tncs) in tncs_derive_recommendation() argument
701 if (tncs->done) in tncs_derive_recommendation()
704 tncs_solicit_recommendation(tncs); in tncs_derive_recommendation()
708 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_derive_recommendation()
710 irec = tncs->imv_data[imv->imvID].recommendation; in tncs_derive_recommendation()
722 tncs->recommendation = rec; in tncs_derive_recommendation()
723 tncs->done = 1; in tncs_derive_recommendation()
746 os_free(tncs->tncs_message); in tncs_derive_recommendation()
747 tncs->tncs_message = os_zalloc(200); in tncs_derive_recommendation()
748 if (tncs->tncs_message) { in tncs_derive_recommendation()
749 os_snprintf(tncs->tncs_message, 199, in tncs_derive_recommendation()
758 for (imv = tncs->imv; imv; imv = imv->next) { in tncs_derive_recommendation()
759 tncs_imv_notify_connection_change(imv, tncs->connectionID, in tncs_derive_recommendation()
778 enum tncs_process_res tncs_process_if_tnccs(struct tncs_data *tncs, in tncs_process_if_tnccs() argument
814 if (batch_id != tncs->last_batchid + 1) { in tncs_process_if_tnccs()
817 batch_id, tncs->last_batchid + 1); in tncs_process_if_tnccs()
821 tncs->last_batchid = batch_id; in tncs_process_if_tnccs()
868 tncs_send_to_imvs(tncs, type, decoded, decoded_len); in tncs_process_if_tnccs()
950 tncs_batch_ending(tncs); in tncs_process_if_tnccs()
952 if (tncs_total_send_len(tncs) == 0) in tncs_process_if_tnccs()
953 return tncs_derive_recommendation(tncs); in tncs_process_if_tnccs()
1065 struct tncs_data *tncs; in tncs_init() local
1070 tncs = os_zalloc(sizeof(*tncs)); in tncs_init()
1071 if (tncs == NULL) in tncs_init()
1073 tncs->imv = tncs_global_data->imv; in tncs_init()
1074 tncs->connectionID = tncs_global_data->next_conn_id++; in tncs_init()
1075 tncs->next = tncs_global_data->connections; in tncs_init()
1076 tncs_global_data->connections = tncs; in tncs_init()
1078 return tncs; in tncs_init()
1082 void tncs_deinit(struct tncs_data *tncs) in tncs_deinit() argument
1087 if (tncs == NULL) in tncs_deinit()
1091 os_free(tncs->imv_data[i].imv_send); in tncs_deinit()
1096 if (conn == tncs) { in tncs_deinit()
1098 prev->next = tncs->next; in tncs_deinit()
1100 tncs_global_data->connections = tncs->next; in tncs_deinit()
1107 os_free(tncs->tncs_message); in tncs_deinit()
1108 os_free(tncs); in tncs_deinit()