/*
- * Copyright (C) 2009 Tobias Brunner
+ * Copyright (C) 2009-2016 Tobias Brunner
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
*
refcount_t ref;
};
+#define MAX_NAMESPACES 5
+
+/**
+ * Additional namespaces registered using __atrribute__((constructor))
+ */
+static char *namespaces[MAX_NAMESPACES];
+static int ns_count;
+
+/**
+ * Described in header
+ */
+void library_add_namespace(char *ns)
+{
+ if (ns_count < MAX_NAMESPACES - 1)
+ {
+ namespaces[ns_count] = ns;
+ ns_count++;
+ }
+ else
+ {
+ fprintf(stderr, "failed to register additional namespace alias, please "
+ "increase MAX_NAMESPACES");
+ }
+}
+
/**
* library instance
*/
{
private_library_t *this;
printf_hook_t *pfh;
+ int i;
if (lib)
{ /* already initialized, increase refcount */
(hashtable_equals_t)equals, 4);
this->public.settings = settings_create(this->public.conf);
+ /* add registered aliases */
+ for (i = 0; i < ns_count; ++i)
+ {
+ lib->settings->add_fallback(lib->settings, lib->ns, namespaces[i]);
+ }
/* all namespace settings may fall back to libstrongswan */
lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan");
/*
- * Copyright (C) 2010-2014 Tobias Brunner
+ * Copyright (C) 2010-2016 Tobias Brunner
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
*
*/
extern library_t *lib;
+/**
+ * Add additional names used as alias for the namespace registered with
+ * library_init().
+ *
+ * To be called from __attribute__((constructor)) functions.
+ *
+ * @param ns additional namespace
+ */
+void library_add_namespace(char *ns);
+
#endif /** LIBRARY_H_ @}*/