2 * Copyright (C) 2005-2007 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
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>.
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
18 * @defgroup receiver receiver
25 typedef struct receiver_t receiver_t
;
28 #include <utils/host.h>
31 * Receives packets from the socket and adds them to the job queue.
33 * The receiver starts a thread, wich reads on the blocking socket. A received
34 * packet is preparsed and a process_message_job is queued in the job queue.
36 * To endure DoS attacks, cookies are enabled when to many IKE_SAs are half
37 * open. The calculation of cookies is slightly different from the proposed
38 * method in RFC4306. We do not include a nonce, because we think the advantage
39 * we gain does not justify the overhead to parse the whole message.
40 * Instead of VersionIdOfSecret, we include a timestamp. This allows us to
41 * find out wich key was used for cookie creation. Further, we can set a
42 * lifetime for the cookie, which allows us to reuse the secret for a longer
44 * COOKIE = time | sha1( IPi | SPIi | time | secret )
46 * The secret is changed after a certain amount of cookies sent. The old
47 * secret is stored to allow a clean migration between secret changes.
49 * Further, the number of half-initiated IKE_SAs is limited per peer. This
50 * mades it impossible for a peer to flood the server with its real IP address.
55 * Destroys a receiver_t object.
57 void (*destroy
) (receiver_t
*receiver
);
61 * Create a receiver_t object.
63 * The receiver thread will start working, get data
64 * from the socket and add those packets to the job queue.
66 * @return receiver_t object, NULL if initialization fails
68 receiver_t
* receiver_create(void);
70 #endif /** RECEIVER_H_ @}*/