From b1a9b43e81aea94b7801ec55144f424cf19ad150 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 22 Feb 2026 14:35:12 -0600 Subject: [PATCH] Update: Add the basic structure for an order header. An order header helps achieve something like serialization. This is different from the packet number. The order represets the order in regards to the packets sent and not the specific data (such as `part`). For example, if a retry is requested for the same packet, then the order will have increased but the actual `part` number would be the same. --- sources/c/program/kevux/tools/tacocat/main/common/define.h | 2 +- sources/c/program/kevux/tools/tacocat/main/common/string.c | 1 + sources/c/program/kevux/tools/tacocat/main/common/string.h | 3 +++ sources/c/program/kevux/tools/tacocat/main/common/type.h | 5 +++++ sources/c/program/kevux/tools/tacocat/main/packet.c | 10 +++++----- sources/c/program/kevux/tools/tacocat/main/process.c | 7 ++++++- sources/c/program/kevux/tools/tacocat/main/receive.c | 1 + sources/c/program/kevux/tools/tacocat/main/send.c | 1 + sources/c/program/kevux/tools/tacocat/main/send/step/packet.c | 1 + sources/c/program/kevux/tools/tacocat/main/send/step/size.c | 2 ++ 10 files changed, 26 insertions(+), 7 deletions(-) diff --git a/sources/c/program/kevux/tools/tacocat/main/common/define.h b/sources/c/program/kevux/tools/tacocat/main/common/define.h index a98e064..f7177a3 100644 --- a/sources/c/program/kevux/tools/tacocat/main/common/define.h +++ b/sources/c/program/kevux/tools/tacocat/main/common/define.h @@ -72,7 +72,7 @@ extern "C" { #define kt_tacocat_max_buffer_d 0x10000000 // 0x10^0x5 * 0x100 (Which is 256 Megabytes (0x10^0x5 where the base unit is 16 rather than 10 or 2 (maybe call this xytes? Megaxytes?)). #define kt_tacocat_max_maintain_d 0x100000 // 0x10^5 (Which is 1 Megabyte in base 16 (1 Megaxyte (MX)). - #define kt_tacocat_packet_headers_d 0xb + #define kt_tacocat_packet_headers_d 0xc #define kt_tacocat_packet_id_length_d 0x20 #define kt_tacocat_packet_minimum_d 0x11 #define kt_tacocat_packet_peek_d 0x40 diff --git a/sources/c/program/kevux/tools/tacocat/main/common/string.c b/sources/c/program/kevux/tools/tacocat/main/common/string.c index 196d130..655614f 100644 --- a/sources/c/program/kevux/tools/tacocat/main/common/string.c +++ b/sources/c/program/kevux/tools/tacocat/main/common/string.c @@ -24,6 +24,7 @@ extern "C" { const f_string_static_t kt_tacocat_network_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_network_s, KT_TACOCAT_network_s_length); const f_string_static_t kt_tacocat_network_or_socket_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_network_or_socket_s, KT_TACOCAT_network_or_socket_s_length); const f_string_static_t kt_tacocat_next_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_next_s, KT_TACOCAT_next_s_length); + const f_string_static_t kt_tacocat_order_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_order_s, KT_TACOCAT_order_s_length); const f_string_static_t kt_tacocat_receive_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_receive_s, KT_TACOCAT_receive_s_length); const f_string_static_t kt_tacocat_receive_done_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_receive_done_s, KT_TACOCAT_receive_done_s_length); const f_string_static_t kt_tacocat_resend_s = macro_f_string_static_t_initialize_3(KT_TACOCAT_resend_s, KT_TACOCAT_resend_s_length); diff --git a/sources/c/program/kevux/tools/tacocat/main/common/string.h b/sources/c/program/kevux/tools/tacocat/main/common/string.h index d81a32d..caaf3f4 100644 --- a/sources/c/program/kevux/tools/tacocat/main/common/string.h +++ b/sources/c/program/kevux/tools/tacocat/main/common/string.h @@ -77,6 +77,7 @@ extern "C" { #define KT_TACOCAT_network_s "network" #define KT_TACOCAT_network_or_socket_s "network / socket" #define KT_TACOCAT_next_s "next" + #define KT_TACOCAT_order_s "order" #define KT_TACOCAT_receive_s "receive" #define KT_TACOCAT_receive_done_s "receive done" #define KT_TACOCAT_resend_s "resend" @@ -106,6 +107,7 @@ extern "C" { #define KT_TACOCAT_network_s_length 7 #define KT_TACOCAT_network_or_socket_s_length 17 #define KT_TACOCAT_next_s_length 4 + #define KT_TACOCAT_order_s_length 5 #define KT_TACOCAT_receive_s_length 7 #define KT_TACOCAT_receive_done_s_length 12 #define KT_TACOCAT_resend_s_length 6 @@ -135,6 +137,7 @@ extern "C" { extern const f_string_static_t kt_tacocat_network_s; extern const f_string_static_t kt_tacocat_network_or_socket_s; extern const f_string_static_t kt_tacocat_next_s; + extern const f_string_static_t kt_tacocat_order_s; extern const f_string_static_t kt_tacocat_receive_s; extern const f_string_static_t kt_tacocat_receive_done_s; extern const f_string_static_t kt_tacocat_resend_s; diff --git a/sources/c/program/kevux/tools/tacocat/main/common/type.h b/sources/c/program/kevux/tools/tacocat/main/common/type.h index 460db2a..1daf4a7 100644 --- a/sources/c/program/kevux/tools/tacocat/main/common/type.h +++ b/sources/c/program/kevux/tools/tacocat/main/common/type.h @@ -34,6 +34,7 @@ extern "C" { * - flag: A set of flags. * - 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. + * - order: An integer whose count increase on each packet (used for things like serialization and packet ordering). * - part: The current active part number. * - port: The current port number for the socket. * @@ -89,6 +90,7 @@ extern "C" { uint16_t flag; uint16_t step; uint16_t retry; + uint64_t order; f_number_unsigned_t part; f_number_unsigned_t port; @@ -148,6 +150,7 @@ extern "C" { .flag = kt_tacocat_socket_step_flag_none_d, \ .step = kt_tacocat_socket_step_receive_none_e, \ .retry = 0, \ + .order = 0, \ .part = 0, \ .port = 0, \ .file = f_file_t_initialize, \ @@ -197,6 +200,7 @@ extern "C" { .flag = kt_tacocat_socket_step_flag_none_d, \ .step = kt_tacocat_socket_step_receive_none_e, \ .retry = 0, \ + .order = 0, \ .part = 0, \ .port = 0, \ .file = f_file_t_initialize, \ @@ -246,6 +250,7 @@ extern "C" { .flag = kt_tacocat_socket_step_flag_none_d, \ .step = kt_tacocat_socket_step_receive_none_e, \ .retry = 0, \ + .order = 0, \ .part = 0, \ .port = 0, \ .file = f_file_t_initialize, \ diff --git a/sources/c/program/kevux/tools/tacocat/main/packet.c b/sources/c/program/kevux/tools/tacocat/main/packet.c index aeb4fa2..0c7a1ca 100644 --- a/sources/c/program/kevux/tools/tacocat/main/packet.c +++ b/sources/c/program/kevux/tools/tacocat/main/packet.c @@ -120,6 +120,7 @@ extern "C" { f_range_t_initialize, f_range_t_initialize, f_range_t_initialize, + f_range_t_initialize, }; f_status_t status = set->status = F_okay; @@ -139,6 +140,7 @@ extern "C" { f_fss_payload_object_time_s, f_fss_payload_object_signature_s, kt_tacocat_encrypt_s, + kt_tacocat_order_s, }; for (; i < set->objects_header.used; ++i) { @@ -334,13 +336,13 @@ extern "C" { // @todo convert encrypt (10). - // Convert the length (2), part (3), total (4), and salt (6). + // Convert the length (2), part (3), total (4), salt (6), and order (11). { f_number_unsigned_t number = 0; - for (i = 2; i < 7; ++i) { + for (i = 2; i < 12; ++i) { - if (!set->abstruses.array[i].value.type || i == 5) continue; + if (!set->abstruses.array[i].value.type || i == 5 || (i > 6 && i < 11)) continue; status = fl_conversion_dynamic_partial_to_unsigned(fl_conversion_data_base_10_c, set->buffer, ranges[i], &number); @@ -361,8 +363,6 @@ extern "C" { } // for } - // @todo index 9 is the signature. - set->abstruses.used = kt_tacocat_packet_headers_d; } #endif // _di_kt_tacocat_packet_extract_header_ diff --git a/sources/c/program/kevux/tools/tacocat/main/process.c b/sources/c/program/kevux/tools/tacocat/main/process.c index 301b4b9..8972693 100644 --- a/sources/c/program/kevux/tools/tacocat/main/process.c +++ b/sources/c/program/kevux/tools/tacocat/main/process.c @@ -19,7 +19,7 @@ extern "C" { #endif // _en_gpgme_support_ #ifdef _di_thread_support_ - // @todo implement fork and wait for both receive and send. + // Not supported at this time. #else { if (main->setting.flag & kt_tacocat_main_flag_receive_d) { @@ -130,6 +130,11 @@ extern "C" { set->abstruses.array[10].value.is.a_dynamic = f_string_empty_s; set->abstruses.array[10].value.is.a_dynamic.size = 0; + // Index 11 is the order. + set->abstruses.array[11].key = kt_tacocat_order_s; + set->abstruses.array[11].value.type = f_abstruse_unsigned_e; + set->abstruses.array[11].value.is.a_unsigned = 0; + if ((main->setting.flag & kt_tacocat_main_flag_encrypt_d) && (set->flag & kt_tacocat_socket_step_flag_send_d)) { #ifdef _en_gpgme_support_ set->abstruses.array[10].value.is.a_dynamic = kt_tacocat_gpgme_s; diff --git a/sources/c/program/kevux/tools/tacocat/main/receive.c b/sources/c/program/kevux/tools/tacocat/main/receive.c index 4ac9e35..de64789 100644 --- a/sources/c/program/kevux/tools/tacocat/main/receive.c +++ b/sources/c/program/kevux/tools/tacocat/main/receive.c @@ -291,6 +291,7 @@ extern "C" { set->objects_delimits.used = 0; set->contents_delimits.used = 0; set->comments.used = 0; + set->order = 0; set->retry = 0; set->size_done = 0; set->size_total = 0; diff --git a/sources/c/program/kevux/tools/tacocat/main/send.c b/sources/c/program/kevux/tools/tacocat/main/send.c index a45d9d8..be6edd5 100644 --- a/sources/c/program/kevux/tools/tacocat/main/send.c +++ b/sources/c/program/kevux/tools/tacocat/main/send.c @@ -182,6 +182,7 @@ extern "C" { set->objects_delimits.used = 0; set->contents_delimits.used = 0; set->comments.used = 0; + set->order = 0; set->retry = 0; set->size_done = 0; set->size_total = 0; diff --git a/sources/c/program/kevux/tools/tacocat/main/send/step/packet.c b/sources/c/program/kevux/tools/tacocat/main/send/step/packet.c index 3b5a973..7e6f866 100644 --- a/sources/c/program/kevux/tools/tacocat/main/send/step/packet.c +++ b/sources/c/program/kevux/tools/tacocat/main/send/step/packet.c @@ -27,6 +27,7 @@ extern "C" { // @todo handle case when written < set->buffer.used, of which each pass. The entire buffer must be sent. May need another variable for say, set->size_process. + set->order++; set->size_done += written; set->step = kt_tacocat_socket_step_send_wait_e; set->status = F_okay; diff --git a/sources/c/program/kevux/tools/tacocat/main/send/step/size.c b/sources/c/program/kevux/tools/tacocat/main/send/step/size.c index 6479131..9cfec37 100644 --- a/sources/c/program/kevux/tools/tacocat/main/send/step/size.c +++ b/sources/c/program/kevux/tools/tacocat/main/send/step/size.c @@ -88,6 +88,8 @@ extern "C" { return; } + set->abstruses.array[11].value.is.a_unsigned = set->order; + set->step = kt_tacocat_socket_step_send_build_e; } #endif // _di_kt_tacocat_send_step_size_ -- 1.8.3.1