]> git.scottworley.com Git - tattlekey/blobdiff - client/net.c
client: Change wire format!: Expand `ago` field: 16 bits → 32 bits
[tattlekey] / client / net.c
index b38d0a838c15ec451d749c7984a6f63a5106ae54..1e0790e3e60a811522b5c9ecac3672bdb3fa00ad 100644 (file)
@@ -1,3 +1,20 @@
+/* tattlekey: A one-key UDP keyboard
+ * Copyright (C) 2023  Scott Worley <scottworley@scottworley.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
 #include "net.h"
 #include "blink.h"
 #include "config.h"
@@ -30,10 +47,10 @@ static void initialize_the_pcb() {
 struct tattle_message_wire_format {
   u16_t sender;
   u16_t seq;
-  u16_t ago;
+  u32_t ago;
 };
 
-void send_report_packet(u16_t seq, u16_t ago) {
+void send_report_packet(u16_t seq, u32_t ago) {
   cyw43_arch_lwip_begin();
 
   initialize_the_pcb();
@@ -47,7 +64,7 @@ void send_report_packet(u16_t seq, u16_t ago) {
       (struct tattle_message_wire_format *)(p->payload);
   msg->sender = htons(config_this_tattler_identity);
   msg->seq = htons(seq);
-  msg->ago = htons(ago);
+  msg->ago = htonl(ago);
 
   if (udp_send(the_pcb, p) != ERR_OK)
     signal_error_by_blinking();