Removed strayed code fragment
[strongswan.git] / src / charon / network / socket_manager.h
1 /*
2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
4 *
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>.
9 *
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
13 * for more details.
14 */
15
16 /**
17 * @defgroup socket_manager socket_manager
18 * @{ @ingroup network
19 */
20
21 #ifndef SOCKET_MANAGER_H_
22 #define SOCKET_MANAGER_H_
23
24 #include <network/socket.h>
25
26 typedef struct socket_manager_t socket_manager_t;
27
28 /**
29 * Handle pluggable socket implementations and send/receive packets through it.
30 */
31 struct socket_manager_t {
32
33 /**
34 * Receive a packet using the registered socket.
35 *
36 * @param packet allocated packet that has been received
37 * @return
38 * - SUCCESS when packet successfully received
39 * - FAILED when unable to receive
40 */
41 status_t (*receive) (socket_manager_t *this, packet_t **packet);
42
43 /**
44 * Send a packet using the registered socket.
45 *
46 * @param packet packet to send out
47 * @return
48 * - SUCCESS when packet successfully sent
49 * - FAILED when unable to send
50 */
51 status_t (*send) (socket_manager_t *this, packet_t *packet);
52
53 /**
54 * Register a socket implementation.
55 */
56 void (*add_socket)(socket_manager_t *this, socket_t *socket);
57
58 /**
59 * Unregister a registered socket implementation.
60 */
61 void (*remove_socket)(socket_manager_t *this, socket_t *socket);
62
63 /**
64 * Destroy a socket_manager_t.
65 */
66 void (*destroy)(socket_manager_t *this);
67 };
68
69 /**
70 * Create a socket_manager instance.
71 */
72 socket_manager_t *socket_manager_create();
73
74 #endif /** SOCKET_MANAGER_H_ @}*/