forked from pvpgn/d2gs109
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd2gs.h
130 lines (107 loc) · 3.29 KB
/
d2gs.h
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
/*
* d2gs.h: declaration of structures and constants
*
* 2001-08-20 faster
* modify
*/
#ifndef INCLUDED_D2GS_H
#define INCLUDED_D2GS_H
#include <windows.h>
/* constants */
#define D2CSERVER 0x01
#define D2DBSERVER 0x02
#define D2GSERVER 0x04
/* version */
#define D2GS_VERSION 0x01090006
#define VERNUM "1.09 beta6"
#define BUILDDATE __DATE__ " " __TIME__
#define D2GS_VERSION_STRING D2COLOR_GOLDEN "D2GS Version " VERNUM ", build on " BUILDDATE
#define D2GSERVER_MUTEX_NAME "DIABLO_II_CLOSE_GAME_SERVER"
#define D2GS_STOP_EVENT_NAME "D2GSERVER_WHO_STOP_ME"
#define DEFAULT_D2CS_PORT 6112
#define DEFAULT_D2DBS_PORT 6113
#define DEFAULT_ADMIN_PORT 8888
#define DEFAULT_ADMIN_TIMEOUT 300
#define DEFAULT_MAX_GAMES 100
#define DEFAULT_NT_MODE 0
#define DEFAULT_PRECACHE_MODE 0
#define DEFAULT_GE_PATCH 1
#define DEFAULT_GE_LOG 0
#define DEFAULT_GE_MSG 0
#define DEFAULT_DEBUGNETPACKET 0
#define DEFAULT_DEBUGEVENTCALLBACK 0
#define DEFAULT_CHARPENDINGTIMEOUT 200
#define DEFAULT_INTERVALRECONNECTD2CS 50
#define DEFAULT_MAXGAMELIFE 3600
#define DEFAULT_GS_SHUTDOWN_INTERVAL 15
#define DEFAULT_GS_SHUTDOWN_DELAY 300
#define DEFAULT_MULTICPUMASK 0
#define MAX_LINE_LEN 1024
#define DEBUG_DUMPSIZE 0x40
/* string lengtn */
#define MAX_GAMENAME_LEN 16
#define MAX_ACCTNAME_LEN 16
#define MAX_CHARNAME_LEN 16
#define MAX_REALMNAME_LEN 32
#define MAX_CHAR_IN_GAME 8
#define TIMER_TICK_IN_MS 100
#define GET_DATA_TIMEOUT 1000
#define SEND_MOTD_INTERVAL 2000
/* some error code */
#define D2GSERROR_NOT_ENOUGH_MEMORY 0x80
#define D2GSERROR_BAD_PARAMETER 0x81
#define D2GSERROR_GAME_IS_FULL 0x82
#define D2GSERROR_CHAR_ALREADY_IN_GAME 0x83
/* utilities */
#define YESNO(n) (n)?"Yes":"No"
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define NELEMS(array) (sizeof(array)/sizeof(array[0]))
/* structures */
typedef int (*CLEANUP_ROUTINE)(void);
typedef struct RAW_CLEANUP_RT_ITEM {
char comment[64];
CLEANUP_ROUTINE cleanup;
struct RAW_CLEANUP_RT_ITEM *next;
} CLEANUP_RT_ITEM, *PCLEANUP_RT_ITEM;
typedef struct RAW_D2GSCONFIGS {
DWORD d2csip; /* in network order */
DWORD d2dbsip; /* in network order */
u_short d2csport; /* in network order */
u_short d2dbsport; /* in network order */
BOOL enablentmode;
BOOL enableprecachemode;
BOOL enablegepatch;
BOOL enablegelog;
BOOL enablegemsg;
BOOL debugnetpacket;
BOOL debugeventcallback;
DWORD checksum;
DWORD gemaxgames;
DWORD gsmaxgames;
DWORD idlesleep;
DWORD busysleep;
DWORD charpendingtimeout;
DWORD intervalreconnectd2cs;
DWORD admintimeout;
DWORD maxgamelife;
DWORD gsshutdowninterval;
DWORD multicpumask;
u_char adminpwd[64];
u_short adminport;
u_char d2cssecrect[32];
u_char motd[256];
} D2GSCONFIGS, *PD2GSCONFIGS;
#define PACKET_PEER_RECV_FROM_D2CS 0x01
#define PACKET_PEER_SEND_TO_D2CS 0x02
#define PACKET_PEER_RECV_FROM_D2DBS 0x03
#define PACKET_PEER_SEND_TO_D2DBS 0x04
typedef struct RAW_D2GSPACKET {
u_short peer; /* where packet from or to? D2CS or D2DBS */
u_short datalen; /* valid date length */
u_char data[16384];
} D2GSPACKET, *PD2GSPACKET;
/* function */
int CleanupRoutineInsert(CLEANUP_ROUTINE pRoutine, char *comment);
void CloseServerMutex(void);
#endif /* INCLUDED_D2GS_H */