]> git.meshlink.io Git - utcp/blobdiff - utcp_priv.h
Turn magic numbers into #defines.
[utcp] / utcp_priv.h
index d73d664d51e9981c82150e7766a98de0dd76fed9..3a119f16cf60a878e327e0b9ebe49efe3aff2f62 100644 (file)
 #define FIN 4
 #define RST 8
 
+#define NSACKS 4
 #define DEFAULT_SNDBUFSIZE 4096
 #define DEFAULT_MAXSNDBUFSIZE 131072
+#define DEFAULT_RCVBUFSIZE 0
+#define DEFAULT_MAXRCVBUFSIZE 131072
+
+#define DEFAULT_MTU 1000
+
+#define DEFAULT_USER_TIMEOUT 60 // s
 
 struct hdr {
        uint16_t src; // Source port
@@ -71,6 +78,18 @@ static const char *strstate[] __attribute__((unused)) = {
        [TIME_WAIT] = "TIME_WAIT"
 };
 
+struct buffer {
+       char *data;
+       uint32_t used;
+       uint32_t size;
+       uint32_t maxsize;
+};
+
+struct sack {
+       uint32_t offset;
+       uint32_t len;
+};
+
 struct utcp_connection {
        void *priv;
        struct utcp *utcp;
@@ -111,11 +130,11 @@ struct utcp_connection {
        struct timeval conn_timeout;
        struct timeval rtrx_timeout;
 
-       // Send buffer
+       // Buffers
 
-       char *sndbuf;
-       uint32_t sndbufsize;
-       uint32_t maxsndbufsize;
+       struct buffer sndbuf;
+       struct buffer rcvbuf;
+       struct sack sacks[NSACKS];
 
        // Per-socket options