2 * Copyright (C) 2012 Martin Willi
3 * Copyright (C) 2012 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 "lookip_plugin.h"
18 #include "lookip_listener.h"
19 #include "lookip_socket.h"
23 typedef struct private_lookip_plugin_t private_lookip_plugin_t
;
26 * private data of lookip plugin
28 struct private_lookip_plugin_t
{
31 * implements plugin interface
33 lookip_plugin_t
public;
36 * Listener collecting virtual IP assignements
38 lookip_listener_t
*listener
;
41 * UNIX socket to serve client queries
43 lookip_socket_t
*socket
;
46 METHOD(plugin_t
, get_name
, char*,
47 private_lookip_plugin_t
*this)
52 METHOD(plugin_t
, destroy
, void,
53 private_lookip_plugin_t
*this)
55 this->socket
->destroy(this->socket
);
56 charon
->bus
->remove_listener(charon
->bus
, &this->listener
->listener
);
57 this->listener
->destroy(this->listener
);
64 plugin_t
*lookip_plugin_create()
66 private_lookip_plugin_t
*this;
71 .get_name
= _get_name
,
72 .reload
= (void*)return_false
,
76 .listener
= lookip_listener_create(),
79 charon
->bus
->add_listener(charon
->bus
, &this->listener
->listener
);
80 this->socket
= lookip_socket_create(this->listener
);
82 return &this->public.plugin
;