Debian Codegraph @

src/d2cs/handle_init.cpp

raw symbols SCIP
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 "handle_init.h"cxx . . $ `<file>/src/d2cs/handle_init.h`/
21
22 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
23 #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/
24 #include "common/init_protocol.h"cxx . . $ `<file>/src/common/init_protocol.h`/
25 #include "d2gs.h"cxx . . $ `<file>/src/d2cs/d2gs.h`/
26 #include "handle_d2gs.h"cxx . . $ `<file>/src/d2cs/handle_d2gs.h`/
27 #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/
28 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
29
30 namespace pvpgncxx . . $ pvpgn/
31 {
32
33 namespace d2cscxx . . $ pvpgn/d2cs/
34 {
35
36 static int on_d2gs_initconncxx . . $ pvpgn/d2cs/on_d2gs_initconn(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c);
37 static int on_d2cs_initconncxx . . $ pvpgn/d2cs/on_d2cs_initconn(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c);
38
39 extern int d2cs_handle_init_packetcxx . . $ pvpgn/d2cs/d2cs_handle_init_packet(5937b18ec8c7bf53).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet)
40 {
41 int cclass;
42 int retval;
43
44 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(c,-1);
45 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(packet,-1);
46 cclass=bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_initconncxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_initconn..cclasscxx . . $ pvpgn/$anonymous_type_7cca3803bac3bad7_0#cclass.);
47 switch (cclass) {
48 case CLIENT_INITCONN_CLASS_D2CScxx . . $ `src/common/init_protocol.h:64:9`!:
49 retval=on_d2cs_initconncxx . . $ pvpgn/d2cs/on_d2cs_initconn(2043ce9004c1cbc1).(c);
50 break;
51 case CLIENT_INITCONN_CLASS_D2GScxx . . $ `src/common/init_protocol.h:65:9`!:
52 retval=on_d2gs_initconncxx . . $ pvpgn/d2cs/on_d2gs_initconn(2043ce9004c1cbc1).(c);
53 break;
54 default:
55 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"got bad connection class {}",cclass);
56 retval=-1;
57 break;
58 }
59 return retval;
60 }
61
62 static int on_d2gs_initconncxx . . $ pvpgn/d2cs/on_d2gs_initconn(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c)
63 {
64 t_d2gscxx . . $ pvpgn/d2cs/t_d2gs# * gs;
65
66 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info.,__FUNCTION__,"[{}] client initiated d2gs connection",d2cs_conn_get_socketcxx . . $ pvpgn/d2cs/d2cs_conn_get_socket(5cce2089e3f63aaf).(c));
67 if (!(gs=d2gslist_find_gs_by_ipcxx . . $ pvpgn/d2cs/d2gslist_find_gs_by_ip(a5ff5b022d63132f).(d2cs_conn_get_addrcxx . . $ pvpgn/d2cs/d2cs_conn_get_addr(efed4e5eb0be6497).(c)))) {
68 // reload list and see if any dns addy's has changed
69 if (d2gslist_reloadcxx . . $ pvpgn/d2cs/d2gslist_reload(5c4306d8553b3696).(prefs_get_d2gs_listcxx . . $ pvpgn/d2cs/prefs_get_d2gs_list(33a1f659e94feb42).())<0) {
70 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"error reloading game server list,exitting");
71 return -1;
72 }
73 //recheck
74 if (!(gs=d2gslist_find_gs_by_ipcxx . . $ pvpgn/d2cs/d2gslist_find_gs_by_ip(a5ff5b022d63132f).(d2cs_conn_get_addrcxx . . $ pvpgn/d2cs/d2cs_conn_get_addr(efed4e5eb0be6497).(c)))) {
75 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"d2gs connection from invalid ip address {}",addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(d2cs_conn_get_addrcxx . . $ pvpgn/d2cs/d2cs_conn_get_addr(efed4e5eb0be6497).(c)));
76 return -1;
77 }
78 }
79 d2cs_conn_set_classcxx . . $ pvpgn/d2cs/d2cs_conn_set_class(b2d3cf3c2f5d38f).(c,conn_class_d2gscxx . . $ pvpgn/d2cs/conn_class_d2gs.);
80 d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(c,conn_state_connectedcxx . . $ pvpgn/d2cs/conn_state_connected.);
81 conn_set_d2gs_idcxx . . $ pvpgn/d2cs/conn_set_d2gs_id(2fb9731f9a7a8931).(c,d2gs_get_idcxx . . $ pvpgn/d2cs/d2gs_get_id(986de4a3f93bb0c3).(gs));
82 if (handle_d2gs_initcxx . . $ pvpgn/d2cs/handle_d2gs_init(2043ce9004c1cbc1).(c)<0) {
83 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"failed to init d2gs connection");
84 return -1;
85 }
86 return 0;
87 }
88
89 static int on_d2cs_initconncxx . . $ pvpgn/d2cs/on_d2cs_initconn(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c)
90 {
91 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info.,__FUNCTION__,"[{}] client initiated d2cs connection",d2cs_conn_get_socketcxx . . $ pvpgn/d2cs/d2cs_conn_get_socket(5cce2089e3f63aaf).(c));
92 d2cs_conn_set_classcxx . . $ pvpgn/d2cs/d2cs_conn_set_class(b2d3cf3c2f5d38f).(c,conn_class_d2cscxx . . $ pvpgn/d2cs/conn_class_d2cs.);
93 d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(c,conn_state_connectedcxx . . $ pvpgn/d2cs/conn_state_connected.);
94 return 0;
95 }
96
97 }
98
99 }