1 #ifndef __TCP_SEND_BUFFER_H_
2 #define __TCP_SEND_BUFFER_H_
3 
4 #include <stdlib.h>
5 #include <stdint.h>
6 
7 /*----------------------------------------------------------------------------*/
8 typedef struct sb_manager* sb_manager_t;
9 /*----------------------------------------------------------------------------*/
10 struct tcp_send_buffer
11 {
12 	unsigned char *data;
13 	unsigned char *head;
14 
15 	uint32_t head_off;
16 	uint32_t tail_off;
17 	uint32_t len;
18 	uint64_t cum_len;
19 	uint32_t size;
20 
21 	uint32_t head_seq;
22 	uint32_t init_seq;
23 };
24 /*----------------------------------------------------------------------------*/
25 uint32_t
26 SBGetCurnum(sb_manager_t sbm);
27 /*----------------------------------------------------------------------------*/
28 sb_manager_t
29 SBManagerCreate(size_t chunk_size, uint8_t disable_rings, uint32_t concurrency);
30 /*----------------------------------------------------------------------------*/
31 struct tcp_send_buffer *
32 SBInit(sb_manager_t sbm, uint32_t init_seq);
33 /*----------------------------------------------------------------------------*/
34 void
35 SBFree(sb_manager_t sbm, struct tcp_send_buffer *buf);
36 /*----------------------------------------------------------------------------*/
37 size_t
38 SBPut(sb_manager_t sbm, struct tcp_send_buffer *buf, const void *data, size_t len);
39 /*----------------------------------------------------------------------------*/
40 size_t
41 SBRemove(sb_manager_t sbm, struct tcp_send_buffer *buf, size_t len);
42 /*----------------------------------------------------------------------------*/
43 
44 #endif /* __TCP_SEND_BUFFER_H_ */
45