|
5 | 5 | * \brief Configuration parser (header file) |
6 | 6 | */ |
7 | 7 | /* Copyright (C) 2018 CESNET, z.s.p.o. |
8 | | -* |
9 | | -* Redistribution and use in source and binary forms, with or without |
10 | | -* modification, are permitted provided that the following conditions |
11 | | -* are met: |
12 | | -* 1. Redistributions of source code must retain the above copyright |
13 | | -* notice, this list of conditions and the following disclaimer. |
14 | | -* 2. Redistributions in binary form must reproduce the above copyright |
15 | | -* notice, this list of conditions and the following disclaimer in |
16 | | -* the documentation and/or other materials provided with the |
17 | | -* distribution. |
18 | | -* 3. Neither the name of the Company nor the names of its contributors |
19 | | -* may be used to endorse or promote products derived from this |
20 | | -* software without specific prior written permission. |
21 | | -* |
22 | | -* ALTERNATIVELY, provided that this notice is retained in full, this |
23 | | -* product may be distributed under the terms of the GNU General Public |
24 | | -* License (GPL) version 2 or later, in which case the provisions |
25 | | -* of the GPL apply INSTEAD OF those given above. |
26 | | -* |
27 | | -* This software is provided ``as is, and any express or implied |
28 | | -* warranties, including, but not limited to, the implied warranties of |
29 | | -* merchantability and fitness for a particular purpose are disclaimed. |
30 | | -* In no event shall the company or contributors be liable for any |
31 | | -* direct, indirect, incidental, special, exemplary, or consequential |
32 | | -* damages (including, but not limited to, procurement of substitute |
33 | | -* goods or services; loss of use, data, or profits; or business |
34 | | -* interruption) however caused and on any theory of liability, whether |
35 | | -* in contract, strict liability, or tort (including negligence or |
36 | | -* otherwise) arising in any way out of the use of this software, even |
37 | | -* if advised of the possibility of such damage. |
38 | | -*/ |
| 8 | + * |
| 9 | + * Redistribution and use in source and binary forms, with or without |
| 10 | + * modification, are permitted provided that the following conditions |
| 11 | + * are met: |
| 12 | + * 1. Redistributions of source code must retain the above copyright |
| 13 | + * notice, this list of conditions and the following disclaimer. |
| 14 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | + * notice, this list of conditions and the following disclaimer in |
| 16 | + * the documentation and/or other materials provided with the |
| 17 | + * distribution. |
| 18 | + * 3. Neither the name of the Company nor the names of its contributors |
| 19 | + * may be used to endorse or promote products derived from this |
| 20 | + * software without specific prior written permission. |
| 21 | + * |
| 22 | + * ALTERNATIVELY, provided that this notice is retained in full, this |
| 23 | + * product may be distributed under the terms of the GNU General Public |
| 24 | + * License (GPL) version 2 or later, in which case the provisions |
| 25 | + * of the GPL apply INSTEAD OF those given above. |
| 26 | + * |
| 27 | + * This software is provided ``as is, and any express or implied |
| 28 | + * warranties, including, but not limited to, the implied warranties of |
| 29 | + * merchantability and fitness for a particular purpose are disclaimed. |
| 30 | + * In no event shall the company or contributors be liable for any |
| 31 | + * direct, indirect, incidental, special, exemplary, or consequential |
| 32 | + * damages (including, but not limited to, procurement of substitute |
| 33 | + * goods or services; loss of use, data, or profits; or business |
| 34 | + * interruption) however caused and on any theory of liability, whether |
| 35 | + * in contract, strict liability, or tort (including negligence or |
| 36 | + * otherwise) arising in any way out of the use of this software, even |
| 37 | + * if advised of the possibility of such damage. |
| 38 | + */ |
39 | 39 |
|
40 | 40 | #ifndef CONFIGURATION_H |
41 | 41 | #define CONFIGURATION_H |
|
58 | 58 | * where the channel belongs. |
59 | 59 | */ |
60 | 60 | struct conf_params { |
61 | | - ipx_ctx_t *ctx; /**< Context of the instance (only for log!) */ |
| 61 | + /** |
| 62 | + * Context of the instance (only for log!) |
| 63 | + */ |
| 64 | + ipx_ctx_t *ctx; |
62 | 65 |
|
63 | 66 | /** |
64 | 67 | * TRAP interface type, e.g. t is for TCP, see https://nemea.liberouter.org/trap-ifcspec/ |
@@ -91,36 +94,32 @@ struct conf_params { |
91 | 94 | * all fields must be contained in unirec-elements.txt |
92 | 95 | */ |
93 | 96 | char *unirec_format; |
94 | | - |
95 | | - /** |
96 | | - * A bit map representing the UR template that has all required fields set to 1. |
97 | | - */ |
98 | | - uint64_t bitmap_required; |
99 | | - |
100 | | - /** |
101 | | - * A bit map representing the UR template with all fields that were not filled set to 1. |
102 | | - * |
103 | | - * Index of a field in bitmap_required and bitmap_tofill can be the same as in ur_template_t. |
104 | | - */ |
105 | | - uint64_t bitmap_tofill; |
106 | 97 | }; |
107 | 98 |
|
108 | 99 | /** |
109 | 100 | * \brief Parse the plugin configuration |
110 | 101 | * |
111 | 102 | * \warning The configuration MUST be free by configuration_free() function. |
| 103 | + * \param[in,out] ctx IPFIXcol2 context for output messages |
112 | 104 | * \param[in] params XML configuration |
113 | 105 | * \return On success returns a pointer to the configuration. Otherwise returns |
114 | 106 | * NULL. |
115 | 107 | */ |
116 | | -struct conf_params * |
117 | | -configuration_parse(ipx_ctx_t *ctx, const char *params); |
| 108 | +struct conf_params *configuration_parse(ipx_ctx_t *ctx, const char *params); |
118 | 109 |
|
119 | 110 | /** |
120 | 111 | * \brief Destroy the plugin configuration |
121 | 112 | * \param[in,out] config Configuration |
122 | 113 | */ |
123 | | -void |
124 | | -configuration_free(struct conf_params *config); |
| 114 | +void configuration_free(struct conf_params *config); |
| 115 | + |
| 116 | +/** |
| 117 | + * Concatenate arguments from parsed configuration and create ifc_spec for trap_init() |
| 118 | + * \param[in,out] ctx IPFIXcol2 context for output messages |
| 119 | + * \param[in] parsed_params Information from configuration file |
| 120 | + * \return IFC specifier that can be passed to trap_*init() |
| 121 | + */ |
| 122 | +char *configuration_create_ifcspec(ipx_ctx_t *ctx, const struct conf_params *parsed_params); |
125 | 123 |
|
126 | 124 | #endif // CONFIGURATION_H |
| 125 | + |
0 commit comments