Utilize the set flag for defining the state on whether or not to keep the senders file name when receiving.
Utilize the set flag for defining whether or not the send is a send set or a receive set.
Provide a `-a` or `--as` parameter for a sender to declare a custom name for some file being transferred.
Do not pre-check or pre-write to files when the file name will only be known once a packet is received.
The direction string no longer needs to be passed to functions now that the set flag defines what direction it is.
Consistently add new lines at the start of the message printing.
Do not reset the set flag on initialization (resetting).
Rename the initialization functions to use the word "reset" to avoid confusion with the real initialization process.
Print verbose log message declaring the name of the received file when keeping the senders file name and when headers are not printed.
Fix mistake where the `kt_tacocat_socket_step_receive_find_e` is incorrectly being compared against the set flag rather than the set step.
Fix problems preventing stand alone builds from compiling.
#define _di_fll_program_print_error_parameter_process_
#define _di_fll_program_print_error_parameter_range_start_before_stop_
//#define _di_fll_program_print_error_parameter_support_not_
+#define _di_fll_program_print_error_parameter_too_few_
+//#define _di_fll_program_print_error_parameter_too_many_
#define _di_fll_program_print_error_parameter_value_too_long_
#define _di_fll_program_print_error_pipe_invalid_form_feed_
#define _di_fll_program_print_error_pipe_missing_content_
#define _di_f_string_ascii_k_s_
//#define _di_f_string_ascii_l_s_
#define _di_f_string_ascii_m_s_
-#define _di_f_string_ascii_mark_question_s_
+//#define _di_f_string_ascii_mark_question_s_
#define _di_f_string_ascii_medium_stop_s_
//#define _di_f_string_ascii_minus_s_
//#define _di_f_string_ascii_n_s_
#define _di_f_string_dynamic_mash_nulless_
#define _di_f_string_dynamic_mish_
#define _di_f_string_dynamic_mish_nulless_
-#define _di_f_string_dynamic_partial_append_
+//#define _di_f_string_dynamic_partial_append_
#define _di_f_string_dynamic_partial_append_assure_
#define _di_f_string_dynamic_partial_append_assure_nulless_
#define _di_f_string_dynamic_partial_append_nulless_
build_sources_program program/kevux/tools/tacocat/main/common.c program/kevux/tools/tacocat/main/common/define.c program/kevux/tools/tacocat/main/common/enumeration.c program/kevux/tools/tacocat/main/common/string.c program/kevux/tools/tacocat/main/common/type.c
build_sources_program program/kevux/tools/tacocat/main/print/error.c program/kevux/tools/tacocat/main/print/message.c program/kevux/tools/tacocat/main/print/verbose.c program/kevux/tools/tacocat/main/print/warning.c
build_sources_program program/kevux/tools/tacocat/main/packet.c program/kevux/tools/tacocat/main/process.c program/kevux/tools/tacocat/main/receive.c program/kevux/tools/tacocat/main/send.c program/kevux/tools/tacocat/main/signal.c program/kevux/tools/tacocat/main/tacocat.c program/kevux/tools/tacocat/main/thread.c
-build_sources_program program/kevux/tools/tacocat/main/send/step/check.c program/kevux/tools/tacocat/main/send/step/control.c program/kevux/tools/tacocat/main/send/step/done.c program/kevux/tools/tacocat/main/send/step/extract.c program/kevux/tools/tacocat/main/send/step/find.c program/kevux/tools/tacocat/main/send/step/next.c program/kevux/tools/tacocat/main/send/step/packet.c program/kevux/tools/tacocat/main/send/step/write.c
+build_sources_program program/kevux/tools/tacocat/main/receive/step/check.c program/kevux/tools/tacocat/main/receive/step/control.c program/kevux/tools/tacocat/main/receive/step/done.c program/kevux/tools/tacocat/main/receive/step/extract.c program/kevux/tools/tacocat/main/receive/step/find.c program/kevux/tools/tacocat/main/receive/step/next.c program/kevux/tools/tacocat/main/receive/step/packet.c program/kevux/tools/tacocat/main/receive/step/write.c
build_sources_program program/kevux/tools/tacocat/main/send/step/build.c program/kevux/tools/tacocat/main/send/step/check.c program/kevux/tools/tacocat/main/send/step/done.c program/kevux/tools/tacocat/main/send/step/encode.c program/kevux/tools/tacocat/main/send/step/file.c program/kevux/tools/tacocat/main/send/step/header.c program/kevux/tools/tacocat/main/send/step/packet.c program/kevux/tools/tacocat/main/send/step/size.c program/kevux/tools/tacocat/main/send/step/wait.c
build_sources_program program/kevux/tools/tacocat/tacocat/config.c program/kevux/tools/tacocat/tacocat/tacocat.c program/kevux/tools/tacocat/tacocat/main.c program/kevux/tools/tacocat/tacocat/string.c
main->setting.flag &= ~kt_tacocat_main_flag_headers_d;
}
+ if (main->program.parameters.array[kt_tacocat_parameter_as_e].result & f_console_result_found_d) {
+ if (main->program.parameters.array[kt_tacocat_parameter_as_e].result & f_console_result_value_d) {
+ if (main->program.parameters.array[kt_tacocat_parameter_as_e].values.used > (main->program.parameters.array[kt_tacocat_parameter_send_e].values.used / 2)) {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ fll_program_print_error_parameter_too_many(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_as_s, main->program.parameters.array[kt_tacocat_parameter_as_e].values.used - (main->program.parameters.array[kt_tacocat_parameter_send_e].values.used / 2));
+
+ return;
+ }
+ }
+ else {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_as_s);
+
+ return;
+ }
+ }
+
// Only process these when needed to avoid unnecessary operations.
if (main->callback.setting_load_send_receive && !(main->setting.flag & (kt_tacocat_main_flag_copyright_d | kt_tacocat_main_flag_version_d |kt_tacocat_main_flag_help_d))) {
main->callback.setting_load_send_receive(arguments, main);
F_file_mode_all_r_d,
};
+ f_number_unsigned_t as = 0;
f_number_unsigned_t j = 0;
f_number_unsigned_t k = 0;
f_number_unsigned_t p = 0;
f_number_unsigned_t index = 0;
+ f_number_unsigned_t index_as = 0;
f_number_unsigned_t length = 0;
f_number_unsigned_t total = 0;
f_status_t failed = F_okay;
sets[i]->array[j].size_block = default_block_size[i];
sets[i]->array[j].abstruses.used = 0;
+ sets[i]->array[j].as.used = 0;
sets[i]->array[j].buffer.used = 0;
sets[i]->array[j].cache.used = 0;
sets[i]->array[j].client.used = 0;
sets[i]->array[j].header.used = 0;
- sets[i]->array[j].flag = 0;
+ sets[i]->array[j].flag = is_receive[i] ? kt_tacocat_socket_step_flag_none_d : kt_tacocat_socket_step_flag_send_d;
sets[i]->array[j].name.used = 0;
sets[i]->array[j].network.used = 0;
sets[i]->array[j].packet.control = 0;
sets[i]->array[j].file.size_read = sets[i]->array[j].size_block;
sets[i]->array[j].file.size_write = sets[i]->array[j].size_block;
+ if (is_receive[i]) {
+ if (f_compare_dynamic(main->program.parameters.arguments.array[index], f_string_ascii_mark_question_s) == F_equal_to) {
+ sets[i]->array[j].flag |= kt_tacocat_socket_step_flag_keep_d;
+ }
+ }
+ else {
+ if (main->program.parameters.array[kt_tacocat_parameter_as_e].result & f_console_result_value_d) {
+ if (as < main->program.parameters.array[kt_tacocat_parameter_as_e].values.used) {
+ index_as = main->program.parameters.array[kt_tacocat_parameter_as_e].values.array[as];
+
+ // Associate "--as" value via a static string.
+ sets[i]->array[j].as.string = main->program.parameters.arguments.array[index_as].string;
+ sets[i]->array[j].as.used = main->program.parameters.arguments.array[index_as].used;
+ sets[i]->array[j].as.size = 0;
+
+ ++as;
+ }
+ }
+ }
+
// Associate file name via a static string.
sets[i]->array[j].name.string = main->program.parameters.arguments.array[index].string;
sets[i]->array[j].name.used = main->program.parameters.arguments.array[index].used;
sets[i]->array[j].name.size = 0;
- // Make sure the file exists and can be read and/or can be written to, then close when done.
- main->setting.state.status = f_file_open(sets[i]->array[j].name, file_modes[i], &sets[i]->array[j].file);
-
- if (F_status_is_error(main->setting.state.status)) {
- macro_kt_tacocat_handle_load_send_receive_error_file_continue_1(sets[i]->array[j].name, f_file_operation_open_s, fll_error_file_type_file_e);
+ // Make sure the file exists and can be read and/or can be written to, then close when done (if possible).
+ if (!is_receive[i] || !(sets[i]->array[j].flag & kt_tacocat_socket_step_flag_keep_d)) {
+ main->setting.state.status = f_file_open(sets[i]->array[j].name, file_modes[i], &sets[i]->array[j].file);
- if (F_status_is_error_not(failed)) {
- failed = main->setting.state.status;
- }
-
- sets[i]->array[j].status = main->setting.state.status;
- }
- else {
- main->setting.state.status = f_file_close(&sets[i]->array[j].file);
+ if (F_status_is_error(main->setting.state.status)) {
+ macro_kt_tacocat_handle_load_send_receive_error_file_continue_1(sets[i]->array[j].name, f_file_operation_open_s, fll_error_file_type_file_e);
- macro_kt_tacocat_handle_load_send_receive_error_file_continue_1(sets[i]->array[j].name, f_file_operation_close_s, fll_error_file_type_file_e);
- }
- }
- else {
- main->setting.state.status = F_status_set_error(F_parameter);
+ if (F_status_is_error_not(failed)) {
+ failed = main->setting.state.status;
+ }
- fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]);
+ sets[i]->array[j].status = main->setting.state.status;
+ }
+ else {
+ main->setting.state.status = f_file_close(&sets[i]->array[j].file);
- if (F_status_is_error_not(failed)) {
- failed = main->setting.state.status;
+ macro_kt_tacocat_handle_load_send_receive_error_file_continue_1(sets[i]->array[j].name, f_file_operation_close_s, fll_error_file_type_file_e);
+ }
}
-
- sets[i]->array[j].status = main->setting.state.status;
-
- continue;
}
} // for
}
if (F_status_is_error(status)) { \
kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, kt_tacocat_receive_s, network, status, name); \
\
- step = 0; \
+ step = kt_tacocat_socket_step_receive_none_e; \
\
return; \
}
#endif // _di_kt_tacocat_socket_flag_d_
/**
+ * Flags related to the socket step.
+ *
+ * kt_tacocat_socket_step_flag_*_d:
+ * - none: No flags set.
+ * - send: Designate that the socket step is a send rather than a receive (when this is not set, the socket step is a receive).
+ * - keep: This (receive) socket is to keep the file name provided by the sender.
+ */
+#ifndef _di_kt_tacocat_socket_step_flag_d_
+ #define kt_tacocat_socket_step_flag_none_d 0x0
+ #define kt_tacocat_socket_step_flag_send_d 0x1
+ #define kt_tacocat_socket_step_flag_keep_d 0x2
+#endif // _di_kt_tacocat_socket_step_flag_d_
+
+/**
* A macro wrapping the appropriate signal check function based on threaded/non-threaded support.
*/
#ifndef _di_kt_tacocat_signal_check_d_
kt_tacocat_parameter_verbosity_debug_e,
kt_tacocat_parameter_version_e,
+ kt_tacocat_parameter_as_e,
kt_tacocat_parameter_headers_e,
kt_tacocat_parameter_interval_e,
kt_tacocat_parameter_max_buffer_e,
{ \
macro_fll_program_console_parameter_standard_initialize, \
\
+ macro_f_console_parameter_t_initialize_3(kt_tacocat_short_as_s, kt_tacocat_long_as_s, 1, f_console_flag_normal_d), \
macro_f_console_parameter_t_initialize_3(kt_tacocat_short_headers_s, kt_tacocat_long_headers_s, 0, f_console_flag_normal_d), \
macro_f_console_parameter_t_initialize_3(kt_tacocat_short_interval_s, kt_tacocat_long_interval_s, 1, f_console_flag_normal_d), \
macro_f_console_parameter_t_initialize_3(kt_tacocat_short_max_buffer_s, kt_tacocat_long_max_buffer_s, 1, f_console_flag_normal_d), \
macro_f_console_parameter_t_initialize_3(kt_tacocat_short_send_s, kt_tacocat_long_send_s, 2, f_console_flag_normal_d), \
}
- #define kt_tacocat_parameter_total_d (f_console_parameter_state_type_total_d + 6)
+ #define kt_tacocat_parameter_total_d (f_console_parameter_state_type_total_d + 7)
#endif // _di_kt_tacocat_parameter_e_
/**
#endif // _di_kt_tacocat_s_
#ifndef _di_kt_tacocat_parameter_s_
+ const f_string_static_t kt_tacocat_short_as_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_as_s, 0, KT_TACOCAT_short_as_s_length);
const f_string_static_t kt_tacocat_short_headers_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_headers_s, 0, KT_TACOCAT_short_headers_s_length);
const f_string_static_t kt_tacocat_short_interval_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_interval_s, 0, KT_TACOCAT_short_interval_s_length);
const f_string_static_t kt_tacocat_short_max_buffer_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_max_buffer_s, 0, KT_TACOCAT_short_max_buffer_s_length);
const f_string_static_t kt_tacocat_short_resolve_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_resolve_s, 0, KT_TACOCAT_short_resolve_s_length);
const f_string_static_t kt_tacocat_short_send_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_short_send_s, 0, KT_TACOCAT_short_send_s_length);
+ const f_string_static_t kt_tacocat_long_as_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_long_as_s, 0, KT_TACOCAT_long_as_s_length);
const f_string_static_t kt_tacocat_long_headers_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_long_headers_s, 0, KT_TACOCAT_long_headers_s_length);
const f_string_static_t kt_tacocat_long_interval_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_long_interval_s, 0, KT_TACOCAT_long_interval_s_length);
const f_string_static_t kt_tacocat_long_max_buffer_s = macro_f_string_static_t_initialize_1(KT_TACOCAT_long_max_buffer_s, 0, KT_TACOCAT_long_max_buffer_s_length);
* The main program parameters.
*/
#ifndef _di_kt_tacocat_parameter_s_
+ #define KT_TACOCAT_short_as_s "a"
#define KT_TACOCAT_short_headers_s "H"
#define KT_TACOCAT_short_interval_s "I"
#define KT_TACOCAT_short_max_buffer_s "M"
#define KT_TACOCAT_short_resolve_s "R"
#define KT_TACOCAT_short_send_s "s"
+ #define KT_TACOCAT_long_as_s "as"
#define KT_TACOCAT_long_headers_s "headers"
#define KT_TACOCAT_long_interval_s "interval"
#define KT_TACOCAT_long_max_buffer_s "max_buffer"
#define KT_TACOCAT_long_resolve_s "resolve"
#define KT_TACOCAT_long_send_s "send"
- #define KT_TACOCAT_short_headers_s_length 1
+ #define KT_TACOCAT_short_as_s_length 1
+ #define KT_TACOCAT_short_headers_s_length 1
#define KT_TACOCAT_short_interval_s_length 1
#define KT_TACOCAT_short_max_buffer_s_length 1
#define KT_TACOCAT_short_receive_s_length 1
#define KT_TACOCAT_short_resolve_s_length 1
#define KT_TACOCAT_short_send_s_length 1
+ #define KT_TACOCAT_long_as_s_length 2
#define KT_TACOCAT_long_headers_s_length 7
#define KT_TACOCAT_long_interval_s_length 8
#define KT_TACOCAT_long_max_buffer_s_length 10
#define KT_TACOCAT_long_resolve_s_length 7
#define KT_TACOCAT_long_send_s_length 4
+ extern const f_string_static_t kt_tacocat_short_as_s;
extern const f_string_static_t kt_tacocat_short_headers_s;
extern const f_string_static_t kt_tacocat_short_interval_s;
extern const f_string_static_t kt_tacocat_short_max_buffer_s;
extern const f_string_static_t kt_tacocat_short_resolve_s;
extern const f_string_static_t kt_tacocat_short_send_s;
+ extern const f_string_static_t kt_tacocat_long_as_s;
extern const f_string_static_t kt_tacocat_long_headers_s;
extern const f_string_static_t kt_tacocat_long_interval_s;
extern const f_string_static_t kt_tacocat_long_max_buffer_s;
f_memory_array_resize(0, sizeof(f_range_t), (void **) &array[i].comments.array, &array[i].comments.used, &array[i].comments.size);
}
+ if (array[i].as.size) {
+ f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].as.string, &array[i].as.used, &array[i].as.size);
+ }
+
if (array[i].buffer.size) {
f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].buffer.string, &array[i].buffer.used, &array[i].buffer.size);
}
* size_total: The size in bytes tht represent the entire size to be processed (size_done should eventually equal this).
*
* flag: A set of flags.
- * step: The current step the socket set is operating under.
+ * step: The current step the socket set is operating under (this is either a send or receive step define depending on whether or not flag has the send bit set).
* retry: The current number of retries performed.
* part: The current active part number.
* port: The current port number for the socket.
* comments: An array of FSS comments.
* state: Basic state information, usually passed to the FSS functions.
*
+ * as: A custom name to use for the file rather than the actual file name.
* buffer: A buffer for sending or receiving data between clients.
* cache: A cache used for various purposes, but primarily for the building of the send packet.
* client: A single client address for some network connection.
f_ranges_t comments;
f_state_t state;
+ f_string_dynamic_t as;
f_string_dynamic_t buffer;
f_string_dynamic_t cache;
f_string_dynamic_t client;
kt_tacocat_block_size_d, \
0, \
0, \
- 0, \
- 0, \
+ kt_tacocat_socket_step_flag_none_d, \
+ kt_tacocat_socket_step_receive_none_e, \
0, \
f_file_t_initialize, \
f_socket_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
f_fss_simple_packet_range_t_initialize, \
fl_fss_payload_header_state_t_initialize, \
f_abstruse_maps_t_initialize, \
size_block, \
0, \
0, \
- 0, \
- 0, \
+ kt_tacocat_socket_step_flag_none_d, \
+ kt_tacocat_socket_step_receive_none_e, \
0, \
f_file_t_initialize, \
f_poll_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
f_fss_simple_packet_range_t_initialize, \
fl_fss_payload_header_state_t_initialize, \
f_abstruse_maps_t_initialize, \
size_block, \
0, \
0, \
- 0, \
- 0, \
+ kt_tacocat_socket_step_flag_none_d, \
+ kt_tacocat_socket_step_receive_none_e, \
0, \
f_file_t_initialize, \
f_poll_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
f_fss_simple_packet_range_t_initialize, \
write_state, \
f_abstruse_maps_t_initialize, \
#endif
#ifndef _di_kt_tacocat_packet_extract_
- void kt_tacocat_packet_extract(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_string_static_t direction) {
+ void kt_tacocat_packet_extract(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set) {
if (!main || !set) return;
kt_tacocat_process_abstruse_initialize(main, set);
if (F_status_is_error(set->status)) {
- kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, direction, set->network, set->status, set->name);
+ kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, set->status, set->name);
if (set->socket.id_data != -1) {
f_file_close_id(&set->socket.id_data);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
return;
}
for (f_number_unsigned_t i = 0; i < set->objects.used; ++i) {
if (f_compare_dynamic_partial_string(f_fss_payload_object_header_s.string, set->buffer, f_fss_payload_object_header_s.used, set->objects.array[i]) == F_equal_to) {
- kt_tacocat_packet_extract_header(main, set, i, direction);
+ kt_tacocat_packet_extract_header(main, set, i);
if (F_status_is_error(set->status)) {
// @todo handle F_packet error, setup the sending of an invalid packet response (things similar to this needs to be done in multiple places).
found_not &= ~0x2;
}
else if (f_compare_dynamic_partial_string(f_fss_payload_object_signature_s.string, set->buffer, f_fss_payload_object_signature_s.used, set->objects.array[i]) == F_equal_to) {
- kt_tacocat_packet_extract_signature(main, set, i, direction);
+ kt_tacocat_packet_extract_signature(main, set, i);
if (F_status_is_error(set->status)) {
++set->retry;
#endif // _di_kt_tacocat_packet_extract_
#ifndef _di_kt_tacocat_packet_extract_header_
- void kt_tacocat_packet_extract_header(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at, const f_string_static_t direction) {
+ void kt_tacocat_packet_extract_header(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at) {
if (!main || !set) return;
set->status = f_memory_array_increase_by(kt_tacocat_packet_headers_d, sizeof(f_abstruse_map_t), (void **) &set->abstruses.array, &set->abstruses.used, &set->abstruses.size);
if (F_status_is_error(set->status)) {
- kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, direction, set->network, set->status, set->name);
+ kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, set->status, set->name);
return;
}
if (F_status_is_error(set->state.status)) {
set->status = set->state.status;
- kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, direction, set->network, set->status, set->name);
+ kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, set->status, set->name);
return;
}
// Convert the status code.
if (set->abstruses.array[0].value.type) {
if (ranges[0].start > ranges[0].stop) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[0]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[0]);
set->abstruses.array[0].value.type = f_abstruse_none_e;
set->abstruses.array[0].value.is.a_unsigned = 0;
set->abstruses.array[0].value.is.a_unsigned = (f_number_unsigned_t) code;
}
else {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_status_is_error(status) ? status : F_found_not, set->name, set->buffer, set->objects.array[at], ranges[0]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_status_is_error(status) ? status : F_found_not, set->name, set->buffer, set->objects.array[at], ranges[0]);
set->abstruses.array[0].value.type = f_abstruse_none_e;
set->abstruses.array[0].value.is.a_unsigned = 0;
if (set->abstruses.array[1].value.type) {
if (ranges[1].start > ranges[1].stop) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_packet, set->name, set->buffer, set->objects.array[at], ranges[1]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_packet, set->name, set->buffer, set->objects.array[at], ranges[1]);
set->abstruses.array[1].value.type = f_abstruse_none_e;
set->abstruses.array[1].value.is.a_unsigned = 0;
set->abstruses.array[1].value.is.a_unsigned = (f_number_unsigned_t) kt_tacocat_packet_type_resend_d;
}
else {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[1]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[1]);
set->abstruses.array[1].value.type = f_abstruse_none_e;
set->abstruses.array[1].value.is.a_unsigned = 0;
}
}
- // Convert the name.
+ // Convert the name, storing the extracted name in set.as for managing allocation and de-allocation.
+ // @todo this abstruse should only exist for the main receive packet for the main receive packet type; review this and handle accordingly.
if (set->abstruses.array[5].value.type) {
if (ranges[5].start > ranges[5].stop) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[5]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[5]);
set->abstruses.array[5].value.type = f_abstruse_none_e;
set->abstruses.array[5].value.is.a_unsigned = 0;
set->status = F_status_set_error(F_packet);
}
else {
- set->name.used = 0;
+ set->as.used = 0;
- status = f_string_dynamic_partial_append(set->buffer, ranges[5], &set->name);
+ status = f_string_dynamic_partial_append(set->buffer, ranges[5], &set->as);
if (F_status_is_error(status)) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, status, set->name, set->buffer, set->objects.array[at], ranges[5]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, status, set->name, set->buffer, set->objects.array[at], ranges[5]);
set->abstruses.array[5].value.type = f_abstruse_none_e;
set->abstruses.array[5].value.is.a_unsigned = 0;
}
else {
set->abstruses.array[5].value.type = f_abstruse_dynamic_e;
- set->abstruses.array[5].value.is.a_dynamic = set->name;
+ set->abstruses.array[5].value.is.a_dynamic = set->as;
set->abstruses.array[5].value.is.a_dynamic.size = 0;
}
}
// Convert the id.
if (set->abstruses.array[7].value.type && ranges[7].start <= ranges[7].stop) {
if (ranges[7].start > ranges[7].stop) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[7]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[7]);
set->abstruses.array[7].value.type = f_abstruse_none_e;
set->abstruses.array[7].value.is.a_unsigned = 0;
status = f_string_dynamic_partial_append(set->buffer, ranges[7], &set->id);
if (F_status_is_error(status)) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, status, set->id, set->buffer, set->objects.array[at], ranges[7]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, status, set->id, set->buffer, set->objects.array[at], ranges[7]);
set->abstruses.array[7].value.type = f_abstruse_none_e;
set->abstruses.array[7].value.is.a_unsigned = 0;
// Convert the time.
if (set->abstruses.array[8].value.type) {
if (ranges[8].start > ranges[8].stop) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[8]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, F_found_not, set->name, set->buffer, set->objects.array[at], ranges[8]);
set->abstruses.array[8].value.type = f_abstruse_none_e;
set->abstruses.array[8].value.is.a_unsigned = 0;
status = f_string_dynamic_partial_append(set->buffer, ranges[8], &set->time);
if (F_status_is_error(status)) {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, status, set->time, set->buffer, set->objects.array[at], ranges[8]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, status, set->time, set->buffer, set->objects.array[at], ranges[8]);
set->abstruses.array[8].value.type = f_abstruse_none_e;
set->abstruses.array[8].value.is.a_unsigned = 0;
set->abstruses.array[i].value.is.a_unsigned = number;
}
else {
- kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, direction, set->network, status, set->name, set->buffer, set->objects.array[at], ranges[i]);
+ kt_tacocat_print_error_on_packet_header_value_invalid(&main->program.error, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, status, set->name, set->buffer, set->objects.array[at], ranges[i]);
set->abstruses.array[i].value.type = f_abstruse_none_e;
set->abstruses.array[i].value.is.a_unsigned = 0;
} // for
}
+ // @todo index 9 is the signature.
+
set->abstruses.used = kt_tacocat_packet_headers_d;
}
#endif // _di_kt_tacocat_packet_extract_header_
#ifndef _di_kt_tacocat_packet_extract_signature_
- void kt_tacocat_packet_extract_signature(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at, const f_string_static_t direction) {
+ void kt_tacocat_packet_extract_signature(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at) {
if (!main || !set) return;
fll_fss_extended_read(set->buffer, &set->range, &set->objects_signature, &set->contents_signature, &set->objects_quoted_header, &set->contents_quoted_header, &set->objects_delimits_signature, &set->contents_delimits_signature, &set->state);
if (F_status_is_error(set->state.status)) {
- kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, direction, set->network, set->status, set->name);
+ kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, (set->flag & kt_tacocat_socket_step_flag_send_d) ? kt_tacocat_send_s : kt_tacocat_receive_s, set->network, set->status, set->name);
set->status = set->state.status;
return;
}
- // @todo maybe index 8 and beyond in the abstruse shall represent signatures?
+ // @todo index 9 in the abstruse shall represent signatures.
set->status = F_okay;
}
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: kt_tacocat_packet_extract_header().
* Errors (with error bit) from: kt_tacocat_packet_extract_signature().
- * @param direction
- * The string representing the direction and is used for error handling.
- * This is generally either kt_tacocat_receive_s or kt_tacocat_send_s.
*
* @see f_memory_array_increase_by()
* @see kt_tacocat_packet_extract_header()
* @see kt_tacocat_packet_extract_signature()
*/
#ifndef _di_kt_tacocat_packet_extract_
- extern void kt_tacocat_packet_extract(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_string_static_t direction);
+ extern void kt_tacocat_packet_extract(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
#endif // _di_kt_tacocat_packet_extract_
/**
* Errors (with error bit) from: fll_fss_extended_read().
* @param at
* The index position representing which Object and Contents set to use.
- * @param direction
- * The string representing the direction and is used for error handling.
- * This is generally either kt_tacocat_receive_s or kt_tacocat_send_s.
*
* @see fll_fss_extended_read()
*/
#ifndef _di_kt_tacocat_packet_extract_header_
- extern void kt_tacocat_packet_extract_header(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at, const f_string_static_t direction);
+ extern void kt_tacocat_packet_extract_header(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at);
#endif // _di_kt_tacocat_packet_extract_header_
/**
*
* This alters set.status:
* F_okay on success.
- * @param direction
- * The string representing the direction and is used for error handling.
- * This is generally either kt_tacocat_receive_s or kt_tacocat_send_s.
* @param at
* The index position representing which Object and Contents set to use.
*/
#ifndef _di_kt_tacocat_packet_extract_signature_
- extern void kt_tacocat_packet_extract_signature(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at, const f_string_static_t direction);
+ extern void kt_tacocat_packet_extract_signature(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set, const f_number_unsigned_t at);
#endif // _di_kt_tacocat_packet_extract_signature_
#ifdef __cplusplus
fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set->name, print->set->notable);
fl_print_format("%['", print->to, print->set->error);
- if (set->flag == kt_tacocat_socket_step_receive_find_e) {
+ if (set->step == kt_tacocat_socket_step_receive_find_e) {
fl_print_format(" while trying to process the Packet headers", print->to);
}
f_file_stream_lock(print->to);
- fl_print_format(sent ? "Headers Sent to " : "Headers Received from ", print->to, f_string_eol_s);
+ fl_print_format(sent ? "%rHeaders Sent to " : "%rHeaders Received from ", print->to, f_string_eol_s);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
if (set.port) {
f_print_dynamic_raw(f_string_eol_s, print->to);
+ fll_program_print_help_option(print, kt_tacocat_short_as_s, kt_tacocat_long_as_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Designate a different name to send the file as.");
fll_program_print_help_option(print, kt_tacocat_short_headers_s, kt_tacocat_long_headers_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the headers on send or on receive.");
fll_program_print_help_option(print, kt_tacocat_short_interval_s, kt_tacocat_long_interval_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom poll interval in milliseconds to use.");
fll_program_print_help_option(print, kt_tacocat_short_max_buffer_s, kt_tacocat_long_max_buffer_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Specify a maximum buffer size to allow (in bytes) when receiving packets.");
fl_print_format(" %[%r%]: The network address or the socket file to use.%r", print->to, print->set->notable, kt_tacocat_network_or_socket_s, print->set->notable, f_string_eol_s);
fl_print_format(" %[%r%]: The local file to use to read from or to write to.%r%r", print->to, print->set->notable, kt_tacocat_file_s, print->set->notable, f_string_eol_s, f_string_eol_s);
+ fl_print_format(" Specify a question mark '%[?%]' (%[U+003F%]) ", print->to, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
+ fl_print_format("as the receive file name to use the file name provided by the sender.%r%r", print->to, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s);
+
fl_print_format(" A local socket file must begin with an absolute path like '%[/var/www.example.com%]' and ", print->to, context.set.notable, context.set.notable);
fl_print_format("'%[/var/example.socket%]', or it must begin with a relative absolute path, like ", print->to, context.set.notable, context.set.notable);
fl_print_format("'%[./www.example.com%]' and %[./example.socket%].%r%r", print->to, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s);
f_file_stream_lock(print->to);
- fl_print_format("Packet from ", print->to);
+ fl_print_format("%rPacket from ", print->to, f_string_eol_s);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
fl_print_format(" is complete.%r", print->to, f_string_eol_s);
f_file_stream_lock(print->to);
- fl_print_format("Packet from ", print->to);
+ fl_print_format("%rPacket from ", print->to, f_string_eol_s);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
fl_print_format(" is %[%ul%] Bytes.%r", print->to, print->set->notable, set.packet.size, print->set->notable, f_string_eol_s);
fl_print_format("')", print->to);
}
- fl_print_format(".%r", print->to, f_string_eol_s);
+ fl_print_format(f_string_format_sentence_end_s.string, print->to, f_string_eol_s);
f_file_stream_unlock(print->to);
}
#endif // _di_kt_tacocat_print_message_receive_operation_received_
+#ifndef _di_kt_tacocat_print_message_receive_operation_determined_name_
+ f_status_t kt_tacocat_print_message_receive_operation_determined_name(fl_print_t * const print, const kt_tacocat_socket_set_t set) {
+
+ if (!print) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not;
+
+ f_file_stream_lock(print->to);
+
+ fl_print_format("%rDetermined the received file name to be ", print->to, f_string_eol_s);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.as, print->set->notable);
+ fl_print_format(f_string_format_sentence_end_s.string, print->to, f_string_eol_s);
+
+ f_file_stream_unlock(print->to);
+ }
+#endif // _di_kt_tacocat_print_message_receive_operation_determined_name_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t kt_tacocat_print_message_receive_operation_received(fl_print_t * const print, const kt_tacocat_socket_set_t set);
#endif // _di_kt_tacocat_print_message_receive_operation_received_
+/**
+ * Print message about receive operation packet name being determined.
+ *
+ * This prints the name from the set.as string.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * Must not be NULL.
+ *
+ * This does not alter print.custom.setting.state.status.
+ * @param set
+ * The socket set relating to the 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_kt_tacocat_print_message_receive_operation_determined_name_
+ extern f_status_t kt_tacocat_print_message_receive_operation_determined_name(fl_print_t * const print, const kt_tacocat_socket_set_t set);
+#endif // _di_kt_tacocat_print_message_receive_operation_determined_name_
+
#ifdef __cplusplus
} // extern "C"
#endif
// Index 5 is the name.
set->abstruses.array[5].key = f_fss_payload_object_name_s;
set->abstruses.array[5].value.type = f_abstruse_dynamic_e;
- set->abstruses.array[5].value.is.a_dynamic = set->name;
+ set->abstruses.array[5].value.is.a_dynamic = (set->flag & kt_tacocat_socket_step_flag_send_d) && set->as.used ? set->as : set->name;
set->abstruses.array[5].value.is.a_dynamic.size = 0;
// Index 6 is the salt.
set->abstruses.array[8].value.is.a_dynamic = set->time;
set->abstruses.array[8].value.is.a_dynamic.size = 0;
+ // Index 9 is the signature.
+
{
long salt = 0;
set->status = F_status_set_error(F_done);
if (set->step) {
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
if (main->setting.active_receive) {
--main->setting.active_receive;
set->status = F_status_set_error(F_done);
if (set->step) {
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
if (main->setting.active_receive) {
--main->setting.active_receive;
if (!(set->step)) {
kt_tacocat_print_message_receive_operation_received(&main->program.message, *set);
- kt_tacocat_receive_process_initialize(main, set);
+ kt_tacocat_receive_process_reset(main, set);
++main->setting.active_receive;
}
// Keep error bit but set state to done to designate that nothing else is to be done.
set->status = F_status_set_error(F_done);
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
if (main->setting.active_receive) {
--main->setting.active_receive;
// Connection is closed when length is 0.
kt_tacocat_print_warning_on_client_closed(&main->program.warning, kt_tacocat_receive_s, set->network);
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
set->status = F_status_set_error(F_packet_too_small);
return;
}
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
if (set->status == F_packet_too_small || set->packet.size < kt_tacocat_packet_minimum_d) {
set->status = F_status_set_error(F_packet_too_small);
}
#endif // _di_kt_tacocat_receive_process_control_
-#ifndef _di_kt_tacocat_receive_process_initialize_
- void kt_tacocat_receive_process_initialize(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set) {
+#ifndef _di_kt_tacocat_receive_process_reset_
+ void kt_tacocat_receive_process_reset(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set) {
if (!main || !set) return;
set->part = 0;
set->parts.used = 0;
set->step = kt_tacocat_socket_step_receive_control_e;
- set->flag = 0;
}
-#endif // _di_kt_tacocat_receive_process_initialize_
+#endif // _di_kt_tacocat_receive_process_reset_
#ifdef __cplusplus
} // extern "C"
#endif // _di_kt_tacocat_receive_process_control_
/**
- * Process the network socket, performing the initialization step such as when step == 0.
+ * Process the network socket, resetting the data during the initialization step, such as when step == 0.
+ *
+ * This does not and must not alter the socket step flags.
*
* @param main
* The main program and settings data.
*
* This does not alter set.status.
*/
-#ifndef _di_kt_tacocat_receive_process_initialize_
- extern void kt_tacocat_receive_process_initialize(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
-#endif // _di_kt_tacocat_receive_process_initialize_
+#ifndef _di_kt_tacocat_receive_process_reset_
+ extern void kt_tacocat_receive_process_reset(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
+#endif // _di_kt_tacocat_receive_process_reset_
#ifdef __cplusplus
} // extern "C"
f_file_close_id(&set->socket.id_data);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
return;
}
f_file_close_id(&set->socket.id_data);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
return F_complete_not;
}
if (main->setting.flag & kt_tacocat_main_flag_headers_d) {
kt_tacocat_print_message_headers(&main->program.message, *set, F_false);
}
+ else {
+ if (!(set->flag & kt_tacocat_socket_step_flag_send_d) && (set->flag & kt_tacocat_socket_step_flag_keep_d)) {
+ kt_tacocat_print_message_receive_operation_determined_name(&main->program.message, *set);
+ }
+ }
set->status = f_file_close(&set->file);
kt_tacocat_print_warning_on_file(&main->program.warning, F_status_debug_source_d, kt_tacocat_receive_done_s, set->network, set->status, set->name, f_file_operation_close_s);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
set->status = F_okay;
if (main->setting.active_receive) {
if (!main || !set || F_status_is_error(set->status)) return;
- kt_tacocat_packet_extract(main, set, kt_tacocat_receive_s);
+ kt_tacocat_packet_extract(main, set);
if (F_status_is_error(set->status)) return;
set->step = kt_tacocat_socket_step_receive_check_e;
f_file_close_id(&set->socket.id_data);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_receive_none_e;
return F_complete_not;
}
if (!main || !set || F_status_is_error(set->status)) return;
- set->status = f_file_open(set->name, F_file_mode_all_rw_d, &set->file);
+ set->status = f_file_open((set->flag & kt_tacocat_socket_step_flag_keep_d) && set->as.used ? set->as : set->name, F_file_mode_all_rw_d, &set->file);
if (F_status_is_error(set->status)) {
kt_tacocat_print_error_on_file_receive(&main->program.error, F_status_debug_source_d, kt_tacocat_receive_s, set->network, set->status, set->name, f_file_operation_open_s);
if (!main || !set) return F_status_set_error(F_parameter);
if (!set->step) {
- kt_tacocat_send_process_initialize(main, set);
+ kt_tacocat_send_process_reset(main, set);
if (F_status_is_error(set->status)) {
kt_tacocat_print_error_on(&main->program.error, F_status_debug_source_d, kt_tacocat_send_s, set->network, set->status, set->name);
f_file_close(&set->file);
f_socket_disconnect(&set->socket, f_socket_close_fast_e);
- set->step = 0;
+ set->step = kt_tacocat_socket_step_send_none_e;
set->socket.id_data = -1;
// Keep error bit but set state to done to designate that nothing else is to be done.
}
#endif // _di_kt_tacocat_send_process_
-#ifndef _di_kt_tacocat_send_process_initialize_
- void kt_tacocat_send_process_initialize(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set) {
+#ifndef _di_kt_tacocat_send_process_reset_
+ void kt_tacocat_send_process_reset(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set) {
if (!main || !set) return;
set->part = 0;
set->parts.used = 0;
set->port = 0;
- set->flag = 0;
// For writes, the id_data is the same as the id.
set->socket.id_data = set->socket.id;
set->status = F_okay;
}
}
-#endif // _di_kt_tacocat_send_process_initialize_
+#endif // _di_kt_tacocat_send_process_reset_
#ifndef _di_kt_tacocat_send_process_time_now_
void kt_tacocat_send_process_time_now(kt_tacocat_socket_set_t * const set) {
* F_parameter (with error bit) on invalid parameter.
*
* @see f_socket_read_stream()
- * @see kt_tacocat_send_process_initialize()
+ * @see kt_tacocat_send_process_reset()
*/
#ifndef _di_kt_tacocat_send_process_
extern f_status_t kt_tacocat_send_process(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
#endif // _di_kt_tacocat_send_process_
/**
- * Process the network socket, performing the initialization step such as when step == 0.
+ * Process the network socket, resetting the data during the initialization step, such as when step == 0.
+ *
+ * This does not and must not alter the socket step flags.
*
* @param main
* The main program and settings data.
* @see kt_tacocat_process_abstruse_initialize()
* @see kt_tacocat_send_process_time_now()
*/
-#ifndef _di_kt_tacocat_send_process_initialize_
- extern void kt_tacocat_send_process_initialize(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
-#endif // _di_kt_tacocat_send_process_initialize_
+#ifndef _di_kt_tacocat_send_process_reset_
+ extern void kt_tacocat_send_process_reset(kt_tacocat_main_t * const main, kt_tacocat_socket_set_t * const set);
+#endif // _di_kt_tacocat_send_process_reset_
/**
* Build a string containing the current time.
kt_tacocat_print_warning_on_file(&main->program.warning, F_status_debug_source_d, kt_tacocat_send_done_s, set->network, set->status, set->name, f_file_operation_close_s);
}
- set->step = 0;
+ set->step = kt_tacocat_socket_step_send_none_e;
set->socket.id_data = -1;
set->status = F_okay;
}
f_file_close(&set->file);
f_socket_disconnect(&set->socket, f_socket_close_fast_e);
- set->step = 0;
+ set->step = kt_tacocat_socket_step_send_none_e;
set->socket.id_data = -1;
// Keep error bit but set state to done to designate that nothing else is to be done.