Lines Matching refs:imv
2 * EAP-TNC - TNCS (IF-IMV, IF-TNCCS, and IF-TNCCS-SOH)
35 /* TNC IF-IMV */
79 struct tnc_if_imv *imv; /* local copy of tncs_global_data->imv */
97 struct tnc_if_imv *imv;
107 struct tnc_if_imv *imv;
111 imv = tncs_global_data->imv;
112 while (imv) {
113 if (imv->imvID == imvID)
114 return imv;
115 imv = imv->next;
149 struct tnc_if_imv *imv;
160 imv = tncs_get_imv(imvID);
161 if (imv == NULL)
163 os_free(imv->supported_types);
164 imv->supported_types =
166 if (imv->supported_types == NULL)
168 os_memcpy(imv->supported_types, supportedTypes,
170 imv->num_supported_types = typeCount;
215 "<IMC-IMV-Message><Type>%08X</Type>"
216 "<Base64>%s</Base64></IMC-IMV-Message>",
335 static int tncs_imv_resolve_funcs(struct tnc_if_imv *imv)
337 void *handle = imv->dlhandle;
339 /* Mandatory IMV functions */
340 imv->Initialize = tncs_get_sym(handle, "TNC_IMV_Initialize");
341 if (imv->Initialize == NULL) {
342 wpa_printf(MSG_ERROR, "TNC: IMV does not export "
347 imv->SolicitRecommendation = tncs_get_sym(
349 if (imv->SolicitRecommendation == NULL) {
350 wpa_printf(MSG_ERROR, "TNC: IMV does not export "
355 imv->ProvideBindFunction =
357 if (imv->ProvideBindFunction == NULL) {
358 wpa_printf(MSG_ERROR, "TNC: IMV does not export "
363 /* Optional IMV functions */
364 imv->NotifyConnectionChange =
366 imv->ReceiveMessage = tncs_get_sym(handle, "TNC_IMV_ReceiveMessage");
367 imv->BatchEnding = tncs_get_sym(handle, "TNC_IMV_BatchEnding");
368 imv->Terminate = tncs_get_sym(handle, "TNC_IMV_Terminate");
374 static int tncs_imv_initialize(struct tnc_if_imv *imv)
379 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMV_Initialize for IMV '%s'",
380 imv->name);
381 res = imv->Initialize(imv->imvID, TNC_IFIMV_VERSION_1,
390 static int tncs_imv_terminate(struct tnc_if_imv *imv)
394 if (imv->Terminate == NULL)
397 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMV_Terminate for IMV '%s'",
398 imv->name);
399 res = imv->Terminate(imv->imvID);
407 static int tncs_imv_provide_bind_function(struct tnc_if_imv *imv)
412 "IMV '%s'", imv->name);
413 res = imv->ProvideBindFunction(imv->imvID, TNC_TNCS_BindFunction);
421 static int tncs_imv_notify_connection_change(struct tnc_if_imv *imv,
427 if (imv->NotifyConnectionChange == NULL)
431 " for IMV '%s'", (int) state, imv->name);
432 res = imv->NotifyConnectionChange(imv->imvID, conn, state);
440 static int tncs_load_imv(struct tnc_if_imv *imv)
442 if (imv->path == NULL) {
443 wpa_printf(MSG_DEBUG, "TNC: No IMV configured");
447 wpa_printf(MSG_DEBUG, "TNC: Opening IMV: %s (%s)",
448 imv->name, imv->path);
449 imv->dlhandle = dlopen(imv->path, RTLD_LAZY);
450 if (imv->dlhandle == NULL) {
451 wpa_printf(MSG_ERROR, "TNC: Failed to open IMV '%s' (%s): %s",
452 imv->name, imv->path, dlerror());
456 if (tncs_imv_resolve_funcs(imv) < 0) {
457 wpa_printf(MSG_ERROR, "TNC: Failed to resolve IMV functions");
461 if (tncs_imv_initialize(imv) < 0 ||
462 tncs_imv_provide_bind_function(imv) < 0) {
463 wpa_printf(MSG_ERROR, "TNC: Failed to initialize IMV");
471 static void tncs_free_imv(struct tnc_if_imv *imv)
473 os_free(imv->name);
474 os_free(imv->path);
475 os_free(imv->supported_types);
478 static void tncs_unload_imv(struct tnc_if_imv *imv)
480 tncs_imv_terminate(imv);
482 if (imv->dlhandle)
483 dlclose(imv->dlhandle);
485 tncs_free_imv(imv);
489 static int tncs_supported_type(struct tnc_if_imv *imv, unsigned int type)
494 if (imv == NULL || imv->supported_types == NULL)
500 for (i = 0; i < imv->num_supported_types; i++) {
502 svendor = imv->supported_types[i] >> 8;
503 ssubtype = imv->supported_types[i] & 0xff;
516 struct tnc_if_imv *imv;
519 wpa_hexdump_ascii(MSG_MSGDUMP, "TNC: Message to IMV(s)", msg, len);
521 for (imv = tncs->imv; imv; imv = imv->next) {
522 if (imv->ReceiveMessage == NULL ||
523 !tncs_supported_type(imv, type))
526 wpa_printf(MSG_DEBUG, "TNC: Call ReceiveMessage for IMV '%s'",
527 imv->name);
528 res = imv->ReceiveMessage(imv->imvID, tncs->connectionID,
539 struct tnc_if_imv *imv;
542 for (imv = tncs->imv; imv; imv = imv->next) {
543 if (imv->BatchEnding == NULL)
546 wpa_printf(MSG_DEBUG, "TNC: Call BatchEnding for IMV '%s'",
547 imv->name);
548 res = imv->BatchEnding(imv->imvID, tncs->connectionID);
557 struct tnc_if_imv *imv;
560 for (imv = tncs->imv; imv; imv = imv->next) {
561 if (tncs->imv_data[imv->imvID].recommendation_set)
565 "IMV '%s'", imv->name);
566 res = imv->SolicitRecommendation(imv->imvID,
576 struct tnc_if_imv *imv;
579 for (imv = tncs->imv; imv; imv = imv->next) {
581 imv, tncs->connectionID, TNC_CONNECTION_STATE_CREATE);
583 imv, tncs->connectionID,
697 struct tnc_if_imv *imv;
710 for (imv = tncs->imv; imv; imv = imv->next) {
712 irec = tncs->imv_data[imv->imvID].recommendation;
760 for (imv = tncs->imv; imv; imv = imv->next) {
761 tncs_imv_notify_connection_change(imv, tncs->connectionID,
835 * <IMC-IMV-Message>
838 * </IMC-IMV-Message>
845 pos = os_strstr(start, "<IMC-IMV-Message>");
849 end = os_strstr(start, "</IMC-IMV-Message>");
861 wpa_printf(MSG_DEBUG, "TNC: IMC-IMV-Message Type 0x%x", type);
964 struct tnc_if_imv *imv;
972 imv = os_zalloc(sizeof(*imv));
973 if (imv == NULL) {
978 imv->imvID = id;
981 wpa_printf(MSG_DEBUG, "TNC: Configured IMV: %s", pos);
983 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMV line '%s' "
985 os_free(imv);
994 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMV line '%s' "
996 os_free(imv);
1001 imv->name = os_strdup(pos);
1005 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMV line '%s' "
1007 os_free(imv);
1012 wpa_printf(MSG_DEBUG, "TNC: IMV file: '%s'", pos);
1013 imv->path = os_strdup(pos);
1015 return imv;
1023 struct tnc_if_imv *imv, *last;
1043 if (os_strncmp(pos, "IMV ", 4) == 0) {
1046 imv = tncs_parse_imv(id++, pos + 4, line_end, &error);
1049 if (imv) {
1051 global->imv = imv;
1053 last->next = imv;
1054 last = imv;
1075 tncs->imv = tncs_global_data->imv;
1116 struct tnc_if_imv *imv;
1130 for (imv = tncs_global_data->imv; imv; imv = imv->next) {
1131 if (tncs_load_imv(imv)) {
1132 wpa_printf(MSG_ERROR, "TNC: Failed to load IMV '%s'",
1133 imv->name);
1148 struct tnc_if_imv *imv, *prev;
1153 imv = tncs_global_data->imv;
1154 while (imv) {
1155 tncs_unload_imv(imv);
1157 prev = imv;
1158 imv = imv->next;