mirror of
https://github.com/skywind3000/kcp.git
synced 2026-08-19 06:03:28 +08:00
pluggable congestion control stage1
This commit is contained in:
37
ikcp.h
37
ikcp.h
@@ -9,8 +9,8 @@
|
|||||||
// + Lightweight, distributed as a single source file.
|
// + Lightweight, distributed as a single source file.
|
||||||
//
|
//
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
#ifndef __IKCP_H__
|
#ifndef _IKCP_H_
|
||||||
#define __IKCP_H__
|
#define _IKCP_H_
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -261,6 +261,13 @@ typedef struct IQUEUEHEAD iqueue_head;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
// Predefine struct
|
||||||
|
//=====================================================================
|
||||||
|
struct IKCPCB;
|
||||||
|
typedef struct IKCPCB ikcpcb;
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
// SEGMENT
|
// SEGMENT
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@@ -283,6 +290,30 @@ struct IKCPSEG
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// IKCPOPS - pluggable congestion control operations
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
struct IKCPOPS
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
int (*init)(ikcpcb *kcp);
|
||||||
|
void (*release)(ikcpcb *kcp);
|
||||||
|
void (*on_ack)(ikcpcb *kcp, IUINT32 acked_segs, IUINT32 prior_in_flight);
|
||||||
|
void (*on_fast_retransmit)(ikcpcb *kcp, IUINT32 fast_retrans,
|
||||||
|
IUINT32 inflight, IUINT32 prior_cwnd);
|
||||||
|
void (*on_timeout)(ikcpcb *kcp, IUINT32 prior_cwnd);
|
||||||
|
void (*on_tick)(ikcpcb *kcp);
|
||||||
|
void (*on_app_limited)(ikcpcb *kcp, IUINT32 inflight);
|
||||||
|
void (*on_rtt)(ikcpcb *kcp, IINT32 rtt);
|
||||||
|
void (*on_pkt_sent)(ikcpcb *kcp, IUINT32 sn, IUINT32 ts,
|
||||||
|
IUINT32 len, IUINT32 inflight);
|
||||||
|
void (*on_pkt_acked)(ikcpcb, IUINT32 sn, IUINT32 ts,
|
||||||
|
IUINT32 len, IINT32 rtt, IUINT32 xmit);
|
||||||
|
IUINT32 (*get_info)(ikcpcb *kcp, void *buf, IUINT32 bufsize);
|
||||||
|
IUINT32 (*pacing_rate)(ikcpcb *kcp);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// IKCPCB
|
// IKCPCB
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@@ -317,8 +348,6 @@ struct IKCPCB
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct IKCPCB ikcpcb;
|
|
||||||
|
|
||||||
#define IKCP_LOG_OUTPUT 1
|
#define IKCP_LOG_OUTPUT 1
|
||||||
#define IKCP_LOG_INPUT 2
|
#define IKCP_LOG_INPUT 2
|
||||||
#define IKCP_LOG_SEND 4
|
#define IKCP_LOG_SEND 4
|
||||||
|
|||||||
Reference in New Issue
Block a user