Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
144
GameTools/GLOBALSCRIPT/Network/ClientSocket/UDPList/UDPList.h
Normal file
144
GameTools/GLOBALSCRIPT/Network/ClientSocket/UDPList/UDPList.h
Normal file
@@ -0,0 +1,144 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// UDPList
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _CSocketHandleList
|
||||
#define _CSocketHandleList
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
|
||||
#include "T_List.h"
|
||||
|
||||
typedef enum _PEERTYPE
|
||||
{
|
||||
Not_Defined = 0, // 정의 안됨
|
||||
REAL_IP, // 리얼 IP
|
||||
NAT_Friendly, // 가상 IP (같은 NAT)
|
||||
NAT_Different // 가상 IP (다른 NAT)
|
||||
} PEERTYPE;
|
||||
|
||||
typedef struct _UDP_LIST
|
||||
{
|
||||
DWORD CharID; // 캐릭터 아이디
|
||||
|
||||
PEERTYPE PeerType; // 전송 타입
|
||||
SOCKADDR_IN PublicAddress; // 주소 Public
|
||||
SOCKADDR_IN PrivateAddress; // 주소 Private
|
||||
|
||||
DWORD MoveTick; // 움직임 시간
|
||||
|
||||
_UDP_LIST* pNext;
|
||||
}UDP_LIST, *LPUDP_LIST;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 클래스 정의
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UDPList : public TList<UDP_LIST>
|
||||
{
|
||||
public:
|
||||
UDPList(void);
|
||||
~UDPList(void);
|
||||
|
||||
inline DWORD InsertIntoAddressList(DWORD CharID_In, SOCKADDR_IN PubAddress_In, SOCKADDR_IN PriAddress_In, PEERTYPE PeerType_In);
|
||||
inline bool DeleteFromAddressList(DWORD CharID_In);
|
||||
inline bool DeleteFromAddressList(SOCKADDR_IN Address_In);
|
||||
inline LPUDP_LIST SearchFromAddressList(DWORD CharID_In);
|
||||
inline LPUDP_LIST SearchFromAddressList(SOCKADDR_IN Address_In);
|
||||
};
|
||||
|
||||
inline DWORD UDPList::InsertIntoAddressList(DWORD CharID_In, SOCKADDR_IN PubAddress_In, SOCKADDR_IN PriAddress_In, PEERTYPE PeerType_In)
|
||||
{
|
||||
LPUDP_LIST lpList = SearchFromAddressList(CharID_In);
|
||||
if(lpList != NULL)
|
||||
{
|
||||
lpList->CharID = CharID_In;
|
||||
lpList->PublicAddress = PubAddress_In;
|
||||
lpList->PrivateAddress = PriAddress_In;
|
||||
lpList->PeerType = PeerType_In;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
lpList = Create();
|
||||
if(lpList != NULL)
|
||||
{
|
||||
lpList->CharID = CharID_In;
|
||||
lpList->PublicAddress = PubAddress_In;
|
||||
lpList->PrivateAddress = PriAddress_In;
|
||||
lpList->PeerType = PeerType_In;
|
||||
|
||||
InsertToList(lpList);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline bool UDPList::DeleteFromAddressList(DWORD CharID_In)
|
||||
{
|
||||
LPUDP_LIST lpList = SearchFromAddressList(CharID_In);
|
||||
if(lpList != NULL)
|
||||
{
|
||||
DeleteFromList(lpList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool UDPList::DeleteFromAddressList(SOCKADDR_IN Address_In)
|
||||
{
|
||||
LPUDP_LIST lpList = SearchFromAddressList(Address_In);
|
||||
if(lpList != NULL)
|
||||
{
|
||||
DeleteFromList(lpList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline LPUDP_LIST UDPList::SearchFromAddressList(DWORD CharID_In)
|
||||
{
|
||||
LPUDP_LIST lpList;
|
||||
|
||||
lpList = m_pListHead;
|
||||
while(lpList)
|
||||
{
|
||||
if(lpList->CharID == CharID_In)
|
||||
return lpList;
|
||||
|
||||
lpList = lpList->pNext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline LPUDP_LIST UDPList::SearchFromAddressList(SOCKADDR_IN Address_In)
|
||||
{
|
||||
LPUDP_LIST lpList;
|
||||
|
||||
lpList = m_pListHead;
|
||||
while(lpList)
|
||||
{
|
||||
if(lpList->PrivateAddress.sin_addr.S_un.S_addr == Address_In.sin_addr.S_un.S_addr && lpList->PrivateAddress.sin_port == Address_In.sin_port)
|
||||
return lpList;
|
||||
|
||||
if(lpList->PublicAddress.sin_addr.S_un.S_addr == Address_In.sin_addr.S_un.S_addr && lpList->PublicAddress.sin_port == Address_In.sin_port)
|
||||
return lpList;
|
||||
|
||||
lpList = lpList->pNext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user