Implement SOCKS proxy feature
This commit is contained in:
51
server/2015Remote/proxy/ProxyConnectServer.h
Normal file
51
server/2015Remote/proxy/ProxyConnectServer.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "HPSocket.h"
|
||||
#include "SocketInterface.h"
|
||||
#include "Buffer.h"
|
||||
#include <IOCPServer.h>
|
||||
|
||||
#define NC_CLIENT_CONNECT 0x0001
|
||||
#define NC_CLIENT_DISCONNECT 0x0002
|
||||
#define NC_TRANSMIT 0x0003
|
||||
#define NC_RECEIVE 0x0004
|
||||
|
||||
typedef void (CALLBACK* NOTIFYPROC)(void* user, ClientContext* ctx, UINT nCode);
|
||||
|
||||
typedef CList<ClientContext*, ClientContext* > ContextList;
|
||||
|
||||
class CProxyConnectServer :public CTcpPullServerListener
|
||||
{
|
||||
public:
|
||||
CProxyConnectServer(void);
|
||||
~CProxyConnectServer(void);
|
||||
|
||||
BOOL Initialize(NOTIFYPROC pNotifyProc, void* user, int nMaxConnections, int nPort);
|
||||
BOOL Send(ClientContext* pContext, LPBYTE lpData, UINT nSize);
|
||||
BOOL SendWithSplit(CONNID dwConnID, LPBYTE lpData, UINT nSize, UINT nSplitSize);
|
||||
void Shutdown();
|
||||
void ClearClient();
|
||||
BOOL Disconnect(CONNID dwConnID);
|
||||
BOOL IsConnected(CONNID dwConnID);
|
||||
int IsOverMaxConnectionCount();
|
||||
|
||||
virtual EnHandleResult OnPrepareListen(ITcpServer* pSender, SOCKET soListen);
|
||||
virtual EnHandleResult OnAccept(ITcpServer* pSender, CONNID dwConnID, UINT_PTR soClient);
|
||||
virtual EnHandleResult OnSend(ITcpServer* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
|
||||
virtual EnHandleResult OnReceive(ITcpServer* pSender, CONNID dwConnID, int iLength);
|
||||
virtual EnHandleResult OnClose(ITcpServer* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
|
||||
virtual EnHandleResult OnShutdown(ITcpServer* pSender);
|
||||
|
||||
CTcpPullServerPtr m_TcpServer;
|
||||
|
||||
private:
|
||||
NOTIFYPROC m_pNotifyProc;
|
||||
void* m_pUser;
|
||||
ContextList m_listFreePool;
|
||||
CLock m_Locker;
|
||||
int m_nPort; // <20><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
CONNID m_IDs[65535]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
||||
LONG m_bStop; // <20>˿<EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD>߿<EFBFBD><DFBF><EFBFBD>
|
||||
int m_nMaxConnection; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
BOOL m_bIsRun; // <20><><EFBFBD><EFBFBD>״̬
|
||||
DWORD m_dwIndex; // <20><><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>
|
||||
};
|
||||
Reference in New Issue
Block a user