| 1 |
sysadm |
1.1 |
/*
|
| 2 |
|
|
* Copyright (C) 2000,2001 Onlyer (onlyer@263.net)
|
| 3 |
|
|
*
|
| 4 |
|
|
* This program is free software; you can redistribute it and/or
|
| 5 |
|
|
* modify it under the terms of the GNU General Public License
|
| 6 |
|
|
* as published by the Free Software Foundation; either version 2
|
| 7 |
|
|
* of the License, or (at your option) any later version.
|
| 8 |
|
|
*
|
| 9 |
|
|
* This program is distributed in the hope that it will be useful,
|
| 10 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
|
|
* GNU General Public License for more details.
|
| 13 |
|
|
*
|
| 14 |
|
|
* You should have received a copy of the GNU General Public License
|
| 15 |
|
|
* along with this program; if not, write to the Free Software
|
| 16 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 17 |
|
|
*/
|
| 18 |
|
|
#ifndef INCLUDED_D2CS_SETUP_H
|
| 19 |
|
|
#define INCLUDED_D2CS_SETUP_H
|
| 20 |
|
|
|
| 21 |
|
|
/* FIXME: what is this for? */
|
| 22 |
|
|
#ifndef D2CS
|
| 23 |
|
|
# define D2CS
|
| 24 |
|
|
#endif
|
| 25 |
|
|
|
| 26 |
|
|
|
| 27 |
|
|
#ifndef min
|
| 28 |
|
|
# define min(a,b) (((a)>(b))?(b):(a))
|
| 29 |
|
|
#endif
|
| 30 |
|
|
#ifndef max
|
| 31 |
|
|
# define max(a,b) (((a)>(b))?(a):(b))
|
| 32 |
|
|
#endif
|
| 33 |
|
|
|
| 34 |
|
|
#define tf(a) ((a)?1:0)
|
| 35 |
|
|
|
| 36 |
|
|
#define strcmp_charname strcasecmp
|
| 37 |
|
|
#define strncmp_charname strncasencmp
|
| 38 |
|
|
|
| 39 |
|
|
#define BEGIN_LIST_TRAVERSE_DATA(list,data) \
|
| 40 |
|
|
{\
|
| 41 |
|
|
t_elem * curr_elem_;\
|
| 42 |
|
|
for (curr_elem_=list_get_first(list); curr_elem_ && (data=elem_get_data(curr_elem_)); \
|
| 43 |
|
|
curr_elem_=elem_get_next(list,curr_elem_))
|
| 44 |
|
|
|
| 45 |
|
|
#define END_LIST_TRAVERSE_DATA() \
|
| 46 |
|
|
}
|
| 47 |
|
|
|
| 48 |
|
|
#define BEGIN_LIST_TRAVERSE_DATA_CONST(list,data)\
|
| 49 |
|
|
{\
|
| 50 |
|
|
t_elem const * curr_elem_;\
|
| 51 |
|
|
for (curr_elem_=list_get_first_const(list); curr_elem_ && (data=elem_get_data(curr_elem_)); \
|
| 52 |
|
|
curr_elem_=elem_get_next_const(list,curr_elem_))
|
| 53 |
|
|
|
| 54 |
|
|
#define END_LIST_TRAVERSE_DATA_CONST() \
|
| 55 |
|
|
}
|
| 56 |
|
|
|
| 57 |
|
|
#define BEGIN_HASHTABLE_TRAVERSE_DATA(hashtable,data)\
|
| 58 |
|
|
{\
|
| 59 |
|
|
t_entry * curr_entry_;\
|
| 60 |
|
|
for (curr_entry_=hashtable_get_first(hashtable); curr_entry_ && (data=entry_get_data(curr_entry_));\
|
| 61 |
|
|
curr_entry_=entry_get_next(curr_entry_))
|
| 62 |
|
|
|
| 63 |
|
|
#define END_HASHTABLE_TRAVERSE_DATA() \
|
| 64 |
|
|
}
|
| 65 |
|
|
|
| 66 |
|
|
#define BEGIN_HASHTABLE_TRAVERSE_MATCHING_DATA(hashtable,data,hash)\
|
| 67 |
|
|
{\
|
| 68 |
|
|
t_entry * curr_entry_;\
|
| 69 |
|
|
for (curr_entry_=hashtable_get_first_matching(hashtable,hash); \
|
| 70 |
|
|
curr_entry_ && (data=entry_get_data(curr_entry_)); \
|
| 71 |
|
|
curr_entry_ = entry_get_next_matching(curr_entry_))
|
| 72 |
|
|
|
| 73 |
|
|
#define END_HASHTABLE_TRAVERSE_DATA() \
|
| 74 |
|
|
}
|
| 75 |
|
|
|
| 76 |
|
|
#define CASE(condition,func) case condition:\
|
| 77 |
|
|
func;\
|
| 78 |
|
|
break;\
|
| 79 |
|
|
|
| 80 |
|
|
#define ASSERT(var,retval) if (!var) { eventlog(eventlog_level_error,__FUNCTION__,"got NULL " #var); return retval; }
|
| 81 |
|
|
#define DECLARE_PACKET_HANDLER(handler) static int handler(t_connection *, t_packet *);
|
| 82 |
|
|
#define NELEMS(s) sizeof(s)/sizeof(s[0])
|
| 83 |
|
|
|
| 84 |
|
|
#define MAX_SAVEFILE_SIZE 32 * 1024
|
| 85 |
|
|
#define MAX_CHARNAME_LEN 16
|
| 86 |
|
|
#define MAX_GAMENAME_LEN 16
|
| 87 |
|
|
#define MAX_GAMEPASS_LEN 16
|
| 88 |
|
|
#define MAX_GAMEDESC_LEN 32
|
| 89 |
|
|
#define MAX_ACCTNAME_LEN 16
|
| 90 |
|
|
#define MAX_REALMNAME_LEN 32
|
| 91 |
|
|
#define MIN_NAME_LEN 2
|
| 92 |
|
|
#define MAX_CHAR_PER_GAME 8
|
| 93 |
|
|
#define D2CS_SERVER_PORT 6113
|
| 94 |
|
|
#define MAX_GAME_IDLE_TIME 0
|
| 95 |
|
|
#define DEFAULT_S2S_RETRYINTERVAL 60
|
| 96 |
|
|
#define DEFAULT_S2S_TIMEOUT 60
|
| 97 |
|
|
#define DEFAULT_SQ_CHECKINTERVAL 300
|
| 98 |
|
|
#define DEFAULT_SQ_TIMEOUT 300
|
| 99 |
|
|
#define DEFAULT_REALM_NAME "D2CS"
|
| 100 |
|
|
#define DEFAULT_SHUTDOWN_DELAY 300
|
| 101 |
|
|
#define DEFAULT_SHUTDOWN_DECR 60
|
| 102 |
|
|
#define DEFAULT_S2S_IDLETIME 300
|
| 103 |
|
|
#define DEFAULT_S2S_KEEPALIVE_INTERVAL 60
|
| 104 |
|
|
#define DEFAULT_TIMEOUT_CHECKINTERVAL 60
|
| 105 |
|
|
#define DEFAULT_ACC_ALLOWED_SYMBOLS "-_[]"
|
| 106 |
|
|
#define DEFAULT_D2GS_RESTART_DELAY 300
|
| 107 |
|
|
|
| 108 |
|
|
#define MAJOR_VERSION_EQUAL(v1,v2,mask) (((v1) & (mask)) == ((v2) & (mask)))
|
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
#ifndef D2CS_DEFAULT_CONF_FILE
|
| 112 |
|
|
# define D2CS_DEFAULT_CONF_FILE "conf/d2cs.conf"
|
| 113 |
|
|
#endif
|
| 114 |
|
|
|
| 115 |
|
|
#ifndef D2GS_SCOPE_CONF_FILE
|
| 116 |
sysadm |
1.2 |
# define D2GS_SCOPE_CONF_FILE "conf/gsscope.conf"
|
| 117 |
sysadm |
1.1 |
#endif
|
| 118 |
|
|
|
| 119 |
sysadm |
1.3 |
#ifndef CHAR_STATUS_DUMP_FILE
|
| 120 |
|
|
# define CHAR_STATUS_DUMP_FILE "/tmp/d2charstatus.dmp"
|
| 121 |
|
|
#endif
|
| 122 |
|
|
|
| 123 |
sysadm |
1.1 |
#define DEFAULT_LOG_FILE "/usr/local/var/d2cs.log"
|
| 124 |
|
|
#define DEFAULT_LOG_LEVELS "info,warn,error"
|
| 125 |
|
|
#define DEFAULT_MEMLOG_FILE "/tmp/d2cs-mem.log"
|
| 126 |
|
|
|
| 127 |
|
|
#define D2CS_SERVER_ADDRS "0.0.0.0"
|
| 128 |
|
|
#define D2GS_SERVER_LIST "192.168.0.1"
|
| 129 |
|
|
#define BNETD_SERVER_LIST "192.168.0.1"
|
| 130 |
|
|
#define MAX_D2GAME_NUMBER 30
|
| 131 |
|
|
#define MAX_CHAR_PER_ACCT 8
|
| 132 |
|
|
// MAX_MAX_CHAR_PER_ACCT is needed cause D2 client can only handle 21 character
|
| 133 |
|
|
#define MAX_MAX_CHAR_PER_ACCT 21
|
| 134 |
|
|
#define MAX_CLIENT_IDLETIME 30 * 60
|
| 135 |
|
|
|
| 136 |
|
|
#define D2CS_CHARINFO_DIR "/usr/local/var/charinfo"
|
| 137 |
|
|
#define D2CS_CHARSAVE_DIR "/usr/local/var/charsave"
|
| 138 |
|
|
#define D2CS_BAK_CHARINFO_DIR "/usr/local/var/bak/charinfo"
|
| 139 |
|
|
#define D2CS_BAK_CHARSAVE_DIR "/usr/local/var/bak/charsave"
|
| 140 |
|
|
#define D2CS_CHARSAVE_NEWBIE "/usr/local/var/files/newbie.save"
|
| 141 |
|
|
#define D2CS_TRANS_FILE "/usr/local/etc/address_translation.conf"
|
| 142 |
|
|
#define D2CS_LADDER_DIR "/usr/local/var/ladders"
|
| 143 |
|
|
|
| 144 |
|
|
#define D2CS_MOTD "No MOTD yet"
|
| 145 |
|
|
|
| 146 |
|
|
#define LIST_PURGE_INTERVAL 300
|
| 147 |
|
|
#define GAMEQUEUE_CHECK_INTERVAL 60
|
| 148 |
|
|
|
| 149 |
|
|
#define MAX_GAME_LIST 20
|
| 150 |
|
|
|
| 151 |
|
|
#endif
|