summaryrefslogtreecommitdiff
path: root/src/proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/proto.h')
-rw-r--r--src/proto.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/proto.h b/src/proto.h
index 1bdc05d..0ce887e 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -26,7 +26,7 @@ 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(cont);
+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);
@@ -41,15 +41,29 @@ struct dht {
struct {
struct sockaddr_storage addr;
socklen_t addr_len;
- cont* fun;
+ 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 {
- char payload[1024];
+ char payload[281];
size_t payload_len;
struct sockaddr_storage dest;
socklen_t dest_len;