Libtrap: Internal development docs  1.16.1
ifc_dummy.h
Go to the documentation of this file.
1 /**
2  * \file ifc_dummy.h
3  * \brief TRAP dummy interfaces (generator and blackhole)
4  * \author Vaclav Bartos <ibartosv@fit.vutbr.cz>
5  * \date 2013
6  * \date 2014
7  */
8 /*
9  * Copyright (C) 2013,2014 CESNET
10  *
11  * LICENSE TERMS
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in
20  * the documentation and/or other materials provided with the
21  * distribution.
22  * 3. Neither the name of the Company nor the names of its contributors
23  * may be used to endorse or promote products derived from this
24  * software without specific prior written permission.
25  *
26  * ALTERNATIVELY, provided that this notice is retained in full, this
27  * product may be distributed under the terms of the GNU General Public
28  * License (GPL) version 2 or later, in which case the provisions
29  * of the GPL apply INSTEAD OF those given above.
30  *
31  * This software is provided ``as is'', and any express or implied
32  * warranties, including, but not limited to, the implied warranties of
33  * merchantability and fitness for a particular purpose are disclaimed.
34  * In no event shall the company or contributors be liable for any
35  * direct, indirect, incidental, special, exemplary, or consequential
36  * damages (including, but not limited to, procurement of substitute
37  * goods or services; loss of use, data, or profits; or business
38  * interruption) however caused and on any theory of liability, whether
39  * in contract, strict liability, or tort (including negligence or
40  * otherwise) arising in any way out of the use of this software, even
41  * if advised of the possibility of such damage.
42  *
43  */
44 #ifndef _TRAP_IFC_DUMMY_H_
45 #define _TRAP_IFC_DUMMY_H_
46 
47 #include "trap_ifc.h"
48 
49 /** Create Generator interface (input ifc).
50  * Receive function of this interface returns always the same data. These data
51  * are given in params on creation.
52  * @param[in] ctx Pointer to the private libtrap context data (#trap_ctx_init()).
53  * @param[in] params Array of n+1 bytes. First byte is equal to n, other bytes
54  * are data the generator should generate.
55  * @param[out] ifc Created interface.
56  * @return Error code (0 on success). Generated interface is returned in ifc.
57  */
58 int create_generator_ifc(trap_ctx_priv_t *ctx, char *params, trap_input_ifc_t *ifc);
59 
60 
61 /** Create Blackhole interface (output ifc).
62  * Send function of this interface does nothing, so everything sent to
63  * a blackhole is dropped.
64  * @param[in] ctx Pointer to the private libtrap context data (#trap_ctx_init()).
65  * @param[in] params Ignored.
66  * @param[out] ifc Created interface.
67  * @return Always returns 0.
68  */
69 int create_blackhole_ifc(trap_ctx_priv_t *ctx, char *params, trap_output_ifc_t *ifc);
70 
71 #endif
int create_generator_ifc(trap_ctx_priv_t *ctx, char *params, trap_input_ifc_t *ifc)
Definition: ifc_dummy.c:113
int create_blackhole_ifc(trap_ctx_priv_t *ctx, char *params, trap_output_ifc_t *ifc)
Definition: ifc_dummy.c:227
Interface of TRAP interfaces.