Lines Matching refs:imc
97 struct tnc_if_imc *imc; member
113 struct tnc_if_imc *imc; in TNC_TNCC_ReportMessageTypes() local
127 imc = tnc_imc[imcID]; in TNC_TNCC_ReportMessageTypes()
128 os_free(imc->supported_types); in TNC_TNCC_ReportMessageTypes()
129 imc->supported_types = os_memdup(supportedTypes, in TNC_TNCC_ReportMessageTypes()
131 if (imc->supported_types == NULL) in TNC_TNCC_ReportMessageTypes()
133 imc->num_supported_types = typeCount; in TNC_TNCC_ReportMessageTypes()
146 struct tnc_if_imc *imc; in TNC_TNCC_SendMessage() local
163 imc = tnc_imc[imcID]; in TNC_TNCC_SendMessage()
164 os_free(imc->imc_send); in TNC_TNCC_SendMessage()
165 imc->imc_send_len = 0; in TNC_TNCC_SendMessage()
166 imc->imc_send = os_zalloc(b64len + 100); in TNC_TNCC_SendMessage()
167 if (imc->imc_send == NULL) { in TNC_TNCC_SendMessage()
172 imc->imc_send_len = in TNC_TNCC_SendMessage()
173 os_snprintf((char *) imc->imc_send, b64len + 100, in TNC_TNCC_SendMessage()
275 static int tncc_imc_resolve_funcs(struct tnc_if_imc *imc) in tncc_imc_resolve_funcs() argument
277 void *handle = imc->dlhandle; in tncc_imc_resolve_funcs()
280 imc->Initialize = tncc_get_sym(handle, "TNC_IMC_Initialize"); in tncc_imc_resolve_funcs()
281 if (imc->Initialize == NULL) { in tncc_imc_resolve_funcs()
287 imc->BeginHandshake = tncc_get_sym(handle, "TNC_IMC_BeginHandshake"); in tncc_imc_resolve_funcs()
288 if (imc->BeginHandshake == NULL) { in tncc_imc_resolve_funcs()
294 imc->ProvideBindFunction = in tncc_imc_resolve_funcs()
296 if (imc->ProvideBindFunction == NULL) { in tncc_imc_resolve_funcs()
303 imc->NotifyConnectionChange = in tncc_imc_resolve_funcs()
305 imc->ReceiveMessage = tncc_get_sym(handle, "TNC_IMC_ReceiveMessage"); in tncc_imc_resolve_funcs()
306 imc->BatchEnding = tncc_get_sym(handle, "TNC_IMC_BatchEnding"); in tncc_imc_resolve_funcs()
307 imc->Terminate = tncc_get_sym(handle, "TNC_IMC_Terminate"); in tncc_imc_resolve_funcs()
313 static int tncc_imc_initialize(struct tnc_if_imc *imc) in tncc_imc_initialize() argument
319 imc->name); in tncc_imc_initialize()
320 res = imc->Initialize(imc->imcID, TNC_IFIMC_VERSION_1, in tncc_imc_initialize()
329 static int tncc_imc_terminate(struct tnc_if_imc *imc) in tncc_imc_terminate() argument
333 if (imc->Terminate == NULL) in tncc_imc_terminate()
337 imc->name); in tncc_imc_terminate()
338 res = imc->Terminate(imc->imcID); in tncc_imc_terminate()
346 static int tncc_imc_provide_bind_function(struct tnc_if_imc *imc) in tncc_imc_provide_bind_function() argument
351 "IMC '%s'", imc->name); in tncc_imc_provide_bind_function()
352 res = imc->ProvideBindFunction(imc->imcID, TNC_TNCC_BindFunction); in tncc_imc_provide_bind_function()
360 static int tncc_imc_notify_connection_change(struct tnc_if_imc *imc, in tncc_imc_notify_connection_change() argument
365 if (imc->NotifyConnectionChange == NULL) in tncc_imc_notify_connection_change()
369 " for IMC '%s'", (int) state, imc->name); in tncc_imc_notify_connection_change()
370 res = imc->NotifyConnectionChange(imc->imcID, imc->connectionID, in tncc_imc_notify_connection_change()
379 static int tncc_imc_begin_handshake(struct tnc_if_imc *imc) in tncc_imc_begin_handshake() argument
384 "'%s'", imc->name); in tncc_imc_begin_handshake()
385 res = imc->BeginHandshake(imc->imcID, imc->connectionID); in tncc_imc_begin_handshake()
393 static int tncc_load_imc(struct tnc_if_imc *imc) in tncc_load_imc() argument
395 if (imc->path == NULL) { in tncc_load_imc()
401 imc->name, imc->path); in tncc_load_imc()
405 TCHAR *lib = wpa_strdup_tchar(imc->path); in tncc_load_imc()
408 imc->dlhandle = LoadLibrary(lib); in tncc_load_imc()
412 imc->dlhandle = LoadLibrary(imc->path); in tncc_load_imc()
414 if (imc->dlhandle == NULL) { in tncc_load_imc()
416 imc->name, imc->path, (int) GetLastError()); in tncc_load_imc()
420 imc->dlhandle = dlopen(imc->path, RTLD_LAZY); in tncc_load_imc()
421 if (imc->dlhandle == NULL) { in tncc_load_imc()
423 imc->name, imc->path, dlerror()); in tncc_load_imc()
428 if (tncc_imc_resolve_funcs(imc) < 0) { in tncc_load_imc()
433 if (tncc_imc_initialize(imc) < 0 || in tncc_load_imc()
434 tncc_imc_provide_bind_function(imc) < 0) { in tncc_load_imc()
443 static void tncc_unload_imc(struct tnc_if_imc *imc) in tncc_unload_imc() argument
445 tncc_imc_terminate(imc); in tncc_unload_imc()
446 tnc_imc[imc->imcID] = NULL; in tncc_unload_imc()
448 if (imc->dlhandle) { in tncc_unload_imc()
450 FreeLibrary(imc->dlhandle); in tncc_unload_imc()
452 dlclose(imc->dlhandle); in tncc_unload_imc()
455 os_free(imc->name); in tncc_unload_imc()
456 os_free(imc->path); in tncc_unload_imc()
457 os_free(imc->supported_types); in tncc_unload_imc()
458 os_free(imc->imc_send); in tncc_unload_imc()
462 static int tncc_supported_type(struct tnc_if_imc *imc, unsigned int type) in tncc_supported_type() argument
467 if (imc == NULL || imc->supported_types == NULL) in tncc_supported_type()
473 for (i = 0; i < imc->num_supported_types; i++) { in tncc_supported_type()
475 svendor = imc->supported_types[i] >> 8; in tncc_supported_type()
476 ssubtype = imc->supported_types[i] & 0xff; in tncc_supported_type()
489 struct tnc_if_imc *imc; in tncc_send_to_imcs() local
494 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_send_to_imcs()
495 if (imc->ReceiveMessage == NULL || in tncc_send_to_imcs()
496 !tncc_supported_type(imc, type)) in tncc_send_to_imcs()
500 imc->name); in tncc_send_to_imcs()
501 res = imc->ReceiveMessage(imc->imcID, imc->connectionID, in tncc_send_to_imcs()
512 struct tnc_if_imc *imc; in tncc_init_connection() local
514 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_init_connection()
516 imc, TNC_CONNECTION_STATE_CREATE); in tncc_init_connection()
518 imc, TNC_CONNECTION_STATE_HANDSHAKE); in tncc_init_connection()
520 os_free(imc->imc_send); in tncc_init_connection()
521 imc->imc_send = NULL; in tncc_init_connection()
522 imc->imc_send_len = 0; in tncc_init_connection()
524 tncc_imc_begin_handshake(imc); in tncc_init_connection()
531 struct tnc_if_imc *imc; in tncc_total_send_len() local
534 for (imc = tncc->imc; imc; imc = imc->next) in tncc_total_send_len()
535 len += imc->imc_send_len; in tncc_total_send_len()
542 struct tnc_if_imc *imc; in tncc_copy_send_buf() local
544 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_copy_send_buf()
545 if (imc->imc_send == NULL) in tncc_copy_send_buf()
548 os_memcpy(pos, imc->imc_send, imc->imc_send_len); in tncc_copy_send_buf()
549 pos += imc->imc_send_len; in tncc_copy_send_buf()
550 os_free(imc->imc_send); in tncc_copy_send_buf()
551 imc->imc_send = NULL; in tncc_copy_send_buf()
552 imc->imc_send_len = 0; in tncc_copy_send_buf()
584 struct tnc_if_imc *imc; in tncc_notify_recommendation() local
601 for (imc = tncc->imc; imc; imc = imc->next) in tncc_notify_recommendation()
602 tncc_imc_notify_connection_change(imc, state); in tncc_notify_recommendation()
885 struct tnc_if_imc *imc, *last; in tncc_read_config_reg() local
888 last = tncc->imc; in tncc_read_config_reg()
965 imc = os_zalloc(sizeof(*imc)); in tncc_read_config_reg()
966 if (imc == NULL) { in tncc_read_config_reg()
971 imc->imcID = j; in tncc_read_config_reg()
974 imc->name = os_strdup((char *) name); in tncc_read_config_reg()
975 imc->path = os_strdup((char *) val); in tncc_read_config_reg()
980 tncc->imc = imc; in tncc_read_config_reg()
982 last->next = imc; in tncc_read_config_reg()
983 last = imc; in tncc_read_config_reg()
985 tnc_imc[imc->imcID] = imc; in tncc_read_config_reg()
1006 struct tnc_if_imc *imc; in tncc_parse_imc() local
1019 imc = os_zalloc(sizeof(*imc)); in tncc_parse_imc()
1020 if (imc == NULL) { in tncc_parse_imc()
1025 imc->imcID = i; in tncc_parse_imc()
1032 os_free(imc); in tncc_parse_imc()
1043 os_free(imc); in tncc_parse_imc()
1048 imc->name = os_strdup(pos); in tncc_parse_imc()
1054 os_free(imc->name); in tncc_parse_imc()
1055 os_free(imc); in tncc_parse_imc()
1061 imc->path = os_strdup(pos); in tncc_parse_imc()
1062 tnc_imc[imc->imcID] = imc; in tncc_parse_imc()
1064 return imc; in tncc_parse_imc()
1072 struct tnc_if_imc *imc, *last; in tncc_read_config() local
1094 imc = tncc_parse_imc(pos + 4, line_end, &error); in tncc_read_config()
1099 if (imc) { in tncc_read_config()
1101 tncc->imc = imc; in tncc_read_config()
1103 last->next = imc; in tncc_read_config()
1104 last = imc; in tncc_read_config()
1120 struct tnc_if_imc *imc; in tncc_init() local
1136 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_init()
1137 if (tncc_load_imc(imc)) { in tncc_init()
1139 imc->name); in tncc_init()
1154 struct tnc_if_imc *imc, *prev; in tncc_deinit() local
1156 imc = tncc->imc; in tncc_deinit()
1157 while (imc) { in tncc_deinit()
1158 tncc_unload_imc(imc); in tncc_deinit()
1160 prev = imc; in tncc_deinit()
1161 imc = imc->next; in tncc_deinit()