Skip to content

Commit 2b70d4c

Browse files
committed
p2xp:p2xp is tcp protocol with xengine now.
p2xp:is enable code added into project p2xp:login,query user,query list and connect protocol supported improved:change p2xp code file to main path.
1 parent 6eac81c commit 2b70d4c

21 files changed

+539
-228
lines changed

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ typedef struct tag_XEngine_ServerConfig
2020
int nCenterPort;
2121
int nStorageDLPort;
2222
int nStorageUPPort;
23+
int nP2XPPort;
2324
struct
2425
{
2526
BOOL bReload;
@@ -32,6 +33,7 @@ typedef struct tag_XEngine_ServerConfig
3233
int nCenterThread;
3334
int nStorageDLThread;
3435
int nStorageUPThread;
36+
int nP2XPThread;
3537
}st_XMax;
3638
struct
3739
{
@@ -40,6 +42,7 @@ typedef struct tag_XEngine_ServerConfig
4042
int nTimeCheck;
4143
int nCenterTimeOut;
4244
int nStorageTimeOut;
45+
int nP2XPTimeOut;
4346
}st_XTime;
4447
struct
4548
{
@@ -84,6 +87,10 @@ typedef struct tag_XEngine_ServerConfig
8487
__int64x nMaxUPLoader;
8588
__int64x nMaxDNLoader;
8689
}st_XLimit;
90+
struct
91+
{
92+
TCHAR tszQQWryFile[MAX_PATH];
93+
}st_P2xp;
8794
struct
8895
{
8996
list<tstring> *pStl_ListStorage;

XEngine_Source/StorageModule_Config/Config_Error.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_XSTORAGE 0x0020007
2323
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_XVER 0x0020008
2424
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_XPROXY 0x0020009
25+
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_P2XP 0x002000A
2526

2627
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_LBCONFIG 0x0020010
2728
#define ERROR_XENGINE_BLOGIC_CONFIG_JSON_LAODBALANCE 0x0020011

XEngine_Source/StorageModule_Config/Config_Json/Config_Json.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile,XENGINE_SERVERCONFIG
6767
pSt_ServerConfig->bDeamon = st_JsonRoot["bDeamon"].asInt();
6868
pSt_ServerConfig->nCenterPort = st_JsonRoot["nCenterPort"].asInt();
6969
pSt_ServerConfig->nStorageDLPort = st_JsonRoot["nStorageDLPort"].asInt();
70-
pSt_ServerConfig->nStorageUPPort = st_JsonRoot["nStorageUPPort"].asInt();
70+
pSt_ServerConfig->nStorageUPPort = st_JsonRoot["nStorageUPPort"].asInt();
71+
pSt_ServerConfig->nP2XPPort = st_JsonRoot["nP2XPPort"].asInt();
7172

72-
if (st_JsonRoot["XMax"].empty() || (6 != st_JsonRoot["XMax"].size()))
73+
if (st_JsonRoot["XMax"].empty() || (7 != st_JsonRoot["XMax"].size()))
7374
{
7475
Config_IsErrorOccur = TRUE;
7576
Config_dwErrorCode = ERROR_XENGINE_BLOGIC_CONFIG_JSON_XMAX;
@@ -82,8 +83,9 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile,XENGINE_SERVERCONFIG
8283
pSt_ServerConfig->st_XMax.nCenterThread = st_JsonXMax["CenterThread"].asInt();
8384
pSt_ServerConfig->st_XMax.nStorageUPThread = st_JsonXMax["nStorageUPThread"].asInt();
8485
pSt_ServerConfig->st_XMax.nStorageDLThread = st_JsonXMax["nStorageDLThread"].asInt();
86+
pSt_ServerConfig->st_XMax.nP2XPThread = st_JsonXMax["nP2XPThread"].asInt();
8587

86-
if (st_JsonRoot["XTime"].empty() || (5 != st_JsonRoot["XTime"].size()))
88+
if (st_JsonRoot["XTime"].empty() || (6 != st_JsonRoot["XTime"].size()))
8789
{
8890
Config_IsErrorOccur = TRUE;
8991
Config_dwErrorCode = ERROR_XENGINE_BLOGIC_CONFIG_JSON_XTIME;
@@ -95,7 +97,8 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile,XENGINE_SERVERCONFIG
9597
pSt_ServerConfig->st_XTime.nTimeCheck = st_JsonXTime["nTimeCheck"].asInt();
9698
pSt_ServerConfig->st_XTime.nCenterTimeOut = st_JsonXTime["nCenterTimeOut"].asInt();
9799
pSt_ServerConfig->st_XTime.nStorageTimeOut = st_JsonXTime["nStorageTimeOut"].asInt();
98-
100+
pSt_ServerConfig->st_XTime.nP2XPTimeOut = st_JsonXTime["nP2XPTimeOut"].asInt();
101+
99102
if (st_JsonRoot["XLog"].empty() || (3 != st_JsonRoot["XLog"].size()))
100103
{
101104
Config_IsErrorOccur = TRUE;
@@ -162,6 +165,15 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile,XENGINE_SERVERCONFIG
162165
pSt_ServerConfig->st_XLimit.nMaxDNLoader = st_JsonXLimit["nMaxDNLoad"].asInt64();
163166
pSt_ServerConfig->st_XLimit.nMaxUPLoader = st_JsonXLimit["nMaxUPLoad"].asInt64();
164167

168+
if (st_JsonRoot["XP2xp"].empty() || (1 != st_JsonRoot["XP2xp"].size()))
169+
{
170+
Config_IsErrorOccur = TRUE;
171+
Config_dwErrorCode = ERROR_XENGINE_BLOGIC_CONFIG_JSON_P2XP;
172+
return FALSE;
173+
}
174+
Json::Value st_JsonP2xp = st_JsonRoot["XP2xp"];
175+
_tcscpy(pSt_ServerConfig->st_P2xp.tszQQWryFile, st_JsonP2xp["tszQQWryFile"].asCString());
176+
165177
if (st_JsonRoot["XVer"].empty() || (1 != st_JsonRoot["XVer"].size()))
166178
{
167179
Config_IsErrorOccur = TRUE;

XEngine_Source/XEngine_P2XPComponents/XEngine_P2XPProtocol/P2XPProtocol_Define.h

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,22 @@ extern "C" BOOL P2XPProtocol_Parse_Connect(LPCTSTR lpszMsgBuffer, int nMsgLen, X
124124
/********************************************************************
125125
函数名称:P2XPProtocol_Parse_Login
126126
函数功能:登录解析函数
127-
参数.一:lpszMsgBuffer
127+
参数.一:pSt_ProtocolHdr
128+
In/Out:In
129+
类型:数据结构指针
130+
可空:N
131+
意思:输入要打包的协议头
132+
参数.二:lpszMsgBuffer
128133
In/Out:In
129134
类型:常量字符指针
130135
可空:N
131136
意思:输入要解析的缓冲区
132-
参数.:nMsgLen
137+
参数.:nMsgLen
133138
In/Out:In
134139
类型:整数型
135140
可空:N
136141
意思:输入缓冲区大小
137-
参数.:pSt_P2XPPeer
142+
参数.:pSt_P2XPPeer
138143
In/Out:In
139144
类型:数据结构指针
140145
可空:N
@@ -144,26 +149,31 @@ extern "C" BOOL P2XPProtocol_Parse_Connect(LPCTSTR lpszMsgBuffer, int nMsgLen, X
144149
意思:是否成功
145150
备注:
146151
*********************************************************************/
147-
extern "C" BOOL P2XPProtocol_Packet_Common(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCTSTR lpszMsgBuffer = NULL);
152+
extern "C" BOOL P2XPProtocol_Packet_Common(XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCTSTR lpszMsgBuffer = NULL);
148153
/********************************************************************
149154
函数名称:P2XPProtocol_Packet_Lan
150155
函数功能:响应同步局域网地址列表
151-
参数.一:pppSt_ListClients
156+
参数.一:pSt_ProtocolHdr
157+
In/Out:In
158+
类型:数据结构指针
159+
可空:N
160+
意思:输入要打包的协议头
161+
参数.二:pppSt_ListClients
152162
In/Out:In
153163
类型:三级指针
154164
可空:N
155165
意思:输入局域网地址信息列表
156-
参数.:nListCount
166+
参数.:nListCount
157167
In/Out:In
158168
类型:整数型
159169
可空:N
160170
意思:局域网地址列表个数
161-
参数.:ptszMsgBuffer
171+
参数.:ptszMsgBuffer
162172
In/Out:Out
163173
类型:字符指针
164174
可空:N
165175
意思:导出封装好的缓冲区
166-
参数.四:pInt_Len
176+
参数.五:pInt_MsgLen
167177
In/Out:In/Out
168178
类型:整数型指针
169179
可空:N
@@ -173,21 +183,55 @@ extern "C" BOOL P2XPProtocol_Packet_Common(TCHAR* ptszMsgBuffer, int* pInt_MsgLe
173183
意思:是否成功
174184
备注:
175185
*********************************************************************/
176-
extern "C" BOOL P2XPProtocol_Packet_Lan(XENGINE_P2XPPEER_PROTOCOL*** pppSt_ListClients, int nListCount, TCHAR* ptszMsgBuffer, int* pInt_Len);
186+
extern "C" BOOL P2XPProtocol_Packet_Lan(XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_P2XPPEER_PROTOCOL*** pppSt_ListClients, int nListCount, TCHAR* ptszMsgBuffer, int* pInt_Len);
177187
/********************************************************************
178188
函数名称:P2XPProtocol_Packet_User
179189
函数功能:响应用户查询用户信息的请求协议封包函数
180-
参数.一:pSt_PeerInfo
190+
参数.一:pSt_ProtocolHdr
191+
In/Out:In
192+
类型:数据结构指针
193+
可空:N
194+
意思:输入要打包的协议头
195+
参数.二:pSt_PeerInfo
181196
In/Out:In
182197
类型:数据结构指针
183198
可空:N
184199
意思:输入获取到的用户信息
185-
参数.二:ptszMsgBuffer
200+
参数.三:ptszMsgBuffer
201+
In/Out:Out
202+
类型:字符指针
203+
可空:N
204+
意思:导出封装好的缓冲区
205+
参数.四:pInt_MsgLen
206+
In/Out:In/Out
207+
类型:整数型指针
208+
可空:N
209+
意思:输入你的缓冲区大小,输出缓冲区真实大小
210+
返回值
211+
类型:逻辑型
212+
意思:是否成功
213+
备注:
214+
*********************************************************************/
215+
extern "C" BOOL P2XPProtocol_Packet_User(XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_P2XPPEER_PROTOCOL* pSt_PeerInfo, TCHAR* ptszMsgBuffer, int* pInt_Len);
216+
/********************************************************************
217+
函数名称:P2XPProtocol_Packet_Connect
218+
函数功能:请求连接打包函数
219+
参数.一:pSt_ProtocolHdr
220+
In/Out:In
221+
类型:数据结构指针
222+
可空:N
223+
意思:输入要打包的协议头
224+
参数.二:pSt_IOProtocol
225+
In/Out:In
226+
类型:数据结构指针
227+
可空:N
228+
意思:输入连接信息
229+
参数.三:ptszMsgBuffer
186230
In/Out:Out
187231
类型:字符指针
188232
可空:N
189233
意思:导出封装好的缓冲区
190-
参数.三:pInt_Len
234+
参数.四:pInt_MsgLen
191235
In/Out:In/Out
192236
类型:整数型指针
193237
可空:N
@@ -197,4 +241,4 @@ extern "C" BOOL P2XPProtocol_Packet_Lan(XENGINE_P2XPPEER_PROTOCOL*** pppSt_ListC
197241
意思:是否成功
198242
备注:
199243
*********************************************************************/
200-
extern "C" BOOL P2XPProtocol_Packet_User(XENGINE_P2XPPEER_PROTOCOL* pSt_PeerInfo, TCHAR* ptszMsgBuffer, int* pInt_Len);
244+
extern "C" BOOL P2XPProtocol_Packet_Connect(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_P2XPIO_PROTOCOL* pSt_IOProtocol, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);

0 commit comments

Comments
 (0)