]>
Commit | Line | Data |
---|---|---|
95f8c9aa JH |
1 | /** |
2 | * @file receiver.h | |
c3dc6f1a | 3 | * |
ca76df97 | 4 | * @brief Interface of receiver_t. |
c3dc6f1a | 5 | * |
95f8c9aa JH |
6 | */ |
7 | ||
8 | /* | |
9 | * Copyright (C) 2005 Jan Hutter, Martin Willi | |
10 | * Hochschule fuer Technik Rapperswil | |
11 | * | |
12 | * This program is free software; you can redistribute it and/or modify it | |
13 | * under the terms of the GNU General Public License as published by the | |
14 | * Free Software Foundation; either version 2 of the License, or (at your | |
15 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
16 | * | |
17 | * This program is distributed in the hope that it will be useful, but | |
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
19 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
20 | * for more details. | |
21 | */ | |
22 | ||
23 | #ifndef RECEIVER_H_ | |
24 | #define RECEIVER_H_ | |
25 | ||
021c2322 | 26 | #include <types.h> |
95f8c9aa | 27 | |
f1046648 | 28 | |
5796aa16 MW |
29 | typedef struct receiver_t receiver_t; |
30 | ||
95f8c9aa | 31 | /** |
ca76df97 MW |
32 | * @brief Receives packets from the socket and adds them to the job queue. |
33 | * | |
34 | * The receiver starts a thread, wich reads on the blocking socket. If | |
f1046648 | 35 | * data is available, a packet_t object is created , wrapped |
ca76df97 MW |
36 | * in an incoming_packet_job_t and added to the job queue. |
37 | * | |
3febcf15 JH |
38 | * @b Constructors: |
39 | * - receiver_create() | |
40 | * | |
ca76df97 | 41 | * @ingroup threads |
95f8c9aa | 42 | */ |
5796aa16 | 43 | struct receiver_t { |
95f8c9aa JH |
44 | |
45 | /** | |
3febcf15 | 46 | * @brief Destroys a receiver_t object. |
c3dc6f1a | 47 | * |
ca76df97 | 48 | * @param receiver receiver object |
95f8c9aa | 49 | */ |
d048df5c | 50 | void (*destroy) (receiver_t *receiver); |
95f8c9aa JH |
51 | }; |
52 | ||
ca76df97 | 53 | /** |
3febcf15 | 54 | * @brief Create a receiver_t object. |
ca76df97 MW |
55 | * |
56 | * The receiver thread will start working, get data | |
57 | * from the socket and add those packets to the job queue. | |
58 | * | |
59 | * @return | |
3febcf15 | 60 | * - receiver_t object |
ca76df97 MW |
61 | * - NULL of thread could not be started |
62 | * | |
63 | * @ingroup threads | |
64 | */ | |
95f8c9aa JH |
65 | receiver_t * receiver_create(); |
66 | ||
67 | #endif /*RECEIVER_H_*/ |