the kcp block definition is different from the c path
zzsczz opened this issue · 0 comments
I use c2pas to translate the c version of kcp implemention
` PInt8 = ^Int8;
PInt16 = ^Int16;
PInt32 = ^Int32;
PInt64 = ^Int64;
PUInt8 = ^UInt8;
PUInt16 = ^UInt16;
PUInt32 = ^UInt32;
PUInt64 = ^UInt64;
Int8_t = Array[0..$effffff] Of Int8;
Int16_t = Array[0..$effffff] Of Int16;
Int32_t = Array[0..$effffff] Of Int32;
Int64_t = Array[0..$ffffffe] Of Int64;
UInt8_t = Array[0..$effffff] Of UInt8;
UInt16_t = Array[0..$effffff] Of UInt16;
UInt32_t = Array[0..$effffff] Of UInt32;
UInt64_t = Array[0..$ffffffe] Of UInt64;
Int8_p = ^Int8_t;
Int16_p = ^Int16_t;
Int32_p = ^Int32_t;
Int64_p = ^Int64_t;
UInt8_p = ^UInt8_t;
UInt16_p = ^UInt16_t;
UInt32_p = ^UInt32_t;
UInt64_p = ^UInt64_t;
PIntPtr = ^IntPtr;
PUIntPtr = ^UIntPtr;
IntPtr_t = Array[0..$ffffffe] Of IntPtr;
UIntPtr_t = Array[0..$ffffffe] Of UIntPtr;
IntPtr_p = ^IntPtr_t;
UIntPtr_p = ^UIntPtr_t;
SIZE_T = UIntPtr;
SIZE_P = ^UIntPtr;
type
Float4 = Single;
PFloat4 = ^Float4;
Float4_t = Array[0..$effffff] Of Float4;
Float4_p = ^Float4_t;
Float8 = Double;
PFloat8 = ^Float8;
Float8_t = Array[0..$ffffffe] Of Float8;
Float8_p = ^Float8_t;
{ IKCPSEG }
PKcpSeg = ^TKcpSeg;
TKcpSeg = record
// KCP SEGMENT QUEUE
next: PKcpSeg;
prev: PKcpSeg;
// KCP SEGMENT QUEUE END
conv: UInt32;
cmd: UInt32;
frg: UInt32;
wnd: UInt32;
ts: UInt32;
sn: UInt32;
una: UInt32;
len: UInt32;
resendts: UInt32;
rto: UInt32;
fastack: UInt32;
xmit: UInt32;
data: UInt8;
end;
{ IKCPCB }
Type
PLongint = ^Longint;
PSmallInt = ^SmallInt;
PByte = ^Byte;
PWord = ^Word;
PDWord = ^DWord;
PDouble = ^Double;
IINT16 = smallint;
IINT64 = int64;
IINT8 = char;
IUINT16= word;
IUINT64= qword;
IUINT8 = byte;
Type
Pchar = ^char;
PIINT16 = ^IINT16;
PIINT32 = ^IINT32;
PIINT64 = ^IINT64;
PIINT8 = ^IINT8;
PIKCPCB = ^IKCPCB;
PIQUEUEHEAD = ^IQUEUEHEAD;
PISTDINT32 = ^ISTDINT32;
PISTDUINT32 = ^ISTDUINT32;
PIUINT16 = ^IUINT16;
PIUINT32 = ^IUINT32;
PIUINT64 = ^IUINT64;
PIUINT8 = ^IUINT8;
//PIUINT32 = ^IUINT32;
ISTDUINT32 = UInt32;
SInt32 = Int32;
IUINT32 = ISTDUINT32;
ISTDINT32 = SInt32;
IINT32 = ISTDINT32;
//PIQUEUEHEAD = ^IQUEUEHEAD;
IQUEUEHEAD = record
next : PIQUEUEHEAD;
prev : PIQUEUEHEAD;
end;
IKCPCB = record
rdc_check_ts : IUINT32;
rdc_check_interval : IUINT32;
rdc_rtt_limit : IINT32;
is_rdc_on : IINT32;
rdc_close_try_times : IINT32;
rdc_close_try_threshold : IINT32;
snd_sum : IUINT32;
timeout_resnd_cnt : IUINT32;
loss_rate : IUINT32;
rdc_loss_rate_limit : IUINT32;
conv : IUINT32;
mtu : IUINT32;
mss : IUINT32;
state : IUINT32;
snd_una : IUINT32;
snd_nxt : IUINT32;
rcv_nxt : IUINT32;
ssthresh : IUINT32;
rx_rttval : IINT32;
rx_srtt : IINT32;
rx_rto : IINT32;
rx_minrto : IINT32;
snd_wnd : IUINT32;
rcv_wnd : IUINT32;
rmt_wnd : IUINT32;
cwnd : IUINT32;
probe : IUINT32;
current : IUINT32;
interval : IUINT32;
ts_flush : IUINT32;
nrcv_buf : IUINT32;
nsnd_buf : IUINT32;
nrcv_que : IUINT32;
nsnd_que : IUINT32;
nodelay : IUINT32;
updated : IUINT32;
ts_probe : IUINT32;
probe_wait : IUINT32;
dead_link : IUINT32;
incr : IUINT32;
snd_queue : IQUEUEHEAD;
rcv_queue : IQUEUEHEAD;
snd_buf : IQUEUEHEAD;
rcv_buf : IQUEUEHEAD;
acklist : PIUINT32;
ackcount : IUINT32;
ackblock : IUINT32;
user : pointer;
buffer : Pchar;
fastresend : longint;
nocwnd : longint;
stream : longint;
logmask : longint;
output : function (buf:Pchar; len:longint; var kcp:IKCPCB; user:pointer):longint;cdecl;
writelog : procedure (log:Pchar; var kcp:IKCPCB; user:pointer);cdecl;
end;`