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