Annotation of embedaddon/strongswan/src/libcharon/tests/utils/mock_sender.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2016 Tobias Brunner
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * sender_t implementation that does not pass the sent packet to a socket but
18: * instead provides it for immediate delivery to an ike_sa_t object.
19: *
20: * @defgroup mock_sender mock_sender
21: * @{ @ingroup test_utils_c
22: */
23:
24: #ifndef MOCK_SENDER_H_
25: #define MOCK_SENDER_H_
26:
27: #include <encoding/message.h>
28: #include <network/sender.h>
29:
30: typedef struct mock_sender_t mock_sender_t;
31:
32: struct mock_sender_t {
33:
34: /**
35: * Implemented interface
36: */
37: sender_t interface;
38:
39: /**
40: * Remove the next packet in the send queue as message_t object. The IKE
41: * header is already parsed (which is assumed does not fail) so it can
42: * directly be passed to ike_sa_t::process_message().
43: *
44: * @return message or NULL if none is queued
45: */
46: message_t *(*dequeue)(mock_sender_t *this);
47: };
48:
49: /**
50: * Creates a mock_sender_t instance.
51: *
52: * @return created object
53: */
54: mock_sender_t *mock_sender_create();
55:
56: #endif /** MOCK_SENDER_H_ @} */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>