summaryrefslogtreecommitdiff
path: root/code/core/rbuf.h
blob: 9cf643db91cbe2f6faaa47859f305cc67811f33d (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    -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);