]>
Commit | Line | Data |
---|---|---|
da6f7756 JH |
1 | /** |
2 | * @file sender.h | |
c3dc6f1a | 3 | * |
ca76df97 | 4 | * @brief Interface of sender_t. |
c3dc6f1a | 5 | * |
da6f7756 JH |
6 | */ |
7 | ||
8 | /* | |
4deb8948 | 9 | * Copyright (C) 2005-2007 Martin Willi |
c71d53ba | 10 | * Copyright (C) 2005 Jan Hutter |
da6f7756 JH |
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 | ||
5796aa16 MW |
27 | typedef struct sender_t sender_t; |
28 | ||
db7ef624 | 29 | #include <library.h> |
4deb8948 | 30 | #include <network/packet.h> |
382b4817 | 31 | |
da6f7756 | 32 | /** |
f1046648 JH |
33 | * @brief Thread responsible for sending packets over the socket. |
34 | * | |
35 | * @b Constructors: | |
36 | * - sender_create() | |
ca76df97 MW |
37 | * |
38 | * @ingroup threads | |
da6f7756 | 39 | */ |
5796aa16 | 40 | struct sender_t { |
4deb8948 MW |
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 things 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 | ||
da6f7756 | 54 | /** |
f1046648 | 55 | * @brief Destroys a sender object. |
c3dc6f1a | 56 | * |
4deb8948 | 57 | * @param this calling object |
da6f7756 | 58 | */ |
4deb8948 | 59 | void (*destroy) (sender_t *this); |
da6f7756 JH |
60 | }; |
61 | ||
ca76df97 MW |
62 | /** |
63 | * @brief Create the sender thread. | |
64 | * | |
65 | * The thread will start to work, getting packets | |
4deb8948 | 66 | * from its queue and sends them out. |
ca76df97 | 67 | * |
4deb8948 | 68 | * @return created sender object |
ca76df97 MW |
69 | * |
70 | * @ingroup threads | |
71 | */ | |
f768bdc3 | 72 | sender_t * sender_create(void); |
da6f7756 JH |
73 | |
74 | #endif /*SENDER_H_*/ |