summaryrefslogtreecommitdiff
path: root/code/core/rbuf.h
blob: 7804602d6f3afa89465022e0717aa85c1413a7e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define ECP_ERR_RBUF_IDX    -100
#define ECP_ERR_RBUF_DUP    -101

#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 ECPRBRecvBuffer {
    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];
} ECPRBRecvBuffer;


typedef struct ECPConnRBuffer {
    ECPRBRecvBuffer *recv;
    // ECPSBuffer *send;
} ECPConnRBuffer;

ssize_t ecp_rbuf_recv_store(struct ECPConnection *conn, ecp_seq_t seq, unsigned char *msg, size_t msg_size);