Home > Back-end >  Please translation UDX SDK for DELPHI
Please translation UDX SDK for DELPHI

Time:10-04

Due to the younger brother of VC are not familiar with which the eldest brother to the translation of the younger brother grateful


 # # ifndef _pudx_h_ 
# define _pudx_h_
# pragma once


/////////////////////////basic definition///////////////////////////////
//flow definition
# # ifndef SOCKADDR
Typedef struct sockaddr sockaddr.
Typedef UINT_PTR SOCKET;
# endif

The class IDebug
{
Public:
Virtual void Test1 () {};
Virtual void Test2 () {};
Virtual void Test3 () {};
Virtual void Test4 () {};
};
The class IRef
{
Public:
Virtual long AddRef ()=0;
Virtual long Release ()=0;
Virtual void Reset ()=0;
Virtual void the Delete ()=0;
};
The class ICreator
{
Public:
Virtual IRef * CreateInstance ()=0;
};
The class IRefPool
{
Public:
Virtual IRef * GetNewRef ()=0;
Virtual void ReleaseRef (IRef * pRef)=0.
Virtual void SetCreator (ICreator * pCreator)=0.
};


The class IUdxSink
{
Public:
Virtual BOOL TryAcceptConnect (SOCKADDR * pAddr, BYTE * pData, int iLen) {return true; };
Virtual void OnRemoteEnject (SOCKADDR * pAddr, BYTE * pData, int iLen) {};
Virtual void OnConnected (SOCKADDR * pAddr) {};
Virtual void OnUdxReadEvent (BYTE * pData, long len) {};
Virtual void OnUdxWriteEvent (BYTE * pData, long len) {};
Virtual void OnUdxReadMsgEvent (BYTE * pData, long len) {};
Virtual void OnUdxWriteMsgEvent (BYTE * pData, long len) {};
Virtual void OnRemoteBroken () {};
};
The class IUdxInfo
{
Public:
DWORD m_dwRead;
DWORD m_dwWrite;
DWORD m_start m_end;
DWORD m_ReadCount;
DWORD m_WriteCount;
DWORD m_SendTotalCount;
DWORD m_errocount;
DWORD s1, e1, s2, e2, m_sendindex;
DWORD m_ackcount;
DWORD m_lastsend;
DWORD m_lastread;
DWORD m_lasttime;
DWORD m_currentspeedread;
DWORD m_currentspeedsend;
DWORD m_lastUpdateTime;

Float m_wnd;
Float m_rto;
Float m_ttl;
Float m_minttl;
Float m_d;
Float m_pi;

Int m_uncheckcount;
Int m_checked;
Int m_currentsendcount;
Int m_expect;
Int m_PipSize;
Int m_buffsize;
Int m_sendbuffsize;

Virtual void GetSpeedStr (char * buff, BOOL bSend=TRUE, BOOL bCurrent=FALSE)=0.
Virtual DWORD GetCurrentSpeed (BOOL bSend=TRUE)=0.
Virtual DWORD GetSpeed (BOOL bSend=TRUE)=0.
Virtual char * GetInfo ()=0;
Virtual void Reset ()=0;
Virtual void UpDateCurrentSpeed ()=0;
Protected:
Char buff [1024].
};
Struct IUdxCfg
{
Int wndmaxsize;//must be 8 integer times, 8 ~ 1024, transmission sliding window size
Float dbLostRat;//the default 0.3

BOOL bPI.//for the diff, dynamic gauge the threshold factor
Float dbpi;

BOOL bCareLost;//bandwidth to grab a factor

BOOL bLimitSpeedWrite;//limit the upload speed
DWORD limitspeedWrite;//specific speed

BOOL bLimitSpeedRead;//download speed limit
DWORD limitspeedRead;//specific speed


BOOL bSpeedThresholdWrite;//send the critical speed
DWORD thresholdspeedWrite;//we are more concerned with the threshold, such as 500 KBPS, when more than this value, we don't have to compete for bandwidth

BOOL bSpeedThresholdRead;//receive critical speed
DWORD thresholdspeedRead;//we are more concerned with the threshold, such as 500 KBPS, when more than this value, we don't have to compete for bandwidth

};


The class IRowUdpSink
{
Public:
Virtual void _OnRead (SOCKADDR * pAddr, BYTE * pData, long len) {};
Virtual int SendBuffs () {return 0; };
};
The class ISocketTimer
{
Public:
Virtual void OnTimer () {};
};
The class IRowUdp
{
Public:
Virtual int __SendUdxBuff (SOCKADDR * pAddr, BYTE * pData, int len)=0.
Virtual void PostWriteRequst (BOOL bSignal)=0;
};
The class IUdxConnectData
{
Public:
Virtual BOOL PutData (BYTE * pData, int iLen)=0.
Virtual BYTE * GetByte ()=0;
Virtual int GetLen ()=0;
};
The class ISubUdx: public IDebug
{
Public:
Virtual BOOL IsConnected ()=0;
Virtual long GetBuffWindow ()=0;
Virtual void SetBuffWindow (long size)=0;
Virtual void ClearBuffWindow ()=0;
Virtual BOOL IsFullBuffs ()=0;
Virtual void the Close ()=0;
Virtual BOOL SendBuff (BYTE * pData, int len)=0.
Virtual BOOL SendMsg (BYTE * pData, int len)=0.
Virtual SOCKADDR GetLocalAddr ()=0;
Virtual SOCKADDR GetRemoteAddr ()=0;
Virtual void SetSink (IUdxSink * pSink)=0.
Virtual IUdxInfo * GetUdxInfo ()=0;
Virtual IUdxCfg * GetUdxCfg ()=0;
Virtual IUdxConnectData * GetIConnectData ()=0;
Virtual __int64 GetKey ()=0;
};

The class IUdx: public ISubUdx
{
Public:
Virtual BOOL Create (short port=0)=0.
Virtual BOOL Connect (char * IP, short port, BOOL bSync=FALSE)=0.
Virtual BOOL Attach (SOCKET s)=0;
Virtual void Destroy ()=0;
};

The class IStreamControl
{
Public:
Virtual void SetUpLoadSpeed (DWORD speed)=0;
Virtual void SetDownloadSpeed (DWORD speed)=0;
Virtual void EnableControl (BOOL bEnable)=0;
};


nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related