summaryrefslogtreecommitdiff
path: root/code/core/rbuf.h
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-07-17 22:17:51 +0200
committerUros Majstorovic <majstor@majstor.org>2017-07-17 22:17:51 +0200
commit8f53a56d06b128406cba3ce6f13696eb823e6a11 (patch)
treea6046e39346dc65d1901fecda480195e214d9870 /code/core/rbuf.h
parent37f628a88d800123dbad003b122322e8181c3baa (diff)
ring buffer initial commit
Diffstat (limited to 'code/core/rbuf.h')
-rw-r--r--code/core/rbuf.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/code/core/rbuf.h b/code/core/rbuf.h
new file mode 100644
index 0000000..9cf643d
--- /dev/null
+++ b/code/core/rbuf.h
@@ -0,0 +1,34 @@
+#define ECP_ERR_RBUF_IDX -1
+#define ECP_ERR_RBUF_DUP -1
+
+#define ECP_MAX_RBUF_MSGR 256
+
+typedef uint32_t ecp_ack_t;
+
+typedef struct ECPRBMessage {
+ unsigned char msg[ECP_MAX_MSG];
+ ssize_t size;
+ char present;
+} ECPRBMessage;
+
+typedef struct ECPRBuffer {
+ unsigned char reliable;
+ unsigned char deliver_delay;
+ unsigned char hole_max;
+ int msg_start;
+ ecp_seq_t seq_ack;
+ ecp_seq_t seq_max;
+ ecp_seq_t seq_start;
+ ecp_ack_t ack_map;
+ ecp_ack_t hole_mask_full;
+ ecp_ack_t hole_mask_empty;
+ ECPRBMessage msg[ECP_MAX_RBUF_MSGR];
+} ECPRBuffer;
+
+
+typedef struct ECPConnRBuffer {
+ ECPRBuffer *recv;
+ // ECPSBuffer *send;
+} ECPConnRBuffer;
+
+ssize_t ecp_rbuf_recv_store(struct ECPConnection *conn, ecp_seq_t seq, unsigned char *msg, size_t msg_size); \ No newline at end of file