From 18485ba79042aa02db31742d916267d629649741 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 4 Feb 2022 22:28:55 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. --- level_0/f_string/c/private-string.c | 1 + level_3/fake/c/private-make-operate_process_type.h | 2 +- level_3/firewall/c/common.c | 4 +- level_3/firewall/c/common.h | 10 +- level_3/firewall/c/firewall.c | 123 +-- level_3/firewall/c/private-common.h | 26 +- level_3/firewall/c/private-firewall.c | 939 +++++++++------------ level_3/firewall/c/private-firewall.h | 10 +- level_3/fss_basic_list_read/c/common.c | 16 +- level_3/fss_basic_list_write/c/common.c | 16 +- level_3/fss_basic_read/c/common.c | 16 +- level_3/fss_basic_write/c/common.c | 16 +- level_3/fss_embedded_list_read/c/common.c | 16 +- level_3/fss_embedded_list_write/c/common.c | 16 +- level_3/fss_extended_list_read/c/common.c | 16 +- level_3/fss_extended_list_write/c/common.c | 16 +- level_3/fss_extended_read/c/common.c | 16 +- level_3/fss_extended_write/c/common.c | 16 +- level_3/fss_identify/c/common.c | 16 +- level_3/fss_payload_read/c/common.c | 16 +- level_3/fss_payload_write/c/common.c | 16 +- level_3/fss_status_code/c/common.c | 16 +- level_3/iki_read/c/common.c | 16 +- level_3/iki_write/c/common.c | 16 +- level_3/status_code/c/common.c | 16 +- level_3/utf8/c/common.c | 16 +- 26 files changed, 624 insertions(+), 779 deletions(-) diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 8d2f650..1ba22ad 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -152,6 +152,7 @@ extern "C" { #if !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) f_status_t private_f_string_dynamics_append(const f_string_dynamics_t source, f_string_dynamics_t *destination) { + f_status_t status = F_none; if (destination->used + source.used > destination->size) { diff --git a/level_3/fake/c/private-make-operate_process_type.h b/level_3/fake/c/private-make-operate_process_type.h index b76f6a9..3c002e6 100644 --- a/level_3/fake/c/private-make-operate_process_type.h +++ b/level_3/fake/c/private-make-operate_process_type.h @@ -29,7 +29,7 @@ extern "C" { * Errors (with error bit) from: f_directory_is(). * Errors (with error bit) from: f_file_clone(). * Errors (with error bit) from: f_file_copy() - * Errors (with error bit) from: fl_directory_clone().. + * Errors (with error bit) from: fl_directory_clone(). * Errors (with error bit) from: fl_directory_copy(). * * @see f_directory_is() diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 7d03c1d..75c128b 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_program_version_s, 0, FIREWALL_program_version_s_length); #endif // _di_firewall_program_version_ #ifndef _di_firewall_program_name_ @@ -74,7 +74,7 @@ extern "C" { const f_string_static_t firewall_group_lock_s = macro_f_string_static_t_initialize(FIREWALL_group_lock_s, 0, FIREWALL_group_lock_s_length); const f_string_static_t firewall_group_main_s = macro_f_string_static_t_initialize(FIREWALL_group_main_s, 0, FIREWALL_group_main_s_length); - const f_string_static_t firewall_ip_list = macro_f_string_static_t_initialize(FIREWALL_ip_list, 0, FIREWALL_ip_list_length); + const f_string_static_t firewall_ip_list = macro_f_string_static_t_initialize(FIREWALL_ip_list_s, 0, FIREWALL_ip_list_s_length); const f_string_static_t firewall_ip_list_source_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_source_s, 0, FIREWALL_ip_list_source_s_length); const f_string_static_t firewall_ip_list_source_action_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_source_action_s, 0, FIREWALL_ip_list_source_action_s_length); const f_string_static_t firewall_ip_list_destination_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_destination_s, 0, FIREWALL_ip_list_destination_s_length); diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index 35ab6e7..2e3cf5d 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -139,7 +139,7 @@ extern "C" { #define FIREWALL_group_lock_s "lock" #define FIREWALL_group_main_s "main" - #define FIREWALL_ip_list "ip_list" + #define FIREWALL_ip_list_s "ip_list" #define FIREWALL_ip_list_source_s "source" #define FIREWALL_ip_list_source_action_s "-s" #define FIREWALL_ip_list_destination_s "destination" @@ -167,7 +167,7 @@ extern "C" { #define FIREWALL_tool_ip46tables_s "ip46tables" #define FIREWALL_tool_ipset_s "ipset" - #define FIREWALL_action_length_s 6 + #define FIREWALL_action_s_length 6 #define FIREWALL_action_append_s_length 6 #define FIREWALL_action_insert_s_length 6 #define FIREWALL_action_policy_s_length 6 @@ -201,8 +201,8 @@ extern "C" { #define FIREWALL_device_this_s_length 4 #define FIREWALL_device_loop_s_length 2 - #define FIREWALL_device_input_command_length_s 2 - #define FIREWALL_device_output_command_length_s 2 + #define FIREWALL_device_input_command_s_length 2 + #define FIREWALL_device_output_command_s_length 2 #define FIREWALL_direction_s_length 9 #define FIREWALL_direction_input_s_length 5 @@ -213,7 +213,7 @@ extern "C" { #define FIREWALL_group_lock_s_length 4 #define FIREWALL_group_main_s_length 4 - #define FIREWALL_ip_list_length_s 7 + #define FIREWALL_ip_list_s_length 7 #define FIREWALL_ip_list_source_s_length 6 #define FIREWALL_ip_list_source_action_s_length 2 #define FIREWALL_ip_list_destination_s_length 11 diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 3176330..6c724ff 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -12,15 +12,6 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_program_version_s, 0, FIREWALL_program_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ - #ifndef _di_firewall_print_help_ f_status_t firewall_print_help(const f_file_t file, const f_color_context_t context) { @@ -39,11 +30,11 @@ extern "C" { fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); fl_print_format("%r%r %[Available Commands:%] ", file.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important); - fl_print_format("%r %[%s%] Turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_start_s, context.set.standout); - fl_print_format("%r %[%s%] Turn off the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_stop_s, context.set.standout); - fl_print_format("%r %[%s%] Turn off and then turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_restart_s, context.set.standout); - fl_print_format("%r %[%s%] Prevent all communication.", file.stream, f_string_eol_s, context.set.standout, firewall_command_lock_s, context.set.standout); - fl_print_format("%r %[%s%] Show active firewall settings.", file.stream, f_string_eol_s, context.set.standout, firewall_command_show_s, context.set.standout); + fl_print_format("%r %[%r%] Turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_start_s, context.set.standout); + fl_print_format("%r %[%r%] Turn off the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_stop_s, context.set.standout); + fl_print_format("%r %[%r%] Turn off and then turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_restart_s, context.set.standout); + fl_print_format("%r %[%r%] Prevent all communication.", file.stream, f_string_eol_s, context.set.standout, firewall_command_lock_s, context.set.standout); + fl_print_format("%r %[%r%] Show active firewall settings.", file.stream, f_string_eol_s, context.set.standout, firewall_command_show_s, context.set.standout); fll_program_print_help_usage(file, context, firewall_program_name_s, firewall_program_help_parameters_s); @@ -408,7 +399,7 @@ extern "C" { char path_file_other_string[path_file_other.used + 1]; path_file_other.string = path_file_other_string; - path_file_other[path_file_other.used] = 0; + path_file_other_string[path_file_other.used] = 0; memcpy(path_file_other_string, firewall_network_path_s.string, firewall_network_path_s.used); memcpy(path_file_other_string + firewall_network_path_s.used, firewall_file_other_s.string, firewall_file_other_s.used); @@ -529,7 +520,7 @@ extern "C" { char path_file_first_string[path_file_first.used + 1]; path_file_first.string = path_file_first_string; - path_file_first[path_file_first.used] = 0; + path_file_first_string[path_file_first.used] = 0; memcpy(path_file_first_string, firewall_network_path_s.string, firewall_network_path_s.used); memcpy(path_file_first_string + firewall_network_path_s.used, firewall_file_first_s.string, firewall_file_first_s.used); @@ -596,30 +587,30 @@ extern "C" { firewall_delete_local_data(&local); { - f_string_dynamic_t file_path = f_string_dynamic_t_initialize; + f_string_dynamic_t path_file = f_string_dynamic_t_initialize; f_array_length_t j = 0; for (i = 0; i < main->devices.used; ++i) { - file_path.used = 0; + path_file.used = 0; local.device = i; - status = f_string_dynamic_increase_by(firewall_network_path_s.used + main->devices.array[i].used + firewall_file_suffix_s_length + 1, &file_path); + status = f_string_dynamic_increase_by(firewall_network_path_s.used + main->devices.array[i].used + firewall_file_suffix_s.used + 1, &path_file); if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(firewall_network_path_s, &file_path); + status = f_string_dynamic_append(firewall_network_path_s, &path_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(main->devices.array[i], &file_path); + status = f_string_dynamic_append(main->devices.array[i], &path_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(firewall_file_suffix_s, &file_path); + status = f_string_dynamic_append(firewall_file_suffix_s, &path_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&file_path); + status = f_string_dynamic_terminate_after(&path_file); } if (F_status_is_error(status)) { @@ -631,12 +622,12 @@ extern "C" { return status; } - status = firewall_buffer_rules(main, file_path, F_true, &local); + status = firewall_buffer_rules(main, path_file, F_true, &local); if (status == F_child) { firewall_delete_local_data(&local); - f_string_dynamic_resize(0, &file_path); + f_string_dynamic_resize(0, &path_file); firewall_main_delete(main); @@ -654,7 +645,7 @@ extern "C" { continue; } - f_string_dynamic_resize(0, &file_path); + f_string_dynamic_resize(0, &path_file); firewall_main_delete(main); @@ -685,6 +676,8 @@ extern "C" { status = firewall_process_rules(main, &input, &local); if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { + f_string_dynamic_resize(0, &path_file); + firewall_delete_local_data(&local); firewall_main_delete(main); @@ -695,54 +688,68 @@ extern "C" { firewall_delete_local_data(&local); } // for - f_string_dynamic_resize(0, &file_path); - } + path_file.used = 0; - status = firewall_buffer_rules(main, network_path_s firewall_file_last_s, F_false, &local); + status = f_string_dynamic_append(firewall_network_path_s, &path_file); - if (F_status_is_error(status) || status == F_child) { - firewall_delete_local_data(&local); - firewall_main_delete(main); + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(firewall_file_last_s, &path_file); + } - return status; - } + if (F_status_is_error_not(status)) { + status = firewall_buffer_rules(main, path_file, F_false, &local); + } - status = firewall_create_custom_chains(main, &reserved, &local); + if (F_status_is_error(status) || status == F_child) { + f_string_dynamic_resize(0, &path_file); - if (F_status_is_error(status) || status == F_child) { - f_status_t status2 = F_none; + firewall_delete_local_data(&local); + firewall_main_delete(main); - macro_firewall_delete_fss_buffers(status2, local.buffer, local.chain_objects, local.chain_contents) - firewall_main_delete(main); + return status; + } - return status; - } + status = firewall_create_custom_chains(main, &reserved, &local); - i = 0; + if (F_status_is_error(status) || status == F_child) { + f_string_dynamic_resize(0, &path_file); - local.is_global = F_true; - local.is_stop = F_false; - local.is_lock = F_false; + firewall_delete_local_data(&local); + firewall_main_delete(main); - while (i < local.chain_contents.used) { + return status; + } - input.start = local.chain_contents.array[i].array[0].start; - input.stop = local.chain_contents.array[i].array[0].stop; + i = 0; - local.is_main = reserved.has_main && i == reserved.main_at ? F_true : F_false; - local.chain = i; + local.is_global = F_true; + local.is_stop = F_false; + local.is_lock = F_false; - status = firewall_process_rules(main, &input, &local); + while (i < local.chain_contents.used) { - if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { - firewall_delete_local_data(&local); - firewall_main_delete(main); + input.start = local.chain_contents.array[i].array[0].start; + input.stop = local.chain_contents.array[i].array[0].stop; - return status; - } + local.is_main = reserved.has_main && i == reserved.main_at ? F_true : F_false; + local.chain = i; - ++i; - } // while + status = firewall_process_rules(main, &input, &local); + + if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { + f_string_dynamic_resize(0, &path_file); + + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return status; + } + + ++i; + } // while + + f_string_dynamic_resize(0, &path_file); + } } firewall_delete_local_data(&local); diff --git a/level_3/firewall/c/private-common.h b/level_3/firewall/c/private-common.h index 2503bf8..9e0677a 100644 --- a/level_3/firewall/c/private-common.h +++ b/level_3/firewall/c/private-common.h @@ -65,39 +65,17 @@ typedef struct { 0, \ } -#define macro_firewall_delete_fss_buffers(status, buffer, objects, contents) \ - macro_f_string_dynamic_t_delete_simple(buffer); \ - macro_f_fss_objects_t_delete_simple(objects); \ - macro_f_fss_contents_t_delete_simple(contents); - -#define macro_firewall_concat_string(destination, source, length) \ - memcpy((void *)(destination), source, length); - #define macro_firewall_rule_contents_has_incorrect_items(index, total_items) \ local.rule_contents.array[index].used <= 0 || local.rule_contents.array[index].used > total_items -// the buffer start to stop points are inclusive such that the size is ((stop - start) + 1). +// The buffer start to stop points are inclusive such that the size is ((stop - start) + 1). #define macro_firewall_string_dynamic_size(structure, index) \ (structure.string[index].stop - structure.string[index].start) + 1 -// the buffer start to stop points are inclusive such that the size is ((stop - start) + 1). +// The buffer start to stop points are inclusive such that the size is ((stop - start) + 1). #define macro_firewall_structure_size(structure, index) \ (structure.array[index].stop - structure.array[index].start) + 1 -// TODO: temporarily added, convert this to a function below. -#define macro_firewall_append_argument_to_arguments(status, arguments, argument) \ - if (arguments.used == arguments.size) { \ - macro_f_string_dynamics_t_resize(status, arguments, arguments.used + firewall_default_allocation_step_d); \ - \ - if (F_status_is_error(status)) break; \ - } \ - \ - arguments.array[arguments.used].string = argument.string; \ - arguments.array[arguments.used].size = argument.size; \ - arguments.array[arguments.used++].used = argument.used; \ - \ - macro_f_string_dynamic_t_clear(argument); - /** * Print debug information about tool execution. * diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index e9ede71..78acc5f 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -10,49 +10,53 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_status_t status = F_none; - f_array_length_t i = 0; - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_string_dynamic_t argument = f_string_dynamic_t_initialize; - - int return_code = 0; - f_array_length_t length = 0; bool invalid = F_false; bool is_ip_list = F_false; - f_string_dynamic_t ip_list = f_string_dynamic_t_initialize; // Iptables command arguments bool device_all = F_false; - bool ip_list_direction = F_false; // false = source, true = destination + bool ip_list_direction = F_false; // false = source, true = destination. bool use_protocol = F_false; uint8_t tool = firewall_program_ip46tables_e; uint8_t chain = firewall_chain_none_id_e; - f_array_length_t repeat = 2; + int return_code = 0; + + f_array_length_t i = 0; f_array_length_t r = 0; + f_array_length_t repeat = 2; + f_array_length_t length = 0; f_string_static_t current_tool = firewall_tool_iptables_s; - f_array_length_t current_tool_length = firewall_tool_iptables_s_length; - f_array_length_t direction = firewall_direction_none_id_e; + uint8_t direction = firewall_direction_none_id_e; + uint8_t action = firewall_action_append_id_e; + + f_string_dynamic_t ip_list = f_string_dynamic_t_initialize; f_string_dynamic_t device = f_string_dynamic_t_initialize; - f_array_length_t action = firewall_action_append_id_e; f_string_dynamic_t protocol = f_string_dynamic_t_initialize; + f_string_dynamics_t arguments = f_string_dynamics_t_initialize; if (local.is_global) { device_all = F_true; } else { - if (main->devices.array[local.device].used > 0) { - macro_f_string_dynamic_t_resize(status, device, main->devices.array[local.device].used); + if (main->devices.array[local.device].used) { + device.used = 0; + + status = f_string_dynamic_append(main->devices.array[local.device], &device); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&device); + } if (F_status_is_error(status)) { - f_string_dynamic_resize(0, &device); + if (F_status_set_fine(status) == F_memory_not) { + firewall_print_error_on_allocation_failure(main->error); + } return status; } - - macro_firewall_concat_string(device.string, main->devices.array[local.device].string, main->devices.array[local.device].used); - device.used = main->devices.array[local.device].used; } } @@ -61,12 +65,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal chain = firewall_chain_custom_id_e; } - for (uint16_t signal_check = 0; i < local.rule_objects.used; ++i) { + for (uint16_t signal_check = 0; F_status_is_error_not(status) && i < local.rule_objects.used; ++i) { if (!((++signal_check) % firewall_signal_check_d)) { if (firewall_signal_received(main)) { f_string_dynamic_resize(0, &ip_list); - f_string_dynamic_resize(0, &argument); f_string_dynamics_resize(0, &arguments); f_string_dynamic_resize(0, &device); f_string_dynamic_resize(0, &protocol); @@ -77,16 +80,16 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal signal_check = 0; } - length = macro_firewall_structure_size(local.rule_objects, i); + length = macro_firewall_structure_size(local.rule_objects, i); invalid = F_false; is_ip_list = F_false; ip_list_direction = F_false; - f_string_dynamic_resize(0, &ip_list); + ip_list.used = 0; // Process chain rule - if (length >= firewall_chain_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain_s, length, firewall_chain_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_chain_s, length) == F_equal_to) { if (chain == firewall_chain_custom_id_e) { // Custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain. @@ -100,22 +103,22 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } - else if (length >= firewall_chain_input_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_input_s, length, firewall_chain_input_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_input_s, length) == F_equal_to) { chain = firewall_chain_input_id_e; } - else if (length >= firewall_chain_output_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_output_s, length, firewall_chain_output_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_output_s, length) == F_equal_to) { chain = firewall_chain_output_id_e; } - else if (length >= firewall_chain_forward_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_forward_s, length, firewall_chain_forward_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_forward_s, length) == F_equal_to) { chain = firewall_chain_forward_id_e; } - else if (length >= firewall_chain_postrouting_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_postrouting_s, length, firewall_chain_postrouting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_postrouting_s, length) == F_equal_to) { chain = firewall_chain_postrouting_id_e; } - else if (length >= firewall_chain_prerouting_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_prerouting_s, length, firewall_chain_prerouting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_prerouting_s, length) == F_equal_to) { chain = firewall_chain_prerouting_id_e; } - else if (length >= firewall_chain_none_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_chain_none_s, length, firewall_chain_none_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_chain_none_s, length) == F_equal_to) { chain = firewall_chain_none_id_e; } else { @@ -126,19 +129,19 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // Process direction rule - else if (length >= firewall_direction_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_direction_s, length, firewall_direction_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_direction_s, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } - else if (length >= firewall_direction_input_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_direction_input_s, length, firewall_direction_input_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_direction_input_s, length) == F_equal_to) { direction = firewall_direction_input_id_e; } - else if (length >= firewall_direction_output_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_direction_output_s, length, firewall_direction_output_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_direction_output_s, length) == F_equal_to) { direction = firewall_direction_output_id_e; } - else if (length >= firewall_direction_none_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_direction_none_s, length, firewall_direction_none_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_direction_none_s, length) == F_equal_to) { direction = firewall_direction_none_id_e; } else { @@ -151,20 +154,20 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // Process device rule. - else if (length >= firewall_device_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_device_s, length, firewall_device_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_device_s, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } - else if (length >= firewall_device_all_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_all_s, length, firewall_device_all_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_device_all_s, length) == F_equal_to) { f_string_dynamic_resize(0, &device); device_all = F_true; continue; } - else if (length >= firewall_device_this_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_this_s, length, firewall_device_this_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_device_this_s, length) == F_equal_to) { if (main->devices.array[local.device].used > 0) { if (main->devices.array[local.device].used > device.size) { macro_f_string_dynamic_t_resize(status, device, main->devices.array[local.device].used); @@ -172,7 +175,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (F_status_is_error(status)) break; } - macro_firewall_concat_string(device.string, main->devices.array[local.device].string, main->devices.array[local.device].used); + memcpy(device.string, main->devices.array[local.device].string, main->devices.array[local.device].used); device.used = main->devices.array[local.device].used; } @@ -186,17 +189,16 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } if (!invalid) { - if (length > 0) { - if (length > device.size) { - status = f_string_dynamic_resize(length, &device); - if (F_status_is_error(status)) break; + device.used = 0; + + if (length) { + status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[0], &device); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&device); } - macro_firewall_concat_string(device.string, local.buffer.string + local.rule_contents.array[i].array[0].start, length); - device.used = length; - } - else { - f_string_dynamic_resize(0, &device); + if (F_status_is_error(status)) break; } device_all = F_false; @@ -206,22 +208,22 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // Process action rule. - else if (length >= firewall_action_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_action_s, length, firewall_action_length_s) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_action_s, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } - else if (length >= firewall_action_append_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_action_append_s, length, firewall_action_append_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_action_append_s, length) == F_equal_to) { action = firewall_action_append_id_e; } - else if (length >= firewall_action_insert_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_action_insert_s, length, firewall_action_insert_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_action_insert_s, length) == F_equal_to) { action = firewall_action_insert_id_e; } - else if (length >= firewall_action_policy_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_action_policy_s, length, firewall_action_policy_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_action_policy_s, length) == F_equal_to) { action = firewall_action_policy_id_e; } - else if (length >= firewall_action_none_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_action_none_s, length, firewall_action_none_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_action_none_s, length) == F_equal_to) { action = firewall_action_none_id_e; } else { @@ -232,37 +234,41 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // Process ip_list rule. - else if (length >= firewall_ip_list_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_ip_list, length, firewall_ip_list_length_s) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_ip_list, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); is_ip_list = F_true; - if (length >= firewall_ip_list_source_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_ip_list_source_s, length, firewall_ip_list_source_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_ip_list_source_s, length) == F_equal_to) { ip_list_direction = F_false; } - else if (length >= firewall_ip_list_destination_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_ip_list_destination_s, length, firewall_ip_list_destination_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_ip_list_destination_s, length) == F_equal_to) { ip_list_direction = F_true; } else { invalid = F_true; } } - else if (length >= firewall_protocol_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_protocol_s, length, firewall_protocol_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_protocol_s, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } else { - if (fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_protocol_none_s, length, firewall_protocol_none_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_protocol_none_s, length) == F_equal_to) { use_protocol = F_false; } - else if (length > 0) { - status = f_string_dynamic_resize(length, &potocol); + else if (length) { + protocol.used = 0; + + status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[0], &protocol); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&protocol); + } if (F_status_is_error(status)) break; - macro_firewall_concat_string(protocol.string, local.buffer.string + local.rule_contents.array[i].array[0].start, length); - protocol.used = length; use_protocol = F_true; } else { @@ -274,29 +280,26 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // Process tool rule. - else if (length >= firewall_tool_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_tool_s, length, firewall_tool_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_tool_s, length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); if (macro_firewall_rule_contents_has_incorrect_items(i, 1)) { invalid = F_true; } else { - if (fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_tool_iptables_s, length, firewall_tool_iptables_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_tool_iptables_s, length) == F_equal_to) { tool = firewall_program_iptables_e; current_tool = firewall_tool_iptables_s; - current_tool_length = firewall_tool_iptables_s_length; repeat = 1; } - else if (fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_tool_ip6tables_s, length, firewall_tool_ip6tables_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_tool_ip6tables_s, length) == F_equal_to) { tool = firewall_program_ip6tables_e; current_tool = firewall_tool_ip6tables_s; - current_tool_length = firewall_tool_ip6tables_s_length; repeat = 1; } - else if (fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_tool_ip46tables_s, length, firewall_tool_ip46tables_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_tool_ip46tables_s, length) == F_equal_to) { tool = firewall_program_ip46tables_e; current_tool = firewall_tool_iptables_s; - current_tool_length = firewall_tool_iptables_s_length; repeat = 2; } else { @@ -307,14 +310,14 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - // Process rule rule, if the remaining rule does not match as firewall_rule_s, then it is an invalid rule. - else if (length < firewall_rule_s_length || fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_rule_s, length, firewall_rule_s_length) == F_equal_to_not) { + // If the remaining rule does not match as firewall_rule_s, then it is an invalid rule. + else if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_objects.array[i].start, firewall_rule_s, length) == F_equal_to_not) { if (length) { flockfile(main->warning.to.stream); - fl_print_format("%r%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); - f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); - fl_print_format("%]%[' is invalid.%]%r", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, f_string_eol_s); + fl_print_format("%r%[%QAt line %ul, the object '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); + fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, local.buffer, local.rule_objects.array[i], main->warning.notable); + fl_print_format("%[' is invalid.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); } @@ -331,11 +334,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (length) { flockfile(main->warning.to.stream); - fl_print_format("%r%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); - f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); - fl_print_format("%]%[' has invalid content '%]%[", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, main->warning.notable); - f_print(local.buffer.string + local.rule_contents.array[i].array[0].start, macro_firewall_structure_size(local.rule_contents.array[i], 0), main->warning.to.stream); - fl_print_format("%]%['.%]%r", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, f_string_eol_s); + fl_print_format("%r%[%QAt line %ul, the object '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context); + fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, local.buffer, local.rule_objects.array[i], main->warning.notable); + fl_print_format("%[' has invalid content '%]", main->warning.to.stream, main->warning.context, main->warning.context); + fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, local.buffer, local.rule_contents.array[i].array[0], main->warning.notable); + fl_print_format("%['.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); } @@ -346,217 +349,202 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal continue; } - for (r = repeat; r > 0; --r) { + for (r = repeat; F_status_is_error_not(status) && r; --r) { - // First add the program name - f_string_dynamics_resize(0, &arguments); + arguments.used = 0; + // First add the program name. status = f_string_dynamics_increase(F_memory_default_allocation_small_d, &arguments); if (F_status_is_error(status)) break; if (tool == firewall_program_ip46tables_e) { if (r == 2) { current_tool = firewall_tool_iptables_s; - current_tool_length = firewall_tool_iptables_s_length; } else { current_tool = firewall_tool_ip6tables_s; - current_tool_length = firewall_tool_ip6tables_s_length; } } - f_string_dynamic_resize(0, &argument); - - if (F_status_is_error(status)) break; - // Process the action when a non-none chain is specified. if (chain != firewall_chain_none_id_e && action != firewall_action_none_id_e) { - if (action == firewall_action_append_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_action_append_command_s_length); + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) break; + arguments.array[arguments.used].used = 0; - macro_firewall_concat_string(argument.string, firewall_action_append_command_s, firewall_action_append_command_s_length); - argument.used = firewall_action_append_command_s_length; + if (action == firewall_action_append_id_e) { + status = f_string_dynamic_append(firewall_action_append_command_s, &arguments.array[arguments.used]); } else if (action == firewall_action_insert_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_action_insert_command_s_length); - - if (F_status_is_error(status)) break; - - macro_firewall_concat_string(argument.string, firewall_action_insert_command_s, firewall_action_insert_command_s_length); - argument.used = firewall_action_insert_command_s_length; + status = f_string_dynamic_append(firewall_action_insert_command_s, &arguments.array[arguments.used]); } else if (action == firewall_action_policy_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_action_policy_command_s_length); - - if (F_status_is_error(status)) break; + status = f_string_dynamic_append(firewall_action_policy_command_s, &arguments.array[arguments.used]); + } - macro_firewall_concat_string(argument.string, firewall_action_policy_command_s, firewall_action_policy_command_s_length); - argument.used = firewall_action_policy_command_s_length; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } - if (argument.used > 0) { - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - f_string_dynamic_resize(0, &argument); + if (F_status_is_error(status)) break; - break; - } + if (action == firewall_action_append_id_e || action == firewall_action_insert_id_e || action == firewall_action_policy_id_e) { + ++arguments.used; - // Process the chain, which is required by the action. - if (chain == firewall_chain_custom_id_e) { - if (main->chains.array[local.chain_ids.array[local.chain]].used > 0) { - macro_f_string_dynamic_t_resize(status, argument, main->chains.array[local.chain_ids.array[local.chain]].used); + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) break; + arguments.array[arguments.used].used = 0; + status = F_data_not; - macro_firewall_concat_string(argument.string, main->chains.array[local.chain_ids.array[local.chain]].string, main->chains.array[local.chain_ids.array[local.chain]].used); - argument.used = main->chains.array[local.chain_ids.array[local.chain]].used; - } + // Process the chain, which is required by the action. + if (chain == firewall_chain_custom_id_e) { + status = f_string_dynamic_append(main->chains.array[local.chain_ids.array[local.chain]], &arguments.array[arguments.used]); } else if (chain == firewall_chain_forward_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_chain_forward_s_length); - - if (F_status_is_error(status)) break; - - macro_firewall_concat_string(argument.string, firewall_chain_forward_s, firewall_chain_forward_s_length); - argument.used = firewall_chain_forward_s_length; + status = f_string_dynamic_append(firewall_chain_forward_s, &arguments.array[arguments.used]); } else if (chain == firewall_chain_postrouting_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_chain_postrouting_s_length); - - if (F_status_is_error(status)) break; - - macro_firewall_concat_string(argument.string, firewall_chain_postrouting_s, firewall_chain_postrouting_s_length); - argument.used += firewall_chain_postrouting_s_length; + status = f_string_dynamic_append(firewall_chain_postrouting_s, &arguments.array[arguments.used]); } else if (chain == firewall_chain_prerouting_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_chain_prerouting_s_length); - - if (F_status_is_error(status)) break; - - macro_firewall_concat_string(argument.string, firewall_chain_prerouting_s, firewall_chain_prerouting_s_length); - argument.used = firewall_chain_prerouting_s_length; + status = f_string_dynamic_append(firewall_chain_prerouting_s, &arguments.array[arguments.used]); } else if (chain == firewall_chain_input_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_chain_input_s_length); - - if (F_status_is_error(status)) break; - - macro_firewall_concat_string(argument.string, firewall_chain_input_s, firewall_chain_input_s_length); - argument.used = firewall_chain_input_s_length; + status = f_string_dynamic_append(firewall_chain_input_s, &arguments.array[arguments.used]); } else if (chain == firewall_chain_output_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_chain_output_s_length); - - if (F_status_is_error(status)) break; + status = f_string_dynamic_append(firewall_chain_output_s, &arguments.array[arguments.used]); + } - macro_firewall_concat_string(argument.string, firewall_chain_output_s, firewall_chain_output_s_length); - argument.used = firewall_chain_output_s_length; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } - if (argument.used > 0) { - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; - } + if (F_status_is_error(status)) break; + + if (status == F_data_not) { + status = F_none; + } + else { + ++arguments.used; } } } // Add the device if and only if a non-none direction is specified. - if (device.used > 0 && (direction == firewall_direction_input_id_e || direction == firewall_direction_output_id_e)) { - if (length < firewall_device_all_s_length || fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_all_s, length, firewall_device_all_s_length) == F_equal_to_not) { + if (device.used && (direction == firewall_direction_input_id_e || direction == firewall_direction_output_id_e)) { + if (fl_string_dynamic_compare_string(local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_device_all_s, length) == F_equal_to_not) { + + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); + if (F_status_is_error(status)) break; + + arguments.array[arguments.used].used = 0; + if (direction == firewall_direction_input_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_device_input_command_length_s); - if (F_status_is_error(status)) break; + status = f_string_dynamic_append(firewall_device_input_command_s, &arguments.array[arguments.used]); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); + } - macro_firewall_concat_string(argument.string, firewall_device_input_command_s, firewall_device_input_command_length_s); - argument.used = firewall_device_input_command_length_s; - } - else if (direction == firewall_direction_output_id_e) { - macro_f_string_dynamic_t_resize(status, argument, firewall_device_output_command_length_s); if (F_status_is_error(status)) break; - macro_firewall_concat_string(argument.string, firewall_device_output_command_s, firewall_device_output_command_length_s); - argument.used = firewall_device_output_command_length_s; + ++arguments.used; } + else if (direction == firewall_direction_output_id_e) { + status = f_string_dynamic_append(firewall_device_output_command_s, &arguments.array[arguments.used]); - if (argument.used > 0) { - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } + + if (F_status_is_error(status)) break; + + ++arguments.used; } } // Add the device. - if (device.used > 0) { - macro_f_string_dynamic_t_resize(status, argument, device.used); - + if (device.used) { + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); if (F_status_is_error(status)) break; - macro_firewall_concat_string(argument.string, device.string, device.used); - argument.used = device.used; + arguments.array[arguments.used].used = 0; - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; + status = f_string_dynamic_append(device, &arguments.array[arguments.used]); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } + + if (F_status_is_error(status)) break; + + ++arguments.used; } } if (use_protocol) { - macro_f_string_dynamic_t_resize(status, argument, firewall_protocol_command_s_length); - + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); if (F_status_is_error(status)) break; - macro_firewall_concat_string(argument.string, firewall_protocol_command_s, firewall_protocol_command_s_length); - argument.used = firewall_protocol_command_s_length; + arguments.array[arguments.used].used = 0; - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; + status = f_string_dynamic_append(firewall_protocol_command_s, &arguments.array[arguments.used]); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } - if (protocol.used > 0) { - macro_f_string_dynamic_t_resize(status, argument, protocol.used); + if (F_status_is_error(status)) break; + + ++arguments.used; + if (protocol.used) { + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &arguments); if (F_status_is_error(status)) break; - macro_firewall_concat_string(argument.string, protocol.string, protocol.used); - argument.used = protocol.used; + arguments.array[arguments.used].used = 0; - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; + status = f_string_dynamic_append(protocol, &arguments.array[arguments.used]); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } + + if (F_status_is_error(status)) break; + + ++arguments.used; } } - // Last up is the "rule" + // Last up is the "rule". if ((!is_ip_list && local.rule_contents.array[i].used > 0) || (is_ip_list && local.rule_contents.array[i].used > 1)) { f_array_length_t subcounter = 0; if (is_ip_list) { - // Skip past the chain + // Skip past the chain. ++subcounter; length = macro_firewall_structure_size(local.rule_contents.array[i], subcounter); - if (length > 0) { - macro_f_string_dynamic_t_resize(status, ip_list, length); + if (length) { + ip_list.used = 0; + + status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[subcounter], &ip_list); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&ip_list); + } if (F_status_is_error(status)) { + // Prevent the loop below from being processed. subcounter = local.rule_contents.array[i].used; } else { - macro_firewall_concat_string(ip_list.string, local.buffer.string + local.rule_contents.array[i].array[subcounter].start, length); - ip_list.used = length; - ++subcounter; } } @@ -566,18 +554,18 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal length = macro_firewall_structure_size(local.rule_contents.array[i], subcounter); - if (length > 0) { - macro_f_string_dynamic_t_resize(status, argument, length); + if (length) { + arguments.array[arguments.used].used = 0; - if (F_status_is_error(status)) break; + status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[subcounter], &arguments.array[arguments.used]); - macro_firewall_concat_string(argument.string, local.buffer.string + local.rule_contents.array[i].array[subcounter].start, length); - argument.used = length; - - macro_firewall_append_argument_to_arguments(status, arguments, argument) - if (F_status_is_error(status)) { - break; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } + + if (F_status_is_error(status)) break; + + ++arguments.used; } } // for } @@ -586,9 +574,9 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal flockfile(main->warning.to.stream); - fl_print_format("%r%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); - f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); - fl_print_format("%]%[' has no content.%]%r", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, f_string_eol_s); + fl_print_format("%r%[%QAt line %ul, the object '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context); + fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, local.buffer, local.rule_objects.array[i], main->warning.notable); + fl_print_format("%]%[' has no content.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -599,59 +587,52 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (arguments.used > 1) { if (is_ip_list) { f_file_t file = f_file_t_initialize; - f_string_dynamic_t file_path = f_string_dynamic_t_initialize; + f_string_dynamic_t path_file = f_string_dynamic_t_initialize; f_string_dynamic_t local_buffer = f_string_dynamic_t_initialize; f_fss_objects_t basic_objects = f_fss_objects_t_initialize; f_fss_contents_t basic_contents = f_fss_objects_t_initialize; - macro_f_string_dynamic_t_resize(status, file_path, network_path_s_length + ip_list.used + firewall_default_allocation_step_d); + status = f_string_dynamic_append(firewall_network_path_s, &path_file); - if (status == F_none) { - macro_firewall_concat_string(file_path.string, network_path_s, network_path_s_length); - macro_firewall_concat_string(file_path.string + network_path_s_length, ip_list.string, ip_list.used); - file_path.used = file_path.size; - file_path.string[file_path.used] = 0; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(ip_list, &path_file); + } - status = f_file_open(file_path.string, 0, &file); + if (F_status_is_error_not(status)) { + status = f_file_open(path_file, 0, &file); } if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_parameter) { + if (F_status_set_fine(status) == F_parameter) { if (main->error.verbosity != f_console_verbosity_quiet_e) { firewall_print_error_on_invalid_parameter(main->error, "f_file_open"); } } - else if (status == F_file_found_not) { + else if (F_status_set_fine(status) == F_file_found_not) { // The file does not have to exist if (main->error.verbosity != f_console_verbosity_verbose_e || main->error.verbosity == f_console_verbosity_debug_e) { - fll_print_format("%r%[%QCannot find the file '%Q'.%]%r", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, file_path, main->warning.context, f_string_eol_s); + fll_print_format("%r%[%QCannot find the file '%Q'.%]%r", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, path_file, main->warning.context, f_string_eol_s); } status = F_none; } - else if (status == F_file_open) { + else if (F_status_set_fine(status) == F_file_open) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QUnable to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QUnable to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } } - else if (status == F_file_descriptor) { + else if (F_status_set_fine(status) == F_file_descriptor) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QFile descriptor error while trying to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QFile descriptor error while trying to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } } - else if (status == F_memory_not) { + else if (F_status_set_fine(status) == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); } else { - firewall_print_error_on_unhandled(main->error, "f_file_open", status); - } - - if (status != F_file_found_not) { - status = F_status_set_error(status); + firewall_print_error_on_unhandled(main->error, "f_file_open", F_status_set_fine(status)); } f_file_stream_close(F_true, &file); @@ -662,33 +643,26 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - status = F_status_set_fine(status); - if (main->error.verbosity != f_console_verbosity_quiet_e) { - if (status == F_parameter) { + if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "f_file_read"); } - else if (status == F_number_overflow) { - fll_print_format("%r%[%QInteger overflow while trying to buffer the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); - } - else if (status == F_file_closed) { - fll_print_format("%r%[%QThe file '%Q' is no longer open.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + else if (F_status_set_fine(status) == F_number_overflow) { + fll_print_format("%r%[%QInteger overflow while trying to buffer the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } - else if (status == F_file_seek) { - fll_print_format("%r%[%QA seek error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + else if (F_status_set_fine(status) == F_file_closed) { + fll_print_format("%r%[%QThe file '%Q' is no longer open.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } - else if (status == F_file_read) { - fll_print_format("%r%[%QA read error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + else if (F_status_set_fine(status) == F_file_seek) { + fll_print_format("%r%[%QA seek error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } - else if (status == F_memory_not) { - firewall_print_error_on_allocation_failure(main->error); + else if (F_status_set_fine(status) == F_file_read) { + fll_print_format("%r%[%QA read error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file, main->error.context, f_string_eol_s); } - else { - firewall_print_error_on_unhandled(main->error, "f_file_read", status); + else if (F_status_set_fine(status) != F_memory_not) { + firewall_print_error_on_unhandled(main->error, "f_file_read", F_status_set_fine(status)); } } - - status = F_status_set_error(status); } else { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; @@ -704,16 +678,13 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = F_status_set_fine(status); if (status == F_parameter) { - firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_read", file_path.used ? file_path.string : ""); + firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_read", path_file.used ? path_file : f_string_empty_s); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - // Empty files are to be silently ignored - } - else if (status == F_memory_not) { - firewall_print_error_on_allocation_failure(main->error); + // Empty files are to be silently ignored. } - else { - firewall_print_error_on_unhandled_for_file(main->error, "fll_fss_basic_read", status, file_path.used ? file_path.string : ""); + else if (status != F_memory_not) { + firewall_print_error_on_unhandled_for_file(main->error, "fll_fss_basic_read", status, path_file.used ? path_file : f_string_empty_s); } status = F_status_set_error(status); @@ -728,118 +699,90 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } if (F_status_is_error_not(status)) { - f_array_length_t buffer_counter = 0; - f_array_length_t ip_length = 0; - f_string_dynamic_t ip_list_action = f_string_dynamic_t_initialize; + status = f_string_dynamics_increase_by(2, &arguments); - if (ip_list_direction) { - macro_f_string_dynamic_t_resize(status, ip_list_action, firewall_ip_list_destination_action_s_length); - - if (F_status_is_error(status)) break; + if (F_status_is_error_not(status)) { + arguments.array[arguments.used].used = 0; - macro_firewall_concat_string(ip_list_action.string, firewall_ip_list_destination_action_s, firewall_ip_list_destination_action_s_length); - ip_list_action.used = firewall_ip_list_destination_action_s_length; + if (ip_list_direction) { + status = f_string_dynamic_append(firewall_ip_list_destination_action_s, &arguments.array[arguments.used]); + } + else { + status = f_string_dynamic_append(firewall_ip_list_source_action_s, &arguments.array[arguments.used]); + } } - else { - macro_f_string_dynamic_t_resize(status, ip_list_action, firewall_ip_list_source_action_s_length); - if (F_status_is_error(status)) break; + if (F_status_is_error(status)) { + f_type_array_lengths_resize(0, &delimits); - macro_firewall_concat_string(ip_list_action.string, firewall_ip_list_source_action_s, firewall_ip_list_source_action_s_length); - ip_list_action.used = firewall_ip_list_source_action_s_length; + break; } - status = F_none; - if (arguments.used + 2 > arguments.size) { - macro_f_string_dynamics_t_resize(status, arguments, arguments.size + 2); - } + ++arguments.used; - if (F_status_is_error(status)) { - firewall_print_error_on_allocation_failure(main->error); + // The ip_list file contains objects and no content, all objects are what matter an nothing else. + for (f_array_length_t at = 0; at < basic_objects.used; ++at) { - f_string_dynamic_resize(0, &ip_list_action); - } - else { - f_string_dynamic_t ip_argument = f_string_dynamic_t_initialize; + arguments.array[arguments.used].used = 0; - macro_firewall_append_argument_to_arguments(status, arguments, ip_list_action) - if (F_status_is_error(status)) { - f_string_dynamic_resize(0, &ip_argument); + status = f_string_dynamic_partial_append(local_buffer, basic_objects.array[at], &arguments.array[arguments.used]); - break; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); } - // the ip_list file contains objects and no content, all objects are what matter an nothing else - for (; buffer_counter < basic_objects.used; ++buffer_counter) { - - ip_length = macro_firewall_structure_size(basic_objects, buffer_counter); - - macro_f_string_dynamic_t_resize(status, ip_argument, ip_length); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) { - firewall_print_error_on_allocation_failure(main->error); + ++arguments.used; - break; - } + firewall_print_debug_tool(main->warning, current_tool, arguments); - macro_firewall_concat_string(ip_argument.string, local_buffer.string + basic_objects.array[buffer_counter].start, ip_length); - ip_argument.used = ip_length; + status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code); - macro_firewall_append_argument_to_arguments(status, arguments, ip_argument) - if (F_status_is_error(status)) break; + if (status == F_child) { + f_type_array_lengths_resize(0, &delimits); - firewall_print_debug_tool(main->warning, current_tool, arguments); + f_string_dynamic_resize(0, &ip_list); + f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &device); + f_string_dynamic_resize(0, &protocol); - status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code); + main->child = return_code; - if (status == F_child) { - f_string_dynamic_resize(0, &ip_list); - f_string_dynamic_resize(0, &argument); - f_string_dynamics_resize(0, &arguments); - f_string_dynamic_resize(0, &device); - f_string_dynamic_resize(0, &protocol); + return status; + } - main->child = return_code; + // Remove ip_argument from arguments string. + --arguments.used; - return status; + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_failure) { + firewall_print_error_on_operation(main->error, current_tool, arguments); } - - if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_failure) { - firewall_print_error_on_operation(main->error, current_tool, arguments); - } - else if (F_status_set_fine(status) == F_parameter) { - firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); - } - else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); - } - - // Remove ip_argument from arguments string. - f_string_dynamic_resize(0, &arguments.array[arguments.used--]); - - break; + else if (F_status_set_fine(status) == F_parameter) { + firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); + } + else { + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } - // Remove ip_argument from arguments string. - f_string_dynamic_resize(0, &arguments.array[arguments.used--]); - } // for - - f_string_dynamic_resize(0, &ip_argument); + break; + } + } // for - // Remove ip_list_action from arguments string. - f_string_dynamic_resize(0, &arguments.array[arguments.used--]); - } + // Remove ip_list_action from arguments string. + --arguments.used; } - macro_f_fss_delimits_t_delete_simple(delimits); + f_type_array_lengths_resize(0, &delimits); } } f_string_dynamic_resize(0, &local_buffer); - f_string_dynamic_resize(0, &file_path); - macro_f_fss_objects_t_delete_simple(basic_objects); - macro_f_fss_contents_t_delete_simple(basic_contents); + f_string_dynamic_resize(0, &path_file); + + f_string_ranges_resize(0, &basic_objects); + f_string_rangess_resize(0, &basic_contents); if (F_status_set_fine(status) == F_failure || F_status_set_fine(status) == F_parameter) break; } @@ -850,7 +793,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (status == F_child) { f_string_dynamic_resize(0, &ip_list); - f_string_dynamic_resize(0, &argument); f_string_dynamics_resize(0, &arguments); f_string_dynamic_resize(0, &device); f_string_dynamic_resize(0, &protocol); @@ -867,8 +809,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal else if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); } - else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); + else if (F_status_set_fine(status) != F_memory_not) { + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } break; @@ -878,8 +820,13 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // for } // for + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_memory_not) { + firewall_print_error_on_allocation_failure(main->error); + } + } + f_string_dynamic_resize(0, &ip_list); - f_string_dynamic_resize(0, &argument); f_string_dynamics_resize(0, &arguments); f_string_dynamic_resize(0, &device); f_string_dynamic_resize(0, &protocol); @@ -900,38 +847,24 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ f_array_length_t j = 0; f_array_length_t length = 0; - f_string_range_t range = f_string_range_t_initialize; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_string_dynamic_t fixed_string = f_string_dynamic_t_initialize; - - f_type_array_lengths_resize(0, &local->chain_ids); - macro_f_array_lengths_t_resize(status, local->chain_ids, local->chain_objects.used); - - if (F_status_is_error(status)) { - return status; - } + local->chain_ids.used = local->chain_objects.used; status = f_string_dynamics_resize(2, &arguments); if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(firewall_chain_create_command_s_length + 1, &arguments.array[0]); + status = f_string_dynamic_append(firewall_chain_create_command_s, &arguments.array[0]); - if (F_status_is_error(status)) { - f_string_dynamics_resize(0, &arguments); - - return status; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&arguments.array[0]); } - macro_firewall_concat_string(arguments.array[0].string, firewall_chain_create_command_s, firewall_chain_create_command_s_length); - - arguments.array[0].used = firewall_chain_create_command_s_length; - arguments.array[0].string[firewall_chain_create_command_s_length] = 0; - - status = f_string_dynamic_increase(F_memory_default_allocation_small_d, &arguments.array[1]); + if (F_status_is_error_not(status)) { + status = f_string_dynamic_increase(F_memory_default_allocation_small_d, &arguments.array[1]); + } if (F_status_is_error(status)) { - arguments.used = 1; f_string_dynamics_resize(0, &arguments); return status; @@ -943,129 +876,79 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ reserved->has_stop = F_false; reserved->has_main = F_false; - for (uint16_t signal_check = 0; i < local->chain_objects.used; ) { + for (uint16_t signal_check = 0; i < local->chain_objects.used; ++i) { new_chain = F_true; j = 0; if (!((++signal_check) % firewall_signal_check_d)) { - if (firewall_signal_received(main)) { - f_string_dynamics_resize(0, &arguments); - - return F_status_set_error(F_interrupt); - } + if (firewall_signal_received(main)) break; } - // Skip globally reserved chain name: main - range.start = 0; - range.stop = firewall_group_main_s_length - 1; - fixed_string.string = firewall_group_main_s; - fixed_string.used = firewall_group_main_s_length; - if (fl_string_dynamic_partial_compare(local->buffer, fixed_string, local->chain_objects.array[i], range) == F_equal_to) { + // Skip globally reserved chain name: main. + if (fl_string_dynamic_partial_compare_string(firewall_group_main_s.string, local->buffer, firewall_group_main_s.used, local->chain_objects.array[i]) == F_equal_to) { new_chain = F_false; reserved->has_main = F_true; reserved->main_at = i; } - // Skip globally reserved chain name: stop - range.start = 0; - range.stop = firewall_group_stop_s_length - 1; - fixed_string.string = firewall_group_stop_s; - fixed_string.used = firewall_group_stop_s_length; - if (fl_string_dynamic_partial_compare(local->buffer, fixed_string, local->chain_objects.array[i], range) == F_equal_to) { + // Skip globally reserved chain name: stop. + if (fl_string_dynamic_partial_compare_string(firewall_group_stop_s.string, local->buffer, firewall_group_stop_s.used, local->chain_objects.array[i]) == F_equal_to) { new_chain = F_false; reserved->has_stop = F_true; reserved->stop_at = i; } - // Skip globally reserved chain name: lock - range.start = 0; - range.stop = firewall_group_lock_s_length - 1; - fixed_string.string = firewall_group_lock_s; - fixed_string.used = firewall_group_lock_s_length; - if (fl_string_dynamic_partial_compare(local->buffer, fixed_string, local->chain_objects.array[i], range) == F_equal_to) { + // Skip globally reserved chain name: lock. + if (fl_string_dynamic_partial_compare_string(firewall_group_lock_s.string, local->buffer, firewall_group_lock_s.used, local->chain_objects.array[i]) == F_equal_to) { new_chain = F_false; reserved->has_lock = F_true; reserved->lock_at = i; } - // Skip globally reserved chain name: none - range.start = 0; - range.stop = firewall_group_lock_s_length - 1; - fixed_string.string = firewall_chain_none_s; - fixed_string.used = firewall_chain_none_s_length; - if (fl_string_dynamic_partial_compare(local->buffer, fixed_string, local->chain_objects.array[i], range) == F_equal_to) { + // Skip globally reserved chain name: none. + if (fl_string_dynamic_partial_compare_string(firewall_chain_none_s.string, local->buffer, firewall_chain_none_s.used, local->chain_objects.array[i]) == F_equal_to) { new_chain = F_false; } - macro_f_string_dynamic_t_clear(fixed_string); - if (new_chain) { - while (j < main->chains.used) { - - range.start = 0; - range.stop = main->chains.array[j].used - 1; + for (; j < main->chains.used; ++j) { - if (fl_string_dynamic_partial_compare(local->buffer, main->chains.array[j], local->chain_objects.array[i], range) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(main->chains.array[j].string, local->buffer, main->chains.array[j].used, local->chain_objects.array[i]) == F_equal_to) { new_chain = F_false; local->chain_ids.array[i] = j; break; } - - ++j; - } // while + } // for } if (new_chain) { - if (main->chains.used == main->chains.size) { - macro_f_string_dynamics_t_resize(status, main->chains, main->chains.used + firewall_default_allocation_step_d); - - if (F_status_is_error(status)) { - f_string_dynamics_resize(0, &arguments); - - return status; - } - } + status = f_string_dynamics_increase(firewall_default_allocation_step_d, &main->chains); + if (F_status_is_error(status)) break; create_chain = F_true; length = macro_firewall_structure_size(local->chain_objects, i); arguments.array[1].used = 0; - if (length > arguments.array[1].size) { - macro_f_string_dynamic_t_resize(status, arguments.array[1], length + 1); - - if (F_status_is_error(status)) { - f_string_dynamics_resize(0, &arguments); - - return status; - } - } - macro_f_string_dynamic_t_resize(status, main->chains.array[main->chains.used], length + 1); - - if (F_status_is_error(status)) { - f_string_dynamics_resize(0, &arguments); + status = f_string_dynamic_increase_by(length + 1, &arguments.array[1]); + if (F_status_is_error(status)) break; - return status; - } + status = f_string_dynamic_increase_by(length + 1, &main->chains.array[main->chains.used]); + if (F_status_is_error(status)) break; main->chains.array[main->chains.used].used = 0; local->chain_ids.array[i] = main->chains.used; - j = local->chain_objects.array[i].start; - // copy the string character by character, ignoring placeholders. - while (j <= local->chain_objects.array[i].stop) { + // Copy the string character by character, ignoring placeholders. + for (j = local->chain_objects.array[i].start; j <= local->chain_objects.array[i].stop; ++j) { - if (local->buffer.string[j] == f_fss_delimit_placeholder_s.string[0]) { - ++j; - continue; - } + if (local->buffer.string[j] == f_fss_delimit_placeholder_s.string[0]) continue; main->chains.array[main->chains.used].string[main->chains.array[main->chains.used].used++] = local->buffer.string[j]; arguments.array[1].string[arguments.array[1].used++] = local->buffer.string[j]; - ++j; - } // while + } // for arguments.array[1].string[arguments.array[1].used] = 0; main->chains.array[main->chains.used].string[main->chains.array[main->chains.used].used] = 0; @@ -1093,59 +976,48 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ status = fll_execute_program(firewall_tool_iptables_s, arguments, 0, 0, (void *) &return_code); if (status == F_child) { - f_string_dynamics_resize(0, &arguments); - main->child = return_code; - return status; + break; } if (F_status_is_error_not(status)) { - status = firewall_signal_received(main); - - if (status) { - f_string_dynamics_resize(0, &arguments); + if (firewall_signal_received(main)) { + status = F_status_set_error(F_interrupt); - return F_status_set_error(F_interrupt); + break; } firewall_print_debug_tool(main->warning, firewall_tool_ip6tables_s, arguments); tool = firewall_program_ip6tables_e; - status = fll_execute_program((f_string_t) firewall_tool_ip6tables_s, arguments, 0, 0, (void *) &return_code); + status = fll_execute_program(firewall_tool_ip6tables_s, arguments, 0, 0, (void *) &return_code); if (status == F_child) { - f_string_dynamics_resize(0, &arguments); - main->child = return_code; - return status; + break; } } if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_failure) { + if (F_status_set_fine(status) == F_failure) { firewall_print_error_on_operation(main->error, tool == firewall_program_iptables_e ? firewall_tool_iptables_s : firewall_tool_ip6tables_s, arguments); } - else if (status == F_parameter) { + else if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); } else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } - f_string_dynamics_resize(0, &arguments); - return status; + break; } } ++main->chains.used; } - - ++i; - } // while + } // for f_string_dynamics_resize(0, &arguments); @@ -1167,7 +1039,7 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { arguments.used = 1; f_string_static_t arguments_array[arguments.used]; - arguments_array[0] = firewall_chain_forward_s; + arguments_array[0] = firewall_chain_flush_command_s; arguments.array = arguments_array; int return_code = 0; @@ -1183,64 +1055,61 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { } if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_failure) { + if (F_status_set_fine(status) == F_failure) { firewall_print_error_on_operation(main->error, tools[i], arguments); } - else if (status == F_parameter) { + else if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); } else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } return status; } } // for - for (f_array_length_t i = 0; i < 2; ++i) { - - if (firewall_signal_received(main)) { - return F_status_set_error(F_interrupt); - } + int return_code = 0; - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_string_dynamic_t argument[1] = f_string_dynamic_t_initialize; - int return_code = 0; + f_string_statics_t arguments = f_string_statics_t_initialize; + arguments.used = 1; - argument[0].string = (f_string_t) firewall_chain_delete_command_s; - argument[0].size = firewall_chain_delete_command_s_length; - argument[0].used = firewall_chain_delete_command_s_length; + f_string_static_t argument_array[arguments.used]; + arguments.array = argument_array; + argument_array[0] = firewall_chain_delete_command_s; - arguments.array = argument; - arguments.size = 1; - arguments.used = 1; + for (f_array_length_t i = 0; i < 2; ++i) { firewall_print_debug_tool(main->warning, tools[i], arguments); + return_code = 0; + status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code); if (status == F_child) { main->child = return_code; - return status; + break; } - if (F_status_is_error(status)) { - status = F_status_set_fine(status); + if (firewall_signal_received(main)) { + status = F_status_set_error(F_interrupt); + + break; + } - if (status == F_failure) { + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_failure) { firewall_print_error_on_operation(main->error, tools[i], arguments); } - else if (status == F_parameter) { + else if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); } else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } - return status; + break; } } // for @@ -1256,24 +1125,22 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { int return_code = 0; - for (f_array_length_t i = 0; i < 3; ++i) { + f_string_statics_t arguments = f_string_statics_t_initialize; + arguments.used = 3; - f_string_statics_t arguments = f_string_statics_t_initialize; - f_string_static_t argument[3]; + f_string_static_t argument_array[arguments.used]; + arguments.array = argument_array; + arguments.array[0] = firewall_action_policy_command_s; + arguments.array[2] = firewall_chain_drop_s; - arguments.array = argument; - arguments.used = 3; - arguments.size = arguments.used; - - arguments.array[0] = firewall_action_policy_command_s; - arguments.array[1] = chains[i]; - arguments.array[2].string = "DROP"; + f_array_length_t i = 0; + f_array_length_t j = 0; - arguments.array[2].used = 4; + for (; i < 3; ++i) { - arguments.array[2].size = arguments.array[2].used; + arguments.array[1] = chains[i]; - for (f_array_length_t j = 0; j < 2; ++j) { + for (j = 0; j < 2; ++j) { firewall_print_debug_tool(main->warning, tools[j], arguments); @@ -1284,27 +1151,27 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { if (status == F_child) { main->child = return_code; - return status; + break; } if (firewall_signal_received(main)) { - return F_status_set_error(F_interrupt); + status = F_status_set_error(F_interrupt); + + break; } if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_failure) { + if (F_status_set_fine(status) == F_failure) { firewall_print_error_on_operation(main->error, tools[j], arguments); } - else if (status == F_parameter) { + else if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program"); } else { - firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); + firewall_print_error_on_unhandled(main->error, "fll_execute_program", F_status_set_fine(status)); } - return status; + break; } } // for } // for @@ -1319,31 +1186,29 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_st f_status_t status = f_file_open(filename, 0, &file); if (F_status_is_error(status)) { - status = F_status_set_fine(status); - if (main->error.verbosity != f_console_verbosity_quiet_e) { if (optional) { - if (status == F_parameter) { + if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "f_file_open"); } - else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) { - firewall_print_error_on_unhandled(main->error, "f_file_open", status); + else if (F_status_set_fine(status) != F_file_found_not && F_status_set_fine(status) != F_file_open && F_status_set_fine(status) != F_file_descriptor) { + firewall_print_error_on_unhandled(main->error, "f_file_open", F_status_set_fine(status)); } } else { - if (status == F_parameter) { + if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "f_file_open"); } - else if (status == F_file_found_not) { + else if (F_status_set_fine(status) == F_file_found_not) { fll_print_format("%r%[%QUnable to find the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_file_open) { + else if (F_status_set_fine(status) == F_file_open) { fll_print_format("%r%[%QUnable to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_file_descriptor) { + else if (F_status_set_fine(status) == F_file_descriptor) { fll_print_format("%r%[%QFile descriptor error while trying to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else { - firewall_print_error_on_unhandled(main->error, "f_file_open", status); + firewall_print_error_on_unhandled(main->error, "f_file_open", F_status_set_fine(status)); } } } @@ -1356,29 +1221,27 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_st f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - status = F_status_set_fine(status); - if (main->error.verbosity != f_console_verbosity_quiet_e) { - if (status == F_parameter) { + if (F_status_set_fine(status) == F_parameter) { firewall_print_error_on_invalid_parameter(main->error, "f_file_read"); } - else if (status == F_number_overflow) { + else if (F_status_set_fine(status) == F_number_overflow) { fll_print_format("%r%[%QInteger overflow while trying to buffer the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_file_closed) { + else if (F_status_set_fine(status) == F_file_closed) { fll_print_format("%r%[%QThe file '%Q' is no longer open.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_file_seek) { + else if (F_status_set_fine(status) == F_file_seek) { fll_print_format("%r%[%QA seek error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_file_read) { + else if (F_status_set_fine(status) == F_file_read) { fll_print_format("%r%[%QA read error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } - else if (status == F_memory_not) { + else if (F_status_set_fine(status) == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); } else { - firewall_print_error_on_unhandled(main->error, "f_file_read", status); + firewall_print_error_on_unhandled(main->error, "f_file_read", F_status_set_fine(status)); } } @@ -1451,35 +1314,21 @@ f_status_t firewall_process_rules(firewall_main_t * const main, f_string_range_t if (F_status_is_error_not(status)) { status = firewall_perform_commands(main, *local); - if (status == F_child) { - macro_f_fss_objects_t_delete_simple(local->rule_objects); - macro_f_fss_contents_t_delete_simple(local->rule_contents); - - return status; - } - if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_memory_not) { + if (F_status_set_fine(status) == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); } - else if (status == F_failure) { + else if (F_status_set_fine(status) == F_failure) { // The error message has already been displayed. } else { - firewall_print_error_on_unhandled(main->error, "firewall_perform_commands", status); + firewall_print_error_on_unhandled(main->error, "firewall_perform_commands", F_status_set_fine(status)); } - - macro_f_fss_objects_t_delete_simple(local->rule_objects); - macro_f_fss_contents_t_delete_simple(local->rule_contents); - - return status; } } - macro_f_fss_objects_t_delete_simple(local->rule_objects); - macro_f_fss_contents_t_delete_simple(local->rule_contents); + f_string_ranges_resize(0, &local->rule_objects); + f_string_rangess_resize(0, &local->rule_contents); return status; } @@ -1496,10 +1345,12 @@ f_status_t firewall_delete_local_data(firewall_local_data_t * const local) { f_string_dynamic_resize(0, &local->buffer); f_type_array_lengths_resize(0, &local->chain_ids); - macro_f_fss_objects_t_delete_simple(local->chain_objects); - macro_f_fss_contents_t_delete_simple(local->chain_contents); - macro_f_fss_objects_t_delete_simple(local->rule_objects); - macro_f_fss_contents_t_delete_simple(local->rule_contents); + + f_string_ranges_resize(0, &local->chain_objects); + f_string_rangess_resize(0, &local->chain_contents); + + f_string_ranges_resize(0, &local->rule_objects); + f_string_rangess_resize(0, &local->rule_contents); return F_none; } diff --git a/level_3/firewall/c/private-firewall.h b/level_3/firewall/c/private-firewall.h index fdb0c68..fcac4b7 100644 --- a/level_3/firewall/c/private-firewall.h +++ b/level_3/firewall/c/private-firewall.h @@ -26,7 +26,15 @@ extern "C" { * * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * - * Status codes (with error bit) are returned on any problem. + * Errors (with error bit) from: f_string_dynamic_append(). + * Errors (with error bit) from: f_string_dynamic_partial_append(). + * Errors (with error bit) from: f_string_dynamics_increase(). + * Errors (with error bit) from: f_string_dynamics_increase_by(). + * + * @see f_string_dynamic_append() + * @see f_string_dynamic_partial_append() + * @see f_string_dynamics_increase() + * @see f_string_dynamics_increase_by() */ extern f_status_t firewall_perform_commands(firewall_main_t * const main, const firewall_local_data_t local) F_attribute_visibility_internal_d; diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index afa5e52..886acda 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_basic_list_read_program_version_ + const f_string_static_t fss_basic_list_read_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_program_version_s, 0, FSS_BASIC_LIST_READ_program_version_s_length); +#endif // _di_fss_basic_list_read_program_version_ + +#ifndef _di_fss_basic_list_read_program_name_ + const f_string_static_t fss_basic_list_read_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_program_name_s, 0, FSS_BASIC_LIST_READ_program_name_s_length); + const f_string_static_t fss_basic_list_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_program_name_long_s, 0, FSS_BASIC_LIST_READ_program_name_long_s_length); +#endif // _di_fss_basic_list_read_program_name_ #ifndef _di_fss_basic_list_read_main_delete_ f_status_t fss_basic_list_read_main_delete(fss_basic_list_read_main_t * const main) { diff --git a/level_3/fss_basic_list_write/c/common.c b/level_3/fss_basic_list_write/c/common.c index dec052c..42e4508 100644 --- a/level_3/fss_basic_list_write/c/common.c +++ b/level_3/fss_basic_list_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_basic_list_write_program_version_ + const f_string_static_t fss_basic_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_version_s, 0, FSS_BASIC_LIST_WRITE_program_version_s_length); +#endif // _di_fss_basic_list_write_program_version_ + +#ifndef _di_fss_basic_list_write_program_name_ + const f_string_static_t fss_basic_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_name_s, 0, FSS_BASIC_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_basic_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_name_long_s, 0, FSS_BASIC_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_basic_list_write_program_name_ #ifndef _di_fss_basic_list_write_main_delete_ f_status_t fss_basic_list_write_main_delete(fss_basic_list_write_main_t * const main) { diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index 6393649..00b15d7 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_basic_read_program_version_ + const f_string_static_t fss_basic_read_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_program_version_s, 0, FSS_BASIC_READ_program_version_s_length); +#endif // _di_fss_basic_read_program_version_ + +#ifndef _di_fss_basic_read_program_name_ + const f_string_static_t fss_basic_read_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_program_name_s, 0, FSS_BASIC_READ_program_name_s_length); + const f_string_static_t fss_basic_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_program_name_long_s, 0, FSS_BASIC_READ_program_name_long_s_length); +#endif // _di_fss_basic_read_program_name_ #ifndef _di_fss_basic_read_main_delete_ f_status_t fss_basic_read_main_delete(fss_basic_read_main_t * const main) { diff --git a/level_3/fss_basic_write/c/common.c b/level_3/fss_basic_write/c/common.c index 2b16896..7dbeed0 100644 --- a/level_3/fss_basic_write/c/common.c +++ b/level_3/fss_basic_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_basic_write_program_version_ + const f_string_static_t fss_basic_write_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_version_s, 0, FSS_BASIC_WRITE_program_version_s_length); +#endif // _di_fss_basic_write_program_version_ + +#ifndef _di_fss_basic_write_program_name_ + const f_string_static_t fss_basic_write_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_name_s, 0, FSS_BASIC_WRITE_program_name_s_length); + const f_string_static_t fss_basic_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_name_long_s, 0, FSS_BASIC_WRITE_program_name_long_s_length); +#endif // _di_fss_basic_write_program_name_ #ifndef _di_fss_basic_write_main_delete_ f_status_t fss_basic_write_main_delete(fss_basic_write_main_t * const main) { diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 99fec5e..e084a68 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_embedded_list_read_program_version_ + const f_string_static_t fss_embedded_list_read_program_version_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_program_version_s, 0, FSS_EMBEDDED_LIST_READ_program_version_s_length); +#endif // _di_fss_embedded_list_read_program_version_ + +#ifndef _di_fss_embedded_list_read_program_name_ + const f_string_static_t fss_embedded_list_read_program_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_program_name_s, 0, FSS_EMBEDDED_LIST_READ_program_name_s_length); + const f_string_static_t fss_embedded_list_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_program_name_long_s, 0, FSS_EMBEDDED_LIST_READ_program_name_long_s_length); +#endif // _di_fss_embedded_list_read_program_name_ #ifndef _di_fss_embedded_list_read_main_delete_ f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t * const main) { diff --git a/level_3/fss_embedded_list_write/c/common.c b/level_3/fss_embedded_list_write/c/common.c index 28fdc85..7e5d00c 100644 --- a/level_3/fss_embedded_list_write/c/common.c +++ b/level_3/fss_embedded_list_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_embedded_list_write_program_version_ + const f_string_static_t fss_embedded_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_version_s, 0, FSS_EMBEDDED_LIST_WRITE_program_version_s_length); +#endif // _di_fss_embedded_list_write_program_version_ + +#ifndef _di_fss_embedded_list_write_program_name_ + const f_string_static_t fss_embedded_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_name_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_embedded_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_name_long_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_embedded_list_write_program_name_ #ifndef _di_fss_embedded_list_write_main_delete_ f_status_t fss_embedded_list_write_main_delete(fss_embedded_list_write_main_t * const main) { diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index 55823ac..07fd628 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_extended_list_read_program_version_ + const f_string_static_t fss_extended_list_read_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_program_version_s, 0, FSS_EXTENDED_LIST_READ_program_version_s_length); +#endif // _di_fss_extended_list_read_program_version_ + +#ifndef _di_fss_extended_list_read_program_name_ + const f_string_static_t fss_extended_list_read_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_program_name_s, 0, FSS_EXTENDED_LIST_READ_program_name_s_length); + const f_string_static_t fss_extended_list_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_program_name_long_s, 0, FSS_EXTENDED_LIST_READ_program_name_long_s_length); +#endif // _di_fss_extended_list_read_program_name_ #ifndef _di_fss_extended_list_read_main_delete_ f_status_t fss_extended_list_read_main_delete(fss_extended_list_read_main_t *main) { diff --git a/level_3/fss_extended_list_write/c/common.c b/level_3/fss_extended_list_write/c/common.c index 453756d..7a09a32 100644 --- a/level_3/fss_extended_list_write/c/common.c +++ b/level_3/fss_extended_list_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_extended_list_write_program_version_ + const f_string_static_t fss_extended_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_version_s, 0, FSS_EXTENDED_LIST_WRITE_program_version_s_length); +#endif // _di_fss_extended_list_write_program_version_ + +#ifndef _di_fss_extended_list_write_program_name_ + const f_string_static_t fss_extended_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_name_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_extended_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_name_long_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_extended_list_write_program_name_ #ifndef _di_fss_extended_list_write_main_delete_ f_status_t fss_extended_list_write_main_delete(fss_extended_list_write_main_t *main) { diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index 5721f09..6df5397 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_extended_read_program_version_ + const f_string_static_t fss_extended_read_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_program_version_s, 0, FSS_EXTENDED_READ_program_version_s_length); +#endif // _di_fss_extended_read_program_version_ + +#ifndef _di_fss_extended_read_program_name_ + const f_string_static_t fss_extended_read_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_program_name_s, 0, FSS_EXTENDED_READ_program_name_s_length); + const f_string_static_t fss_extended_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_program_name_long_s, 0, FSS_EXTENDED_READ_program_name_long_s_length); +#endif // _di_fss_extended_read_program_name_ #ifndef _di_fss_extended_read_main_delete_ f_status_t fss_extended_read_main_delete(fss_extended_read_main_t * const main) { diff --git a/level_3/fss_extended_write/c/common.c b/level_3/fss_extended_write/c/common.c index 1150784..823700d 100644 --- a/level_3/fss_extended_write/c/common.c +++ b/level_3/fss_extended_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_extended_write_program_version_ + const f_string_static_t fss_extended_write_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_version_s, 0, FSS_EXTENDED_WRITE_program_version_s_length); +#endif // _di_fss_extended_write_program_version_ + +#ifndef _di_fss_extended_write_program_name_ + const f_string_static_t fss_extended_write_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_name_s, 0, FSS_EXTENDED_WRITE_program_name_s_length); + const f_string_static_t fss_extended_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_name_long_s, 0, FSS_EXTENDED_WRITE_program_name_long_s_length); +#endif // _di_fss_extended_write_program_name_ #ifndef _di_fss_extended_write_main_delete_ f_status_t fss_extended_write_main_delete(fss_extended_write_main_t * const main) { diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index c55c2cb..ae737ea 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_identify_program_version_ + const f_string_static_t fss_identify_program_version_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_program_version_s, 0, FSS_IDENTIFY_program_version_s_length); +#endif // _di_fss_identify_program_version_ + +#ifndef _di_fss_identify_program_name_ + const f_string_static_t fss_identify_program_name_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_program_name_s, 0, FSS_IDENTIFY_program_name_s_length); + const f_string_static_t fss_identify_program_name_long_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_program_name_long_s, 0, FSS_IDENTIFY_program_name_long_s_length); +#endif // _di_fss_identify_program_name_ #ifndef _di_fss_identify_main_delete_ f_status_t fss_identify_main_delete(fss_identify_main_t * const main) { diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index c2ec9b3..fab4106 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_payload_read_program_version_ + const f_string_static_t fss_payload_read_program_version_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_program_version_s, 0, FSS_PAYLOAD_READ_program_version_s_length); +#endif // _di_fss_payload_read_program_version_ + +#ifndef _di_fss_payload_read_program_name_ + const f_string_static_t fss_payload_read_program_name_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_program_name_s, 0, FSS_PAYLOAD_READ_program_name_s_length); + const f_string_static_t fss_payload_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_program_name_long_s, 0, FSS_PAYLOAD_READ_program_name_long_s_length); +#endif // _di_fss_payload_read_program_name_ #ifndef _di_fss_payload_read_main_delete_ f_status_t fss_payload_read_main_delete(fss_payload_read_main_t * const main) { diff --git a/level_3/fss_payload_write/c/common.c b/level_3/fss_payload_write/c/common.c index 580f1d8..73ec236 100644 --- a/level_3/fss_payload_write/c/common.c +++ b/level_3/fss_payload_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_payload_write_program_version_ + const f_string_static_t fss_payload_write_program_version_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_program_version_s, 0, FSS_PAYLOAD_WRITE_program_version_s_length); +#endif // _di_fss_payload_write_program_version_ + +#ifndef _di_fss_payload_write_program_name_ + const f_string_static_t fss_payload_write_program_name_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_program_name_s, 0, FSS_PAYLOAD_WRITE_program_name_s_length); + const f_string_static_t fss_payload_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_program_name_long_s, 0, FSS_PAYLOAD_WRITE_program_name_long_s_length); +#endif // _di_fss_payload_write_program_name_ #ifndef _di_fss_payload_write_main_delete_ f_status_t fss_payload_write_main_delete(fss_payload_write_main_t * const main) { diff --git a/level_3/fss_status_code/c/common.c b/level_3/fss_status_code/c/common.c index 63ed5a1..7938516 100644 --- a/level_3/fss_status_code/c/common.c +++ b/level_3/fss_status_code/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_fss_status_code_program_version_ + const f_string_static_t fss_status_code_program_version_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_version_s, 0, FSS_STATUS_CODE_program_version_s_length); +#endif // _di_fss_status_code_program_version_ + +#ifndef _di_fss_status_code_program_name_ + const f_string_static_t fss_status_code_program_name_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_s, 0, FSS_STATUS_CODE_program_name_s_length); + const f_string_static_t fss_status_code_program_name_long_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_long_s, 0, FSS_STATUS_CODE_program_name_long_s_length); +#endif // _di_fss_status_code_program_name_ #ifndef _di_fss_status_code_main_delete_ f_status_t fss_status_code_main_delete(fss_status_code_main_t * const main) { diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c index 8fb3210..c177de7 100644 --- a/level_3/iki_read/c/common.c +++ b/level_3/iki_read/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_iki_read_program_version_ + const f_string_static_t iki_read_program_version_s = macro_f_string_static_t_initialize(IKI_READ_program_version_s, 0, IKI_READ_program_version_s_length); +#endif // _di_iki_read_program_version_ + +#ifndef _di_iki_read_program_name_ + const f_string_static_t iki_read_program_name_s = macro_f_string_static_t_initialize(IKI_READ_program_name_s, 0, IKI_READ_program_name_s_length); + const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length); +#endif // _di_iki_read_program_name_ #ifndef _di_iki_read_main_delete_ f_status_t iki_read_main_delete(iki_read_main_t * const main) { diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/common.c index 1f1ba64..37f36f4 100644 --- a/level_3/iki_write/c/common.c +++ b/level_3/iki_write/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_iki_write_program_version_ + const f_string_static_t iki_write_program_version_s = macro_f_string_static_t_initialize(IKI_WRITE_program_version_s, 0, IKI_WRITE_program_version_s_length); +#endif // _di_iki_write_program_version_ + +#ifndef _di_iki_write_program_name_ + const f_string_static_t iki_write_program_name_s = macro_f_string_static_t_initialize(IKI_WRITE_program_name_s, 0, IKI_WRITE_program_name_s_length); + const f_string_static_t iki_write_program_name_long_s = macro_f_string_static_t_initialize(IKI_WRITE_program_name_long_s, 0, IKI_WRITE_program_name_long_s_length); +#endif // _di_iki_write_program_name_ #ifndef _di_iki_write_main_delete_ f_status_t iki_write_main_delete(iki_write_main_t * const main) { diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/common.c index 3bcc73c..5389d22 100644 --- a/level_3/status_code/c/common.c +++ b/level_3/status_code/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_status_code_program_version_ + const f_string_static_t status_code_program_version_s = macro_f_string_static_t_initialize(STATUS_CODE_program_version_s, 0, STATUS_CODE_program_version_s_length); +#endif // _di_status_code_program_version_ + +#ifndef _di_status_code_program_name_ + const f_string_static_t status_code_program_name_s = macro_f_string_static_t_initialize(STATUS_CODE_program_name_s, 0, STATUS_CODE_program_name_s_length); + const f_string_static_t status_code_program_name_long_s = macro_f_string_static_t_initialize(STATUS_CODE_program_name_long_s, 0, STATUS_CODE_program_name_long_s_length); +#endif // _di_status_code_program_name_ #ifndef _di_status_code_main_delete_ f_status_t status_code_main_delete(status_code_main_t * const main) { diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/common.c index d1a892d..9071f8c 100644 --- a/level_3/utf8/c/common.c +++ b/level_3/utf8/c/common.c @@ -4,14 +4,14 @@ extern "C" { #endif -#ifndef _di_firewall_program_version_ - const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); - const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); -#endif // _di_firewall_program_name_ +#ifndef _di_utf8_program_version_ + const f_string_static_t utf8_program_version_s = macro_f_string_static_t_initialize(UTF8_program_version_s, 0, UTF8_program_version_s_length); +#endif // _di_utf8_program_version_ + +#ifndef _di_utf8_program_name_ + const f_string_static_t utf8_program_name_s = macro_f_string_static_t_initialize(UTF8_program_name_s, 0, UTF8_program_name_s_length); + const f_string_static_t utf8_program_name_long_s = macro_f_string_static_t_initialize(UTF8_program_name_long_s, 0, UTF8_program_name_long_s_length); +#endif // _di_utf8_program_name_ #ifndef _di_utf8_main_delete_ f_status_t utf8_main_delete(utf8_main_t *main) { -- 1.8.3.1