aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/network/socket.h
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2010-10-15 17:24:23 +0200
committerTobias Brunner <tobias@strongswan.org>2010-10-15 17:30:21 +0200
commitfa208494319efd0bc48fa63bfff9dac9bef84a55 (patch)
treecd20dae44e8f03eec2d505400830db0b84a7d656 /src/libcharon/network/socket.h
parent4de8398f931e1777c685710c87ad412bcf6715c4 (diff)
downloadstrongswan-fa208494319efd0bc48fa63bfff9dac9bef84a55.tar.bz2
strongswan-fa208494319efd0bc48fa63bfff9dac9bef84a55.tar.xz
Deferred instantiation of socket implmentations until registration.
Instantiating the implementations on plugin load was problematic in case multiple socket plugins were loaded. Now, the first one registered is instantiated.
Diffstat (limited to 'src/libcharon/network/socket.h')
-rw-r--r--src/libcharon/network/socket.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/libcharon/network/socket.h b/src/libcharon/network/socket.h
index 5c5a4edfb..51b26920f 100644
--- a/src/libcharon/network/socket.h
+++ b/src/libcharon/network/socket.h
@@ -1,6 +1,7 @@
/*
- * Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
+ * Copyright (C) 2006-2010 Tobias Brunner
* Copyright (C) 2005-2010 Martin Willi
+ * Copyright (C) 2006 Daniel Roethlisberger
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -30,6 +31,11 @@ typedef struct socket_t socket_t;
#include <utils/enumerator.h>
/**
+ * Constructor prototype for sockets.
+ */
+typedef socket_t *(*socket_constructor_t)();
+
+/**
* Socket interface definition.
*/
struct socket_t {
@@ -42,8 +48,8 @@ struct socket_t {
*
* @param packet pinter gets address from allocated packet_t
* @return
- * - SUCCESS when packet successfully received
- * - FAILED when unable to receive
+ * - SUCCESS when packet successfully received
+ * - FAILED when unable to receive
*/
status_t (*receive) (socket_t *this, packet_t **packet);
@@ -55,10 +61,15 @@ struct socket_t {
*
* @param packet packet_t to send
* @return
- * - SUCCESS when packet successfully sent
- * - FAILED when unable to send
+ * - SUCCESS when packet successfully sent
+ * - FAILED when unable to send
*/
status_t (*send) (socket_t *this, packet_t *packet);
+
+ /**
+ * Destroy a socket implementation.
+ */
+ void (*destroy) (socket_t *this);
};
#endif /** SOCKET_H_ @}*/