]> Kevux Git Server - kevux-tools/commitdiff
Update: Add the basic structure for an order header. development
authorKevin Day <Kevin@kevux.org>
Sun, 22 Feb 2026 20:35:12 +0000 (14:35 -0600)
committerKevin Day <Kevin@kevux.org>
Sun, 22 Feb 2026 20:38:13 +0000 (14:38 -0600)
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
sources/c/program/kevux/tools/tacocat/main/common/string.c
sources/c/program/kevux/tools/tacocat/main/common/string.h
sources/c/program/kevux/tools/tacocat/main/common/type.h
sources/c/program/kevux/tools/tacocat/main/packet.c
sources/c/program/kevux/tools/tacocat/main/process.c
sources/c/program/kevux/tools/tacocat/main/receive.c
sources/c/program/kevux/tools/tacocat/main/send.c
sources/c/program/kevux/tools/tacocat/main/send/step/packet.c
sources/c/program/kevux/tools/tacocat/main/send/step/size.c

index a98e064dd60b2c5bfaff2b3987a6b2a88d01c722..f7177a30b7922d318bd46211d415707b93f15096 100644 (file)
@@ -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
index 196d1305a095e24551b45ea579b112ff65a25da8..655614f3ea608c5ba957e7a7abaa2478809d79f3 100644 (file)
@@ -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);
index d81a32dd2ba698d8d270ca9cc2b0eb48c5ec3098..caaf3f41247a3aa5f1cefecfdd68b066fc607d37 100644 (file)
@@ -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;
index 460db2a344fbc5a1327b0090be91785d2a2d90f8..1daf4a78aa973864d444cfc47e8f45e6f54adb3a 100644 (file)
@@ -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, \
index aeb4fa215dff2c6364c261becd55d1b33bdb45fc..0c7a1ca26253f5cc9b937b92d3854772f4de46d7 100644 (file)
@@ -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_
index 301b4b928df048377dbd42a38bd1e2e50982139a..89726930d12aedf9da68147d561e47971491da97 100644 (file)
@@ -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;
index 4ac9e3539faf81ed74f56d4e313274f96f49b7d0..de64789ddec29ca2a30e536e6a267c122b2e2585 100644 (file)
@@ -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;
index a45d9d81c5f0ca99023062472c9ab6bfbf80a8f7..be6edd57a3d8121ed1723cc7c1262de1a351077d 100644 (file)
@@ -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;
index 3b5a97366ca94a139c27a9a6af8a832803befd51..7e6f866e6eaf178985003c9bd92cf1f1d497ee7e 100644 (file)
@@ -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;
index 6479131a3108b621877e2369d6df1d953b4a22c4..9cfec371777f701a109f7388b2cfbefd884a5ed3 100644 (file)
@@ -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_