| 1 | /* SPDX-License-Identifier: BSD-2-Clause */cxx . . $ `<file>/src/config.h`/ |
| 2 | /* |
| 3 | * Copyright (C) 2020-2025 Linutronix GmbH |
| 4 | * Author Kurt Kanzenbach <[email protected]> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _CONFIG_H_ |
| 8 | #define _CONFIG_H_cxx . . $ `src/config.h:8:9`! |
| 9 | |
| 10 | #include <stdbool.h> |
| 11 | #include <stddef.h> |
| 12 | #include <stdint.h> |
| 13 | #include <string.h> |
| 14 | #include <strings.h> |
| 15 | #include <time.h> |
| 16 | |
| 17 | #include <linux/if_ether.h> |
| 18 | #include <net/if.h> |
| 19 | #include <sys/ioctl.h> |
| 20 | |
| 21 | #include "app_config.h"cxx . . $ `<file>/build/app_config.h`/ |
| 22 | |
| 23 | #include "security.h"cxx . . $ `<file>/src/security.h`/ |
| 24 | #include "stat.h"cxx . . $ `<file>/src/stat.h`/ |
| 25 | |
| 26 | struct traffic_class_configcxx . . $ traffic_class_config# { |
| 27 | /* General */ |
| 28 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enabledcxx . . $ traffic_class_config#enabled.; |
| 29 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled.; |
| 30 | char *namecxx . . $ traffic_class_config#name.; |
| 31 | size_tcxx . . $ size_t# name_lengthcxx . . $ traffic_class_config#name_length.; |
| 32 | |
| 33 | /* Network settings */ |
| 34 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xdp_enabledcxx . . $ traffic_class_config#xdp_enabled.; |
| 35 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xdp_skb_modecxx . . $ traffic_class_config#xdp_skb_mode.; |
| 36 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xdp_zc_modecxx . . $ traffic_class_config#xdp_zc_mode.; |
| 37 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xdp_wakeup_modecxx . . $ traffic_class_config#xdp_wakeup_mode.; |
| 38 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xdp_busy_poll_modecxx . . $ traffic_class_config#xdp_busy_poll_mode.; |
| 39 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_time_enabledcxx . . $ traffic_class_config#tx_time_enabled.; |
| 40 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.; |
| 41 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ignore_rx_errorscxx . . $ traffic_class_config#ignore_rx_errors.; |
| 42 | uint64_tcxx . . $ uint64_t# tx_time_offset_nscxx . . $ traffic_class_config#tx_time_offset_ns.; |
| 43 | uint64_tcxx . . $ uint64_t# burst_period_nscxx . . $ traffic_class_config#burst_period_ns.; |
| 44 | |
| 45 | /* Traffic class settings */ |
| 46 | unsigned int ether_typecxx . . $ traffic_class_config#ether_type.; |
| 47 | int vidcxx . . $ traffic_class_config#vid.; |
| 48 | int pcpcxx . . $ traffic_class_config#pcp.; |
| 49 | size_tcxx . . $ size_t# num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.; |
| 50 | char *payload_patterncxx . . $ traffic_class_config#payload_pattern.; |
| 51 | size_tcxx . . $ size_t# payload_pattern_lengthcxx . . $ traffic_class_config#payload_pattern_length.; |
| 52 | size_tcxx . . $ size_t# frame_lengthcxx . . $ traffic_class_config#frame_length.; |
| 53 | int rx_queuecxx . . $ traffic_class_config#rx_queue.; |
| 54 | int tx_queuecxx . . $ traffic_class_config#tx_queue.; |
| 55 | |
| 56 | /* Layer 2/3 settings */ |
| 57 | char interfacecxx . . $ traffic_class_config#interface.[IF_NAMESIZEcxx . . $ `<external>/2638090476884991293/if.h:31:9`!]; |
| 58 | unsigned char l2_destinationcxx . . $ traffic_class_config#l2_destination.[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!]; |
| 59 | char *l3_portcxx . . $ traffic_class_config#l3_port.; |
| 60 | size_tcxx . . $ size_t# l3_port_lengthcxx . . $ traffic_class_config#l3_port_length.; |
| 61 | char *l3_destinationcxx . . $ traffic_class_config#l3_destination.; |
| 62 | size_tcxx . . $ size_t# l3_destination_lengthcxx . . $ traffic_class_config#l3_destination_length.; |
| 63 | char *l3_sourcecxx . . $ traffic_class_config#l3_source.; |
| 64 | size_tcxx . . $ size_t# l3_source_lengthcxx . . $ traffic_class_config#l3_source_length.; |
| 65 | |
| 66 | /* Security settings */ |
| 67 | enum security_modecxx . . $ security_mode# security_modecxx . . $ traffic_class_config#security_mode.; |
| 68 | enum security_algorithmcxx . . $ security_algorithm# security_algorithmcxx . . $ traffic_class_config#security_algorithm.; |
| 69 | char *security_keycxx . . $ traffic_class_config#security_key.; |
| 70 | size_tcxx . . $ size_t# security_key_lengthcxx . . $ traffic_class_config#security_key_length.; |
| 71 | char *security_iv_prefixcxx . . $ traffic_class_config#security_iv_prefix.; |
| 72 | size_tcxx . . $ size_t# security_iv_prefix_lengthcxx . . $ traffic_class_config#security_iv_prefix_length.; |
| 73 | |
| 74 | /* Operating system settings */ |
| 75 | int socket_prioritycxx . . $ traffic_class_config#socket_priority.; |
| 76 | int tx_thread_prioritycxx . . $ traffic_class_config#tx_thread_priority.; |
| 77 | int rx_thread_prioritycxx . . $ traffic_class_config#rx_thread_priority.; |
| 78 | int tx_thread_cpucxx . . $ traffic_class_config#tx_thread_cpu.; |
| 79 | int rx_thread_cpucxx . . $ traffic_class_config#rx_thread_cpu.; |
| 80 | int workload_thread_cpucxx . . $ traffic_class_config#workload_thread_cpu.; |
| 81 | int workload_thread_prioritycxx . . $ traffic_class_config#workload_thread_priority.; |
| 82 | |
| 83 | /* Workload settings */ |
| 84 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rx_workload_enabledcxx . . $ traffic_class_config#rx_workload_enabled.; |
| 85 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rx_workload_prewarmcxx . . $ traffic_class_config#rx_workload_prewarm.; |
| 86 | int rx_workload_skip_countcxx . . $ traffic_class_config#rx_workload_skip_count.; |
| 87 | char *workload_filecxx . . $ traffic_class_config#workload_file.; |
| 88 | size_tcxx . . $ size_t# workload_file_lengthcxx . . $ traffic_class_config#workload_file_length.; |
| 89 | char *workload_functioncxx . . $ traffic_class_config#workload_function.; |
| 90 | size_tcxx . . $ size_t# workload_function_lengthcxx . . $ traffic_class_config#workload_function_length.; |
| 91 | char *workload_argumentscxx . . $ traffic_class_config#workload_arguments.; |
| 92 | size_tcxx . . $ size_t# workload_arguments_lengthcxx . . $ traffic_class_config#workload_arguments_length.; |
| 93 | char *workload_setup_functioncxx . . $ traffic_class_config#workload_setup_function.; |
| 94 | size_tcxx . . $ size_t# workload_setup_function_lengthcxx . . $ traffic_class_config#workload_setup_function_length.; |
| 95 | char *workload_setup_argumentscxx . . $ traffic_class_config#workload_setup_arguments.; |
| 96 | size_tcxx . . $ size_t# workload_setup_arguments_lengthcxx . . $ traffic_class_config#workload_setup_arguments_length.; |
| 97 | }; |
| 98 | |
| 99 | struct application_configcxx . . $ application_config# { |
| 100 | /* Application scheduling configuration */ |
| 101 | clockid_tcxx . . $ clockid_t# application_clock_idcxx . . $ application_config#application_clock_id.; |
| 102 | uint64_tcxx . . $ uint64_t# application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns.; |
| 103 | uint64_tcxx . . $ uint64_t# application_base_start_time_nscxx . . $ application_config#application_base_start_time_ns.; |
| 104 | uint64_tcxx . . $ uint64_t# application_base_start_offset_nscxx . . $ application_config#application_base_start_offset_ns.; |
| 105 | uint64_tcxx . . $ uint64_t# application_tx_base_offset_nscxx . . $ application_config#application_tx_base_offset_ns.; |
| 106 | uint64_tcxx . . $ uint64_t# application_rx_base_offset_nscxx . . $ application_config#application_rx_base_offset_ns.; |
| 107 | char *application_xdp_programcxx . . $ application_config#application_xdp_program.; |
| 108 | size_tcxx . . $ size_t# application_xdp_program_lengthcxx . . $ application_config#application_xdp_program_length.; |
| 109 | /* Traffic class configurations */ |
| 110 | struct traffic_class_configcxx . . $ traffic_class_config# classescxx . . $ application_config#classes.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 111 | /* Logging */ |
| 112 | int log_thread_prioritycxx . . $ application_config#log_thread_priority.; |
| 113 | int log_thread_cpucxx . . $ application_config#log_thread_cpu.; |
| 114 | char *log_filecxx . . $ application_config#log_file.; |
| 115 | size_tcxx . . $ size_t# log_file_lengthcxx . . $ application_config#log_file_length.; |
| 116 | char *log_levelcxx . . $ application_config#log_level.; |
| 117 | size_tcxx . . $ size_t# log_level_lengthcxx . . $ application_config#log_level_length.; |
| 118 | /* Debug */ |
| 119 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! debug_stop_trace_on_outliercxx . . $ application_config#debug_stop_trace_on_outlier.; |
| 120 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! debug_stop_trace_on_errorcxx . . $ application_config#debug_stop_trace_on_error.; |
| 121 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! debug_monitor_modecxx . . $ application_config#debug_monitor_mode.; |
| 122 | unsigned char debug_monitor_destinationcxx . . $ application_config#debug_monitor_destination.[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!]; |
| 123 | /* Statistics */ |
| 124 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! stats_histogram_enabledcxx . . $ application_config#stats_histogram_enabled.; |
| 125 | uint64_tcxx . . $ uint64_t# stats_histogram_minimum_nscxx . . $ application_config#stats_histogram_minimum_ns.; |
| 126 | uint64_tcxx . . $ uint64_t# stats_histogram_maximum_nscxx . . $ application_config#stats_histogram_maximum_ns.; |
| 127 | char *stats_histogram_filecxx . . $ application_config#stats_histogram_file.; |
| 128 | size_tcxx . . $ size_t# stats_histogram_file_lengthcxx . . $ application_config#stats_histogram_file_length.; |
| 129 | uint64_tcxx . . $ uint64_t# stats_collection_interval_nscxx . . $ application_config#stats_collection_interval_ns.; |
| 130 | /* Log through MQTT */ |
| 131 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! log_mqttcxx . . $ application_config#log_mqtt.; |
| 132 | int log_mqtt_thread_prioritycxx . . $ application_config#log_mqtt_thread_priority.; |
| 133 | int log_mqtt_thread_cpucxx . . $ application_config#log_mqtt_thread_cpu.; |
| 134 | size_tcxx . . $ size_t# log_mqtt_broker_ip_lengthcxx . . $ application_config#log_mqtt_broker_ip_length.; |
| 135 | char *log_mqtt_broker_ipcxx . . $ application_config#log_mqtt_broker_ip.; |
| 136 | int log_mqtt_broker_portcxx . . $ application_config#log_mqtt_broker_port.; |
| 137 | int log_mqtt_keep_alive_secscxx . . $ application_config#log_mqtt_keep_alive_secs.; |
| 138 | size_tcxx . . $ size_t# log_mqtt_measurement_name_lengthcxx . . $ application_config#log_mqtt_measurement_name_length.; |
| 139 | char *log_mqtt_measurement_namecxx . . $ application_config#log_mqtt_measurement_name.; |
| 140 | /* Log through JSON/UDP */ |
| 141 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! log_jsoncxx . . $ application_config#log_json.; |
| 142 | int log_json_thread_prioritycxx . . $ application_config#log_json_thread_priority.; |
| 143 | int log_json_thread_cpucxx . . $ application_config#log_json_thread_cpu.; |
| 144 | size_tcxx . . $ size_t# log_json_host_lengthcxx . . $ application_config#log_json_host_length.; |
| 145 | char *log_json_hostcxx . . $ application_config#log_json_host.; |
| 146 | size_tcxx . . $ size_t# log_json_port_lengthcxx . . $ application_config#log_json_port_length.; |
| 147 | char *log_json_portcxx . . $ application_config#log_json_port.; |
| 148 | size_tcxx . . $ size_t# log_json_measurement_name_lengthcxx . . $ application_config#log_json_measurement_name_length.; |
| 149 | char *log_json_measurement_namecxx . . $ application_config#log_json_measurement_name.; |
| 150 | }; |
| 151 | |
| 152 | extern struct application_configcxx . . $ application_config# app_configcxx . . $ app_config.; |
| 153 | |
| 154 | int config_read_from_filecxx . . $ config_read_from_file(5c4306d8553b3696).(const char *config_file); |
| 155 | int config_set_defaultscxx . . $ config_set_defaults(73da94e76e6bd037).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mirror_enabled); |
| 156 | void config_print_valuescxx . . $ config_print_values(49f6e7a06ebc5aa8).(void); |
| 157 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_sanity_checkcxx . . $ config_sanity_check(c9857a73d68e59ba).(void); |
| 158 | void config_freecxx . . $ config_free(49f6e7a06ebc5aa8).(void); |
| 159 | |
| 160 | #define CONFIG_STORE_BOOL_PARAM_CLASScxx . . $ `src/config.h:160:9`!(name, var) \ |
| 161 | do { \ |
| 162 | if (!strcmp(key, #name)) { \ |
| 163 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 164 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! result; \ |
| 165 | \ |
| 166 | if (config_parse_bool(value, &result)) { \ |
| 167 | ret = -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; \ |
| 168 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 169 | goto err_parse; \ |
| 170 | } else { \ |
| 171 | app_config.classes[type].var = result; \ |
| 172 | } \ |
| 173 | } \ |
| 174 | } while (0) |
| 175 | |
| 176 | #define CONFIG_STORE_BOOL_PARAMcxx . . $ `src/config.h:176:9`!(name, var) \ |
| 177 | do { \ |
| 178 | if (!strcmp(key, #name)) { \ |
| 179 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! result; \ |
| 180 | \ |
| 181 | if (config_parse_bool(value, &result)) { \ |
| 182 | ret = -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; \ |
| 183 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 184 | goto err_parse; \ |
| 185 | } else { \ |
| 186 | app_config.var = result; \ |
| 187 | } \ |
| 188 | } \ |
| 189 | } while (0) |
| 190 | |
| 191 | #define CONFIG_STORE_INT_PARAM_CLASScxx . . $ `src/config.h:191:9`!(name, var) \ |
| 192 | do { \ |
| 193 | if (!strcmp(key, #name)) { \ |
| 194 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 195 | long result; \ |
| 196 | \ |
| 197 | if (config_parse_int(value, &result)) { \ |
| 198 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 199 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 200 | goto err_parse; \ |
| 201 | } else { \ |
| 202 | app_config.classes[type].var = result; \ |
| 203 | } \ |
| 204 | } \ |
| 205 | } while (0) |
| 206 | |
| 207 | #define CONFIG_STORE_INT_PARAMcxx . . $ `src/config.h:207:9`!(name, var) \ |
| 208 | do { \ |
| 209 | if (!strcmp(key, #name)) { \ |
| 210 | long result; \ |
| 211 | \ |
| 212 | if (config_parse_int(value, &result)) { \ |
| 213 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 214 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 215 | goto err_parse; \ |
| 216 | } else { \ |
| 217 | app_config.var = result; \ |
| 218 | } \ |
| 219 | } \ |
| 220 | } while (0) |
| 221 | |
| 222 | #define CONFIG_STORE_ULONG_PARAM_CLASScxx . . $ `src/config.h:222:9`!(name, var) \ |
| 223 | do { \ |
| 224 | if (!strcmp(key, #name)) { \ |
| 225 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 226 | unsigned long long result; \ |
| 227 | \ |
| 228 | if (config_parse_ulong(value, &result)) { \ |
| 229 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 230 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 231 | goto err_parse; \ |
| 232 | } else { \ |
| 233 | app_config.classes[type].var = result; \ |
| 234 | } \ |
| 235 | } \ |
| 236 | } while (0) |
| 237 | |
| 238 | #define CONFIG_STORE_TIME_PARAM_CLASScxx . . $ `src/config.h:238:9`!(name, var) \ |
| 239 | do { \ |
| 240 | if (!strcmp(key, #name)) { \ |
| 241 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 242 | \ |
| 243 | if (config_parse_time(value, &app_config.classes[type].var)) { \ |
| 244 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 245 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 246 | goto err_parse; \ |
| 247 | } \ |
| 248 | } \ |
| 249 | } while (0) |
| 250 | |
| 251 | #define CONFIG_STORE_TIME_PARAMcxx . . $ `src/config.h:251:9`!(name, var) \ |
| 252 | do { \ |
| 253 | if (!strcmp(key, #name)) { \ |
| 254 | if (config_parse_time(value, &app_config.var)) { \ |
| 255 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 256 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 257 | goto err_parse; \ |
| 258 | } \ |
| 259 | } \ |
| 260 | } while (0) |
| 261 | |
| 262 | #define CONFIG_STORE_STRING_PARAM_CLASScxx . . $ `src/config.h:262:9`!(name, var) \ |
| 263 | do { \ |
| 264 | if (!strcmp(key, #name)) { \ |
| 265 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 266 | \ |
| 267 | /* config_set_defaults() may have set a default value. */ \ |
| 268 | free(app_config.classes[type].var); \ |
| 269 | app_config.classes[type].var = strdup(value); \ |
| 270 | if (!app_config.classes[type].var) { \ |
| 271 | ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; \ |
| 272 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "strdup() for " #name " failed!\n"); \ |
| 273 | goto err_parse; \ |
| 274 | } \ |
| 275 | app_config.classes[type].var##_length = strlen(value); \ |
| 276 | } \ |
| 277 | } while (0) |
| 278 | |
| 279 | #define CONFIG_STORE_STRING_PARAMcxx . . $ `src/config.h:279:9`!(name, var) \ |
| 280 | do { \ |
| 281 | if (!strcmp(key, #name)) { \ |
| 282 | /* config_set_defaults() may have set a default value. */ \ |
| 283 | free(app_config.var); \ |
| 284 | app_config.var = strdup(value); \ |
| 285 | if (!app_config.var) { \ |
| 286 | ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; \ |
| 287 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "strdup() for " #name " failed!\n"); \ |
| 288 | goto err_parse; \ |
| 289 | } \ |
| 290 | app_config.var##_length = strlen(value); \ |
| 291 | } \ |
| 292 | } while (0) |
| 293 | |
| 294 | #define CONFIG_STORE_INTERFACE_PARAM_CLASScxx . . $ `src/config.h:294:9`!(name, var) \ |
| 295 | do { \ |
| 296 | if (!strcmp(key, #name)) { \ |
| 297 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 298 | \ |
| 299 | strncpy(app_config.classes[type].var, value, \ |
| 300 | sizeof(app_config.classes[type].var) - 1); \ |
| 301 | } \ |
| 302 | } while (0) |
| 303 | |
| 304 | #define CONFIG_STORE_MAC_PARAM_CLASScxx . . $ `src/config.h:304:9`!(name, var) \ |
| 305 | do { \ |
| 306 | if (!strcmp(key, #name)) { \ |
| 307 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 308 | unsigned int tmp[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!]; \ |
| 309 | int i; \ |
| 310 | \ |
| 311 | ret = sscanf(value, "%x:%x:%x:%x:%x:%x", &tmp[0], &tmp[1], &tmp[2], \ |
| 312 | &tmp[3], &tmp[4], &tmp[5]); \ |
| 313 | \ |
| 314 | if (ret != ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!) { \ |
| 315 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to parse MAC Address!\n"); \ |
| 316 | ret = -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; \ |
| 317 | goto err_parse; \ |
| 318 | } \ |
| 319 | \ |
| 320 | for (i = 0; i < ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!; ++i) \ |
| 321 | app_config.classes[type].var[i] = (unsigned char)tmp[i]; \ |
| 322 | } \ |
| 323 | } while (0) |
| 324 | |
| 325 | #define CONFIG_STORE_MAC_PARAMcxx . . $ `src/config.h:325:9`!(name, var) \ |
| 326 | do { \ |
| 327 | if (!strcmp(key, #name)) { \ |
| 328 | unsigned int tmp[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!]; \ |
| 329 | int i; \ |
| 330 | \ |
| 331 | ret = sscanf(value, "%x:%x:%x:%x:%x:%x", &tmp[0], &tmp[1], &tmp[2], \ |
| 332 | &tmp[3], &tmp[4], &tmp[5]); \ |
| 333 | \ |
| 334 | if (ret != ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!) { \ |
| 335 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to parse MAC Address!\n"); \ |
| 336 | ret = -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; \ |
| 337 | goto err_parse; \ |
| 338 | } \ |
| 339 | \ |
| 340 | for (i = 0; i < ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!; ++i) \ |
| 341 | app_config.var[i] = (unsigned char)tmp[i]; \ |
| 342 | } \ |
| 343 | } while (0) |
| 344 | |
| 345 | #define CONFIG_STORE_CLOCKID_PARAMcxx . . $ `src/config.h:345:9`!(name, var) \ |
| 346 | do { \ |
| 347 | if (!strcmp(key, #name)) { \ |
| 348 | if (strcmp(value, "CLOCK_TAI") && strcmp(value, "CLOCK_MONOTONIC")) { \ |
| 349 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Invalid clockid specified!\n"); \ |
| 350 | goto err_parse; \ |
| 351 | } \ |
| 352 | \ |
| 353 | if (!strcmp(value, "CLOCK_TAI")) \ |
| 354 | app_config.var = CLOCK_TAIcxx . . $ `<external>/89459239771508533/time.h:66:10`!; \ |
| 355 | if (!strcmp(value, "CLOCK_MONOTONIC")) \ |
| 356 | app_config.var = CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!; \ |
| 357 | } \ |
| 358 | } while (0) |
| 359 | |
| 360 | #define CONFIG_STORE_ETHER_TYPE_CLASScxx . . $ `src/config.h:360:9`!(name, var) \ |
| 361 | do { \ |
| 362 | if (!strcmp(key, #name)) { \ |
| 363 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 364 | \ |
| 365 | app_config.classes[type].var = strtoul(value, &endptr, 16); \ |
| 366 | if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != 0 || endptr == value || *endptr != '\0') { \ |
| 367 | ret = -ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!; \ |
| 368 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The value for " #name " is invalid!\n"); \ |
| 369 | goto err_parse; \ |
| 370 | } \ |
| 371 | } \ |
| 372 | } while (0) |
| 373 | |
| 374 | #define CONFIG_STORE_SECURITY_MODE_PARAM_CLASScxx . . $ `src/config.h:374:9`!(name, var) \ |
| 375 | do { \ |
| 376 | if (!strcmp(key, #name)) { \ |
| 377 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 378 | \ |
| 379 | if (strcasecmp(value, "none") && strcasecmp(value, "ao") && \ |
| 380 | strcasecmp(value, "ae")) { \ |
| 381 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Invalid security mode specified!\n"); \ |
| 382 | goto err_parse; \ |
| 383 | } \ |
| 384 | \ |
| 385 | if (!strcasecmp(value, "none")) \ |
| 386 | app_config.classes[type].var = SECURITY_MODE_NONE; \ |
| 387 | if (!strcasecmp(value, "ao")) \ |
| 388 | app_config.classes[type].var = SECURITY_MODE_AO; \ |
| 389 | if (!strcasecmp(value, "ae")) \ |
| 390 | app_config.classes[type].var = SECURITY_MODE_AE; \ |
| 391 | } \ |
| 392 | } while (0) |
| 393 | |
| 394 | #define CONFIG_STORE_SECURITY_ALGORITHM_PARAM_CLASScxx . . $ `src/config.h:394:9`!(name, var) \ |
| 395 | do { \ |
| 396 | if (!strcmp(key, #name)) { \ |
| 397 | enum stat_frame_type type = config_opt_to_type(#name); \ |
| 398 | \ |
| 399 | if (strcasecmp(value, "aes256-gcm") && strcasecmp(value, "aes128-gcm") && \ |
| 400 | strcasecmp(value, "chacha20-poly1305")) { \ |
| 401 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Invalid security algorithm specified!\n"); \ |
| 402 | goto err_parse; \ |
| 403 | } \ |
| 404 | if (!strcasecmp(value, "aes256-gcm")) \ |
| 405 | app_config.classes[type].var = SECURITY_ALGORITHM_AES256_GCM; \ |
| 406 | if (!strcasecmp(value, "aes128-gcm")) \ |
| 407 | app_config.classes[type].var = SECURITY_ALGORITHM_AES128_GCM; \ |
| 408 | if (!strcasecmp(value, "chacha20-poly1305")) \ |
| 409 | app_config.classes[type].var = \ |
| 410 | SECURITY_ALGORITHM_CHACHA20_POLY1305; \ |
| 411 | } \ |
| 412 | } while (0) |
| 413 | |
| 414 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_is_traffic_class_activecxx . . $ config_is_traffic_class_active(c5f7da30cbc0f4e9).(const char *traffic_class); |
| 415 | |
| 416 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_have_busy_pollcxx . . $ config_have_busy_poll(c9857a73d68e59ba).(void) |
| 417 | { |
| 418 | #if defined(HAVE_SO_BUSY_POLLcxx . . $ `build/app_config.h:14:9`!) && defined(HAVE_SO_PREFER_BUSY_POLLcxx . . $ `build/app_config.h:15:9`!) && \ |
| 419 | defined(HAVE_SO_BUSY_POLL_BUDGETcxx . . $ `build/app_config.h:16:9`!) |
| 420 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 421 | #else |
| 422 | return false; |
| 423 | #endif |
| 424 | } |
| 425 | |
| 426 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_have_mosquittocxx . . $ config_have_mosquitto(c9857a73d68e59ba).(void) |
| 427 | { |
| 428 | #if defined(WITH_MQTT) |
| 429 | return true; |
| 430 | #else |
| 431 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 432 | #endif |
| 433 | } |
| 434 | |
| 435 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_have_xdp_tx_timecxx . . $ config_have_xdp_tx_time(c9857a73d68e59ba).(void) |
| 436 | { |
| 437 | #ifdef HAVE_XDP_TX_TIMEcxx . . $ `build/app_config.h:17:9`! |
| 438 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 439 | #else |
| 440 | return false; |
| 441 | #endif |
| 442 | } |
| 443 | |
| 444 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_have_rx_timestampcxx . . $ config_have_rx_timestamp(c9857a73d68e59ba).(void) |
| 445 | { |
| 446 | #ifdef RX_TIMESTAMP |
| 447 | return true; |
| 448 | #else |
| 449 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 450 | #endif |
| 451 | } |
| 452 | |
| 453 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! config_have_tx_timestampcxx . . $ config_have_tx_timestamp(c9857a73d68e59ba).(void) |
| 454 | { |
| 455 | #ifdef TX_TIMESTAMP |
| 456 | return true; |
| 457 | #else |
| 458 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 459 | #endif |
| 460 | } |
| 461 | |
| 462 | #endif /* _CONFIG_H_ */ |