| 1 | /* |
| 2 | * Copyright (C) 2000,2001 Onlyer ([email protected]) |
| 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 | #define tf(a) ((a)?1:0) |
| 22 | |
| 23 | #define strcmp_charname strcasecmp |
| 24 | #define strncmp_charname strncasencmp |
| 25 | |
| 26 | #define BEGIN_LIST_TRAVERSE_DATA(list,data,type) \ |
| 27 | {\ |
| 28 | t_elem * curr_elem_; \ |
| 29 | for (curr_elem_ = list_get_first(list); curr_elem_ && (data = (type*)elem_get_data(curr_elem_)); \ |
| 30 | curr_elem_ = elem_get_next(list, curr_elem_)) |
| 31 | |
| 32 | #define END_LIST_TRAVERSE_DATA() \ |
| 33 | } |
| 34 | |
| 35 | #define BEGIN_LIST_TRAVERSE_DATA_CONST(list,data,type)\ |
| 36 | {\ |
| 37 | t_elem const * curr_elem_; \ |
| 38 | for (curr_elem_ = list_get_first_const(list); curr_elem_ && (data = (type*)elem_get_data(curr_elem_)); \ |
| 39 | curr_elem_ = elem_get_next_const(list, curr_elem_)) |
| 40 | |
| 41 | #define END_LIST_TRAVERSE_DATA_CONST() \ |
| 42 | } |
| 43 | |
| 44 | #define BEGIN_HASHTABLE_TRAVERSE_DATA(hashtable,data,type)\ |
| 45 | {\ |
| 46 | t_entry * curr_entry_; \ |
| 47 | for (curr_entry_ = hashtable_get_first(hashtable); curr_entry_ && (data = (type*)entry_get_data(curr_entry_)); \ |
| 48 | curr_entry_ = entry_get_next(curr_entry_)) |
| 49 | |
| 50 | #define END_HASHTABLE_TRAVERSE_DATA() \ |
| 51 | } |
| 52 | |
| 53 | #define BEGIN_HASHTABLE_TRAVERSE_MATCHING_DATA(hashtable,data,hash,type)\ |
| 54 | {\ |
| 55 | t_entry * curr_entry_; \ |
| 56 | for (curr_entry_ = hashtable_get_first_matching(hashtable, hash); \ |
| 57 | curr_entry_ && (data = (type*)entry_get_data(curr_entry_)); \ |
| 58 | curr_entry_ = entry_get_next_matching(curr_entry_)) |
| 59 | |
| 60 | #define END_HASHTABLE_TRAVERSE_DATA() \ |
| 61 | } |
| 62 | |
| 63 | #define CASE(condition,func) case condition:\ |
| 64 | func; \ |
| 65 | break; \ |
| 66 | |
| 67 | #define ASSERT(var,retval) if (!var) { eventlog(eventlog_level_error,__FUNCTION__,"got NULL " #var); return retval; } |
| 68 | #define DECLARE_PACKET_HANDLER(handler) static int handler(t_connection *, t_packet *); |
| 69 | #define NELEMS(s) sizeof(s)/sizeof(s[0]) |
| 70 | |
| 71 | #define MAX_SAVEFILE_SIZE 32 * 1024 |
| 72 | #define MAX_CHAR_PER_GAME 8 |
| 73 | #define D2CS_SERVER_PORT 6113 |
| 74 | #define MAX_GAME_IDLE_TIME 0 |
| 75 | #define DEFAULT_S2S_RETRYINTERVAL 60 |
| 76 | #define DEFAULT_S2S_TIMEOUT 60 |
| 77 | #define DEFAULT_SQ_CHECKINTERVAL 300 |
| 78 | #define DEFAULT_SQ_TIMEOUT 300 |
| 79 | #define DEFAULT_REALM_NAME "D2CS" |
| 80 | #define DEFAULT_SHUTDOWN_DELAY 300 |
| 81 | #define DEFAULT_SHUTDOWN_DECR 60 |
| 82 | #define DEFAULT_S2S_IDLETIME 300 |
| 83 | #define DEFAULT_S2S_KEEPALIVE_INTERVAL 60 |
| 84 | #define DEFAULT_TIMEOUT_CHECKINTERVAL 60 |
| 85 | #define DEFAULT_ACC_ALLOWED_SYMBOLS "-_[]" |
| 86 | #define DEFAULT_D2GS_RESTART_DELAY 300 |
| 87 | |
| 88 | #define MAJOR_VERSION_EQUAL(v1,v2,mask) (((v1) & (mask)) == ((v2) & (mask))) |
| 89 | |
| 90 | |
| 91 | #ifndef D2CS_DEFAULT_CONF_FILE |
| 92 | # define D2CS_DEFAULT_CONF_FILE "conf/d2cs.conf" |
| 93 | #endif |
| 94 | |
| 95 | #define DEFAULT_LOG_FILE "/usr/local/var/d2cs.std::log" |
| 96 | #define DEFAULT_LOG_LEVELS "info,warn,error" |
| 97 | #define DEFAULT_MEMLOG_FILE "/tmp/d2cs-mem.std::log" |
| 98 | |
| 99 | #define D2CS_SERVER_ADDRS "0.0.0.0" |
| 100 | #define D2GS_SERVER_LIST "192.168.0.1" |
| 101 | #define BNETD_SERVER_LIST "192.168.0.1" |
| 102 | #define MAX_D2GAME_NUMBER 30 |
| 103 | #define MAX_CHAR_PER_ACCT 8 |
| 104 | // MAX_MAX_CHAR_PER_ACCT is needed cause D2 client can at worst case only handle 18 chars |
| 105 | #define MAX_MAX_CHAR_PER_ACCT 18 |
| 106 | #define MAX_CLIENT_IDLETIME 30 * 60 |
| 107 | |
| 108 | #define D2CS_CHARINFO_DIR "/usr/local/var/charinfo" |
| 109 | #define D2CS_CHARSAVE_DIR "/usr/local/var/charsave" |
| 110 | #define D2CS_BAK_CHARINFO_DIR "/usr/local/var/bak/charinfo" |
| 111 | #define D2CS_BAK_CHARSAVE_DIR "/usr/local/var/bak/charsave" |
| 112 | #define D2CS_CHARSAVE_NEWBIE "/usr/local/var/files/newbie.save" |
| 113 | #define D2CS_TRANS_FILE "/usr/local/etc/address_translation.conf" |
| 114 | #define D2CS_LADDER_DIR "/usr/local/var/ladders" |
| 115 | |
| 116 | #define D2CS_MOTD "No MOTD yet" |
| 117 | |
| 118 | #define LIST_PURGE_INTERVAL 300 |
| 119 | #define GAMEQUEUE_CHECK_INTERVAL 60 |
| 120 | |
| 121 | #define MAX_GAME_LIST 20 |
| 122 | |
| 123 | #endif |