| 1 |
#ifndef HV_KCP_H_ |
| 2 |
#define HV_KCP_H_ |
| 3 |
|
| 4 |
#include "hloop.h" |
| 5 |
|
| 6 |
#if WITH_KCP |
| 7 |
|
| 8 |
#include "ikcp.h" |
| 9 |
#include "hbuf.h" |
| 10 |
|
| 11 |
#define DEFAULT_KCP_UPDATE_INTERVAL 10 // ms |
| 12 |
#define DEFAULT_KCP_READ_BUFSIZE 1400 |
| 13 |
|
| 14 |
typedef struct kcp_s { |
| 15 |
ikcpcb* ikcp; |
| 16 |
uint32_t conv; |
| 17 |
htimer_t* update_timer; |
| 18 |
hbuf_t readbuf; |
| 19 |
} kcp_t; |
| 20 |
|
| 21 |
|
| 22 |
void kcp_release(kcp_t* kcp); |
| 23 |
|
| 24 |
kcp_t* hio_get_kcp (hio_t* io, uint32_t conv); |
| 25 |
int hio_read_kcp (hio_t* io, void* buf, int readbytes); |
| 26 |
int hio_write_kcp(hio_t* io, const void* buf, size_t len); |
| 27 |
|
| 28 |
#endif |
| 29 |
|
| 30 |
#endif |