diff options
Diffstat (limited to 'src/libcharon/plugins/tnc_imc')
-rw-r--r-- | src/libcharon/plugins/tnc_imc/Makefile.in | 32 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc.c | 102 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc.h | 26 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c | 2 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc_manager.c | 113 |
5 files changed, 210 insertions, 65 deletions
diff --git a/src/libcharon/plugins/tnc_imc/Makefile.in b/src/libcharon/plugins/tnc_imc/Makefile.in index 00c0d0d61..b21cbb348 100644 --- a/src/libcharon/plugins/tnc_imc/Makefile.in +++ b/src/libcharon/plugins/tnc_imc/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -73,6 +73,12 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(plugindir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES) @MONOLITHIC_FALSE@libstrongswan_tnc_imc_la_DEPENDENCIES = \ @@ -125,6 +131,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLIB = @DLLIB@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -152,6 +159,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQLCFLAG = @MYSQLCFLAG@ MYSQLCONFIG = @MYSQLCONFIG@ @@ -179,6 +187,7 @@ RANLIB = @RANLIB@ RTLIB = @RTLIB@ RUBY = @RUBY@ RUBYINCLUDE = @RUBYINCLUDE@ +RUBYLIB = @RUBYLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -191,6 +200,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -244,7 +254,6 @@ libexecdir = @libexecdir@ linux_headers = @linux_headers@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ maemo_CFLAGS = @maemo_CFLAGS@ maemo_LIBS = @maemo_LIBS@ manager_plugins = @manager_plugins@ @@ -384,7 +393,7 @@ clean-pluginLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libstrongswan-tnc-imc.la: $(libstrongswan_tnc_imc_la_OBJECTS) $(libstrongswan_tnc_imc_la_DEPENDENCIES) +libstrongswan-tnc-imc.la: $(libstrongswan_tnc_imc_la_OBJECTS) $(libstrongswan_tnc_imc_la_DEPENDENCIES) $(EXTRA_libstrongswan_tnc_imc_la_DEPENDENCIES) $(libstrongswan_tnc_imc_la_LINK) $(am_libstrongswan_tnc_imc_la_rpath) $(libstrongswan_tnc_imc_la_OBJECTS) $(libstrongswan_tnc_imc_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -524,10 +533,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.c b/src/libcharon/plugins/tnc_imc/tnc_imc.c index a1f2d770f..9ac578401 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc.c @@ -20,9 +20,10 @@ #include <tncif_pa_subtypes.h> -#include <debug.h> +#include <utils/debug.h> +#include <daemon.h> #include <library.h> -#include <utils/linked_list.h> +#include <collections/linked_list.h> #include <threading/mutex.h> typedef struct private_tnc_imc_t private_tnc_imc_t; @@ -38,11 +39,6 @@ struct private_tnc_imc_t { imc_t public; /** - * Path of loaded IMC - */ - char *path; - - /** * Name of loaded IMC */ char *name; @@ -291,10 +287,10 @@ METHOD(imc_t, type_supported, bool, for (i = 0; i < this->type_count; i++) { - vid = this->supported_vids[i]; - subtype = this->supported_subtypes[i]; + vid = this->supported_vids[i]; + subtype = this->supported_subtypes[i]; - if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) || + if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) || (vid == msg_vid && (subtype == TNC_SUBTYPE_ANY || subtype == msg_subtype))) { @@ -307,20 +303,23 @@ METHOD(imc_t, type_supported, bool, METHOD(imc_t, destroy, void, private_tnc_imc_t *this) { - dlclose(this->handle); + if (this->handle && lib->settings->get_bool(lib->settings, + "%s.plugins.tnc-imc.dlclose", TRUE, charon->name)) + { + dlclose(this->handle); + } this->mutex->destroy(this->mutex); this->additional_ids->destroy(this->additional_ids); free(this->supported_vids); free(this->supported_subtypes); free(this->name); - free(this->path); free(this); } /** - * Described in header. + * Generic constructor */ -imc_t* tnc_imc_create(char *name, char *path) +static private_tnc_imc_t* tnc_imc_create_empty(char *name) { private_tnc_imc_t *this; @@ -335,59 +334,96 @@ imc_t* tnc_imc_create(char *name, char *path) .set_message_types_long = _set_message_types_long, .type_supported = _type_supported, .destroy = _destroy, - }, - .name = name, - .path = path, + }, + .name = strdup(name), .additional_ids = linked_list_create(), .mutex = mutex_create(MUTEX_TYPE_DEFAULT), ); + return this; +} + +/** + * See header + */ +imc_t* tnc_imc_create(char *name, char *path) +{ + private_tnc_imc_t *this; + + this = tnc_imc_create_empty(name); + this->handle = dlopen(path, RTLD_LAZY); if (!this->handle) { DBG1(DBG_TNC, "IMC \"%s\" failed to load: %s", name, dlerror()); - free(this); + destroy(this); return NULL; } this->public.initialize = dlsym(this->handle, "TNC_IMC_Initialize"); if (!this->public.initialize) - { + { DBG1(DBG_TNC, "could not resolve TNC_IMC_Initialize in %s: %s\n", path, dlerror()); - dlclose(this->handle); - free(this); + destroy(this); return NULL; } this->public.notify_connection_change = dlsym(this->handle, "TNC_IMC_NotifyConnectionChange"); - this->public.begin_handshake = dlsym(this->handle, "TNC_IMC_BeginHandshake"); + this->public.begin_handshake = dlsym(this->handle, "TNC_IMC_BeginHandshake"); if (!this->public.begin_handshake) - { + { DBG1(DBG_TNC, "could not resolve TNC_IMC_BeginHandshake in %s: %s\n", path, dlerror()); - dlclose(this->handle); - free(this); + destroy(this); return NULL; } - this->public.receive_message = + this->public.receive_message = dlsym(this->handle, "TNC_IMC_ReceiveMessage"); - this->public.receive_message_long = + this->public.receive_message_long = dlsym(this->handle, "TNC_IMC_ReceiveMessageLong"); - this->public.batch_ending = + this->public.batch_ending = dlsym(this->handle, "TNC_IMC_BatchEnding"); - this->public.terminate = + this->public.terminate = dlsym(this->handle, "TNC_IMC_Terminate"); - this->public.provide_bind_function = + this->public.provide_bind_function = dlsym(this->handle, "TNC_IMC_ProvideBindFunction"); - if (!this->public.provide_bind_function) + if (!this->public.provide_bind_function) { DBG1(DBG_TNC, "could not resolve TNC_IMC_ProvideBindFunction in %s: %s\n", path, dlerror()); - dlclose(this->handle); - free(this); + destroy(this); return NULL; } return &this->public; } + +/** + * See header + */ +imc_t* tnc_imc_create_from_functions(char *name, + TNC_IMC_InitializePointer initialize, + TNC_IMC_NotifyConnectionChangePointer notify_connection_change, + TNC_IMC_BeginHandshakePointer begin_handshake, + TNC_IMC_ReceiveMessagePointer receive_message, + TNC_IMC_ReceiveMessageLongPointer receive_message_long, + TNC_IMC_BatchEndingPointer batch_ending, + TNC_IMC_TerminatePointer terminate, + TNC_IMC_ProvideBindFunctionPointer provide_bind_function) +{ + private_tnc_imc_t *this; + + this = tnc_imc_create_empty(name); + + this->public.initialize = initialize; + this->public.notify_connection_change = notify_connection_change; + this->public.begin_handshake = begin_handshake; + this->public.receive_message = receive_message; + this->public.receive_message_long = receive_message_long; + this->public.batch_ending = batch_ending; + this->public.terminate = terminate; + this->public.provide_bind_function = provide_bind_function; + + return &this->public; +} diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.h b/src/libcharon/plugins/tnc_imc/tnc_imc.h index 10a67f90b..2d4607e77 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc.h +++ b/src/libcharon/plugins/tnc_imc/tnc_imc.h @@ -25,7 +25,7 @@ #include <tnc/imc/imc.h> /** - * Create an Integrity Measurement Collector. + * Create an Integrity Measurement Collector loaded from a library. * * @param name name of the IMC * @param filename path to the dynamic IMC library @@ -33,4 +33,28 @@ */ imc_t* tnc_imc_create(char *name, char *filename); +/** + * Create an Integrity Measurement Collector from a set of IMC functions. + * + * @param name name of the IMC + * @param initialize TNC_IMC_InitializePointer + * @param notify_connection_change TNC_IMC_NotifyConnectionChangePointer + * @param begin_handshake TNC_IMC_BeginHandshakePointer + * @param receive_message TNC_IMC_ReceiveMessagePointer + * @param receive_message_long TNC_IMC_ReceiveMessageLongPointer + * @param batch_ending TNC_IMC_BatchEndingPointer + * @param terminate TNC_IMC_TerminatePointer + * @param provide_bind_function TNC_IMC_ProvideBindFunctionPointer + * @return instance of the imc_t interface + */ +imc_t* tnc_imc_create_from_functions(char *name, + TNC_IMC_InitializePointer initialize, + TNC_IMC_NotifyConnectionChangePointer notify_connection_change, + TNC_IMC_BeginHandshakePointer begin_handshake, + TNC_IMC_ReceiveMessagePointer receive_message, + TNC_IMC_ReceiveMessageLongPointer receive_message_long, + TNC_IMC_BatchEndingPointer batch_ending, + TNC_IMC_TerminatePointer terminate, + TNC_IMC_ProvideBindFunctionPointer provide_bind_function); + #endif /** TNC_IMC_H_ @}*/ diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c index 90a607ccc..26a5ed2b4 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c @@ -17,7 +17,7 @@ #include <tnc/imc/imc_manager.h> #include <tnc/tnccs/tnccs_manager.h> -#include <debug.h> +#include <utils/debug.h> /** * Called by the IMC to inform a TNCC about the set of message types the IMC diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c index 65ec81dae..078f7bc34 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c @@ -19,9 +19,11 @@ #include <tncifimc.h> -#include <utils/linked_list.h> -#include <debug.h> #include <daemon.h> +#include <utils/debug.h> +#include <threading/rwlock.h> +#include <threading/mutex.h> +#include <collections/linked_list.h> typedef struct private_tnc_imc_manager_t private_tnc_imc_manager_t; @@ -41,36 +43,56 @@ struct private_tnc_imc_manager_t { linked_list_t *imcs; /** + * Lock to access IMC list + */ + rwlock_t *lock; + + /** * Next IMC ID to be assigned */ TNC_IMCID next_imc_id; + + /** + * Mutex to access next IMC ID + */ + mutex_t *id_mutex; }; METHOD(imc_manager_t, add, bool, private_tnc_imc_manager_t *this, imc_t *imc) { TNC_Version version; + TNC_IMCID imc_id; + + this->id_mutex->lock(this->id_mutex); + imc_id = this->next_imc_id++; + this->id_mutex->unlock(this->id_mutex); - /* Initialize the module */ - imc->set_id(imc, this->next_imc_id); - if (imc->initialize(imc->get_id(imc), TNC_IFIMC_VERSION_1, - TNC_IFIMC_VERSION_1, &version) != TNC_RESULT_SUCCESS) + imc->set_id(imc, imc_id); + if (imc->initialize(imc_id, TNC_IFIMC_VERSION_1, + TNC_IFIMC_VERSION_1, &version) != TNC_RESULT_SUCCESS) { DBG1(DBG_TNC, "IMC \"%s\" failed to initialize", imc->get_name(imc)); return FALSE; } + this->lock->write_lock(this->lock); this->imcs->insert_last(this->imcs, imc); - this->next_imc_id++; + this->lock->unlock(this->lock); - if (imc->provide_bind_function(imc->get_id(imc), TNC_TNCC_BindFunction) - != TNC_RESULT_SUCCESS) + if (imc->provide_bind_function(imc->get_id(imc), + TNC_TNCC_BindFunction) != TNC_RESULT_SUCCESS) { + if (imc->terminate) + { + imc->terminate(imc->get_id(imc)); + } DBG1(DBG_TNC, "IMC \"%s\" failed to obtain bind function", - imc->get_name(imc)); + imc->get_name(imc)); + this->lock->write_lock(this->lock); this->imcs->remove_last(this->imcs, (void**)&imc); + this->lock->unlock(this->lock); return FALSE; } - return TRUE; } @@ -80,6 +102,7 @@ METHOD(imc_manager_t, remove_, imc_t*, enumerator_t *enumerator; imc_t *imc, *removed_imc = NULL; + this->lock->write_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -91,6 +114,7 @@ METHOD(imc_manager_t, remove_, imc_t*, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); return removed_imc; } @@ -103,18 +127,10 @@ METHOD(imc_manager_t, load, bool, imc = tnc_imc_create(name, path); if (!imc) { - free(name); - free(path); return FALSE; } if (!add(this, imc)) { - if (imc->terminate && - imc->terminate(imc->get_id(imc)) != TNC_RESULT_SUCCESS) - { - DBG1(DBG_TNC, "IMC \"%s\" not terminated successfully", - imc->get_name(imc)); - } imc->destroy(imc); return FALSE; } @@ -122,6 +138,37 @@ METHOD(imc_manager_t, load, bool, return TRUE; } +METHOD(imc_manager_t, load_from_functions, bool, + private_tnc_imc_manager_t *this, char *name, + TNC_IMC_InitializePointer initialize, + TNC_IMC_NotifyConnectionChangePointer notify_connection_change, + TNC_IMC_BeginHandshakePointer begin_handshake, + TNC_IMC_ReceiveMessagePointer receive_message, + TNC_IMC_ReceiveMessageLongPointer receive_message_long, + TNC_IMC_BatchEndingPointer batch_ending, + TNC_IMC_TerminatePointer terminate, + TNC_IMC_ProvideBindFunctionPointer provide_bind_function) +{ + imc_t *imc; + + imc = tnc_imc_create_from_functions(name, + initialize, notify_connection_change, + begin_handshake, receive_message, + receive_message_long, batch_ending, + terminate, provide_bind_function); + if (!imc) + { + return FALSE; + } + if (!add(this, imc)) + { + imc->destroy(imc); + return FALSE; + } + DBG1(DBG_TNC, "IMC %u \"%s\" loaded", imc->get_id(imc), name); + return TRUE; +} + METHOD(imc_manager_t, is_registered, bool, private_tnc_imc_manager_t *this, TNC_IMCID id) { @@ -129,6 +176,7 @@ METHOD(imc_manager_t, is_registered, bool, imc_t *imc; bool found = FALSE; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -139,6 +187,7 @@ METHOD(imc_manager_t, is_registered, bool, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); return found; } @@ -150,13 +199,16 @@ METHOD(imc_manager_t, reserve_id, bool, imc_t *imc; bool found = FALSE; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { - if (imc->get_id(imc)) + if (id == imc->get_id(imc)) { found = TRUE; + this->id_mutex->lock(this->id_mutex); *new_id = this->next_imc_id++; + this->id_mutex->unlock(this->id_mutex); imc->add_id(imc, *new_id); DBG2(DBG_TNC, "additional ID %u reserved for IMC with primary ID %u", *new_id, id); @@ -164,6 +216,7 @@ METHOD(imc_manager_t, reserve_id, bool, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); return found; } @@ -182,6 +235,7 @@ METHOD(imc_manager_t, notify_connection_change, void, enumerator_t *enumerator; imc_t *imc; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -191,6 +245,7 @@ METHOD(imc_manager_t, notify_connection_change, void, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); } METHOD(imc_manager_t, begin_handshake, void, @@ -199,12 +254,14 @@ METHOD(imc_manager_t, begin_handshake, void, enumerator_t *enumerator; imc_t *imc; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { imc->begin_handshake(imc->get_id(imc), id); } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); } METHOD(imc_manager_t, set_message_types, TNC_Result, @@ -216,6 +273,7 @@ METHOD(imc_manager_t, set_message_types, TNC_Result, imc_t *imc; TNC_Result result = TNC_RESULT_FATAL; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -227,6 +285,7 @@ METHOD(imc_manager_t, set_message_types, TNC_Result, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); return result; } @@ -240,6 +299,7 @@ METHOD(imc_manager_t, set_message_types_long, TNC_Result, imc_t *imc; TNC_Result result = TNC_RESULT_FATAL; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -252,6 +312,7 @@ METHOD(imc_manager_t, set_message_types_long, TNC_Result, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); return result; } @@ -271,11 +332,12 @@ METHOD(imc_manager_t, receive_message, void, enumerator_t *enumerator; imc_t *imc; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { if (imc->type_supported(imc, msg_vid, msg_subtype) && - (!excl || (excl && imc->has_id(imc, dst_imc_id)) )) + (!excl || (excl && imc->has_id(imc, dst_imc_id)))) { if (imc->receive_message_long && src_imv_id) { @@ -297,6 +359,8 @@ METHOD(imc_manager_t, receive_message, void, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); + if (!type_supported) { DBG2(DBG_TNC, "message type 0x%06x/0x%08x not supported by any IMC", @@ -310,6 +374,7 @@ METHOD(imc_manager_t, batch_ending, void, enumerator_t *enumerator; imc_t *imc; + this->lock->read_lock(this->lock); enumerator = this->imcs->create_enumerator(this->imcs); while (enumerator->enumerate(enumerator, &imc)) { @@ -319,6 +384,7 @@ METHOD(imc_manager_t, batch_ending, void, } } enumerator->destroy(enumerator); + this->lock->unlock(this->lock); } METHOD(imc_manager_t, destroy, void, @@ -337,6 +403,8 @@ METHOD(imc_manager_t, destroy, void, imc->destroy(imc); } this->imcs->destroy(this->imcs); + this->lock->destroy(this->lock); + this->id_mutex->destroy(this->id_mutex); free(this); } @@ -352,6 +420,7 @@ imc_manager_t* tnc_imc_manager_create(void) .add = _add, .remove = _remove_, /* avoid name conflict with stdio.h */ .load = _load, + .load_from_functions = _load_from_functions, .is_registered = _is_registered, .reserve_id = _reserve_id, .get_preferred_language = _get_preferred_language, @@ -364,6 +433,8 @@ imc_manager_t* tnc_imc_manager_create(void) .destroy = _destroy, }, .imcs = linked_list_create(), + .lock = rwlock_create(RWLOCK_TYPE_DEFAULT), + .id_mutex = mutex_create(MUTEX_TYPE_DEFAULT), .next_imc_id = 1, ); |