2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "dhcp_plugin.h"
21 #include "dhcp_socket.h"
22 #include "dhcp_provider.h"
24 typedef struct private_dhcp_plugin_t private_dhcp_plugin_t
;
27 * private data of dhcp plugin
29 struct private_dhcp_plugin_t
{
32 * implements plugin interface
37 * DHCP communication socket
39 dhcp_socket_t
*socket
;
44 dhcp_provider_t
*provider
;
47 METHOD(plugin_t
, destroy
, void,
48 private_dhcp_plugin_t
*this)
50 hydra
->attributes
->remove_provider(hydra
->attributes
,
51 &this->provider
->provider
);
52 this->provider
->destroy(this->provider
);
53 this->socket
->destroy(this->socket
);
60 plugin_t
*dhcp_plugin_create()
62 private_dhcp_plugin_t
*this;
65 .public.plugin
.destroy
= _destroy
,
66 .socket
= dhcp_socket_create(),
75 this->provider
= dhcp_provider_create(this->socket
);
76 hydra
->attributes
->add_provider(hydra
->attributes
,
77 &this->provider
->provider
);
79 return &this->public.plugin
;