forked from LiXizhi/TMInterface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsgTM.hpp
More file actions
546 lines (470 loc) · 9.56 KB
/
Copy pathMsgTM.hpp
File metadata and controls
546 lines (470 loc) · 9.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
#include "pdumanip.hpp"
#ifndef MSG_TM_HPP_
#define MSG_TM_HPP_
using namespace taomee;
#define HEAD_LENGTH 18
//#define HEAD_LENGTH 17
#define DBPROXY_HEAD_LENGTH 18
#define PAY_HEAD_LENGTH 18
#define MAGICWORD_HEAD_LENGTH 18
#define REGISTER_PASSWD_LENGTH 32
#define EMAIL_LENGTH 64
#define SESSION_LENGTH 16
#define VFYCODE_LENGTH 6
#define CITY_LENGTH 64
#define REALNAME_LENGTH 15
#define IDNO_LENGTH 18
#define TELEPHONE_LENGTH 16
#define MOBILE_LENGTH 15
#define POSTCODE_LENGTH 6
#define ADDR_LENGTH 192
#define NICKNAME_LENGTH 90
#define SIGNATURE_LENGTH 384
#define LOGIN_PASSWD_LENGTH 16
#define TITLE_LENGTH 60
#define NICK_LENGTH 16
#define CONTENT_LENGTH 2048
#define MAX_GIFT_COUNT 256
#define CHANNELKEY_LENGTH 32
#define VERIFYCHANNE_HEAD_LENGTH 34
#define VFY_IMGSIZE 1024
//#define CMD_REGISTER 0x0003
#define CMD_REGISTER 0x6101
#define CMD_GET_TAOMEE_ID 0x4004
#define CMD_GET_EMAIL_BYID 0x0044
//#define CMD_LOGIN 0x000D
#define CMD_LOGIN 0xA026
#define CMD_GET_VERIFY_IMG_ORNOT 0xA027
#define CMD_GET_VERIFY_IMG_BYSESSION 0xA031
//#define CMD_SET_GAME_FLAG 0x0108
#define CMD_SET_GAME_FLAG 0xA123
#define USER_LOGIN_ADD 0xA125
#define CMD_GET_LASTLOGIN_TIME 0xF009
#define CMD_GET_USERINFO 0x0022
#define CMD_PAY_GET_PRODUCT_PRICE 1001
#define CMD_PAY_MUTI_PRODUCT_PRICE 1002
#define USER_PAY_BUY_PRODUCT_INFO 1003
#define CMD_PAY_BUY_PRODUCT 2004
#define CHANNEL_ID 31
#define CHANNEL_KEY "19801322"
//#define CHANNEL_KEY "12345678"
#define GAME_ID 21
class MsgTMHead
{
public:
MsgTMHead()
{
}
~MsgTMHead()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 PkgLen;
//uint8 Version;
uint32 Version;
//uint32 CommandID;
uint16 CommandID;
uint32 Result; // status_code
uint32 UserID;
} ;
class MsgTMChannelVerifyHead
{
public:
MsgTMChannelVerifyHead()
{
memset(this, 0, sizeof(MsgTMChannelVerifyHead));
}
~MsgTMChannelVerifyHead()
{
}
void EncodeRegist( char *pkgbuf, int &iOutLength );
void Encode2( char *pkgbuf, int &iOutLength );
uint16 channelID;
char channel_key[CHANNELKEY_LENGTH];
} ;
class MsgTMRegister
{
public:
MsgTMRegister()
{
//memset(passwd,0,REGISTER_PASSWD_LENGTH);
//memset(email,0,EMAIL_LENGTH);
//memset(session,0,SESSION_LENGTH);
memset(this, 0, sizeof(MsgTMRegister));
}
~MsgTMRegister()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 ip;
char passwd[REGISTER_PASSWD_LENGTH];
char email[EMAIL_LENGTH];
char sex[1];
uint32 birthday;
char realname[REALNAME_LENGTH];
char idno[IDNO_LENGTH];
uint16 regchannel;
uint16 regfrom;
char session[SESSION_LENGTH];
} ;
class TMDBProxyHead
{
public:
TMDBProxyHead()
{
}
~TMDBProxyHead()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 PkgLen;
uint32 Seq;
uint16 CommandID;
uint32 Result;
uint32 UserID;
} ;
class TMDBProxyGetID
{
public:
TMDBProxyGetID()
{
memset(email,0,EMAIL_LENGTH);
}
~TMDBProxyGetID()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
char email[EMAIL_LENGTH];
uint32 map_userid;
} ;
/*
class TMDBProxyLogin
{
public:
TMDBProxyLogin()
{
memset(passwd,0,LOGIN_PASSWD_LENGTH);
memset(email,0,EMAIL_LENGTH);
ip = 0;
}
~TMDBProxyLogin()
{
}
void SetPassword(const void* srcstring, size_t srclen);
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
char passwd[LOGIN_PASSWD_LENGTH];
char email[EMAIL_LENGTH];
uint32 ip;
uint32 login_channel;
uint32 game_flag;
} ;
*/
class TMDBProxyLogin
{
public:
TMDBProxyLogin()
{
/*memset(passwd,0,LOGIN_PASSWD_LENGTH);
memset(session,0,SESSION_LENGTH);
memset(vfy_session,0,SESSION_LENGTH);
memset(vfy_code,0,VFYCODE_LENGTH);
memset(vfyimg,0,VFY_IMGSIZE);*/
memset(this, 0, sizeof(TMDBProxyLogin));
}
~TMDBProxyLogin()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
void DecodeSuccess( const char *pkgbuf, const int iInLength );
void DecodeVfyCode( const char *pkgbuf, const int iInLength );
void DecodeLastLogin( const char *pkgbuf, const int iInLength );
char email[EMAIL_LENGTH];
char passwd[LOGIN_PASSWD_LENGTH];
uint16 channelID;
uint16 region;
uint16 gameid;
uint32 ip;
char vfy_session[SESSION_LENGTH];
char vfy_code[VFYCODE_LENGTH];
uint32 flag;
char session[SESSION_LENGTH];
uint32 gameflag;
uint32 vfyimg_size;
unsigned char vfyimg[VFY_IMGSIZE];
uint32 lastip;
uint32 lasttime;
char lastcity[CITY_LENGTH];
char currcity[CITY_LENGTH];
} ;
class TMDBProxyGetEmailByID
{
public:
TMDBProxyGetEmailByID()
{
memset(email,0,EMAIL_LENGTH);
}
~TMDBProxyGetEmailByID()
{
}
void Decode( const char *pkgbuf, const int iInLength );
char email[EMAIL_LENGTH];
} ;
class TMDBProxySetGameFlag
{
public:
TMDBProxySetGameFlag()
{
}
~TMDBProxySetGameFlag()
{
}
void Encode( char *pkgbuf, int &iOutLength );
uint32 idczone;
uint32 gameid_flag;
} ;
class TMDBProxyLogout
{
public:
TMDBProxyLogout()
{
login_time = 0;
logout_time = 0;
gameid = 21;
}
~TMDBProxyLogout()
{
}
uint32 GetLocalTime(double today_time);
void Encode( char *pkgbuf, int &iOutLength ,double today_login_time,double today_logout_time);
uint32 gameid;
uint32 login_time;
uint32 logout_time;
} ;
class TMDBProxyGetLastLoginTime
{
public:
TMDBProxyGetLastLoginTime()
{
login_time = 0;
}
~TMDBProxyGetLastLoginTime()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 count;
uint32 UserID;
uint32 login_time;
} ;
class TMDBProxyPostMsg
{
public:
TMDBProxyPostMsg()
{
memset(title,0,TITLE_LENGTH);
memset(nick,0,NICK_LENGTH);
memset(content,0,CONTENT_LENGTH);
type = 0;
msglen = 0;
}
~TMDBProxyPostMsg()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength);
char title[TITLE_LENGTH];
char nick[NICK_LENGTH];
char content[CONTENT_LENGTH];
uint32 type;
uint32 msglen;
uint32 ret;
} ;
class TMPayHead
{
public:
TMPayHead()
{
}
~TMPayHead()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 PkgLen;
uint32 Seq;
uint16 CommandID;
uint32 Result;
uint32 UserID;
} ;
class TMPayGetProductPrice
{
public:
TMPayGetProductPrice()
{
}
~TMPayGetProductPrice()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 product_id;
uint32 price;
uint32 vip_price;
uint32 nonvip_price;
};
class TMPayGetProductInfo
{
public:
TMPayGetProductInfo()
{
}
~TMPayGetProductInfo()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 product_id;
uint32 price;
uint32 vip_price;
uint32 nonvip_price;
uint8 type;
uint8 category;
uint8 must_vip;
uint32 max_limit;
uint32 total_count;
uint32 current_count;
uint8 is_valid;
uint8 flag;
};
class TMPayBuyProduct
{
public:
TMPayBuyProduct()
{
memset(pay_passwd,0,16);
}
~TMPayBuyProduct()
{
}
void SetPassword(const void* srcstring, size_t srclen);
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 dest_user_id;
uint32 product_id;
uint16 product_count;
uint8 is_vip;
uint8 buy_place;
char pay_passwd[16];
uint32 op_id;
uint32 mb_number;
uint32 mb_balance;
};
class TMMagicWordHead
{
public:
TMMagicWordHead()
{
}
~TMMagicWordHead()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
uint32 PkgLen;
uint32 version;
uint16 CommandID;
uint32 Result;
uint32 UserID;
} ;
class TMQueryMagicWord
{
public:
TMQueryMagicWord()
{
memset(magic_word,0,32);
}
~TMQueryMagicWord()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
char magic_word[32];
uint16 can_choose_count;
uint16 use_count;
uint16 has_gift_count;
uint32 gift_id[MAX_GIFT_COUNT];
uint16 gift_count[MAX_GIFT_COUNT];
};
class TMConsumeMagicWord
{
public:
TMConsumeMagicWord()
{
memset(magic_word,0,32);
}
~TMConsumeMagicWord()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
char magic_word[32];
uint32 nid;
uint32 ip;
uint16 gift_count;
uint32 gift_id[MAX_GIFT_COUNT];
uint32 gift_count_array[MAX_GIFT_COUNT];
uint8 gift_right;
};
class TMDBGetVfyImg
{
public:
TMDBGetVfyImg()
{
/* memset(session,0,SESSION_LENGTH);*/
memset(this, 0, sizeof(TMDBGetVfyImg));
}
~TMDBGetVfyImg()
{
}
void Encode( char *pkgbuf, int &iOutLength );
void Decode( const char *pkgbuf, const int iInLength );
void EncodeBySession( char *pkgbuf, int &iOutLength );
uint16 channelID;
uint32 ip;
uint32 flag;
char session[SESSION_LENGTH];
uint32 vfyimg_size;
unsigned char vfyimg[VFY_IMGSIZE];
} ;
class TMDBGetUserInfo
{
public:
TMDBGetUserInfo()
{
memset(this, 0, sizeof(TMDBGetUserInfo));
}
~TMDBGetUserInfo()
{
}
void Decode( const char *pkgbuf, const int iInLength );
char sex[1];
uint32 birthday;
char tel[TELEPHONE_LENGTH];
char mobile[MOBILE_LENGTH];
char postcode[POSTCODE_LENGTH];
uint16 addr_province;
uint16 addr_city;
char addr[ADDR_LENGTH];
char interest[ADDR_LENGTH];
char realname[REALNAME_LENGTH];
char idno[IDNO_LENGTH];
char nickname[NICKNAME_LENGTH];
char signature[SIGNATURE_LENGTH];
} ;
#endif // MSG_TM_HPP_