| 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 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 19 | #include "setup.h"cxx . . $ `<file>/src/d2cs/setup.h`/ |
| 20 | #include "connection.h"cxx . . $ `<file>/src/d2cs/connection.h`/ |
| 21 | |
| 22 | #include <limits> |
| 23 | #include <cctype> |
| 24 | #include <cstring> |
| 25 | #include <ctime> |
| 26 | #include <cassert> |
| 27 | |
| 28 | #include "compat/psock.h"cxx . . $ `<file>/src/compat/psock.h`/ |
| 29 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 30 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 31 | #include "common/introtate.h"cxx . . $ `<file>/src/common/introtate.h`/ |
| 32 | #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/ |
| 33 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 34 | #include "common/network.h"cxx . . $ `<file>/src/common/network.h`/ |
| 35 | #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/ |
| 36 | #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/ |
| 37 | #include "game.h"cxx . . $ `<file>/src/d2cs/game.h`/ |
| 38 | #include "net.h"cxx . . $ `<file>/src/d2cs/net.h`/ |
| 39 | #include "handle_init.h"cxx . . $ `<file>/src/d2cs/handle_init.h`/ |
| 40 | #include "handle_bnetd.h"cxx . . $ `<file>/src/d2cs/handle_bnetd.h`/ |
| 41 | #include "handle_d2cs.h"cxx . . $ `<file>/src/d2cs/handle_d2cs.h`/ |
| 42 | #include "handle_d2gs.h"cxx . . $ `<file>/src/d2cs/handle_d2gs.h`/ |
| 43 | #include "d2gs.h"cxx . . $ `<file>/src/d2cs/d2gs.h`/ |
| 44 | #include "s2s.h"cxx . . $ `<file>/src/d2cs/s2s.h`/ |
| 45 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 46 | |
| 47 | namespace pvpgncxx . . $ pvpgn/ |
| 48 | { |
| 49 | |
| 50 | namespace d2cscxx . . $ pvpgn/d2cs/ |
| 51 | { |
| 52 | |
| 53 | static t_hashtablecxx . . $ pvpgn/t_hashtable# * connlist_headcxx . . $ pvpgn/d2cs/connlist_head. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 54 | static t_hashtablecxx . . $ pvpgn/t_hashtable# * conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 55 | static t_list * connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 56 | static unsigned int total_connectioncxx . . $ pvpgn/d2cs/total_connection. = 0; |
| 57 | |
| 58 | static int conn_handle_connectingcxx . . $ pvpgn/d2cs/conn_handle_connecting(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 59 | static t_packetcxx . . $ pvpgn/t_packet# * conn_create_packetcxx . . $ pvpgn/d2cs/conn_create_packet(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 60 | static int conn_handle_packetcxx . . $ pvpgn/d2cs/conn_handle_packet(5937b18ec8c7bf53).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet); |
| 61 | static int conn_handle_readcxx . . $ pvpgn/d2cs/conn_handle_read(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 62 | static int conn_handle_writecxx . . $ pvpgn/d2cs/conn_handle_write(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 63 | static unsigned int conn_charname_hashcxx . . $ pvpgn/d2cs/conn_charname_hash(c61c63047ce273de).(char const * charname); |
| 64 | static unsigned int conn_sessionnum_hashcxx . . $ pvpgn/d2cs/conn_sessionnum_hash(2141b656ce2cc063).(unsigned int sessionnum); |
| 65 | |
| 66 | static unsigned int conn_sessionnum_hashcxx . . $ pvpgn/d2cs/conn_sessionnum_hash(2141b656ce2cc063).(unsigned int sessionnum) |
| 67 | { |
| 68 | return sessionnum; |
| 69 | } |
| 70 | |
| 71 | static unsigned int conn_charname_hashcxx . . $ pvpgn/d2cs/conn_charname_hash(c61c63047ce273de).(char const * charname) |
| 72 | { |
| 73 | unsigned int hash; |
| 74 | unsigned int i, len, pos; |
| 75 | unsigned int ch; |
| 76 | |
| 77 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, 0); |
| 78 | len = stdcxx . . $ std/::strlen(charname); |
| 79 | for (hash = 0, i = 0, pos = 0; i < len; i++) { |
| 80 | ch = safe_tolowercxx . . $ `src/common/xstring.h:41:10`!(charname[i]); |
| 81 | hash ^= ROTLcxx . . $ `src/common/introtate.h:50:9`!(ch, pos, (std::numeric_limits<unsigned int>::digits)); |
| 82 | pos += (stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<unsigned char>::digitscxx . . $ std/numeric_limits#digits.) - 1; |
| 83 | } |
| 84 | return hash; |
| 85 | } |
| 86 | |
| 87 | extern t_hashtablecxx . . $ pvpgn/t_hashtable# * d2cs_connlistcxx . . $ pvpgn/d2cs/d2cs_connlist(be8548fcc1b5d2a).(void) |
| 88 | { |
| 89 | return connlist_headcxx . . $ pvpgn/d2cs/connlist_head.; |
| 90 | } |
| 91 | |
| 92 | extern int d2cs_connlist_createcxx . . $ pvpgn/d2cs/d2cs_connlist_create(b126dc7c1de90089).(void) |
| 93 | { |
| 94 | if (!(connlist_headcxx . . $ pvpgn/d2cs/connlist_head. = hashtable_createcxx . . $ pvpgn/hashtable_create(7bfadb07e2d0490a).(200))) return -1; |
| 95 | if (!(conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head. = hashtable_createcxx . . $ pvpgn/hashtable_create(7bfadb07e2d0490a).(200))) return -1; |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | extern int d2cs_connlist_destroycxx . . $ pvpgn/d2cs/d2cs_connlist_destroy(b126dc7c1de90089).(void) |
| 100 | { |
| 101 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 102 | t_elem * curr; |
| 103 | |
| 104 | |
| 105 | if (connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead.) { |
| 106 | d2cs_connlist_reapcxx . . $ pvpgn/d2cs/d2cs_connlist_reap(b126dc7c1de90089).(); |
| 107 | if (list_destroy(connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead.)) |
| 108 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error destroy conndead list"); |
| 109 | connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 110 | } |
| 111 | |
| 112 | BEGIN_HASHTABLE_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:44:9`!(connlist_head, c, t_connection) |
| 113 | { |
| 114 | d2cs_conn_destroycxx . . $ pvpgn/d2cs/d2cs_conn_destroy(1db121a5d939189b).(c, &curr); |
| 115 | } |
| 116 | END_HASHTABLE_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:60:9`!() |
| 117 | |
| 118 | if (hashtable_destroycxx . . $ pvpgn/hashtable_destroy(8afcf31a4e16cf42).(connlist_headcxx . . $ pvpgn/d2cs/connlist_head.) < 0) { |
| 119 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error destroy connection list"); |
| 120 | return -1; |
| 121 | } |
| 122 | connlist_headcxx . . $ pvpgn/d2cs/connlist_head. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 123 | |
| 124 | if (hashtable_destroycxx . . $ pvpgn/hashtable_destroy(8afcf31a4e16cf42).(conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head.) < 0) { |
| 125 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error destroy connection charname list"); |
| 126 | return -1; |
| 127 | } |
| 128 | conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 129 | return 0; |
| 130 | } |
| 131 | |
| 132 | extern int d2cs_connlist_reapcxx . . $ pvpgn/d2cs/d2cs_connlist_reap(b126dc7c1de90089).(void) |
| 133 | { |
| 134 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 135 | |
| 136 | if (!connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead.) return 0; |
| 137 | BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(connlist_dead, c, t_connection) |
| 138 | { |
| 139 | d2cs_conn_destroycxx . . $ pvpgn/d2cs/d2cs_conn_destroy(1db121a5d939189b).(c, &curr_elem_); |
| 140 | } |
| 141 | END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!() |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | extern int conn_check_multilogincxx . . $ pvpgn/d2cs/conn_check_multilogin(636e7872f5a2b03c).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c, char const * charname) |
| 147 | { |
| 148 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * conn; |
| 149 | |
| 150 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 151 | if (!prefs_check_multilogincxx . . $ pvpgn/d2cs/prefs_check_multilogin(db52760e79bf9054).()) return 0; |
| 152 | if (gamelist_find_charactercxx . . $ pvpgn/d2cs/gamelist_find_character(6da516f6176bdca0).(charname)) { |
| 153 | return -1; |
| 154 | } |
| 155 | conn = d2cs_connlist_find_connection_by_charnamecxx . . $ pvpgn/d2cs/d2cs_connlist_find_connection_by_charname(fe46e8d6a7b3eb1f).(charname); |
| 156 | if (conn && conn != c) { |
| 157 | return -1; |
| 158 | } |
| 159 | return 0; |
| 160 | } |
| 161 | |
| 162 | extern t_connectioncxx . . $ pvpgn/d2cs/t_connection# * d2cs_connlist_find_connection_by_sessionnumcxx . . $ pvpgn/d2cs/d2cs_connlist_find_connection_by_sessionnum(ffc4e98cf54e05f7).(unsigned int sessionnum) |
| 163 | { |
| 164 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 165 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 166 | unsigned int hash; |
| 167 | |
| 168 | hash = conn_sessionnum_hashcxx . . $ pvpgn/d2cs/conn_sessionnum_hash(2141b656ce2cc063).(sessionnum); |
| 169 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `src/common/hashtable.h:108:9`!(connlist_head, curr, hash) |
| 170 | { |
| 171 | if (!(c = (t_connectioncxx . . $ pvpgn/d2cs/t_connection#*)entry_get_datacxx . . $ pvpgn/entry_get_data(ad401fc46215ce52).(curr))) { |
| 172 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection in list"); |
| 173 | } |
| 174 | else if (c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum. == sessionnum) { |
| 175 | hashtable_entry_releasecxx . . $ pvpgn/hashtable_entry_release(ac222f288a486716).(curr); |
| 176 | return c; |
| 177 | } |
| 178 | } |
| 179 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 180 | } |
| 181 | |
| 182 | extern t_connectioncxx . . $ pvpgn/d2cs/t_connection# * d2cs_connlist_find_connection_by_charnamecxx . . $ pvpgn/d2cs/d2cs_connlist_find_connection_by_charname(fe46e8d6a7b3eb1f).(char const * charname) |
| 183 | { |
| 184 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 185 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 186 | unsigned int hash; |
| 187 | |
| 188 | hash = conn_charname_hashcxx . . $ pvpgn/d2cs/conn_charname_hash(c61c63047ce273de).(charname); |
| 189 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `src/common/hashtable.h:108:9`!(connlist_head, curr, hash) |
| 190 | { |
| 191 | if (!(c = (t_connectioncxx . . $ pvpgn/d2cs/t_connection#*)entry_get_datacxx . . $ pvpgn/entry_get_data(ad401fc46215ce52).(curr))) { |
| 192 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection in list"); |
| 193 | } |
| 194 | else { |
| 195 | if (!c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname.) continue; |
| 196 | if (!strcmp_charnamecxx . . $ `src/d2cs/setup.h:23:9`!(c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname., charname)) { |
| 197 | hashtable_entry_releasecxx . . $ pvpgn/hashtable_entry_release(ac222f288a486716).(curr); |
| 198 | return c; |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 203 | } |
| 204 | |
| 205 | static t_packetcxx . . $ pvpgn/t_packet# * conn_create_packetcxx . . $ pvpgn/d2cs/conn_create_packet(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 206 | { |
| 207 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 208 | |
| 209 | switch (c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.) { |
| 210 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_init, packet = packet_create(packet_class_init)); |
| 211 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_d2cs, packet = packet_create(packet_class_d2cs)); |
| 212 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_d2gs, packet = packet_create(packet_class_d2gs)); |
| 213 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_bnetd, packet = packet_create(packet_class_d2cs_bnetd)); |
| 214 | default: |
| 215 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad connection class {}", c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.); |
| 216 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 217 | } |
| 218 | if (!packet) { |
| 219 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error create packet"); |
| 220 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 221 | } |
| 222 | d2cs_conn_set_in_queuecxx . . $ pvpgn/d2cs/d2cs_conn_set_in_queue(32e536cd64efe99b).(c, packet); |
| 223 | return packet; |
| 224 | } |
| 225 | |
| 226 | static int conn_handle_connectingcxx . . $ pvpgn/d2cs/conn_handle_connecting(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 227 | { |
| 228 | int retval; |
| 229 | |
| 230 | if (net_check_connectedcxx . . $ pvpgn/d2cs/net_check_connected(7864480464b09eea).(c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock.) < 0) { |
| 231 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "can not connect to {}", addr_num_to_addr_strcxx . . $ pvpgn/addr_num_to_addr_str(9313bf3c546cb16).(c->addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#addr., c->portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#port.)); |
| 232 | return -1; |
| 233 | } |
| 234 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "connected to {}", addr_num_to_addr_strcxx . . $ pvpgn/addr_num_to_addr_str(9313bf3c546cb16).(c->addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#addr., c->portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#port.)); |
| 235 | c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. = conn_state_initcxx . . $ pvpgn/d2cs/conn_state_init.; |
| 236 | /* this is a kind of hack to not update fd but updating breaks kqueue |
| 237 | * and the clean fix would require a cache a userland copy of the kernel |
| 238 | * kqueue fds, considering that it also doesnt brake anything else should do |
| 239 | * for the moment |
| 240 | fdwatch_update_fd(c->sock, fdwatch_type_read); */ |
| 241 | switch (c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.) { |
| 242 | case conn_class_bnetdcxx . . $ pvpgn/d2cs/conn_class_bnetd.: |
| 243 | retval = handle_bnetd_initcxx . . $ pvpgn/d2cs/handle_bnetd_init(2043ce9004c1cbc1).(c); |
| 244 | break; |
| 245 | default: |
| 246 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad connection class {}", c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.); |
| 247 | return -1; |
| 248 | } |
| 249 | return retval; |
| 250 | } |
| 251 | |
| 252 | static int conn_handle_packetcxx . . $ pvpgn/d2cs/conn_handle_packet(5937b18ec8c7bf53).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet) |
| 253 | { |
| 254 | int retval; |
| 255 | |
| 256 | switch (c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.) { |
| 257 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_init, retval = d2cs_handle_init_packet(c, packet)); |
| 258 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_d2cs, retval = d2cs_handle_d2cs_packet(c, packet)); |
| 259 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_d2gs, retval = handle_d2gs_packet(c, packet)); |
| 260 | CASEcxx . . $ `src/d2cs/setup.h:63:9`!(conn_class_bnetd, retval = handle_bnetd_packet(c, packet)); |
| 261 | default: |
| 262 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad connection class {} (close connection)", c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.); |
| 263 | retval = -1; |
| 264 | break; |
| 265 | } |
| 266 | return retval; |
| 267 | } |
| 268 | |
| 269 | static int conn_handle_readcxx . . $ pvpgn/d2cs/conn_handle_read(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 270 | { |
| 271 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 272 | int retval; |
| 273 | |
| 274 | packet = d2cs_conn_get_in_queuecxx . . $ pvpgn/d2cs/d2cs_conn_get_in_queue(18bf395024c270e7).(c); |
| 275 | if (!packet) { |
| 276 | packet = conn_create_packetcxx . . $ pvpgn/d2cs/conn_create_packet(6c0ef7f20a17d55d).(c); |
| 277 | if (!packet) return -1; |
| 278 | c->insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize. = 0; |
| 279 | } |
| 280 | |
| 281 | switch (net_recv_packetcxx . . $ pvpgn/net_recv_packet(364823e0b5ea3b9f).(c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock., packet, &c->insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize.)) { |
| 282 | case -1: |
| 283 | retval = -1; |
| 284 | break; |
| 285 | case 0: |
| 286 | retval = 0; |
| 287 | break; |
| 288 | case 1: |
| 289 | c->insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize. = 0; |
| 290 | d2cs_conn_set_in_queuecxx . . $ pvpgn/d2cs/d2cs_conn_set_in_queue(32e536cd64efe99b).(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 291 | retval = conn_handle_packetcxx . . $ pvpgn/d2cs/conn_handle_packet(5937b18ec8c7bf53).(c, packet); |
| 292 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 293 | break; |
| 294 | default: |
| 295 | retval = 0; |
| 296 | break; |
| 297 | } |
| 298 | return retval; |
| 299 | } |
| 300 | |
| 301 | static int conn_handle_writecxx . . $ pvpgn/d2cs/conn_handle_write(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 302 | { |
| 303 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 304 | int retval; |
| 305 | |
| 306 | if (c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. == conn_state_connectingcxx . . $ pvpgn/d2cs/conn_state_connecting.) { |
| 307 | return conn_handle_connectingcxx . . $ pvpgn/d2cs/conn_handle_connecting(2043ce9004c1cbc1).(c); |
| 308 | } |
| 309 | |
| 310 | if (!(packet = conn_peek_outqueuecxx . . $ pvpgn/d2cs/conn_peek_outqueue(6c0ef7f20a17d55d).(c))) return 0; |
| 311 | |
| 312 | switch (net_send_packetcxx . . $ pvpgn/net_send_packet(98ac2114d339f481).(c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock., packet, &c->outsizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsize.)) { |
| 313 | case -1: |
| 314 | retval = -1; |
| 315 | break; |
| 316 | case 0: |
| 317 | retval = 0; |
| 318 | break; |
| 319 | case 1: |
| 320 | c->outsizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsize. = 0; |
| 321 | packet = conn_pull_outqueuecxx . . $ pvpgn/d2cs/conn_pull_outqueue(6c0ef7f20a17d55d).(c); |
| 322 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 323 | retval = 0; |
| 324 | break; |
| 325 | default: |
| 326 | retval = -1; |
| 327 | } |
| 328 | return retval; |
| 329 | } |
| 330 | |
| 331 | extern int conn_handle_socketcxx . . $ pvpgn/d2cs/conn_handle_socket(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 332 | { |
| 333 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# now; |
| 334 | |
| 335 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 336 | now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 337 | if (c->socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag. & SOCKET_FLAG_READcxx . . $ `src/d2cs/connection.h:92:9`!) { |
| 338 | if (conn_handle_readcxx . . $ pvpgn/d2cs/conn_handle_read(2043ce9004c1cbc1).(c) < 0) return -1; |
| 339 | c->last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active. = now; |
| 340 | } |
| 341 | if (c->socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag. & SOCKET_FLAG_WRITEcxx . . $ `src/d2cs/connection.h:93:9`!) { |
| 342 | if (conn_handle_writecxx . . $ pvpgn/d2cs/conn_handle_write(2043ce9004c1cbc1).(c) < 0) return -1; |
| 343 | c->last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active. = now; |
| 344 | } |
| 345 | c->socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag. = 0; |
| 346 | return 0; |
| 347 | } |
| 348 | |
| 349 | extern int connlist_check_timeoutcxx . . $ pvpgn/d2cs/connlist_check_timeout(b126dc7c1de90089).(void) |
| 350 | { |
| 351 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 352 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# now; |
| 353 | |
| 354 | now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 355 | BEGIN_HASHTABLE_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:44:9`!(connlist_head, c, t_connection) |
| 356 | { |
| 357 | switch (c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.) { |
| 358 | case conn_class_d2cscxx . . $ pvpgn/d2cs/conn_class_d2cs.: |
| 359 | if (prefs_get_idletimecxx . . $ pvpgn/d2cs/prefs_get_idletime(db52760e79bf9054).() && (now - c->last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active. > prefs_get_idletimecxx . . $ pvpgn/d2cs/prefs_get_idletime(db52760e79bf9054).())) { |
| 360 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "client {} idled too long std::time, destroy it", c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum.); |
| 361 | d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(c, conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy.); |
| 362 | } |
| 363 | break; |
| 364 | case conn_class_d2gscxx . . $ pvpgn/d2cs/conn_class_d2gs.: |
| 365 | if (prefs_get_s2s_idletimecxx . . $ pvpgn/d2cs/prefs_get_s2s_idletime(db52760e79bf9054).() && now - c->last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active. > prefs_get_s2s_idletimecxx . . $ pvpgn/d2cs/prefs_get_s2s_idletime(db52760e79bf9054).()) { |
| 366 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "server {} timed out", c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum.); |
| 367 | d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(c, conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy.); |
| 368 | } |
| 369 | break; |
| 370 | case conn_class_bnetdcxx . . $ pvpgn/d2cs/conn_class_bnetd.: |
| 371 | break; |
| 372 | default: |
| 373 | break; |
| 374 | } |
| 375 | } |
| 376 | END_HASHTABLE_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:60:9`!() |
| 377 | return 0; |
| 378 | } |
| 379 | |
| 380 | extern t_connectioncxx . . $ pvpgn/d2cs/t_connection# * d2cs_conn_createcxx . . $ pvpgn/d2cs/d2cs_conn_create(4cb7e5fc0a5b19b8).(int sock, unsigned int local_addr, unsigned short local_port, |
| 381 | unsigned int addr, unsigned short port) |
| 382 | { |
| 383 | static unsigned int sessionnum = 1; |
| 384 | t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c; |
| 385 | |
| 386 | if (sock < 0) { |
| 387 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad socket"); |
| 388 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 389 | } |
| 390 | c = (t_connectioncxx . . $ pvpgn/d2cs/t_connection#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_connection)); |
| 391 | c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 392 | c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 393 | c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock. = sock; |
| 394 | c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx. = -1; |
| 395 | c->socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag. = 0; |
| 396 | c->local_addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#local_addr. = local_addr; |
| 397 | c->local_portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#local_port. = local_port; |
| 398 | c->addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#addr. = addr; |
| 399 | c->portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#port. = port; |
| 400 | c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass. = conn_class_initcxx . . $ pvpgn/d2cs/conn_class_init.; |
| 401 | c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. = conn_state_initcxx . . $ pvpgn/d2cs/conn_state_init.; |
| 402 | c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum. = sessionnum++; |
| 403 | c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 404 | c->inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 405 | c->outsizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsize. = 0; |
| 406 | c->outsizepcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsizep. = 0; |
| 407 | c->insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize. = 0; |
| 408 | c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 409 | c->d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id. = 0; |
| 410 | c->gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 411 | c->last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active. = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 412 | c->sessionnum_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum_hash. = conn_sessionnum_hashcxx . . $ pvpgn/d2cs/conn_sessionnum_hash(2141b656ce2cc063).(c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum.); |
| 413 | c->bnetd_sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#bnetd_sessionnum. = 0; |
| 414 | c->charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash. = 0; |
| 415 | if (hashtable_insert_datacxx . . $ pvpgn/hashtable_insert_data(e38f1de6fd62ec3a).(connlist_headcxx . . $ pvpgn/d2cs/connlist_head., c, c->sessionnum_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum_hash.) < 0) { |
| 416 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(c); |
| 417 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error add connection to list"); |
| 418 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 419 | } |
| 420 | total_connectioncxx . . $ pvpgn/d2cs/total_connection.++; |
| 421 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "created session={} socket={} ({} current connections)", c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum., sock, total_connectioncxx . . $ pvpgn/d2cs/total_connection.); |
| 422 | return c; |
| 423 | } |
| 424 | |
| 425 | extern int d2cs_conn_destroycxx . . $ pvpgn/d2cs/d2cs_conn_destroy(1db121a5d939189b).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_elem ** curr) |
| 426 | { |
| 427 | t_elem * elem; |
| 428 | |
| 429 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 430 | if (c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. == conn_state_destroyingcxx . . $ pvpgn/d2cs/conn_state_destroying.) return 0; |
| 431 | if (hashtable_remove_datacxx . . $ pvpgn/hashtable_remove_data(c6644015312508b0).(connlist_headcxx . . $ pvpgn/d2cs/connlist_head., c, c->sessionnum_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum_hash.) < 0) { |
| 432 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error remove connection from list"); |
| 433 | return -1; |
| 434 | } |
| 435 | c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. = conn_state_destroyingcxx . . $ pvpgn/d2cs/conn_state_destroying.; |
| 436 | if (c->d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id. && c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass. == conn_class_d2gscxx . . $ pvpgn/d2cs/conn_class_d2gs.) { |
| 437 | d2gs_deactivecxx . . $ pvpgn/d2cs/d2gs_deactive(9b01a82329d01ede).(d2gslist_find_gscxx . . $ pvpgn/d2cs/d2gslist_find_gs(a5ff5b022d63132f).(c->d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id.), c); |
| 438 | } |
| 439 | if (c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass. == conn_class_bnetdcxx . . $ pvpgn/d2cs/conn_class_bnetd.) { |
| 440 | s2s_destroycxx . . $ pvpgn/d2cs/s2s_destroy(2043ce9004c1cbc1).(c); |
| 441 | } |
| 442 | if (c->gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue.) { |
| 443 | gq_destroycxx . . $ pvpgn/d2cs/gq_destroy(cf9f34ccc49a2ace).(c->gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue., &elem); |
| 444 | } |
| 445 | if (c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->account); |
| 446 | if (c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->charinfo); |
| 447 | if (c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname.) d2cs_conn_set_charnamecxx . . $ pvpgn/d2cs/d2cs_conn_set_charname(127e6fcf538cb408).(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 448 | if (c->inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue.) packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(c->inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue.); |
| 449 | queue_clearcxx . . $ pvpgn/queue_clear(e7fc052edc0a6819).(&c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue.); |
| 450 | |
| 451 | if (connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead.) list_remove_data(connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead., c, curr); |
| 452 | fdwatch_del_fdcxx . . $ pvpgn/fdwatch_del_fd(7864480464b09eea).(c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx.); |
| 453 | psock_shutdowncxx . . $ `src/compat/psock.h:299:9`!(c->sock, PSOCK_SHUT_RDWRcxx . . $ `src/compat/psock.h:263:10`!); |
| 454 | psock_closecxx . . $ `src/compat/psock.h:300:9`!(c->sock); |
| 455 | |
| 456 | total_connectioncxx . . $ pvpgn/d2cs/total_connection.--; |
| 457 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] closed connection {} ({} left)", c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock., c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum., total_connectioncxx . . $ pvpgn/d2cs/total_connection.); |
| 458 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(c); |
| 459 | return 0; |
| 460 | } |
| 461 | |
| 462 | extern int d2cs_conn_get_socketcxx . . $ pvpgn/d2cs/d2cs_conn_get_socket(5cce2089e3f63aaf).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 463 | { |
| 464 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 465 | return c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock.; |
| 466 | } |
| 467 | |
| 468 | extern t_conn_statecxx . . $ pvpgn/d2cs/t_conn_state# d2cs_conn_get_statecxx . . $ pvpgn/d2cs/d2cs_conn_get_state(d7c7cd454402ea03).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 469 | { |
| 470 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, conn_state_none); |
| 471 | return c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state.; |
| 472 | } |
| 473 | |
| 474 | extern int d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_conn_statecxx . . $ pvpgn/d2cs/t_conn_state# state) |
| 475 | { |
| 476 | t_elem * curr; |
| 477 | |
| 478 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 479 | /* special case for destroying connections, add them to connlist_dead list */ |
| 480 | if (state == conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy. && c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. != conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy.) { |
| 481 | if (!connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead.) |
| 482 | connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead. = list_create(); |
| 483 | list_append_data(connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead., c); |
| 484 | } |
| 485 | else if (state != conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy. && c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. == conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy.) { |
| 486 | if (list_remove_data(connlist_deadcxx . . $ pvpgn/d2cs/connlist_dead., c, &curr)) { |
| 487 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not remove dead connection"); |
| 488 | return -1; |
| 489 | } |
| 490 | } |
| 491 | c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. = state; |
| 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | extern t_conn_classcxx . . $ pvpgn/d2cs/t_conn_class# d2cs_conn_get_classcxx . . $ pvpgn/d2cs/d2cs_conn_get_class(7dc3dc6c3bcda4e9).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 496 | { |
| 497 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, conn_class_none); |
| 498 | return c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.; |
| 499 | } |
| 500 | |
| 501 | extern int d2cs_conn_set_classcxx . . $ pvpgn/d2cs/d2cs_conn_set_class(b2d3cf3c2f5d38f).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_conn_classcxx . . $ pvpgn/d2cs/t_conn_class# cclass) |
| 502 | { |
| 503 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 504 | c->cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass. = cclass; |
| 505 | return 0; |
| 506 | } |
| 507 | |
| 508 | extern t_packetcxx . . $ pvpgn/t_packet# * d2cs_conn_get_in_queuecxx . . $ pvpgn/d2cs/d2cs_conn_get_in_queue(18bf395024c270e7).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 509 | { |
| 510 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 511 | return c->inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue.; |
| 512 | } |
| 513 | |
| 514 | extern void d2cs_conn_set_in_queuecxx . . $ pvpgn/d2cs/d2cs_conn_set_in_queue(32e536cd64efe99b).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# *packet) |
| 515 | { |
| 516 | assertcxx . . $ `/usr/include/assert.h:102:11`!(c); |
| 517 | c->inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue. = packet; |
| 518 | } |
| 519 | |
| 520 | extern unsigned int d2cs_conn_get_out_sizecxx . . $ pvpgn/d2cs/d2cs_conn_get_out_size(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 521 | { |
| 522 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 523 | return c->outsizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsize.; |
| 524 | } |
| 525 | |
| 526 | extern t_queuecxx . . $ pvpgn/t_queue# * * d2cs_conn_get_out_queuecxx . . $ pvpgn/d2cs/d2cs_conn_get_out_queue(5dbbba92861a3a6e).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 527 | { |
| 528 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 529 | return (t_queuecxx . . $ pvpgn/t_queue# * *)&c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue.; |
| 530 | } |
| 531 | |
| 532 | extern unsigned int d2cs_conn_get_in_sizecxx . . $ pvpgn/d2cs/d2cs_conn_get_in_size(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 533 | { |
| 534 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 535 | return c->insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize.; |
| 536 | } |
| 537 | |
| 538 | extern int conn_push_outqueuecxx . . $ pvpgn/d2cs/conn_push_outqueue(5937b18ec8c7bf53).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet) |
| 539 | { |
| 540 | if (!c) |
| 541 | { |
| 542 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 543 | return -1; |
| 544 | } |
| 545 | |
| 546 | if (!packet) |
| 547 | { |
| 548 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL packet"); |
| 549 | return -1; |
| 550 | } |
| 551 | |
| 552 | queue_push_packetcxx . . $ pvpgn/queue_push_packet(dcf0852b5319de36).((t_queuecxx . . $ pvpgn/t_queue# * *)&c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue., packet); |
| 553 | if (!c->outsizepcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsizep.++) fdwatch_update_fdcxx . . $ pvpgn/fdwatch_update_fd(b223e862534b1804).(c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx., fdwatch_type_readcxx . . $ pvpgn/fdwatch_type_read. | fdwatch_type_writecxx . . $ pvpgn/fdwatch_type_write.); |
| 554 | |
| 555 | return 0; |
| 556 | } |
| 557 | |
| 558 | extern t_packetcxx . . $ pvpgn/t_packet# * conn_peek_outqueuecxx . . $ pvpgn/d2cs/conn_peek_outqueue(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 559 | { |
| 560 | if (!c) |
| 561 | { |
| 562 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 563 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 564 | } |
| 565 | |
| 566 | return queue_peek_packetcxx . . $ pvpgn/queue_peek_packet(7fa79213a3522fc5).((t_queuecxx . . $ pvpgn/t_queue# const * const *)&c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue.); |
| 567 | } |
| 568 | |
| 569 | extern t_packetcxx . . $ pvpgn/t_packet# * conn_pull_outqueuecxx . . $ pvpgn/d2cs/conn_pull_outqueue(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c) |
| 570 | { |
| 571 | if (!c) |
| 572 | { |
| 573 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 574 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 575 | } |
| 576 | |
| 577 | if (c->outsizepcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsizep.) { |
| 578 | if (!(--c->outsizepcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsizep.)) fdwatch_update_fdcxx . . $ pvpgn/fdwatch_update_fd(b223e862534b1804).(c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx., fdwatch_type_readcxx . . $ pvpgn/fdwatch_type_read.); |
| 579 | return queue_pull_packetcxx . . $ pvpgn/queue_pull_packet(fc21e149db949db4).((t_queuecxx . . $ pvpgn/t_queue# * *)&c->outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue.); |
| 580 | } |
| 581 | |
| 582 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 583 | } |
| 584 | |
| 585 | extern int conn_add_socket_flagcxx . . $ pvpgn/d2cs/conn_add_socket_flag(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int flag) |
| 586 | { |
| 587 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 588 | c->socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag. |= flag; |
| 589 | return 0; |
| 590 | } |
| 591 | |
| 592 | extern int conn_process_packetcxx . . $ pvpgn/d2cs/conn_process_packet(2bc178548fb00cfb).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet, t_packet_handle_tablecxx . . $ pvpgn/d2cs/t_packet_handle_table# * table, |
| 593 | unsigned int table_size) |
| 594 | { |
| 595 | unsigned int type; |
| 596 | unsigned int size; |
| 597 | |
| 598 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 599 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(packet, -1); |
| 600 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(table, -1); |
| 601 | type = packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet); |
| 602 | size = packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet); |
| 603 | |
| 604 | if (type >= table_size || !table[type].sizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#size.) { |
| 605 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet type {} (class {})", type, packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet)); |
| 606 | return -1; |
| 607 | } |
| 608 | if (size < table[type].sizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#size.) { |
| 609 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet size {} (type {} class {})", size, type, packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet)); |
| 610 | return -1; |
| 611 | } |
| 612 | if (!(c->statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state. & table[type].statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#state.)) { |
| 613 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "connection {} state mismatch for packet type {} (class {})", c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum., |
| 614 | type, packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet)); |
| 615 | return -1; |
| 616 | } |
| 617 | if (!table[type].handlercxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#handler.) { |
| 618 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "missing handler for packet type {} (class {})", type, packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet)); |
| 619 | return -1; |
| 620 | } |
| 621 | return table[type].handlercxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#handler.(c, packet); |
| 622 | } |
| 623 | |
| 624 | extern int d2cs_conn_set_accountcxx . . $ pvpgn/d2cs/d2cs_conn_set_account(127e6fcf538cb408).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, char const * account) |
| 625 | { |
| 626 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 627 | if (!account) { |
| 628 | if (c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->account); |
| 629 | c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 630 | } |
| 631 | if (c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->account); |
| 632 | c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(account); |
| 633 | |
| 634 | return 0; |
| 635 | } |
| 636 | |
| 637 | extern char const * d2cs_conn_get_accountcxx . . $ pvpgn/d2cs/d2cs_conn_get_account(204e3869d17161f9).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 638 | { |
| 639 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 640 | return c->accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account.; |
| 641 | } |
| 642 | |
| 643 | extern int d2cs_conn_set_charnamecxx . . $ pvpgn/d2cs/d2cs_conn_set_charname(127e6fcf538cb408).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, char const * charname) |
| 644 | { |
| 645 | char const * temp; |
| 646 | |
| 647 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 648 | temp = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 649 | if (charname) temp = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(charname); |
| 650 | if (c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname.) { |
| 651 | if (hashtable_remove_datacxx . . $ pvpgn/hashtable_remove_data(c6644015312508b0).(conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head., c, c->charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash.) < 0) { |
| 652 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error remove charname {} from list", charname); |
| 653 | if (temp) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)temp); |
| 654 | return -1; |
| 655 | } |
| 656 | hashtable_purgecxx . . $ pvpgn/hashtable_purge(8afcf31a4e16cf42).(conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head.); |
| 657 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->charname); |
| 658 | } |
| 659 | if (charname) { |
| 660 | c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname. = temp; |
| 661 | c->charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash. = conn_charname_hashcxx . . $ pvpgn/d2cs/conn_charname_hash(c61c63047ce273de).(charname); |
| 662 | if (hashtable_insert_datacxx . . $ pvpgn/hashtable_insert_data(e38f1de6fd62ec3a).(conn_charname_list_headcxx . . $ pvpgn/d2cs/conn_charname_list_head., c, c->charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash.) < 0) { |
| 663 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error insert charname {} to list", charname); |
| 664 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->charname); |
| 665 | c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 666 | return -1; |
| 667 | } |
| 668 | } |
| 669 | else { |
| 670 | c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 671 | c->charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash. = 0; |
| 672 | } |
| 673 | return 0; |
| 674 | } |
| 675 | |
| 676 | extern char const * d2cs_conn_get_charnamecxx . . $ pvpgn/d2cs/d2cs_conn_get_charname(204e3869d17161f9).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 677 | { |
| 678 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 679 | return c->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname.; |
| 680 | } |
| 681 | |
| 682 | extern unsigned int d2cs_conn_get_sessionnumcxx . . $ pvpgn/d2cs/d2cs_conn_get_sessionnum(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 683 | { |
| 684 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 685 | return c->sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum.; |
| 686 | } |
| 687 | |
| 688 | extern unsigned int conn_get_charinfo_laddercxx . . $ pvpgn/d2cs/conn_get_charinfo_ladder(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 689 | { |
| 690 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 691 | return d2charinfo_get_laddercxx . . $ pvpgn/d2cs/d2charinfo_get_ladder(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 692 | } |
| 693 | |
| 694 | extern unsigned int conn_get_charinfo_expansioncxx . . $ pvpgn/d2cs/conn_get_charinfo_expansion(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 695 | { |
| 696 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 697 | return d2charinfo_get_expansioncxx . . $ pvpgn/d2cs/d2charinfo_get_expansion(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 698 | } |
| 699 | |
| 700 | extern unsigned int conn_get_charinfo_hardcorecxx . . $ pvpgn/d2cs/conn_get_charinfo_hardcore(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 701 | { |
| 702 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 703 | return d2charinfo_get_hardcorecxx . . $ pvpgn/d2cs/d2charinfo_get_hardcore(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 704 | } |
| 705 | |
| 706 | extern unsigned int conn_get_charinfo_deadcxx . . $ pvpgn/d2cs/conn_get_charinfo_dead(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 707 | { |
| 708 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 709 | return d2charinfo_get_deadcxx . . $ pvpgn/d2cs/d2charinfo_get_dead(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 710 | } |
| 711 | |
| 712 | extern unsigned int conn_get_charinfo_difficultycxx . . $ pvpgn/d2cs/conn_get_charinfo_difficulty(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 713 | { |
| 714 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 715 | return d2charinfo_get_difficultycxx . . $ pvpgn/d2cs/d2charinfo_get_difficulty(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 716 | } |
| 717 | |
| 718 | extern unsigned int conn_get_charinfo_levelcxx . . $ pvpgn/d2cs/conn_get_charinfo_level(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 719 | { |
| 720 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 721 | return d2charinfo_get_levelcxx . . $ pvpgn/d2cs/d2charinfo_get_level(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 722 | } |
| 723 | |
| 724 | extern unsigned int conn_get_charinfo_classcxx . . $ pvpgn/d2cs/conn_get_charinfo_class(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 725 | { |
| 726 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 727 | return d2charinfo_get_classcxx . . $ pvpgn/d2cs/d2charinfo_get_class(cae5a827379a95b4).(c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.); |
| 728 | } |
| 729 | |
| 730 | extern int conn_set_charinfocxx . . $ pvpgn/d2cs/conn_set_charinfo(e7ef76122ed37433).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 731 | { |
| 732 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 733 | if (!charinfo) { |
| 734 | if (c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->charinfo); |
| 735 | c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 736 | return 0; |
| 737 | } |
| 738 | if (c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)c->charinfo); |
| 739 | c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo. = (t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_d2charinfo_summary)); |
| 740 | stdcxx . . $ std/::memcpy((void*)c->charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo., charinfo, sizeof(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary#)); |
| 741 | return 0; |
| 742 | } |
| 743 | |
| 744 | extern int conn_set_d2gs_idcxx . . $ pvpgn/d2cs/conn_set_d2gs_id(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int d2gs_id) |
| 745 | { |
| 746 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1) |
| 747 | c->d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id. = d2gs_id; |
| 748 | return 0; |
| 749 | } |
| 750 | |
| 751 | extern unsigned int conn_get_d2gs_idcxx . . $ pvpgn/d2cs/conn_get_d2gs_id(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 752 | { |
| 753 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0) |
| 754 | return c->d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id.; |
| 755 | } |
| 756 | |
| 757 | extern unsigned int d2cs_conn_get_addrcxx . . $ pvpgn/d2cs/d2cs_conn_get_addr(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 758 | { |
| 759 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 760 | return c->addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#addr.; |
| 761 | } |
| 762 | |
| 763 | extern unsigned short d2cs_conn_get_portcxx . . $ pvpgn/d2cs/d2cs_conn_get_port(8f34d5366750eb9d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 764 | { |
| 765 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 766 | return c->portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#port.; |
| 767 | } |
| 768 | |
| 769 | extern t_gqcxx . . $ pvpgn/d2cs/t_gq# * conn_get_gamequeuecxx . . $ pvpgn/d2cs/conn_get_gamequeue(21f4c4cb9db64b4d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 770 | { |
| 771 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 772 | return c->gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue.; |
| 773 | } |
| 774 | |
| 775 | extern int conn_set_gamequeuecxx . . $ pvpgn/d2cs/conn_set_gamequeue(bd9afd294a72d45a).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_gqcxx . . $ pvpgn/d2cs/t_gq# * gq) |
| 776 | { |
| 777 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 778 | c->gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue. = gq; |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | extern int conn_set_bnetd_sessionnumcxx . . $ pvpgn/d2cs/conn_set_bnetd_sessionnum(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int sessionnum) |
| 783 | { |
| 784 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, -1); |
| 785 | c->bnetd_sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#bnetd_sessionnum. = sessionnum; |
| 786 | return 0; |
| 787 | } |
| 788 | |
| 789 | extern unsigned int conn_get_bnetd_sessionnumcxx . . $ pvpgn/d2cs/conn_get_bnetd_sessionnum(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c) |
| 790 | { |
| 791 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c, 0); |
| 792 | return c->bnetd_sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#bnetd_sessionnum.; |
| 793 | } |
| 794 | |
| 795 | extern int conn_add_fdcxx . . $ pvpgn/d2cs/conn_add_fd(7106cf9a3c640428).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_fdwatch_typecxx . . $ pvpgn/t_fdwatch_type# rw, fdwatch_handlercxx . . $ pvpgn/fdwatch_handler# handler) |
| 796 | { |
| 797 | assertcxx . . $ `/usr/include/assert.h:102:11`!(c); |
| 798 | c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx. = fdwatch_add_fdcxx . . $ pvpgn/fdwatch_add_fd(559ef48a7724bde6).(c->sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock., rw, handler, c); |
| 799 | return c->fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx.; |
| 800 | } |
| 801 | |
| 802 | } |
| 803 | |
| 804 | } |