Add Non-ESP marker in sender and not individual socket plugins.
[strongswan.git] / src / libcharon / network / sender.h
1 /*
2 * Copyright (C) 2005-2007 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup sender sender
19 * @{ @ingroup network
20 */
21
22 #ifndef SENDER_H_
23 #define SENDER_H_
24
25 typedef struct sender_t sender_t;
26
27 #include <library.h>
28 #include <network/packet.h>
29
30 /**
31 * Callback job responsible for sending IKE packets over the socket.
32 */
33 struct sender_t {
34
35 /**
36 * Send a packet over the network.
37 *
38 * This function is non blocking and adds the packet to a queue.
39 * Whenever the sender thread thinks it's good to send the packet,
40 * it'll do so.
41 *
42 * @param packet packet to send
43 */
44 void (*send) (sender_t *this, packet_t *packet);
45
46 /**
47 * Enforce a flush of the send queue.
48 *
49 * This function blocks until all queued packets have been sent.
50 */
51 void (*flush)(sender_t *this);
52
53 /**
54 * Destroys a sender object.
55 */
56 void (*destroy) (sender_t *this);
57 };
58
59 /**
60 * Create the sender thread.
61 *
62 * The thread will start to work, getting packets
63 * from its queue and sends them out.
64 *
65 * @return created sender object
66 */
67 sender_t * sender_create(void);
68
69 #endif /** SENDER_H_ @}*/