- Added more signal commands.
- Added more signal codes for up to 64 signals.
- Replaced f_error_unmask with f_error_set_fine to be more consistent with the other f_error_set_* names.
- The signal bit is intended to be both the error and warning bit set so it is mathematically the same as the mask bit.
- Change f_none starting point to 197 to handle all possible 64 signals.
#define f_error_bit_warning 16384
#define f_error_bit_mask 49152
#define f_error_bit_fine 16383
+ #define f_error_bit_signal 49152
- #define f_error_is_error(status) status & f_error_bit_error
- #define f_error_is_warning(status) status & f_error_bit_warning
- #define f_error_is_problem(status) status & f_error_bit_mask // this is either a warning or an error
- #define f_error_is_fine(status) (status & f_error_bit_mask) == 0
- #define f_error_is_not_error(status) (status & f_error_bit_error) == 0
+ #define f_error_is_error(status) status & f_error_bit_error
+ #define f_error_is_warning(status) status & f_error_bit_warning
+ #define f_error_is_problem(status) status & f_error_bit_mask
+ #define f_error_is_fine(status) (status & f_error_bit_mask) == 0
+ #define f_error_is_not_error(status) (status & f_error_bit_error) == 0
+ #define f_error_is_not_warning(status) (status & f_error_bit_warning) == 0
+ #define f_error_is_not_signal(status) (status & f_error_bit_signal) == 0
+
+ // use both error and warning bits to designate that the response is a signal.
+ #define f_error_is_signal(status) (status & f_error_bit_signal) == f_error_bit_signal
#define f_error_set_error(status) status | f_error_bit_error
#define f_error_set_warning(status) status | f_error_bit_warning
+ #define f_error_set_signal(status) status | f_error_bit_signal
- // use f_error_unmask to remove the error and warning bits
- #define f_error_unmask(status) status & f_error_bit_fine
+ // use f_error_set_fine to remove the error, warning, and signal bits
+ #define f_error_set_fine(status) status & f_error_bit_fine
#endif // _di_f_error_masks_
// use of an enumerator makes more sense here than explicitly defining every error code
f_signal_pollable_event,
f_signal_power_failure,
f_signal_bad_system_call,
+
+ // these will be renamed if new names are given for the remaining system calls (up to 64).
+ f_signal_reserved_32,
+ f_signal_reserved_33,
+ f_signal_reserved_34,
+ f_signal_reserved_35,
+ f_signal_reserved_36,
+ f_signal_reserved_37,
+ f_signal_reserved_38,
+ f_signal_reserved_39,
+ f_signal_reserved_40,
+ f_signal_reserved_41,
+ f_signal_reserved_42,
+ f_signal_reserved_43,
+ f_signal_reserved_44,
+ f_signal_reserved_45,
+ f_signal_reserved_46,
+ f_signal_reserved_47,
+ f_signal_reserved_48,
+ f_signal_reserved_49,
+ f_signal_reserved_50,
+ f_signal_reserved_51,
+ f_signal_reserved_52,
+ f_signal_reserved_53,
+ f_signal_reserved_54,
+ f_signal_reserved_55,
+ f_signal_reserved_56,
+ f_signal_reserved_57,
+ f_signal_reserved_58,
+ f_signal_reserved_59,
+ f_signal_reserved_60,
+ f_signal_reserved_61,
+ f_signal_reserved_62,
+ f_signal_reserved_63,
+ f_signal_reserved_64,
#endif // _di_f_errors_signals_
#ifndef _di_f_errors_basic_
- f_none = 166, // start at 166 to allow compatibility with the reserved bash return codes (keep in mind fss return codes can be larger than 255).
+ f_none = 197, // start at 197 to allow compatibility with the reserved bash return codes (keep in mind fss return codes can be larger than 255).
f_dummy, // to only be used as a placeholder
f_warn, // warning
f_critical,
if (string == f_null) return f_error_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- f_status umasked_error = f_error_unmask(error);
+ f_status umasked_error = f_error_set_fine(error);
switch (umasked_error) {
#ifndef _di_fl_errors_booleans_
if (string == f_null) return f_error_set_error(f_invalid_parameter);
#endif // _di_level_2_parameter_checking_
- f_status unmasked_error = f_error_unmask(error);
+ f_status unmasked_error = f_error_set_fine(error);
switch (unmasked_error) {
#ifndef _di_fll_fss_errors_error_
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
// nothing can be 0 as that represents the program name, unless argv[] is improperly created
} else if (f_macro_test_for_allocation_errors(status)) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
- } else if (f_error_unmask(status) == f_invalid_parameter) {
+ } else if (f_error_set_fine(status) == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
} else {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_error_set_error(status));
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (f_macro_test_for_allocation_errors(status)) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
status = fl_directory_list((f_string) network_devices, &data->devices);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (f_macro_test_for_allocation_errors(status)) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
firewall_delete_local_data(&local);
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
f_file_close(&file);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read()");
}
if (f_error_set_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_read() for the file '%s'", file_path.string);
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_failure) {
if (tool == firewall_program_iptables) {
status = f_file_open(&file, filename);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (optional) {
if (status == f_invalid_parameter) {
f_file_close(&file);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read().");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", filename);
status = firewall_perform_commands(*local, *data);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (f_macro_test_for_allocation_errors(status)) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory.");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &data->buffer);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
data->file_position.total_elements = original_size;
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
f_file_close(&file);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'", filename);
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &input);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
status = f_file_open(&output, argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
f_file_close(&output);
f_file_close(&output);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &data->buffer);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read()");
data->file_position.total_elements = original_size;
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
f_file_close(&file);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'", filename);
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &input);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
status = f_file_open(&output, argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
f_file_close(&output);
f_file_close(&output);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &data->buffer);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
data->file_position.total_elements = original_size;
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
f_file_close(&file);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_read()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_extended_read() for the file '%s'", filename);
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
status = fl_file_read_fifo(file, &input);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
status = f_file_open(&output, argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
f_file_close(&output);
f_file_close(&output);
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_invalid_parameter) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
}
if (f_error_is_error(status)) {
- status = f_error_unmask(status);
+ status = f_error_set_fine(status);
if (status == f_no_data) {
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");