diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-07-06 11:36:58 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-09-02 19:01:23 +0200 |
commit | 09ae31f13a65e4946d5e71ffd635af62b1695e1c (patch) | |
tree | 0b07adaefa92f328b924a8d770fba36bb3b6b1c7 /src/libcharon/kernel/kernel_handler.c | |
parent | f7f3d87ed7206f8b5f8cdb2b2de6f3d657ca6426 (diff) | |
download | strongswan-09ae31f13a65e4946d5e71ffd635af62b1695e1c.tar.bz2 strongswan-09ae31f13a65e4946d5e71ffd635af62b1695e1c.tar.xz |
Added kernel event handler stub.
Diffstat (limited to 'src/libcharon/kernel/kernel_handler.c')
-rw-r--r-- | src/libcharon/kernel/kernel_handler.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/libcharon/kernel/kernel_handler.c b/src/libcharon/kernel/kernel_handler.c new file mode 100644 index 000000000..0e967fe5f --- /dev/null +++ b/src/libcharon/kernel/kernel_handler.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Tobias Brunner + * Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "kernel_handler.h" + +#include <daemon.h> + +typedef struct private_kernel_handler_t private_kernel_handler_t; + +/** + * Private data of a kernel_handler_t object. + */ +struct private_kernel_handler_t { + + /** + * Public part of kernel_handler_t object. + */ + kernel_handler_t public; + +}; + +METHOD(kernel_handler_t, destroy, void, + private_kernel_handler_t *this) +{ + charon->kernel_interface->remove_listener(charon->kernel_interface, + &this->public.listener); + free(this); +} + +kernel_handler_t *kernel_handler_create() +{ + private_kernel_handler_t *this; + + INIT(this, + .public = { + .listener = { + .acquire = NULL, + }, + .destroy = _destroy, + }, + ); + + charon->kernel_interface->add_listener(charon->kernel_interface, + &this->public.listener); + + return &this->public; +} + |