summaryrefslogtreecommitdiff
path: root/src/proto.h.orig
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2024-01-28 09:01:22 +0100
committerJesper Jensen <jesper@jnsn.dev>2025-04-12 10:21:20 +0200
commitcd622b745254baafa21adf4b1b724e079652321a (patch)
treeb1faf03808a5f8729cf8a69f971c00cb9d662683 /src/proto.h.orig
parent47d4780eb448f839fc6b0644135395f879080ba4 (diff)
I don't know
Diffstat (limited to 'src/proto.h.orig')
-rw-r--r--src/proto.h.orig78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/proto.h.orig b/src/proto.h.orig
deleted file mode 100644
index ce2a713..0000000
--- a/src/proto.h.orig
+++ /dev/null
@@ -1,78 +0,0 @@
-#pragma once
-
-#include "routing.h"
-#include <sys/socket.h>
-#include <arpa/inet.h>
-
-// 192.0.2.0
-#define UNDEF_ADDR (struct in_addr){0xC0000200}
-#define MAX_DISC 32
-#define MAX_INFLIGHT 32
-
-#define PROTO_UNCTM 60
-#define PROTO_TMOUT 5
-
-struct ping {
- struct nodeid remote_id;
- int attempt;
- bool is_new;
-};
-
-union message_cont {
- struct ping ping;
-};
-
-struct dht;
-struct msgbuff;
-
-#define PROCESS_REPONSE(NAME) int (NAME)(struct dht* dht, time_t now, union message_cont* cont, char* packet, size_t packet_len, int socket, struct sockaddr* remote, socklen_t remote_len, struct msgbuff* msgbuff)
-typedef PROCESS_REPONSE(resp);
-
-#define PROCESS_TIMEOUT(NAME) int (NAME)(struct dht* dht, struct nodeid* self, time_t now, union message_cont* cont, struct msgbuff* msgbuff)
-typedef PROCESS_TIMEOUT(tmout);
-
-struct dht {
- struct nodeid self;
- int sfd;
-
- bool pause;
-
- bool reqalloc[MAX_INFLIGHT];
- struct {
- struct sockaddr_storage addr;
- socklen_t addr_len;
- resp* fun;
- time_t timeout;
- tmout* timeout_fun;
- union message_cont cont;
- } requestdata[MAX_INFLIGHT];
-};
-
-// @HACK: This isn't true anymore
-// The longest message we can send is probably a response to find_node which
-// consists of:
-// d1:t <-- 4 bytes
-// <tid length> <-- 2 bytes
-// : <-- 1 byte
-// <tid> <-- 16 bytes*
-// 1:y1:r1:r <-- 9 bytes
-// d2:id20: <-- 8 bytes
-// <our nodeid> <-- 20 bytes
-// 5:nodes208: <-- 11 bytes
-// <payload> <-- 208 bytes
-// ee <-- 2 bytes
-// TOTAL 281 bytes
-struct message {
-<<<<<<< HEAD
- char payload[1024];
-=======
- char payload[281];
->>>>>>> 685b13e (I don't remember)
- size_t payload_len;
- struct sockaddr_storage dest;
- socklen_t dest_len;
-};
-
-void proto_begin(struct dht* dht, time_t now, struct message** output, const struct message* const output_end);
-int proto_run(struct dht* dht, char* buffer, size_t buffer_len, struct sockaddr_in* remote, socklen_t remote_len, time_t now, struct message** output, const struct message* const output_end);
-void proto_end(struct dht* dht);