server/peer.c, etc.: Introduce who-goes-there protocol.
[tripe] / server / tripe.h
index a304e3e..6c5c827 100644 (file)
 
 #define T_WOBBLE (1.0/3.0)             /* Relative timer randomness */
 
+#define T_WGT 5                                /* Age for who-goes-there */
+
 /* --- Other things --- */
 
 #define PKBUFSZ 65536
@@ -678,6 +680,13 @@ typedef struct peer {
   stats st;                            /* Statistics */
   keyexch kx;                          /* Key exchange protocol block */
   sel_timer tka;                       /* Timer for keepalives */
+#define NWGT 16
+  struct {
+    octet msg[WGTLEN];                 /* Message prefix */
+    unsigned sz;                       /* Length of prefix */
+    time_t when;                       /* Time it was transmitted */
+  } wgt[NWGT];                         /* Recently sent messages */
+  unsigned wgtix;                      /* Next index to transmit */
 } peer;
 
 typedef struct peer_iter { sym_iter i; } peer_iter;
@@ -1587,6 +1596,7 @@ extern int p_txaddr(const addr */*a*/, const void */*p*/, size_t /*sz*/);
  * Use:                Sends a packet to the peer.
  */
 
+#define TXF_WGT 1u                     /* Include in who-goes-there table */
 extern void p_txend(peer */*p*/, unsigned /*f*/);
 
 /* --- @p_pingsend@ --- *