diff options
author | Martin Willi <martin@revosec.ch> | 2010-03-23 17:18:18 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2010-03-25 14:28:28 +0100 |
commit | ddc93db612b51179d8b62da931c2080708c8bd68 (patch) | |
tree | b616eabcd864e2acc97b1ffa8bb8016e59aacc41 /src/libcharon/plugins/dhcp/dhcp_plugin.c | |
parent | beaa048eed92d00aa23547e55be7e6dc8a450206 (diff) | |
download | strongswan-ddc93db612b51179d8b62da931c2080708c8bd68.tar.bz2 strongswan-ddc93db612b51179d8b62da931c2080708c8bd68.tar.xz |
DHCP plugin framework, send DHCP Discover upon IP request
Diffstat (limited to 'src/libcharon/plugins/dhcp/dhcp_plugin.c')
-rw-r--r-- | src/libcharon/plugins/dhcp/dhcp_plugin.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libcharon/plugins/dhcp/dhcp_plugin.c b/src/libcharon/plugins/dhcp/dhcp_plugin.c index 0f7ab041d..e3dae9bb6 100644 --- a/src/libcharon/plugins/dhcp/dhcp_plugin.c +++ b/src/libcharon/plugins/dhcp/dhcp_plugin.c @@ -17,6 +17,9 @@ #include <daemon.h> +#include "dhcp_socket.h" +#include "dhcp_provider.h" + typedef struct private_dhcp_plugin_t private_dhcp_plugin_t; /** @@ -28,11 +31,24 @@ struct private_dhcp_plugin_t { * implements plugin interface */ dhcp_plugin_t public; + + /** + * DHCP communication socket + */ + dhcp_socket_t *socket; + + /** + * Attribute provider + */ + dhcp_provider_t *provider; }; METHOD(plugin_t, destroy, void, private_dhcp_plugin_t *this) { + lib->attributes->remove_provider(lib->attributes, &this->provider->provider); + this->provider->destroy(this->provider); + this->socket->destroy(this->socket); free(this); } @@ -45,8 +61,18 @@ plugin_t *dhcp_plugin_create() INIT(this, .public.plugin.destroy = _destroy, + .socket = dhcp_socket_create(), ); + if (!this->socket) + { + free(this); + return NULL; + } + + this->provider = dhcp_provider_create(this->socket); + lib->attributes->add_provider(lib->attributes, &this->provider->provider); + return &this->public.plugin; } |