static bool load_hooks()
{
enumerator_t *enumerator;
- char *name, buf[64];
- hook_t *(*create)(void);
+ char *name, *pos, buf[64];
+ hook_t *(*create)(char*);
hook_t *hook;
enumerator = conftest->test->create_section_enumerator(conftest->test,
"hooks");
while (enumerator->enumerate(enumerator, &name))
{
- snprintf(buf, sizeof(buf), "%s_hook_create", name);
+ pos = strchr(name, '-');
+ if (pos)
+ {
+ snprintf(buf, sizeof(buf), "%.*s_hook_create", pos - name, name);
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf), "%s_hook_create", name);
+ }
create = dlsym(RTLD_DEFAULT, buf);
if (create)
{
- hook = create();
+ hook = create(name);
if (hook)
{
conftest->hooks->insert_last(conftest->hooks, hook);
/**
* Create the IKE_AUTH fill hook
*/
-hook_t *add_notify_hook_create(void)
+hook_t *add_notify_hook_create(char *name)
{
private_add_notify_t *this;
.destroy = _destroy,
},
.req = conftest->test->get_bool(conftest->test,
- "hooks.add_notify.request", TRUE),
+ "hooks.%s.request", TRUE, name),
.id = conftest->test->get_int(conftest->test,
- "hooks.add_notify.id", 0),
+ "hooks.%s.id", 0, name),
.type = conftest->test->get_str(conftest->test,
- "hooks.add_notify.type", ""),
+ "hooks.%s.type", "", name),
.data = conftest->test->get_str(conftest->test,
- "hooks.add_notify.data", ""),
+ "hooks.%s.data", "", name),
.spi = conftest->test->get_int(conftest->test,
- "hooks.add_notify.spi", 0),
+ "hooks.%s.spi", 0, name),
.esp = conftest->test->get_bool(conftest->test,
- "hooks.add_notify.esp", FALSE),
+ "hooks.%s.esp", FALSE, name),
);
return &this->hook;
/**
* Create the ignore_message hook
*/
-hook_t *ignore_message_hook_create(void)
+hook_t *ignore_message_hook_create(char *name)
{
private_ignore_message_t *this;
.destroy = _destroy,
},
.in = conftest->test->get_bool(conftest->test,
- "hooks.ignore_message.inbound", TRUE),
+ "hooks.%s.inbound", TRUE, name),
.req = conftest->test->get_bool(conftest->test,
- "hooks.ignore_message.request", TRUE),
+ "hooks.%s.request", TRUE, name),
.id = conftest->test->get_int(conftest->test,
- "hooks.ignore_message.id", 0),
+ "hooks.%s.id", 0, name),
);
return &this->hook;
/**
* Create the IKE_AUTH fill hook
*/
-hook_t *ike_auth_fill_hook_create(void)
+hook_t *ike_auth_fill_hook_create(char *name)
{
private_ike_auth_fill_t *this;
.destroy = _destroy,
},
.req = conftest->test->get_bool(conftest->test,
- "hooks.ike_auth_fill.request", TRUE),
+ "hooks.%s.request", TRUE, name),
.id = conftest->test->get_int(conftest->test,
- "hooks.ike_auth_fill.id", 1),
+ "hooks.%s.id", 1, name),
.bytes = conftest->test->get_int(conftest->test,
- "hooks.ike_auth_fill.bytes", 0),
+ "hooks.%s.bytes", 0, name),
);
return &this->hook;
/**
* Create the IKE_AUTH fill hook
*/
-hook_t *unencrypted_notify_hook_create(void)
+hook_t *unencrypted_notify_hook_create(char *name)
{
private_unencrypted_notify_t *this;
.destroy = _destroy,
},
.id = conftest->test->get_int(conftest->test,
- "hooks.unencrypted_notify.id", 2),
+ "hooks.%s.id", 2, name),
.type = conftest->test->get_str(conftest->test,
- "hooks.unencrypted_notify.type", ""),
+ "hooks.%s.type", "", name),
.data = conftest->test->get_str(conftest->test,
- "hooks.unencrypted_notify.data", ""),
+ "hooks.%s.data", "", name),
.spi = conftest->test->get_int(conftest->test,
- "hooks.unencrypted_notify.spi", 0),
+ "hooks.%s.spi", 0, name),
.esp = conftest->test->get_bool(conftest->test,
- "hooks.unencrypted_notify.esp", FALSE),
+ "hooks.%s.esp", FALSE, name),
);
return &this->hook;
/**
* Create the IKE_AUTH fill hook
*/
-hook_t *unsort_message_hook_create(void)
+hook_t *unsort_message_hook_create(char *name)
{
private_unsort_message_t *this;
.destroy = _destroy,
},
.req = conftest->test->get_bool(conftest->test,
- "hooks.unsort_message.request", TRUE),
+ "hooks.%s.request", TRUE, name),
.id = conftest->test->get_int(conftest->test,
- "hooks.unsort_message.id", 0),
+ "hooks.%s.id", 0, name),
.order = conftest->test->get_str(conftest->test,
- "hooks.unsort_message.order", ""),
+ "hooks.%s.order", "", name),
);
return &this->hook;