]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libcharon/tests/utils/mock_sender.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libcharon / tests / utils / mock_sender.h
1 /*
2 * Copyright (C) 2016 Tobias Brunner
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
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>.
10 *
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
14 * for more details.
15 */
16
17 /**
18 * sender_t implementation that does not pass the sent packet to a socket but
19 * instead provides it for immediate delivery to an ike_sa_t object.
20 *
21 * @defgroup mock_sender mock_sender
22 * @{ @ingroup test_utils_c
23 */
24
25 #ifndef MOCK_SENDER_H_
26 #define MOCK_SENDER_H_
27
28 #include <encoding/message.h>
29 #include <network/sender.h>
30
31 typedef struct mock_sender_t mock_sender_t;
32
33 struct mock_sender_t {
34
35 /**
36 * Implemented interface
37 */
38 sender_t interface;
39
40 /**
41 * Remove the next packet in the send queue as message_t object. The IKE
42 * header is already parsed (which is assumed does not fail) so it can
43 * directly be passed to ike_sa_t::process_message().
44 *
45 * @return message or NULL if none is queued
46 */
47 message_t *(*dequeue)(mock_sender_t *this);
48 };
49
50 /**
51 * Creates a mock_sender_t instance.
52 *
53 * @return created object
54 */
55 mock_sender_t *mock_sender_create();
56
57 #endif /** MOCK_SENDER_H_ @} */