Removed strayed code fragment
[strongswan.git] / src / charon / network / socket.h
1 /*
2 * Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
3 * Copyright (C) 2005-2010 Martin Willi
4 * Copyright (C) 2005 Jan Hutter
5 * Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 /**
19 * @defgroup socket socket
20 * @{ @ingroup network
21 */
22
23 #ifndef SOCKET_H_
24 #define SOCKET_H_
25
26 typedef struct socket_t socket_t;
27
28 #include <library.h>
29 #include <network/packet.h>
30 #include <utils/enumerator.h>
31
32 /**
33 * Socket interface definition.
34 */
35 struct socket_t {
36
37 /**
38 * Receive a packet.
39 *
40 * Reads a packet from the socket and sets source/dest
41 * appropriately.
42 *
43 * @param packet pinter gets address from allocated packet_t
44 * @return
45 * - SUCCESS when packet successfully received
46 * - FAILED when unable to receive
47 */
48 status_t (*receive) (socket_t *this, packet_t **packet);
49
50 /**
51 * Send a packet.
52 *
53 * Sends a packet to the net using source and destination addresses of
54 * the packet.
55 *
56 * @param packet packet_t to send
57 * @return
58 * - SUCCESS when packet successfully sent
59 * - FAILED when unable to send
60 */
61 status_t (*send) (socket_t *this, packet_t *packet);
62 };
63
64 #endif /** SOCKET_H_ @}*/