- revised packet and socket interface
[strongswan.git] / Source / charon / socket.h
1 /**
2 * @file socket.h
3 *
4 * @brief management of sockets
5 *
6 * receiver reads from here, sender writes to here
7 *
8 */
9
10 /*
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 */
24
25 #ifndef SOCKET_H_
26 #define SOCKET_H_
27
28
29 #include "types.h"
30 #include "packet.h"
31
32
33 /**
34 * maximum size of a packet
35 * 3000 Bytes should be sufficient, see IKEv2 draft
36 */
37 #define MAX_PACKET 3000
38
39
40 /**
41 * @brief abstraction of one (ipv4), or in future, of multiple sockets
42 *
43 */
44 typedef struct socket_s socket_t;
45 struct socket_s {
46 /**
47 * @brief
48 *
49 *
50 *
51 * @param
52 * @return
53 */
54 status_t (*receive) (socket_t *sock, packet_t **packet);
55
56 /**
57 * @brief
58 *
59 *
60 *
61 * @param
62 * @return
63 */
64 status_t (*send) (socket_t *sock, packet_t *packet);
65
66 /**
67 * @brief
68 *
69 *
70 *
71 * @param
72 * @return
73 */
74 status_t (*destroy) (socket_t *sock);
75 };
76
77 /**
78 * @brief
79 *
80 * @param
81 * @return
82 */
83 socket_t *socket_create(u_int16_t port);
84
85
86 #endif /*SOCKET_H_*/