Added socket plugin feature loading callback
This commit is contained in:
@@ -39,10 +39,9 @@ encoding/payloads/ts_payload.c encoding/payloads/ts_payload.h \
|
|||||||
encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \
|
encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \
|
||||||
encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \
|
encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \
|
||||||
kernel/kernel_handler.c kernel/kernel_handler.h \
|
kernel/kernel_handler.c kernel/kernel_handler.h \
|
||||||
network/packet.c network/packet.h \
|
network/receiver.c network/receiver.h network/sender.c network/sender.h \
|
||||||
network/receiver.c network/receiver.h \
|
network/packet.c network/packet.h network/socket.c network/socket.h \
|
||||||
network/sender.c network/sender.h \
|
network/socket_manager.c network/socket_manager.h \
|
||||||
network/socket_manager.c network/socket_manager.h network/socket.h \
|
|
||||||
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
|
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
|
||||||
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
|
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
|
||||||
processing/jobs/delete_ike_sa_job.c processing/jobs/delete_ike_sa_job.h \
|
processing/jobs/delete_ike_sa_job.c processing/jobs/delete_ike_sa_job.h \
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Martin Willi
|
||||||
|
* Copyright (C) 2011 revosec AG
|
||||||
|
*
|
||||||
|
* 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 "socket.h"
|
||||||
|
|
||||||
|
#include <daemon.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See header
|
||||||
|
*/
|
||||||
|
bool socket_register(plugin_t *plugin, plugin_feature_t *feature,
|
||||||
|
bool reg, void *data)
|
||||||
|
{
|
||||||
|
if (reg)
|
||||||
|
{
|
||||||
|
charon->socket->add_socket(charon->socket, (socket_constructor_t)data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
charon->socket->remove_socket(charon->socket,
|
||||||
|
(socket_constructor_t)data);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ typedef struct socket_t socket_t;
|
|||||||
#include <library.h>
|
#include <library.h>
|
||||||
#include <network/packet.h>
|
#include <network/packet.h>
|
||||||
#include <utils/enumerator.h>
|
#include <utils/enumerator.h>
|
||||||
|
#include <plugins/plugin.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor prototype for sockets.
|
* Constructor prototype for sockets.
|
||||||
@@ -72,4 +73,18 @@ struct socket_t {
|
|||||||
void (*destroy) (socket_t *this);
|
void (*destroy) (socket_t *this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to (un-)register socket interfaces from plugin features.
|
||||||
|
*
|
||||||
|
* This function is a plugin_feature_callback_t and can be used with the
|
||||||
|
* PLUGIN_CALLBACK macro to register an socket interface constructor.
|
||||||
|
*
|
||||||
|
* @param plugin plugin registering the socket interface
|
||||||
|
* @param feature associated plugin feature
|
||||||
|
* @param reg TRUE to register, FALSE to unregister
|
||||||
|
* @param data data passed to callback, a socket_constructor_t
|
||||||
|
*/
|
||||||
|
bool socket_register(plugin_t *plugin, plugin_feature_t *feature,
|
||||||
|
bool reg, void *data);
|
||||||
|
|
||||||
#endif /** SOCKET_H_ @}*/
|
#endif /** SOCKET_H_ @}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user