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 = in TNC_TNCC_ReportMessageTypes()
131 if (imc->supported_types == NULL) in TNC_TNCC_ReportMessageTypes()
133 os_memcpy(imc->supported_types, supportedTypes, in TNC_TNCC_ReportMessageTypes()
135 imc->num_supported_types = typeCount; in TNC_TNCC_ReportMessageTypes()
148 struct tnc_if_imc *imc; in TNC_TNCC_SendMessage() local
165 imc = tnc_imc[imcID]; in TNC_TNCC_SendMessage()
166 os_free(imc->imc_send); in TNC_TNCC_SendMessage()
167 imc->imc_send_len = 0; in TNC_TNCC_SendMessage()
168 imc->imc_send = os_zalloc(b64len + 100); in TNC_TNCC_SendMessage()
169 if (imc->imc_send == NULL) { in TNC_TNCC_SendMessage()
174 imc->imc_send_len = in TNC_TNCC_SendMessage()
175 os_snprintf((char *) imc->imc_send, b64len + 100, in TNC_TNCC_SendMessage()
276 static int tncc_imc_resolve_funcs(struct tnc_if_imc *imc) in tncc_imc_resolve_funcs() argument
278 void *handle = imc->dlhandle; in tncc_imc_resolve_funcs()
281 imc->Initialize = tncc_get_sym(handle, "TNC_IMC_Initialize"); in tncc_imc_resolve_funcs()
282 if (imc->Initialize == NULL) { in tncc_imc_resolve_funcs()
288 imc->BeginHandshake = tncc_get_sym(handle, "TNC_IMC_BeginHandshake"); in tncc_imc_resolve_funcs()
289 if (imc->BeginHandshake == NULL) { in tncc_imc_resolve_funcs()
295 imc->ProvideBindFunction = in tncc_imc_resolve_funcs()
297 if (imc->ProvideBindFunction == NULL) { in tncc_imc_resolve_funcs()
304 imc->NotifyConnectionChange = in tncc_imc_resolve_funcs()
306 imc->ReceiveMessage = tncc_get_sym(handle, "TNC_IMC_ReceiveMessage"); in tncc_imc_resolve_funcs()
307 imc->BatchEnding = tncc_get_sym(handle, "TNC_IMC_BatchEnding"); in tncc_imc_resolve_funcs()
308 imc->Terminate = tncc_get_sym(handle, "TNC_IMC_Terminate"); in tncc_imc_resolve_funcs()
314 static int tncc_imc_initialize(struct tnc_if_imc *imc) in tncc_imc_initialize() argument
320 imc->name); in tncc_imc_initialize()
321 res = imc->Initialize(imc->imcID, TNC_IFIMC_VERSION_1, in tncc_imc_initialize()
330 static int tncc_imc_terminate(struct tnc_if_imc *imc) in tncc_imc_terminate() argument
334 if (imc->Terminate == NULL) in tncc_imc_terminate()
338 imc->name); in tncc_imc_terminate()
339 res = imc->Terminate(imc->imcID); in tncc_imc_terminate()
347 static int tncc_imc_provide_bind_function(struct tnc_if_imc *imc) in tncc_imc_provide_bind_function() argument
352 "IMC '%s'", imc->name); in tncc_imc_provide_bind_function()
353 res = imc->ProvideBindFunction(imc->imcID, TNC_TNCC_BindFunction); in tncc_imc_provide_bind_function()
361 static int tncc_imc_notify_connection_change(struct tnc_if_imc *imc, in tncc_imc_notify_connection_change() argument
366 if (imc->NotifyConnectionChange == NULL) in tncc_imc_notify_connection_change()
370 " for IMC '%s'", (int) state, imc->name); in tncc_imc_notify_connection_change()
371 res = imc->NotifyConnectionChange(imc->imcID, imc->connectionID, in tncc_imc_notify_connection_change()
380 static int tncc_imc_begin_handshake(struct tnc_if_imc *imc) in tncc_imc_begin_handshake() argument
385 "'%s'", imc->name); in tncc_imc_begin_handshake()
386 res = imc->BeginHandshake(imc->imcID, imc->connectionID); in tncc_imc_begin_handshake()
394 static int tncc_load_imc(struct tnc_if_imc *imc) in tncc_load_imc() argument
396 if (imc->path == NULL) { in tncc_load_imc()
402 imc->name, imc->path); in tncc_load_imc()
406 TCHAR *lib = wpa_strdup_tchar(imc->path); in tncc_load_imc()
409 imc->dlhandle = LoadLibrary(lib); in tncc_load_imc()
413 imc->dlhandle = LoadLibrary(imc->path); in tncc_load_imc()
415 if (imc->dlhandle == NULL) { in tncc_load_imc()
417 imc->name, imc->path, (int) GetLastError()); in tncc_load_imc()
421 imc->dlhandle = dlopen(imc->path, RTLD_LAZY); in tncc_load_imc()
422 if (imc->dlhandle == NULL) { in tncc_load_imc()
424 imc->name, imc->path, dlerror()); in tncc_load_imc()
429 if (tncc_imc_resolve_funcs(imc) < 0) { in tncc_load_imc()
434 if (tncc_imc_initialize(imc) < 0 || in tncc_load_imc()
435 tncc_imc_provide_bind_function(imc) < 0) { in tncc_load_imc()
444 static void tncc_unload_imc(struct tnc_if_imc *imc) in tncc_unload_imc() argument
446 tncc_imc_terminate(imc); in tncc_unload_imc()
447 tnc_imc[imc->imcID] = NULL; in tncc_unload_imc()
449 if (imc->dlhandle) { in tncc_unload_imc()
451 FreeLibrary(imc->dlhandle); in tncc_unload_imc()
453 dlclose(imc->dlhandle); in tncc_unload_imc()
456 os_free(imc->name); in tncc_unload_imc()
457 os_free(imc->path); in tncc_unload_imc()
458 os_free(imc->supported_types); in tncc_unload_imc()
459 os_free(imc->imc_send); in tncc_unload_imc()
463 static int tncc_supported_type(struct tnc_if_imc *imc, unsigned int type) in tncc_supported_type() argument
468 if (imc == NULL || imc->supported_types == NULL) in tncc_supported_type()
474 for (i = 0; i < imc->num_supported_types; i++) { in tncc_supported_type()
476 svendor = imc->supported_types[i] >> 8; in tncc_supported_type()
477 ssubtype = imc->supported_types[i] & 0xff; in tncc_supported_type()
490 struct tnc_if_imc *imc; in tncc_send_to_imcs() local
495 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_send_to_imcs()
496 if (imc->ReceiveMessage == NULL || in tncc_send_to_imcs()
497 !tncc_supported_type(imc, type)) in tncc_send_to_imcs()
501 imc->name); in tncc_send_to_imcs()
502 res = imc->ReceiveMessage(imc->imcID, imc->connectionID, in tncc_send_to_imcs()
513 struct tnc_if_imc *imc; in tncc_init_connection() local
515 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_init_connection()
517 imc, TNC_CONNECTION_STATE_CREATE); in tncc_init_connection()
519 imc, TNC_CONNECTION_STATE_HANDSHAKE); in tncc_init_connection()
521 os_free(imc->imc_send); in tncc_init_connection()
522 imc->imc_send = NULL; in tncc_init_connection()
523 imc->imc_send_len = 0; in tncc_init_connection()
525 tncc_imc_begin_handshake(imc); in tncc_init_connection()
532 struct tnc_if_imc *imc; in tncc_total_send_len() local
535 for (imc = tncc->imc; imc; imc = imc->next) in tncc_total_send_len()
536 len += imc->imc_send_len; in tncc_total_send_len()
543 struct tnc_if_imc *imc; in tncc_copy_send_buf() local
545 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_copy_send_buf()
546 if (imc->imc_send == NULL) in tncc_copy_send_buf()
549 os_memcpy(pos, imc->imc_send, imc->imc_send_len); in tncc_copy_send_buf()
550 pos += imc->imc_send_len; in tncc_copy_send_buf()
551 os_free(imc->imc_send); in tncc_copy_send_buf()
552 imc->imc_send = NULL; in tncc_copy_send_buf()
553 imc->imc_send_len = 0; in tncc_copy_send_buf()
585 struct tnc_if_imc *imc; in tncc_notify_recommendation() local
602 for (imc = tncc->imc; imc; imc = imc->next) in tncc_notify_recommendation()
603 tncc_imc_notify_connection_change(imc, state); in tncc_notify_recommendation()
887 struct tnc_if_imc *imc, *last; in tncc_read_config_reg() local
890 last = tncc->imc; in tncc_read_config_reg()
967 imc = os_zalloc(sizeof(*imc)); in tncc_read_config_reg()
968 if (imc == NULL) { in tncc_read_config_reg()
973 imc->imcID = j; in tncc_read_config_reg()
976 imc->name = os_strdup((char *) name); in tncc_read_config_reg()
977 imc->path = os_strdup((char *) val); in tncc_read_config_reg()
982 tncc->imc = imc; in tncc_read_config_reg()
984 last->next = imc; in tncc_read_config_reg()
985 last = imc; in tncc_read_config_reg()
987 tnc_imc[imc->imcID] = imc; in tncc_read_config_reg()
1008 struct tnc_if_imc *imc; in tncc_parse_imc() local
1021 imc = os_zalloc(sizeof(*imc)); in tncc_parse_imc()
1022 if (imc == NULL) { in tncc_parse_imc()
1027 imc->imcID = i; in tncc_parse_imc()
1034 os_free(imc); in tncc_parse_imc()
1045 os_free(imc); in tncc_parse_imc()
1050 imc->name = os_strdup(pos); in tncc_parse_imc()
1056 os_free(imc->name); in tncc_parse_imc()
1057 os_free(imc); in tncc_parse_imc()
1063 imc->path = os_strdup(pos); in tncc_parse_imc()
1064 tnc_imc[imc->imcID] = imc; in tncc_parse_imc()
1066 return imc; in tncc_parse_imc()
1074 struct tnc_if_imc *imc, *last; in tncc_read_config() local
1096 imc = tncc_parse_imc(pos + 4, line_end, &error); in tncc_read_config()
1101 if (imc) { in tncc_read_config()
1103 tncc->imc = imc; in tncc_read_config()
1105 last->next = imc; in tncc_read_config()
1106 last = imc; in tncc_read_config()
1122 struct tnc_if_imc *imc; in tncc_init() local
1138 for (imc = tncc->imc; imc; imc = imc->next) { in tncc_init()
1139 if (tncc_load_imc(imc)) { in tncc_init()
1141 imc->name); in tncc_init()
1156 struct tnc_if_imc *imc, *prev; in tncc_deinit() local
1158 imc = tncc->imc; in tncc_deinit()
1159 while (imc) { in tncc_deinit()
1160 tncc_unload_imc(imc); in tncc_deinit()
1162 prev = imc; in tncc_deinit()
1163 imc = imc->next; in tncc_deinit()