- fixed bad bugs in kernel interface
[strongswan.git] / Source / charon / threads / receiver.h
1 /**
2 * @file receiver.h
3 *
4 * @brief Interface of receiver_t.
5 *
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
26 #include <types.h>
27
28
29 typedef struct receiver_t receiver_t;
30
31 /**
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
35 * data is available, a packet_t object is created , wrapped
36 * in an incoming_packet_job_t and added to the job queue.
37 *
38 * @b Constructors:
39 * - receiver_create()
40 *
41 * @ingroup threads
42 */
43 struct receiver_t {
44
45 /**
46 * @brief Destroys a receiver_t object.
47 *
48 * @param receiver receiver object
49 */
50 void (*destroy) (receiver_t *receiver);
51 };
52
53 /**
54 * @brief Create a receiver_t object.
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
60 * - receiver_t object
61 * - NULL of thread could not be started
62 *
63 * @ingroup threads
64 */
65 receiver_t * receiver_create();
66
67 #endif /*RECEIVER_H_*/