This gets the programming compiling.
There still remains some code to change.
The runtime needs to be tested.
I expect that there are things wrong given how much I jumped around while migrating this.
}
f_number_unsigned_t at = 0;
+ f_number_unsigned_t index = 0;
if (main->program.parameters.array[firewall_parameter_operation_start_e].result & f_console_result_found_e) {
main->setting.flag &= ~firewall_main_flag_operation_lock_e;
}
if (main->setting.flag & firewall_main_flag_operation_show_e) {
- if (main->parameters.remaining.used) {
+ if (main->program.parameters.remaining.used) {
main->setting.flag &= ~firewall_main_flag_operation_show_filter_nat_mangle_e;
- for (at = 0; at < main->parameters.remaining.used; ++at) {
+ for (at = 0; at < main->program.parameters.remaining.used; ++at) {
if (firewall_signal_check(main)) return;
- if (f_compare_dynamic(firewall_show_nat_s, data.argv[main->program.parameters.remaining.array[at]]) == F_equal_to) {
+ index = main->program.parameters.remaining.array[at];
+
+ if (f_compare_dynamic(firewall_show_nat_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
main->setting.flag |= firewall_main_flag_operation_show_nat_e;
}
- else if (f_compare_dynamic(firewall_show_mangle_s, data.argv[main->program.parameters.remaining.array[at]]) == F_equal_to) {
+ else if (f_compare_dynamic(firewall_show_mangle_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
main->setting.flag |= firewall_main_flag_operation_show_mangle_e;
}
- else if (f_compare_dynamic(firewall_show_fillter_s, data.argv[main->program.parameters.remaining.array[at]]) == F_equal_to) {
+ else if (f_compare_dynamic(firewall_show_filter_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
main->setting.flag |= firewall_main_flag_operation_show_filter_e;
}
else {
- firewall_print_warning_show_option_unknown(&main->warning, data.argv[main->program.parameters.remaining.array[at]]);
+ firewall_print_warning_show_option_unknown(&main->program.warning, main->program.parameters.arguments.array[index]);
}
} // for
}
main->setting.flag |= firewall_main_flag_operation_show_filter_nat_mangle_e;
}
}
+ else {
+ // @todo
+
+ // Example:
+ /*
+ for (f_number_unsigned_t number = 0; index < main->program.parameters.remaining.used; ++index) {
+
+ if (control_signal_check(main)) return;
+
+ number = main->program.parameters.remaining.array[index];
+
+ // Statically allocate the inner strings.
+ main->setting.actions.array[main->setting.actions.used].string = main->program.parameters.arguments.array[number].string;
+ main->setting.actions.array[main->setting.actions.used].used = main->program.parameters.arguments.array[number].used;
+ main->setting.actions.array[main->setting.actions.used++].size = 0;
+ } // for
+ */
+ }
}
#endif // _di_firewall_setting_load_
*
* firewall_chain_*_e:
* - none: The chain is none.
+ * - custom: The chain is custom.
* - forward: The chain is forward.
* - input: The chain is input.
* - output: The chain is output.
#ifndef _di_firewall_action_e_
enum {
firewall_chain_none_e,
+ firewall_chain_custom_e,
firewall_chain_forward_e,
firewall_chain_input_e,
firewall_chain_output_e,
*/
#ifndef _di_firewall_parameter_e_
enum {
- fake_parameter_operation_lock_e = f_console_standard_parameter_last_e,
- fake_parameter_operation_restart_e,
- fake_parameter_operation_show_e,
- fake_parameter_operation_start_e,
- fake_parameter_operation_stop_e,
+ firewall_parameter_operation_lock_e = f_console_standard_parameter_last_e,
+ firewall_parameter_operation_restart_e,
+ firewall_parameter_operation_show_e,
+ firewall_parameter_operation_start_e,
+ firewall_parameter_operation_stop_e,
}; // enum
#define firewall_console_parameter_t_initialize \
{ \
macro_fll_program_console_parameter_standard_initialize, \
\
- macro_f_console_parameter_t_initialize_6(fake_other_operation_lock_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_6(fake_other_operation_restart_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_6(fake_other_operation_show_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_6(fake_other_operation_start_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_6(fake_other_operation_stop_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_operation_lock_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_operation_restart_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_operation_show_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_operation_start_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_operation_stop_s, 0, f_console_flag_simple_e), \
}
#define firewall_parameter_total_d (f_console_parameter_state_type_total_d + 5)
"f_memory_array_increase_by",
"f_string_dynamic_append",
"f_string_dynamic_partial_append",
+ "f_string_dynamic_partial_append_nulless",
+ "f_string_dynamic_terminate_after",
+ "f_thread_create",
"firewall_operate_process_rules",
"fll_execute_program",
"fll_fss_basic_read",
firewall_f_f_memory_array_increase_by_e,
firewall_f_f_string_dynamic_append_e,
firewall_f_f_string_dynamic_partial_append_e,
- firewall_f_firewall_operate_process_rules_perform_e,
+ firewall_f_f_string_dynamic_partial_append_nulless_e,
+ firewall_f_f_string_dynamic_terminate_after_e,
+ firewall_f_f_thread_create_e,
+ firewall_f_firewall_operate_process_rules_e,
firewall_f_fll_execute_program_e,
firewall_f_fll_fss_basic_read_e,
firewall_f_fll_fss_basic_list_read_e,
const f_string_static_t firewall_tool_ipset_s = macro_f_string_static_t_initialize_1(FIREWALL_tool_ipset_s, 0, FIREWALL_tool_ipset_s_length);
#endif // _di_firewall_s_
-#ifndef _di_firewall_operation_s_
- const f_string_static_t firewall_operation_start_s = macro_f_string_static_t_initialize_1(FIREWALL_operation_start_s, 0, FIREWALL_operation_start_s_length);
- const f_string_static_t firewall_operation_stop_s = macro_f_string_static_t_initialize_1(FIREWALL_operation_stop_s, 0, FIREWALL_operation_stop_s_length);
- const f_string_static_t firewall_operation_restart_s = macro_f_string_static_t_initialize_1(FIREWALL_operation_restart_s, 0, FIREWALL_operation_restart_s_length);
- const f_string_static_t firewall_operation_lock_s = macro_f_string_static_t_initialize_1(FIREWALL_operation_lock_s, 0, FIREWALL_operation_lock_s_length);
- const f_string_static_t firewall_operation_show_s = macro_f_string_static_t_initialize_1(FIREWALL_operation_show_s, 0, FIREWALL_operation_show_s_length);
-#endif // _di_firewall_operation_s_
-
#ifndef _di_firewall_path_s_
const f_string_static_t firewall_file_first_s = macro_f_string_static_t_initialize_1(FIREWALL_file_first_s, 0, FIREWALL_file_first_s_length);
const f_string_static_t firewall_file_last_s = macro_f_string_static_t_initialize_1(FIREWALL_file_last_s, 0, FIREWALL_file_last_s_length);
const f_string_static_t firewall_network_devices_s = macro_f_string_static_t_initialize_1(FIREWALL_network_devices_s, 0, FIREWALL_network_devices_s_length);
#endif // _di_firewall_path_s_
-#ifndef _di_firewall_show_s_
- const f_string_static_t firewall_show_filter_s = macro_f_string_static_t_initialize_1(FIREWALL_show_filter_s, 0, FIREWALL_show_filter_s_length);
- const f_string_static_t firewall_show_mangle_s = macro_f_string_static_t_initialize_1(FIREWALL_show_mangle_s, 0, FIREWALL_show_mangle_s_length);
- const f_string_static_t firewall_show_nat_s = macro_f_string_static_t_initialize_1(FIREWALL_show_nat_s, 0, FIREWALL_show_nat_s_length);
+#ifndef _di_firewall_print_show_s_
+ const f_string_static_t firewall_print_show_filter_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_filter_s, 0, FIREWALL_print_show_filter_s_length);
+ const f_string_static_t firewall_print_show_mangle_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_mangle_s, 0, FIREWALL_print_show_mangle_s_length);
+ const f_string_static_t firewall_print_show_nat_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_nat_s, 0, FIREWALL_print_show_nat_s_length);
- const f_string_static_t firewall_show_bars_26_s = macro_f_string_static_t_initialize_1(FIREWALL_show_bars_26_s, 0, FIREWALL_show_bars_26_s_length);
- const f_string_static_t firewall_show_bars_27_s = macro_f_string_static_t_initialize_1(FIREWALL_show_bars_27_s, 0, FIREWALL_show_bars_27_s_length);
- const f_string_static_t firewall_show_bars_28_s = macro_f_string_static_t_initialize_1(FIREWALL_show_bars_28_s, 0, FIREWALL_show_bars_28_s_length);
-#endif // _di_firewall_show_s_
+ const f_string_static_t firewall_print_show_bars_26_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_bars_26_s, 0, FIREWALL_print_show_bars_26_s_length);
+ const f_string_static_t firewall_print_show_bars_27_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_bars_27_s, 0, FIREWALL_print_show_bars_27_s_length);
+ const f_string_static_t firewall_print_show_bars_28_s = macro_f_string_static_t_initialize_1(FIREWALL_print_show_bars_28_s, 0, FIREWALL_print_show_bars_28_s_length);
+#endif // _di_firewall_print_show_s_
#ifdef __cplusplus
} // extern "C"
#endif // _di_firewall_path_s_
/**
- * The show option related strings.
+ * The show option related strings for printing to the screen.
*/
-#ifndef _di_firewall_show_s_
- #define FIREWALL_show_filter_s "FILTER"
- #define FIREWALL_show_mangle_s "MANGLE"
- #define FIREWALL_show_nat_s "NAT"
-
- #define FIREWALL_show_bars_26_s "=========================="
- #define FIREWALL_show_bars_27_s "============================"
- #define FIREWALL_show_bars_28_s "============================"
-
- #define FIREWALL_show_filter_s_length 6
- #define FIREWALL_show_mangle_s_length 6
- #define FIREWALL_show_nat_s_length 3
-
- #define FIREWALL_show_bars_26_s_length 26
- #define FIREWALL_show_bars_27_s_length 27
- #define FIREWALL_show_bars_28_s_length 28
-
- extern const f_string_static_t firewall_show_filter_s;
- extern const f_string_static_t firewall_show_mangle_s;
- extern const f_string_static_t firewall_show_nat_s;
-
- extern const f_string_static_t firewall_show_bars_26_s;
- extern const f_string_static_t firewall_show_bars_27_s;
- extern const f_string_static_t firewall_show_bars_28_s;
-#endif // _di_firewall_show_s_
+#ifndef _di_firewall_print_show_s_
+ #define FIREWALL_print_show_filter_s "FILTER"
+ #define FIREWALL_print_show_mangle_s "MANGLE"
+ #define FIREWALL_print_show_nat_s "NAT"
+
+ #define FIREWALL_print_show_bars_26_s "=========================="
+ #define FIREWALL_print_show_bars_27_s "============================"
+ #define FIREWALL_print_show_bars_28_s "============================"
+
+ #define FIREWALL_print_show_filter_s_length 6
+ #define FIREWALL_print_show_mangle_s_length 6
+ #define FIREWALL_print_show_nat_s_length 3
+
+ #define FIREWALL_print_show_bars_26_s_length 26
+ #define FIREWALL_print_show_bars_27_s_length 27
+ #define FIREWALL_print_show_bars_28_s_length 28
+
+ extern const f_string_static_t firewall_print_show_filter_s;
+ extern const f_string_static_t firewall_print_show_mangle_s;
+ extern const f_string_static_t firewall_print_show_nat_s;
+
+ extern const f_string_static_t firewall_print_show_bars_26_s;
+ extern const f_string_static_t firewall_print_show_bars_27_s;
+ extern const f_string_static_t firewall_print_show_bars_28_s;
+#endif // _di_firewall_print_show_s_
#ifdef __cplusplus
} // extern "C"
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->buffer.string, &cache->buffer.used, &cache->buffer.size);
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->device.string, &cache->device.used, &cache->device.size);
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->ip_list.string, &cache->ip_list.used, &cache->ip_list.size);
- f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->local_buffer.string, &cache->local_buffer.used, &cache->local_buffer.size);
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->path_file.string, &cache->path_file.used, &cache->path_file.size);
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->path_file_specific.string, &cache->path_file_specific.used, &cache->path_file_specific.size);
f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->protocol.string, &cache->protocol.used, &cache->protocol.size);
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &cache->arguments.array, &cache->arguments.used, &cache->arguments.size, &f_string_dynamics_delete_callback);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &cache->basic_objects.string, &cache->basic_objects.used, &cache->basic_objects.size);
+ f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &cache->delimits.array, &cache->delimits.used, &cache->delimits.size);
+
+ f_memory_array_resize(0, sizeof(f_range_t), (void **) &cache->basic_objects.array, &cache->basic_objects.used, &cache->basic_objects.size);
f_memory_arrays_resize(0, sizeof(f_ranges_t), (void **) &cache->basic_contents.array, &cache->basic_contents.used, &cache->basic_contents.size, &f_rangess_delete_callback);
}
#endif // _di_firewall_cache_delete_
if (!data) return;
f_memory_array_resize(0, sizeof(f_char_t), (void **) &data->buffer.string, &data->buffer.used, &data->buffer.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->chain_ids.string, &data->chain_ids.used, &data->chain_ids.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.string, &data->delimits.used, &data->delimits.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &data->chain_objects.string, &data->chain_objects.used, &data->chain_objects.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &data->rule_objects.string, &data->rule_objects.used, &data->rule_objects.size);
+
+ f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->chain_ids.array, &data->chain_ids.used, &data->chain_ids.size);
+
+ f_memory_array_resize(0, sizeof(f_range_t), (void **) &data->comments.array, &data->comments.used, &data->comments.size);
+ f_memory_array_resize(0, sizeof(f_range_t), (void **) &data->chain_objects.array, &data->chain_objects.used, &data->chain_objects.size);
+ f_memory_array_resize(0, sizeof(f_range_t), (void **) &data->rule_objects.array, &data->rule_objects.used, &data->rule_objects.size);
f_memory_arrays_resize(0, sizeof(f_ranges_t), (void **) &data->chain_contents.array, &data->chain_contents.used, &data->chain_contents.size, &f_rangess_delete_callback);
f_memory_arrays_resize(0, sizeof(f_ranges_t), (void **) &data->rule_contents.array, &data->rule_contents.used, &data->rule_contents.size, &f_rangess_delete_callback);
* Properties:
* - file: The file structure.
*
- * - buffer: A generic string buffer.
- * - device: The device string.
- * - ip_list: The ip_list string.
- * - local_buffer: The protocol string.
- * - path_file: The protocol string.
- * - path_file_specific: The protocol string.
- * - protocol: The protocol string.
- * - arguments: The array of strings.
+ * - buffer: A buffer used when proessing the basic objects and contents cache.
+ * - device: The device.
+ * - ip_list: The ip list.
+ * - path_file: The path to a file.
+ * - path_file_specific: The specific path to a file.
+ * - protocol: The protocol.
+ * - arguments: The arguments array.
+ *
+ * - delimits: The delimits array used when loading FSS data.
*
* - basic_objects: The FSS Basic Objects.
* - basic_contents: The FSS Basic Contents.
*/
#ifndef _di_firewall_cache_t_
typedef struct {
- f_file_t file = f_file_t_initialize;
+ f_file_t file;
f_string_dynamic_t buffer;
f_string_dynamic_t device;
f_string_dynamic_t ip_list;
- f_string_dynamic_t local_buffer;
f_string_dynamic_t path_file;
f_string_dynamic_t path_file_specific;
f_string_dynamic_t protocol;
f_string_dynamics_t arguments;
+ f_number_unsigneds_t delimits;
+
f_ranges_t basic_objects;
f_rangess_t basic_contents;
} firewall_cache_t;
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
+ f_number_unsigneds_t_initialize, \
f_ranges_t_initialize, \
f_rangess_t_initialize, \
}
* - stop: The stop position.
* - range: A range used during operation processing.
*
- * - buffer: The buffer used for during processing.
+ * - buffer: The entire set of chains and rules to operate on.
*
* - chain_ids: The list of chain IDs.
- * - delimits: The delimits array used when loading FSS data.
*
* - chain_objects: The list of chain Objects.
* - rule_objects: The list of rule Objects.
f_number_unsigned_t stop;
f_range_t range;
- f_number_unsigneds_t chain_ids;
- f_number_unsigneds_t delimits;
-
f_string_dynamic_t buffer;
+ f_number_unsigneds_t chain_ids;
+
+ f_ranges_t comments;
f_ranges_t chain_objects;
f_ranges_t rule_objects;
f_rangess_t chain_contents;
0, \
0, \
f_range_t_initialize, \
- f_number_unsigneds_t_initialize, \
- f_number_unsigneds_t_initialize, \
f_string_dynamic_t_initialize, \
+ f_number_unsigneds_t_initialize, \
+ f_ranges_t_initialize, \
f_ranges_t_initialize, \
f_ranges_t_initialize, \
f_rangess_t_initialize, \
* This does not alter main.setting.state.status.
*/
#ifndef _di_firewall_cache_delete_
- extern void firewall_data_delete(firewall_cache_t * const cache);
+ extern void firewall_cache_delete(firewall_cache_t * const cache);
#endif // _di_firewall_cache_delete_
/**
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/execute.h>
#include <fll/level_2/fss.h>
+#include <fll/level_2/fss/basic.h>
+#include <fll/level_2/fss/basic_list.h>
+#include <fll/level_2/fss/extended.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/firewall/main/print/error.h>
#include <program/firewall/main/print/message.h>
#include <program/firewall/main/print/warning.h>
+#include <program/firewall/main/operate.h>
#include <program/firewall/main/operate/buffer.h>
#include <program/firewall/main/operate/create.h>
#include <program/firewall/main/operate/default.h>
#include <program/firewall/main/operate/delete.h>
-#include <program/firewall/main/operate/load.h>
#include <program/firewall/main/operate/process.h>
#include <program/firewall/main/signal.h>
#include <program/firewall/main/thread.h>
return;
}
- main->setting.state.status = f_directory_list(firewall_network_devices_s, 0, alphasort, &main->data.devices);
+ main->setting.state.status = f_directory_list(firewall_network_devices_s, 0, alphasort, &main->setting.devices);
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_data_not) {
firewall_print_error_network_device_none(&main->program.error);
}
else if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_directory_read(&main->program.error, firewall_network_devices_s);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(f_directory_list), firewall_network_devices_s, f_file_operation_read_s, fll_error_file_type_directory_e);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(f_console_parameter_process));
f_string_static_t buffer = f_string_static_t_initialize;
// Remove "lo" (loopback) from the device listing.
- for (; i < main->data.devices.used; ++i) {
+ for (; i < main->setting.devices.used; ++i) {
if (firewall_signal_check(main)) return;
- if (f_compare_dynamic(firewall_device_loop_s, main->data.devices.array[i]) == F_equal_to) {
- buffer = main->data.devices.array[i];
+ if (f_compare_dynamic(firewall_device_loop_s, main->setting.devices.array[i]) == F_equal_to) {
+ buffer = main->setting.devices.array[i];
- for (--main->data.devices.used; i < main->data.devices.used; ++i) {
- main->data.devices.array[i] = main->data.devices.array[i + 1];
+ for (--main->setting.devices.used; i < main->setting.devices.used; ++i) {
+ main->setting.devices.array[i] = main->setting.devices.array[i + 1];
} // for
- main->data.devices.array[main->data.devices.used] = buffer;
+ main->setting.devices.array[main->setting.devices.used] = buffer;
}
} // for
memcpy(path_file_other, firewall_network_path_s.string, sizeof(f_char_t) * firewall_network_path_s.used);
memcpy(path_file_other + firewall_network_path_s.used, firewall_file_other_s.string, sizeof(f_char_t) * firewall_file_other_s.used);
- firewall_operate_buffer_rules(&main, buffer, F_false);
+ firewall_operate_buffer_chain(main, buffer, F_false);
if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_child) return;
for (i = 0; i < main->data.chain_objects.used; ++i) {
main->data.range.start = main->data.chain_contents.array[main->data.lock].array[0].start;
main->data.range.stop = main->data.chain_contents.array[main->data.lock].array[0].stop;
- firewall_operate_load_rules(main);
+ firewall_operate_buffer_rules(main);
+
+ firewall_operate_rules(main);
}
else {
main->setting.state.status = F_status_set_error(F_data);
- firewall_print_error_operation_files_missing(&main->error, firewall_operation_lock_s, path_file_other);
+ firewall_print_error_operation_files_missing(&main->program.error, firewall_operation_lock_s, buffer);
}
return;
firewall_operate_default_lock(main);
- if (F_status_is_error(status) || status == F_child) return;
+ if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_child) return;
main->data.chain = main->data.stop;
main->data.is = firewall_data_is_global_e | firewall_data_is_stop_e;
main->data.range.start = main->data.chain_contents.array[main->data.stop].array[0].start;
main->data.range.stop = main->data.chain_contents.array[main->data.stop].array[0].stop;
- firewall_operate_load_rules(&main);
+ firewall_operate_buffer_rules(main);
+
+ firewall_operate_rules(main);
+
if (F_status_is_error(main->setting.state.status) || (main->data.has & firewall_main_flag_operation_stop_e) || main->setting.state.status == F_child) return;
}
else {
main->setting.state.status = F_status_set_error(F_data);
- firewall_print_error_operation_files_missing(&main->error, firewall_operation_stop_s, path_file_other);
+ firewall_print_error_operation_files_missing(&main->program.error, firewall_operation_stop_s, buffer);
return;
}
buffer.used = firewall_network_path_s.used + firewall_file_first_s.used;
f_char_t path_file_first[buffer.used + 1];
- buffer.string = path_file_first_string;
+ buffer.string = path_file_first;
path_file_first[buffer.used] = 0;
memcpy(path_file_first, firewall_network_path_s.string, sizeof(f_char_t) * firewall_network_path_s.used);
memcpy(path_file_first + firewall_network_path_s.used, firewall_file_first_s.string, sizeof(f_char_t) * firewall_file_first_s.used);
- firewall_operate_buffer_rules(main, buffer, F_false);
+ firewall_operate_buffer_chain(main, buffer, F_false);
if (main->setting.flag & firewall_main_flag_operation_start_e) {
firewall_operate_delete_chains(main);
main->data.is = firewall_data_is_global_e;
- firewall_operate_load_chains(main);
+ firewall_operate_chains(main);
+
if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_child || (main->setting.flag & firewall_main_flag_operation_stop_e)) return;
{
- for (f_number_unsigned_t j = 0; j < main->data.devices.used; ++j) {
+ for (f_number_unsigned_t j = 0; j < main->setting.devices.used; ++j) {
if (firewall_signal_check(main)) return;
- main->data.path_file.used = 0;
- local.device = j;
+ main->cache.path_file.used = 0;
+ main->data.device = j;
- main->setting.state.status = f_memory_array_increase_by(firewall_network_path_s.used + data.devices.array[j].used + firewall_file_suffix_s.used + 1, sizeof(f_char_t), (void **) &main->data.path_file.string, &main->data.path_file.used, &main->data.path_file.size);
+ main->setting.state.status = f_memory_array_increase_by(firewall_network_path_s.used + main->setting.devices.array[j].used + firewall_file_suffix_s.used + 1, sizeof(f_char_t), (void **) &main->cache.path_file.string, &main->cache.path_file.used, &main->cache.path_file.size);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_memory_array_increase_by));
return;
}
- main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &main->data.path_file);
+ main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &main->cache.path_file);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(data.devices.array[j], &main->data.path_file);
+ main->setting.state.status = f_string_dynamic_append(main->setting.devices.array[j], &main->cache.path_file);
}
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(firewall_file_suffix_s, &main->data.path_file);
+ main->setting.state.status = f_string_dynamic_append(firewall_file_suffix_s, &main->cache.path_file);
}
if (F_status_is_error(main->setting.state.status)) {
return;
}
- firewall_operate_buffer_rules(main, main->data.path_file, F_true);
+ firewall_operate_buffer_chain(main, main->cache.path_file, F_true);
firewall_operate_create_custom_chains(main);
main->data.is = 0;
- firewall_operate_load_chains(main);
+ firewall_operate_chains(main);
if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_child || (main->setting.flag & firewall_main_flag_operation_stop_e)) return;
} // for
- main->data.path_file.used = 0;
+ main->cache.path_file.used = 0;
- main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &main->data.path_file);
+ main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &main->cache.path_file);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(firewall_file_last_s, &main->data.path_file);
+ main->setting.state.status = f_string_dynamic_append(firewall_file_last_s, &main->cache.path_file);
}
if (F_status_is_error(main->setting.state.status)) {
return;
}
- firewall_operate_buffer_rules(main, main->data.path_file, F_false);
+ firewall_operate_buffer_chain(main, main->cache.path_file, F_false);
firewall_operate_create_custom_chains(main);
main->data.is = firewall_data_is_global_e;
- firewall_operate_load_chains(main);
+ firewall_operate_chains(main);
if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_child) return;
}
}
}
#endif // _di_firewall_operate_
+#ifndef _di_firewall_operate_chains_
+ void firewall_operate_chains(firewall_main_t * const main) {
+
+ if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
+
+ for (f_number_unsigned_t i = 0; i < main->data.chain_contents.used; ++i) {
+
+ main->data.range = main->data.chain_contents.array[i].array[0];
+
+ if ((main->data.has & firewall_data_has_main_e) && i == main->data.main) {
+ main->data.is |= firewall_data_is_main_e;
+ }
+ else {
+ main->data.is &= ~firewall_data_is_main_e;
+ }
+
+ main->data.chain = i;
+
+ firewall_operate_buffer_rules(main);
+
+ firewall_operate_rules(main);
+
+ if (F_status_is_error(main->setting.state.status) || (main->setting.flag & firewall_main_flag_operation_stop_e) || main->setting.state.status == F_child) return;
+ } // for
+
+ main->setting.state.status = F_okay;
+ }
+#endif // _di_firewall_operate_chains_
+
+#ifndef _di_firewall_operate_rules_
+ void firewall_operate_rules(firewall_main_t * const main) {
+
+ if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
+
+ firewall_operate_process_rules(main);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) != F_failure) {
+ firewall_print_error_unhandled(&main->program.error, macro_firewall_f(firewall_operate_process_rules), f_string_empty_s);
+ }
+
+ return;
+ }
+
+ main->setting.state.status = F_okay;
+ }
+#endif // _di_firewall_operate_rules_
+
#ifndef _di_firewall_operate_show_
void firewall_operate_show(firewall_main_t * const main) {
firewall_show_parameter_list_s,
};
- const f_string_static_t show_arrays[][] = {
+ f_string_static_t * const show_arrays[] = {
show_nats,
show_mangles,
show_filters,
};
const f_string_static_t show_lefts[] = {
- firewall_show_bars_27_s,
- firewall_show_bars_26_s,
- firewall_show_bars_26_s,
+ firewall_print_show_bars_27_s,
+ firewall_print_show_bars_26_s,
+ firewall_print_show_bars_26_s,
};
const f_string_static_t show_headers[] = {
- firewall_show_nat_s,
- firewall_show_mangle_s,
- firewall_show_filter_s,
+ firewall_print_show_nat_s,
+ firewall_print_show_mangle_s,
+ firewall_print_show_filter_s,
};
const f_string_static_t show_rights[] = {
- firewall_show_bars_28_s,
- firewall_show_bars_26_s,
- firewall_show_bars_26_s,
+ firewall_print_show_bars_28_s,
+ firewall_print_show_bars_26_s,
+ firewall_print_show_bars_26_s,
};
const uint16_t show_flags[] = {
parameters.array = show_arrays[i];
parameters.used = show_lengths[i];
- firewall_print_message_show_header(&main->output, show_lefts[i], show_headers[i], show_rights[i]);
+ firewall_print_message_show_header(&main->program.output, show_lefts[i], show_headers[i], show_rights[i]);
- main->setting.status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code);
+ main->setting.state.status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code);
- if (status == F_child) {
- main->child = return_code;
+ if (main->setting.state.status == F_child) {
+ main->program.child = return_code;
return;
}
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
- f_file_stream_flush(main->output.to);
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
+ f_file_stream_flush(main->program.output.to);
- if (F_status_is_error(main->setting.status)) {
- firewall_print_error_operation(&main->error, firewall_tool_iptables_s, parameters);
+ if (F_status_is_error(main->setting.state.status)) {
+ firewall_print_error_operation(&main->program.error, firewall_tool_iptables_s, parameters);
return;
}
*
* Errors (with error bit) from: f_directory_list()
* Errors (with error bit) from: f_memory_array_increase_by()
- * Errors (with error bit) from: firewall_operate_buffer_rules()
+ * Errors (with error bit) from: firewall_operate_buffer_chain()
* Errors (with error bit) from: firewall_operate_create_custom_chains()
* Errors (with error bit) from: firewall_operate_default_lock()
* Errors (with error bit) from: firewall_operate_delete_chains()
- * Errors (with error bit) from: firewall_operate_load_rules()
+ * Errors (with error bit) from: firewall_operate_rules()
* Errors (with error bit) from: firewall_operate_process_rules()
* Errors (with error bit) from: firewall_operate_show()
*
* @see f_directory_list()
* @see f_memory_array_increase_by()
- * @see firewall_operate_buffer_rules()
+ * @see firewall_operate_buffer_chain()
* @see firewall_operate_create_custom_chains()
* @see firewall_operate_default_lock()
* @see firewall_operate_delete_chains()
- * @see firewall_operate_load_rules()
+ * @see firewall_operate_rules()
* @see firewall_operate_process_rules()
* @see firewall_operate_show()
*/
#endif // _di_firewall_operate_
/**
+ * Load and operate the each of the Content chains.
+ *
+ * @param main
+ * The main program and setting data.
+ *
+ * This alters:
+ * - main.data.is.
+ * - main.data.range.
+ *
+ * This alters main.setting.state.status:
+ * F_okay on success.
+ *
+ * F_interrupt (with error bit) on interrupt signal received.
+ *
+ * Errors (with error bit) from: firewall_operate_rules()
+ *
+ * @see firewall_operate_rules()
+ */
+#ifndef _di_firewall_operate_chains_
+ extern void firewall_operate_chains(firewall_main_t * const main);
+#endif // _di_firewall_operate_chains_
+
+/**
* Perform the firewall show operation.
*
* @param main
extern void firewall_operate_show(firewall_main_t * const main);
#endif // _di_firewall_operate_show_
+/**
+ * Operate the rules.
+ *
+ * @param main
+ * The main program and setting data.
+ *
+ * This alters main.setting.state.status:
+ * F_okay on success.
+ *
+ * F_interrupt (with error bit) on interrupt signal received.
+ *
+ * Errors (with error bit) from: f_fss_apply_delimit()
+ * Errors (with error bit) from: firewall_operate_process_rules()
+ * Errors (with error bit) from: fll_fss_extended_read()
+ *
+ * @see f_fss_apply_delimit()
+ * @see firewall_operate_process_rules()
+ * @see fll_fss_extended_read()
+ */
+#ifndef _di_firewall_operate_rules_
+ extern void firewall_operate_rules(firewall_main_t * const main);
+#endif // _di_firewall_operate_rules_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern "C" {
#endif
-#ifndef _di_firewall_operate_buffer_rules_
- void firewall_operate_buffer_rules(firewall_main_t * const main, const f_string_static_t file, const bool optional) {
+#ifndef _di_firewall_operate_buffer_chain_
+ void firewall_operate_buffer_chain(firewall_main_t * const main, const f_string_static_t file, const bool optional) {
if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
main->data.buffer.used = 0;
+ main->data.chain_contents.used = 0;
+ main->data.chain_objects.used = 0;
+ main->cache.delimits.used = 0;
main->setting.state.status = f_file_open(file, 0, &main->cache.file);
if (F_status_is_error(main->setting.state.status)) {
if (!optional || optional && F_status_set_fine(main->setting.state.status) != F_file_found_not && F_status_set_fine(main->setting.state.status) != F_file_open && F_status_set_fine(main->setting.state.status) != F_file_descriptor) {
- firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_open), f_file_operation_open_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_open), file, f_file_operation_open_s, fll_error_file_type_file_e);
return;
}
f_file_stream_close(&main->cache.file);
if (F_status_is_error(main->setting.state.status)) {
- firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_read), f_file_operation_read_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_read), file, f_file_operation_read_s, fll_error_file_type_file_e);
return;
}
main->data.range.start = 0;
main->data.range.stop = main->data.buffer.used - 1;
-// @fixme bufferchain_objects, etc..
- main->setting.state.status = fll_fss_basic_list_read(main->data.buffer, main->setting.state, &main->data.range, &main->data.bufferchain_objects, &main->data.bufferchain_contents, &main->data.delimits, 0, &main->data.comments);
+ fll_fss_basic_list_read(main->data.buffer, &main->data.range, &main->data.chain_objects, &main->data.chain_contents, &main->cache.delimits, 0, &main->data.comments, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_data_not_eos || F_status_set_fine(main->setting.state.status) == F_data_not || F_status_set_fine(main->setting.state.status) == F_data_not_stop) {
firewall_print_error_file_empty(&main->program.error, file);
}
else {
- firewall_print_error_file(&main->program.error, macro_firewall_f(fll_fss_basic_list_read), f_file_operation_process_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(fll_fss_basic_list_read), file, f_file_operation_process_s, fll_error_file_type_file_e);
}
return;
}
else {
- main->setting.state.status = f_fss_apply_delimit(state, main->data.delimits, &main->data.buffer);
+ f_fss_apply_delimit(main->cache.delimits, &main->data.buffer, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_fss_apply_delimit));
main->setting.state.status = F_okay;
}
+#endif // _di_firewall_operate_buffer_chain_
+
+#ifndef _di_firewall_operate_buffer_rules_
+ void firewall_operate_buffer_rules(firewall_main_t * const main) {
+
+ if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
+
+ main->cache.delimits.used = 0;
+ main->data.rule_contents.used = 0;
+ main->data.rule_objects.used = 0;
+
+ fll_fss_extended_read(main->data.buffer, &main->data.range, &main->data.rule_objects, &main->data.rule_contents, 0, 0, &main->cache.delimits, 0, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ firewall_print_error(&main->program.error, macro_firewall_f(fll_fss_extended_read));
+
+ return;
+ }
+
+ f_fss_apply_delimit(main->cache.delimits, &main->data.buffer, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ firewall_print_error(&main->program.error, macro_firewall_f(f_fss_apply_delimit));
+
+ return;
+ }
+
+ main->setting.state.status = F_okay;
+ }
#endif // _di_firewall_operate_buffer_rules_
#ifdef __cplusplus
#endif
/**
- * Buffer firewall rules.
+ * Buffer firewall chain.
+ *
+ * The rules being processed are selected from main.data.range within main.data.buffer.
+ * Delimits are applied to the main.data.buffer on success.
*
* @param main
* The main program and setting data.
*
+ * This alters:
+ * - main.cache.delimits.
+ * - main.data.buffer.
+ * - main.data.chain_contents.
+ * - main.data.chain_objects.
+ *
* This alters main.setting.state.status:
* F_okay on success.
* F_child on child process exiting.
* @see f_fss_apply_delimit()
* @see fll_fss_basic_list_read()
*/
+#ifndef _di_firewall_operate_buffer_chain_
+ extern void firewall_operate_buffer_chain(firewall_main_t * const main, const f_string_static_t file, const bool optional);
+#endif // _di_firewall_operate_buffer_chain_
+
+/**
+ * Buffer firewall rules.
+ *
+ * The rules being processed are selected from main.data.range within main.data.buffer.
+ * Delimits are applied to the main.data.buffer on success.
+ *
+ * @param main
+ * The main program and setting data.
+ *
+ * This alters:
+ * - main.cache.delimits.
+ * - main.data.buffer.
+ * - main.data.rule_contents.
+ * - main.data.rule_objects.
+ *
+ * This alters main.setting.state.status:
+ * F_okay on success.
+ *
+ * F_interrupt (with error bit) on interrupt signal received.
+ *
+ * Errors (with error bit) from: f_fss_apply_delimit()
+ * Errors (with error bit) from: firewall_operate_process_rules()
+ * Errors (with error bit) from: fll_fss_extended_read()
+ *
+ * @see f_fss_apply_delimit()
+ * @see firewall_operate_process_rules()
+ * @see fll_fss_extended_read()
+ */
#ifndef _di_firewall_operate_buffer_rules_
- extern void firewall_operate_buffer_rules(firewall_main_t * const main, const f_string_static_t file, const bool optional);
+ extern void firewall_operate_buffer_rules(firewall_main_t * const main);
#endif // _di_firewall_operate_buffer_rules_
#ifdef __cplusplus
f_string_static_t tool = firewall_tool_iptables_s;
- main->cache.chain_ids.used = 0;
+ main->data.chain_ids.used = 0;
main->cache.arguments.used = 0;
main->setting.state.status = f_memory_array_increase_by(2, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_memory_array_increase_by(main->cache.chain_objects.used, sizeof(f_number_unsigned_t), (void **) &main->cache.chain_ids.array, &main->cache.chain_ids.used, &main->cache.chain_ids.size);
+ main->setting.state.status = f_memory_array_increase_by(main->data.chain_objects.used, sizeof(f_number_unsigned_t), (void **) &main->data.chain_ids.array, &main->data.chain_ids.used, &main->data.chain_ids.size);
}
if (F_status_is_error(main->setting.state.status)) {
return;
}
- main->cache.chain_ids.used = main->cache.chain_objects.used;
- memset(main->cache.chain_ids.array, 0, sizeof(f_number_unsigned_t) * main->cache.chain_ids.used);
+ main->data.chain_ids.used = main->data.chain_objects.used;
+ memset(main->data.chain_ids.array, 0, sizeof(f_number_unsigned_t) * main->data.chain_ids.used);
- main->setting.state.status = f_string_dynamic_append(firewall_chain_create_command_s, &main->cache.arguments.array[0]);
+ main->setting.state.status = f_string_dynamic_append(firewall_chain_create_operation_s, &main->cache.arguments.array[0]);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_string_dynamic_append));
main->cache.arguments.used = 2;
main->data.has = 0;
- for (; i < main->cache.chain_objects.used; ++i) {
+ for (; i < main->data.chain_objects.used; ++i) {
if (firewall_signal_check(main)) return;
j = 0;
// Skip globally reserved chain name: main.
- if (f_compare_dynamic_partial_string(firewall_group_main_s.string, main->cache.buffer, firewall_group_main_s.used, main->cache.chain_objects.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_group_main_s.string, main->data.buffer, firewall_group_main_s.used, main->data.chain_objects.array[i]) == F_equal_to) {
new_chain = F_false;
main->data.has |= firewall_data_has_main_e;
main->data.main = i;
}
// Skip globally reserved chain name: stop.
- if (f_compare_dynamic_partial_string(firewall_group_stop_s.string, main->cache.buffer, firewall_group_stop_s.used, main->cache.chain_objects.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_group_stop_s.string, main->data.buffer, firewall_group_stop_s.used, main->data.chain_objects.array[i]) == F_equal_to) {
new_chain = F_false;
main->data.has |= firewall_data_has_stop_e;
main->data.stop = i;
}
// Skip globally reserved chain name: lock.
- if (f_compare_dynamic_partial_string(firewall_group_lock_s.string, main->cache.buffer, firewall_group_lock_s.used, main->cache.chain_objects.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_group_lock_s.string, main->data.buffer, firewall_group_lock_s.used, main->data.chain_objects.array[i]) == F_equal_to) {
new_chain = F_false;
main->data.has |= firewall_data_has_lock_e;
main->data.lock = i;
}
// Skip globally reserved chain name: none.
- if (f_compare_dynamic_partial_string(firewall_chain_none_s.string, main->cache.buffer, firewall_chain_none_s.used, main->cache.chain_objects.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_chain_none_s.string, main->data.buffer, firewall_chain_none_s.used, main->data.chain_objects.array[i]) == F_equal_to) {
new_chain = F_false;
}
if (new_chain) {
- for (; j < main->data.chains.used; ++j) {
+ for (; j < main->setting.chains.used; ++j) {
- if (f_compare_dynamic_partial_string(main->data.chains.array[j].string, main->cache.buffer, main->data.chains.array[j].used, main->cache.chain_objects.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(main->setting.chains.array[j].string, main->data.buffer, main->setting.chains.array[j].used, main->data.chain_objects.array[i]) == F_equal_to) {
new_chain = F_false;
- main->cache.chain_ids.array[i] = j;
+ main->data.chain_ids.array[i] = j;
break;
}
}
if (new_chain) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->data.chains.array, &main->data.chains.used, &main->data.chains.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->setting.chains.array, &main->setting.chains.used, &main->setting.chains.size);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_memory_array_increase));
}
create_chain = F_true;
- length = (main->data.chain_objects.array[i].stop - main->data.chain_objects.array[i].start) + 1;
+ length = (main->data.chain_objects.array[i].start > main->data.chain_objects.array[i].stop) ? 0 : (main->data.chain_objects.array[i].stop - main->data.chain_objects.array[i].start) + 1;
main->cache.arguments.array[1].used = 0;
main->setting.state.status = f_memory_array_increase_by(length + 1, sizeof(f_char_t), (void **) &main->cache.arguments.array[1].string, &main->cache.arguments.array[1].used, &main->cache.arguments.array[1].size);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_memory_array_increase_by(length + 1, sizeof(f_char_t), (void **) &main->data.chains.array[main->data.chains.used].string, &main->data.chains.array[main->data.chains.used].used, &main->data.chains.array[main->data.chains.used].size);
+ main->setting.state.status = f_memory_array_increase_by(length + 1, sizeof(f_char_t), (void **) &main->setting.chains.array[main->setting.chains.used].string, &main->setting.chains.array[main->setting.chains.used].used, &main->setting.chains.array[main->setting.chains.used].size);
}
if (F_status_is_error(main->setting.state.status)) {
return;
}
- main->data.chains.array[main->data.chains.used].used = 0;
- main->data.chain_ids.array[i] = main->data.chains.used;
+ f_string_dynamic_partial_append_nulless(main->data.buffer, main->data.chain_objects.array[i], &main->cache.arguments.array[1]);
- // Copy the string character by character, ignoring placeholders.
- for (j = main->data.chain_objects.array[i].start; j <= main->data.chain_objects.array[i].stop; ++j) {
+ if (F_status_is_error_not(main->setting.state.status)) {
+ f_string_dynamic_partial_append_nulless(main->data.buffer, main->data.chain_objects.array[i], &main->setting.chains.array[main->setting.chains.used]);
+ }
- if (main->data.buffer.string[j] == f_fss_placeholder_s.string[0]) continue;
+ if (F_status_is_error(main->setting.state.status)) {
+ firewall_print_error(&main->program.error, macro_firewall_f(f_string_dynamic_partial_append_nulless));
- main->data.chains.array[main->data.chains.used].string[main->data.chains.array[main->data.chains.used].used++] = main->data.buffer.string[j];
- main->cache.arguments.array[1].string[main->cache.arguments.array[1].used++] = main->data.buffer.string[j];
- } // for
+ return;
+ }
+
+ f_string_dynamic_terminate_after(&main->cache.arguments.array[1]);
+
+ if (F_status_is_error_not(main->setting.state.status)) {
+ f_string_dynamic_terminate_after(&main->setting.chains.array[main->setting.chains.used]);
+ }
+
+ if (F_status_is_error(main->setting.state.status)) {
+ firewall_print_error(&main->program.error, macro_firewall_f(f_string_dynamic_terminate_after));
+
+ return;
+ }
- main->cache.arguments.array[1].string[main->cache.arguments.array[1].used] = 0;
- main->data.chains.array[main->data.chains.used].string[main->data.chains.array[main->data.chains.used].used] = 0;
+ main->data.chain_ids.array[i] = main->setting.chains.used;
if (f_compare_dynamic(main->cache.arguments.array[1], firewall_chain_forward_s) == F_equal_to) {
create_chain = F_false;
}
if (create_chain) {
- firewall_print_debug_tool(main->program->warning, firewall_tool_iptables_s, main->cache.arguments);
+ firewall_print_debug_tool(&main->program.warning, firewall_tool_iptables_s, main->cache.arguments);
tool = firewall_tool_iptables_s;
main->setting.state.status = fll_execute_program(firewall_tool_iptables_s, main->cache.arguments, 0, 0, (void *) &return_code);
if (main->setting.state.status == F_child) {
- main->program->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_child) {
tool = firewall_tool_ip6tables_s;
- firewall_print_debug_tool(main->program->warning, firewall_tool_ip6tables_s, main->cache.arguments);
+ firewall_print_debug_tool(&main->program.warning, firewall_tool_ip6tables_s, main->cache.arguments);
main->setting.state.status = fll_execute_program(firewall_tool_ip6tables_s, main->cache.arguments, 0, 0, (void *) &return_code);
}
if (main->setting.state.status == F_child) {
- main->program->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_operation(main->program->error, tool, main->cache.arguments);
+ firewall_print_error_operation(&main->program.error, tool, main->cache.arguments);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(fll_execute_program));
}
}
- ++main->data.chains.used;
+ ++main->setting.chains.used;
}
} // for
*/
#ifndef _di_firewall_operate_create_custom_chains_
extern void firewall_operate_create_custom_chains(firewall_main_t * const main);
-#endif / _di_firewall_operate_create_custom_chains_
+#endif // _di_firewall_operate_create_custom_chains_
#ifdef __cplusplus
} // extern "C"
f_string_static_t argument_array[arguments.used];
arguments.array = argument_array;
- arguments.array[0] = firewall_action_policy_command_s;
+ arguments.array[0] = firewall_action_policy_operation_s;
arguments.array[2] = firewall_chain_drop_s;
int return_code = 0;
for (j = 0; j < 2; ++j) {
- firewall_print_debug_tool(data->main->warning, tools[j], arguments);
+ firewall_print_debug_tool(&main->program.warning, tools[j], arguments);
return_code = 0;
main->setting.state.status = fll_execute_program(tools[j], arguments, 0, 0, (void *) &return_code);
if (main->setting.state.status == F_child) {
- data->main->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_operation(main->program->error, tools[j], arguments);
+ firewall_print_error_operation(&main->program.error, tools[j], arguments);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(fll_execute_program));
if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
const f_string_static_t tools[2] = { firewall_tool_iptables_s, firewall_tool_ip6tables_s };
- const f_string_static_t command[2] = { firewall_chain_flush_command_s, firewall_chain_delete_command_s };
+ const f_string_static_t command[2] = { firewall_chain_flush_operation_s, firewall_chain_delete_operation_s };
f_string_statics_t arguments = f_string_statics_t_initialize;
arguments.used = 1;
f_string_static_t argument_array[arguments.used];
arguments.array = argument_array;
- argument_array[0] = firewall_chain_flush_command_s;
+ argument_array[0] = firewall_chain_flush_operation_s;
int return_code = 0;
uint8_t i = 0;
return_code = 0;
- firewall_print_debug_tool(data->main->warning, tools[j], arguments);
+ firewall_print_debug_tool(&main->program.warning, tools[j], arguments);
main->setting.state.status = fll_execute_program(tools[j], arguments, 0, 0, (void *) &return_code);
if (main->setting.state.status == F_child) {
- data->main->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_operation(main->program->error, tools[j], arguments);
+ firewall_print_error_operation(&main->program.error, tools[j], arguments);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(fll_execute_program));
+++ /dev/null
-#include "../firewall.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_firewall_operate_load_chains_
- void firewall_operate_load_chains(firewall_main_t * const main) {
-
- if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
-
- for (i = 0; i < local.chain_contents.used; ++i) {
-
- main->data.range = local.chain_contents.array[i].array[0];
-
- if ((main->data.has & firewall_data_has_main_e) && i == main->data.main) {
- main->data.is |= firewall_data_is_main_e;
- }
- else {
- main->data.is &= ~firewall_data_is_main_e;
- }
-
- main->data.chain = i;
-
- firewall_operate_load_rules(main);
- if (F_status_is_error(main->setting.state.status) || (main->setting.flag & firewall_main_flag_operation_stop_e) || main->setting.state.status == F_child) return;
- } // for
-
- main->setting.state.status = F_okay;
- }
-#endif // _di_firewall_operate_load_chains_
-
-#ifndef _di_firewall_operate_load_rules_
- void firewall_operate_load_rules(firewall_main_t * const main) {
-
- if (!main || F_status_is_error_not(main->setting.state.status) && main->setting.state.status == F_child) return;
-
- main->data.buffer.used = 0;
- main->data.delimits.used = 0;
- main->data.rule_objects.used = 0;
- main->data.rule_contents.used = 0;
-
-// @fixme the data.rule_objects and rule_contents may be in use by a caller function (specifically in operate.c via firewall_operate_buffer_rules()).
- main->setting.state.status = fll_fss_extended_read(main->data.buffer, main->setting.state, main->data.range, &main->data.rule_objects, &main->data.rule_contents, 0, 0, &main->data.delimits, 0);
-
- if (F_status_is_error(main->setting.state.status)) {
- firewall_print_error(&main->program.error, macro_firewall_f(fll_fss_extended_read));
-
- return;
- }
-
- main->setting.state.status = f_fss_apply_delimit(main->setting.state, main->data.delimits, &main->data.buffer);
-
- if (F_status_is_error(main->setting.state.status)) {
- firewall_print_error(&main->program.error, macro_firewall_f(f_fss_apply_delimit));
-
- return;
- }
-
- firewall_operate_process_rules(main);
-
- if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) != F_failure) {
- firewall_print_error_unhandled(&main->error, macro_firewall_f(firewall_operate_process_rules));
- }
-
- return;
- }
-
- main->setting.state.status = F_okay;
- }
-#endif // _di_firewall_operate_load_rules_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 3
- *
- * Project: Firewall
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the load functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _firewall_operate_load_h
-#define _firewall_operate_load_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Load and process the Content chains.
- *
- * @param main
- * The main program and setting data.
- *
- * This alters:
- * - main.data.is.
- * - main.data.range.
- *
- * This alters main.setting.state.status:
- * F_okay on success.
- *
- * F_interrupt (with error bit) on interrupt signal received.
- *
- * Errors (with error bit) from: firewall_operate_load_rules()
- *
- * @see firewall_operate_load_rules()
- */
-#ifndef _di_firewall_operate_load_chains_
- extern void firewall_operate_load_chains(firewall_main_t * const main);
-#endif // _di_firewall_operate_load_chains_
-
-/**
- * Load and process the rules.
- *
- * @param main
- * The main program and setting data.
- *
- * This alters:
- * - main.data.buffer.
- * - main.data.delimits.
- * - main.data.rule_objects.
- * - main.data.rule_contents.
- *
- * This alters main.setting.state.status:
- * F_okay on success.
- *
- * F_interrupt (with error bit) on interrupt signal received.
- *
- * Errors (with error bit) from: f_fss_apply_delimit()
- * Errors (with error bit) from: firewall_operate_process_rules()
- * Errors (with error bit) from: fll_fss_extended_read()
- *
- * @see f_fss_apply_delimit()
- * @see firewall_operate_process_rules()
- * @see fll_fss_extended_read()
- */
-#ifndef _di_firewall_operate_load_rules_
- extern void firewall_operate_load_rules(firewall_main_t * const main);
-#endif // _di_firewall_operate_load_rules_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _firewall_operate_load_h
f_number_unsigned_t repeat = 2;
f_string_static_t tool = firewall_tool_iptables_s;
- f_ranges_t * const rule_objects = &data->main.rule_objects;
- f_rangess_t * const rule_contents = data->main.rule_contents;
+ f_ranges_t * const rule_objects = &main->data.rule_objects;
+ f_rangess_t * const rule_contents = &main->data.rule_contents;
if (!(main->data.is & firewall_data_is_global_e)) {
- if (data->devices.array[data->main.device].used) {
+ if (main->setting.devices.array[main->data.device].used) {
main->cache.device.used = 0;
- main->setting.state.status = f_string_dynamic_append(data->devices.array[data->main.device], &main->cache.device);
+ main->setting.state.status = f_string_dynamic_append(main->setting.devices.array[main->data.device], &main->cache.device);
if (F_status_is_error(main->setting.state.status)) return;
}
}
main->cache.ip_list.used = 0;
// Process chain rule.
- if (f_compare_dynamic_partial_string(firewall_chain_s.string, data->main.buffer, firewall_chain_s.used, rule_objects->array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_chain_s.string, main->data.buffer, firewall_chain_s.used, rule_objects->array[i]) == F_equal_to) {
if (chain == firewall_chain_custom_e) {
// Custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain.
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_input_s.string, data->main.buffer, firewall_chain_input_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_input_s.string, main->data.buffer, firewall_chain_input_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_input_e;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_output_s.string, data->main.buffer, firewall_chain_output_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_output_s.string, main->data.buffer, firewall_chain_output_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_output_e;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_forward_s.string, data->main.buffer, firewall_chain_forward_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_forward_s.string, main->data.buffer, firewall_chain_forward_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_forward_e;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_postrouting_s.string, data->main.buffer, firewall_chain_postrouting_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_postrouting_s.string, main->data.buffer, firewall_chain_postrouting_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_postrouting_e;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_prerouting_s.string, data->main.buffer, firewall_chain_prerouting_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_prerouting_s.string, main->data.buffer, firewall_chain_prerouting_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_prerouting_e;
}
- else if (f_compare_dynamic_partial_string(firewall_chain_none_s.string, data->main.buffer, firewall_chain_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_chain_none_s.string, main->data.buffer, firewall_chain_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
chain = firewall_chain_none_e;
}
else {
}
// Process direction rule
- else if (f_compare_dynamic_partial_string(firewall_direction_s.string, data->main.buffer, firewall_direction_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_direction_s.string, main->data.buffer, firewall_direction_s.used, rule_objects->array[i]) == F_equal_to) {
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
- else if (f_compare_dynamic_partial_string(firewall_direction_input_s.string, data->main.buffer, firewall_direction_input_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_direction_input_s.string, main->data.buffer, firewall_direction_input_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
direction = firewall_direction_input_e;
}
- else if (f_compare_dynamic_partial_string(firewall_direction_output_s.string, data->main.buffer, firewall_direction_output_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_direction_output_s.string, main->data.buffer, firewall_direction_output_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
direction = firewall_direction_output_e;
}
- else if (f_compare_dynamic_partial_string(firewall_direction_none_s.string, data->main.buffer, firewall_direction_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_direction_none_s.string, main->data.buffer, firewall_direction_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
direction = firewall_direction_none_e;
}
else {
}
// Process device rule.
- else if (f_compare_dynamic_partial_string(firewall_device_s.string, data->main.buffer, firewall_device_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_device_s.string, main->data.buffer, firewall_device_s.used, rule_objects->array[i]) == F_equal_to) {
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
- else if (f_compare_dynamic_partial_string(firewall_device_all_s.string, data->main.buffer, firewall_device_all_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_device_all_s.string, main->data.buffer, firewall_device_all_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
main->cache.device.used = 0;
continue;
}
- else if (f_compare_dynamic_partial_string(firewall_device_this_s.string, data->main.buffer, firewall_device_this_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
- if (data->devices.array[data->main.device].used) {
- main->setting.state.status = f_string_dynamic_append(data->devices.array[data->main.device], &main->cache.device);
+ else if (f_compare_dynamic_partial_string(firewall_device_this_s.string, main->data.buffer, firewall_device_this_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ if (main->setting.devices.array[main->data.device].used) {
+ main->setting.state.status = f_string_dynamic_append(main->setting.devices.array[main->data.device], &main->cache.device);
}
else {
main->cache.device.used = 0;
if (valid) {
main->cache.device.used = 0;
- main->setting.state.status = f_string_dynamic_partial_append(data->main.buffer, rule_contents->array[i].array[0], &main->cache.device);
+ main->setting.state.status = f_string_dynamic_partial_append(main->data.buffer, rule_contents->array[i].array[0], &main->cache.device);
if (F_status_is_error(main->setting.state.status)) return;
continue;
}
// Process action rule.
- else if (f_compare_dynamic_partial_string(firewall_action_s.string, data->main.buffer, firewall_action_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_action_s.string, main->data.buffer, firewall_action_s.used, rule_objects->array[i]) == F_equal_to) {
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
- else if (f_compare_dynamic_partial_string(firewall_action_append_s.string, data->main.buffer, firewall_action_append_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_action_append_s.string, main->data.buffer, firewall_action_append_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
action = firewall_action_append_e;
}
- else if (f_compare_dynamic_partial_string(firewall_action_insert_s.string, data->main.buffer, firewall_action_insert_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_action_insert_s.string, main->data.buffer, firewall_action_insert_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
action = firewall_action_insert_e;
}
- else if (f_compare_dynamic_partial_string(firewall_action_policy_s.string, data->main.buffer, firewall_action_policy_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_action_policy_s.string, main->data.buffer, firewall_action_policy_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
action = firewall_action_policy_e;
}
- else if (f_compare_dynamic_partial_string(firewall_action_none_s.string, data->main.buffer, firewall_action_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_action_none_s.string, main->data.buffer, firewall_action_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
action = firewall_action_none_e;
}
else {
}
// Process ip_list rule.
- else if (f_compare_dynamic_partial_string(firewall_ip_list.string, data->main.buffer, firewall_ip_list.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_ip_list.string, main->data.buffer, firewall_ip_list.used, rule_objects->array[i]) == F_equal_to) {
is_ip_list = F_true;
- if (f_compare_dynamic_partial_string(firewall_ip_list_source_s.string, data->main.buffer, firewall_ip_list_source_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_ip_list_source_s.string, main->data.buffer, firewall_ip_list_source_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
ip_list_direction = F_false;
}
- else if (f_compare_dynamic_partial_string(firewall_ip_list_destination_s.string, data->main.buffer, firewall_ip_list_destination_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_ip_list_destination_s.string, main->data.buffer, firewall_ip_list_destination_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
ip_list_direction = F_true;
}
else {
valid = F_false;
}
}
- else if (f_compare_dynamic_partial_string(firewall_protocol_s.string, data->main.buffer, firewall_protocol_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_protocol_s.string, main->data.buffer, firewall_protocol_s.used, rule_objects->array[i]) == F_equal_to) {
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
else {
- if (f_compare_dynamic_partial_string(firewall_protocol_none_s.string, data->main.buffer, firewall_protocol_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_protocol_none_s.string, main->data.buffer, firewall_protocol_none_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
use_protocol = F_false;
}
else if (rule_contents->array[i].array[0].start <= rule_contents->array[i].array[0].stop) {
main->cache.protocol.used = 0;
- main->setting.state.status = f_string_dynamic_partial_append(data->main.buffer, rule_contents->array[i].array[0], &main->cache.protocol);
+ main->setting.state.status = f_string_dynamic_partial_append(main->data.buffer, rule_contents->array[i].array[0], &main->cache.protocol);
if (F_status_is_error(main->setting.state.status)) return;
use_protocol = F_true;
}
// Process tool rule.
- else if (f_compare_dynamic_partial_string(firewall_tool_s.string, data->main.buffer, firewall_tool_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_tool_s.string, main->data.buffer, firewall_tool_s.used, rule_objects->array[i]) == F_equal_to) {
if (rule_contents->array[i].used != 1) {
valid = F_false;
}
else {
- if (f_compare_dynamic_partial_string(firewall_tool_iptables_s.string, data->main.buffer, firewall_tool_iptables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(firewall_tool_iptables_s.string, main->data.buffer, firewall_tool_iptables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
tool = firewall_tool_iptables_s;
repeat = 1;
}
- else if (f_compare_dynamic_partial_string(firewall_tool_ip6tables_s.string, data->main.buffer, firewall_tool_ip6tables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_tool_ip6tables_s.string, main->data.buffer, firewall_tool_ip6tables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
tool = firewall_tool_ip6tables_s;
repeat = 1;
}
- else if (f_compare_dynamic_partial_string(firewall_tool_ip46tables_s.string, data->main.buffer, firewall_tool_ip46tables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_tool_ip46tables_s.string, main->data.buffer, firewall_tool_ip46tables_s.used, rule_contents->array[i].array[0]) == F_equal_to) {
tool = firewall_tool_iptables_s;
repeat = 2;
}
}
// If the remaining rule does not match as firewall_rule_s, then it is an invalid rule.
- else if (f_compare_dynamic_partial_string(firewall_rule_s.string, data->main.buffer, firewall_rule_s.used, rule_objects->array[i]) == F_equal_to) {
+ else if (f_compare_dynamic_partial_string(firewall_rule_s.string, main->data.buffer, firewall_rule_s.used, rule_objects->array[i]) == F_equal_to) {
firewall_print_warning_object_invalid_missing_line(&main->program.warning, i, main->data.buffer, main->data.rule_objects.array[i]);
continue;
// First add the program name.
main->cache.arguments.used = 0;
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
if (tool.string == firewall_tool_ip46tables_s.string) {
// Process the action when a non-none chain is specified.
if (chain != firewall_chain_none_e && action != firewall_action_none_e) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &arguments.array, &arguments.used, &arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
if (action == firewall_action_append_e) {
- main->setting.state.status = f_string_dynamic_append(firewall_action_append_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_action_append_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
}
else if (action == firewall_action_insert_e) {
- main->setting.state.status = f_string_dynamic_append(firewall_action_insert_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_action_insert_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
}
else if (action == firewall_action_policy_e) {
- main->setting.state.status = f_string_dynamic_append(firewall_action_policy_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_action_policy_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
}
if (F_status_is_error(main->setting.state.status)) return;
if (action == firewall_action_append_e || action == firewall_action_insert_e || action == firewall_action_policy_e) {
++main->cache.arguments.used;
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
// Process the chain, which is required by the action.
if (chain == firewall_chain_custom_e) {
- main->setting.state.status = f_string_dynamic_append(data->chains.array[data->main.chain_ids.array[main->data.chain]], &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(main->setting.chains.array[main->data.chain_ids.array[main->data.chain]], &main->cache.arguments.array[main->cache.arguments.used]);
}
else if (chain == firewall_chain_forward_e) {
main->setting.state.status = f_string_dynamic_append(firewall_chain_forward_s, &main->cache.arguments.array[main->cache.arguments.used]);
}
// Add the device if and only if a non-none direction is specified.
- if (device.used && (direction == firewall_direction_input_e || direction == firewall_direction_output_e)) {
- if (f_compare_dynamic_partial_string(firewall_device_all_s.string, data->main.buffer, firewall_device_all_s.used, rule_contents->array[i].array[0]) == F_equal_to_not) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ if (main->cache.device.used && (direction == firewall_direction_input_e || direction == firewall_direction_output_e)) {
+ if (f_compare_dynamic_partial_string(firewall_device_all_s.string, main->data.buffer, firewall_device_all_s.used, rule_contents->array[i].array[0]) == F_equal_to_not) {
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
if (direction == firewall_direction_input_e) {
- main->setting.state.status = f_string_dynamic_append(firewall_device_input_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_device_input_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
if (F_status_is_error(main->setting.state.status)) return;
++main->cache.arguments.used;
}
else if (direction == firewall_direction_output_e) {
- main->setting.state.status = f_string_dynamic_append(firewall_device_output_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_device_output_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
if (F_status_is_error(main->setting.state.status)) return;
++main->cache.arguments.used;
// Add the device.
if (main->cache.device.used) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
}
if (use_protocol) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
- main->setting.state.status = f_string_dynamic_append(firewall_protocol_command_s, &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_append(firewall_protocol_operation_s, &main->cache.arguments.array[main->cache.arguments.used]);
if (F_status_is_error(main->setting.state.status)) return;
++main->cache.arguments.used;
if (main->cache.protocol.used) {
- main->setting.state.status = f_memory_array_increase(firewall_default_allocation_step_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
+ main->setting.state.status = f_memory_array_increase(firewall_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &main->cache.arguments.array, &main->cache.arguments.used, &main->cache.arguments.size);
if (F_status_is_error(main->setting.state.status)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
++j;
if (rule_contents->array[i].array[j].start <= rule_contents->array[i].array[j].stop) {
- ip_list.used = 0;
+ main->cache.ip_list.used = 0;
- main->setting.state.status = f_string_dynamic_partial_append(data->main.buffer, rule_contents->array[i].array[j], &ip_list);
+ main->setting.state.status = f_string_dynamic_partial_append(main->data.buffer, rule_contents->array[i].array[j], &main->cache.ip_list);
if (F_status_is_error(main->setting.state.status)) {
if (rule_contents->array[i].array[j].start <= rule_contents->array[i].array[j].stop) {
main->cache.arguments.array[main->cache.arguments.used].used = 0;
- main->setting.state.status = f_string_dynamic_partial_append(data->main.buffer, rule_contents->array[i].array[j], &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_partial_append(main->data.buffer, rule_contents->array[i].array[j], &main->cache.arguments.array[main->cache.arguments.used]);
if (F_status_is_error(main->setting.state.status)) return;
++main->cache.arguments.used;
// Now execute the generated commands.
if (main->cache.arguments.used > 1) {
if (is_ip_list) {
- data->cache.path_file_specific.used = 0;
- data->cache.local_buffer.used = 0;
- data->cache.basic_objects.used = 0;
- data->cache.basic_contents.used = 0;
+ main->cache.basic_objects.used = 0;
+ main->cache.basic_contents.used = 0;
+ main->cache.buffer.used = 0;
+ main->cache.delimits.used = 0;
+ main->cache.path_file_specific.used = 0;
- main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &data->cache.path_file_specific);
+ main->setting.state.status = f_string_dynamic_append(firewall_network_path_s, &main->cache.path_file_specific);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(main->cache.ip_list, &data->cache.path_file_specific);
+ main->setting.state.status = f_string_dynamic_append(main->cache.ip_list, &main->cache.path_file_specific);
}
if (F_status_is_error(main->setting.state.status)) {
return;
}
- main->setting.state.status = f_file_open(data->cache.path_file_specific, 0, &data->cache.file);
+ main->setting.state.status = f_file_open(main->cache.path_file_specific, 0, &main->cache.file);
if (F_status_is_error(main->setting.state.status)) {
- firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_open), data->cache.path_file_specific, f_file_operation_open_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_open), main->cache.path_file_specific, f_file_operation_open_s, fll_error_file_type_file_e);
- f_file_stream_close(&data->cache.file);
+ f_file_stream_close(&main->cache.file);
return;
}
- main->setting.state.status = f_file_read(data->cache.file, &data->cache.local_buffer);
+ main->setting.state.status = f_file_read(main->cache.file, &main->cache.buffer);
- f_file_stream_close(&data->cache.file);
+ f_file_stream_close(&main->cache.file);
if (F_status_is_error(main->setting.state.status)) {
- firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_read), data->cache.path_file_specific, f_file_operation_read_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(f_file_read), main->cache.path_file_specific, f_file_operation_read_s, fll_error_file_type_file_e);
return;
}
- main->data.delimits.used = 0;
- main->data.range.start = 0;
- main->data.range.stop = data->cache.local_buffer.used - 1;
+ main->cache.delimits.used = 0;
- main->setting.state.status = fll_fss_basic_read(data->cache.local_buffer, main->setting.state.status, &input, &data->cache.basic_objects, &data->cache.basic_contents, 0, &main->data.delimits, 0);
+ if (main->cache.buffer.used) {
+ main->data.range.start = 0;
+ main->data.range.stop = main->cache.buffer.used - 1;
+ }
+ else {
+ main->data.range.start = 1;
+ main->data.range.stop = 0;
+ }
+
+ fll_fss_basic_read(main->cache.buffer, &main->data.range, &main->cache.basic_objects, &main->cache.basic_contents, 0, &main->cache.delimits, 0, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_data_not_eos || F_status_set_fine(main->setting.state.status) == F_data_not || F_status_set_fine(main->setting.state.status) == F_data_not_stop) {
// Empty files are to be silently ignored.
}
else {
- firewall_print_error_file(&main->program.error, macro_firewall_f(fll_fss_basic_read), data->cache.path_file_specific, f_file_operation_read_s, fll_error_file_type_file_e);
+ firewall_print_error_file(&main->program.error, macro_firewall_f(fll_fss_basic_read), main->cache.path_file_specific, f_file_operation_read_s, fll_error_file_type_file_e);
return;
}
}
- main->setting.state.status = f_fss_apply_delimit(main->setting.state, main->data.delimits, &data->cache.local_buffer);
+ f_fss_apply_delimit(main->cache.delimits, &main->cache.buffer, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_fss_apply_delimit));
++main->cache.arguments.used;
// The ip_list file contains objects and no content, all objects are what matter an nothing else.
- for (at = 0; at < data->cache.basic_objects.used; ++at) {
+ for (at = 0; at < main->cache.basic_objects.used; ++at) {
if (firewall_signal_check(main)) return;
main->cache.arguments.array[main->cache.arguments.used].used = 0;
- main->setting.state.status = f_string_dynamic_partial_append(data->cache.local_buffer, data->cache.basic_objects.array[at], &main->cache.arguments.array[main->cache.arguments.used]);
+ main->setting.state.status = f_string_dynamic_partial_append(main->cache.buffer, main->cache.basic_objects.array[at], &main->cache.arguments.array[main->cache.arguments.used]);
if (F_status_is_error(main->setting.state.status)) {
firewall_print_error(&main->program.error, macro_firewall_f(f_string_dynamic_partial_append));
++main->cache.arguments.used;
- firewall_print_debug_tool(data->main->warning, tool, main->cache.arguments);
+ firewall_print_debug_tool(&main->program.warning, tool, main->cache.arguments);
main->setting.state.status = fll_execute_program(tool, main->cache.arguments, 0, 0, (void *) &return_code);
if (main->setting.state.status == F_child) {
- data->main->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_operation(main->program->error, tool, main->cache.arguments);
+ firewall_print_error_operation(&main->program.error, tool, main->cache.arguments);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(fll_execute_program));
if (F_status_set_fine(main->setting.state.status) == F_failure || F_status_set_fine(main->setting.state.status) == F_parameter) return;
}
else {
- firewall_print_debug_tool(data->main->warning, tool, main->cache.arguments);
+ firewall_print_debug_tool(&main->program.warning, tool, main->cache.arguments);
main->setting.state.status = fll_execute_program(tool, main->cache.arguments, 0, 0, (void *) &return_code);
if (main->setting.state.status == F_child) {
- data->main->child = return_code;
+ main->program.child = return_code;
return;
}
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_failure) {
- firewall_print_error_operation(main->program->error, tool, main->cache.arguments);
+ firewall_print_error_operation(&main->program.error, tool, main->cache.arguments);
}
else {
firewall_print_error(&main->program.error, macro_firewall_f(fll_execute_program));
#endif
#ifndef _di_firewall_print_debug_tool_
- void firewall_print_debug_tool(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) {
+ f_status_t firewall_print_debug_tool(fl_print_t * const print, const f_string_static_t tool, const f_string_statics_t arguments) {
- if (output.verbosity != f_console_verbosity_debug_e) return;
+ if (!print) return F_status_set_error(F_output_not);
+ if (print->verbosity != f_console_verbosity_debug_e) return F_output_not;
- f_file_stream_lock(output.to);
+ f_file_stream_lock(print->to);
- fl_print_format("%[%r", output.to, output.context, tool);
+ fl_print_format("%[%Q", print->to, print->context, tool);
for (f_number_unsigned_t i = 0; i < arguments.used; ++i) {
- fl_print_format(" %Q", output.to, arguments.array[i]);
+ fl_print_format(" %Q", print->to, arguments.array[i]);
} // for
- fl_print_format("%]%r", output.to, output.context, f_string_eol_s);
+ fl_print_format("%]%r", print->to, print->context, f_string_eol_s);
- f_file_stream_unlock(output.to);
+ f_file_stream_unlock(print->to);
+
+ return F_okay;
}
#endif // _di_firewall_print_debug_tool_
/**
* Print debug information about tool execution.
*
- * @param output
- * The output to print to.
+ * @param print
+ * The output structure to print to.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param tool
- * The iptables tool.
+ * The name of the function associated with the error.
* @param arguments
- * The arguments passed to the tool.
+ * The name of the file, if this error is assocaited with a file.
+ * Otherwise, set file.used to 0 to not have an file related error message.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_firewall_print_debug_tool_
- extern void firewall_print_debug_tool(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments);
+ extern f_status_t firewall_print_debug_tool(fl_print_t * const print, const f_string_static_t tool, const f_string_statics_t arguments);
#endif // _di_firewall_print_debug_tool_
#ifdef __cplusplus
#endif // _di_firewall_print_error_file_
#ifndef _di_firewall_print_error_file_empty_
- f_status_t firewall_print_error_file_empty(fl_print_t * const print, const f_string_static_t section, const f_string_static_t file) {
+ f_status_t firewall_print_error_file_empty(fl_print_t * const print, const f_string_static_t file) {
if (!print) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
f_file_stream_lock(print->to);
fl_print_format("%[%QNo relevant data is found within the file '%]", print->to, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, operation, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, file, print->notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->set->error, print->set->error, f_string_eol_s);
f_file_stream_unlock(print->to);
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- firewall_main_t * const main = (firewall_main_t *) print->custom);
-
- if (output.verbosity == f_console_verbosity_quiet_e) return;
+ firewall_main_t * const main = (firewall_main_t *) print->custom;
f_file_stream_lock(print->to);
if (F_status_set_fine(main->setting.state.status) == F_memory_not) {
- fl_print_format("%[%QOut of memory while performing requested %r operation:%]", print->to, print->context, output.prefix, tool, print->context);
+ fl_print_format("%[%QOut of memory while performing requested %r operation:%]", print->to, print->context, print->prefix, tool, print->context);
}
else {
- fl_print_format("%[%QFailed to perform requested %r operation:%]", print->to, print->context, output.prefix, tool, print->context);
+ fl_print_format("%[%QFailed to perform requested %r operation:%]", print->to, print->context, print->prefix, tool, print->context);
}
fl_print_format("%r %[%Q", print->to, f_string_eol_s, print->context, tool);
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
- firewall_main_t * const main = (firewall_main_t *) print->custom);
+ firewall_main_t * const main = (firewall_main_t *) print->custom;
f_file_stream_lock(print->to);
- fl_print_format("%[%QFailed to perform%] ", print->to, print->context, output.prefix);
+ fl_print_format("%[%QFailed to perform%] ", print->to, print->context, print->prefix);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, operation, print->notable);
fl_print_format(" %[request because the%] ", print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, operation, print->notable);
}
#endif // _di_firewall_print_error_operation_specified_not_
-#ifndef _di_firewall_print_error_directory_read_
- f_status_t firewall_print_error_directory_read(fl_print_t * const print, const f_string_static_t ) {
-
- if (!print) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- f_file_stream_lock(print->to);
-
- fl_print_format("%[%QFailed to read the device directory '%]", print->to, print->context, print->prefix, print->context);
- fl_print_format(firewall_operation_show_s.string, print->to, print->notable, option, print->notable);
- fl_print_format(" %[option '%]", print->to, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, option, print->notable);
- fl_print_format("%[' is not known.%]%r", print->to, print->context, print->context, f_string_eol_s);
-
- f_file_stream_unlock(print->to);
- f_file_stream_flush(print->to);
-
- return F_okay;
- }
-#endif // _di_firewall_print_error_directory_read_
-
#ifndef _di_firewall_print_error_unhandled_
- void firewall_print_error_unhandled(const fl_print_t print, const f_string_t function, const f_string_static_t file) {
+ f_status_t firewall_print_error_unhandled(fl_print_t * const print, const f_string_t function, const f_string_static_t file) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- f_file_stream_lock(print->to);
+ firewall_main_t * const main = (firewall_main_t *) print->custom;
- firewall_main_t * const main = (firewall_main_t *) print->custom);
+ f_file_stream_lock(print->to);
fl_print_format("%[%QAn unhandled error (%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_ui_single_s.string, print->to, print->notable, F_status_set_fine(main->setting.state.status), print->notable);
fl_print_format("%[) has occurred while calling%] ", print->to, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, operation, print->notable);
+ fl_print_format(f_string_format_S_single_s.string, print->to, print->notable, function, print->notable);
if (file.used) {
fl_print_format("%[() for the file%] ", print->to, print->context, print->prefix, print->context);
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_firewall_print_error_unhandled_
- extern f_status_t firewall_print_error_unhandled(const fl_print_t print, const f_string_t function, const f_string_static_t file);
+ extern f_status_t firewall_print_error_unhandled(fl_print_t * const print, const f_string_t function, const f_string_static_t file);
#endif // _di_firewall_print_error_unhandled_
#ifdef __cplusplus
f_print_dynamic_raw(f_string_eol_s, print->to);
- fll_program_print_help_usage(print, firewall_program_name_s, firewall_program_help_commands_s);
+ fll_program_print_help_usage(print, firewall_program_name_s, firewall_program_help_parameters_s);
f_file_stream_flush(print->to);
f_file_stream_unlock(print->to);
f_file_stream_lock(print->to);
if (left.used) {
- fl_print_format("%[%Q%] ", print->to, print->set.standout, left, print->set.standout);
+ fl_print_format("%[%Q%] ", print->to, print->set->standout, left, print->set->standout);
}
- fll_print_format("%[%Q%]", print->to, print->set.standout, print->set.standout, print->set.title, print->set.title, print->set.standout, print->set.standout, f_string_eol_s);
+ fll_print_format("%[%Q%]", print->to, print->set->standout, print->set->standout, print->set->title, print->set->title, print->set->standout, print->set->standout, f_string_eol_s);
if (left.used) {
- fl_print_format(" %[%Q%]", print->to, print->set.standout, right, print->set.standout);
+ fl_print_format(" %[%Q%]", print->to, print->set->standout, right, print->set->standout);
}
f_print_dynamic_raw(f_string_eol_s, print->to);
build_sources_library main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c
build_sources_library main/print/debug.c main/print/error.c main/print/message.c main/print/warning.c
-build_sources_library main/operate.c main/operate/buffer.c main/operate/create.c main/operate/default.c main/operate/delete.c main/operate/load.c main/operate/process.c
+build_sources_library main/operate.c main/operate/buffer.c main/operate/create.c main/operate/default.c main/operate/delete.c main/operate/process.c
build_sources_library main/firewall.c main/signal.c main/thread.c
build_sources_program main/main.c
build_sources_headers main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h
build_sources_headers main/print/debug.h main/print/error.h main/print/message.h main/print/warning.h
-build_sources_headers main/operate.h main/operate/buffer.h main/operate/create.h main/operate/default.h main/operate/delete.h main/operate/load.h main/operate/process.h
+build_sources_headers main/operate.h main/operate/buffer.h main/operate/create.h main/operate/default.h main/operate/delete.h main/operate/process.h
build_sources_headers main/firewall.h main/operate.h main/signal.h main/thread.h
build_sources_documentation man