Debian Codegraph @

src/d2cs/bnetd.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 "bnetd.h"cxx . . $ `<file>/src/d2cs/bnetd.h`/
21
22 #include <ctime>
23
24 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
25 #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/
26 #include "s2s.h"cxx . . $ `<file>/src/d2cs/s2s.h`/
27 #include "handle_bnetd.h"cxx . . $ `<file>/src/d2cs/handle_bnetd.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 t_connectioncxx . . $ pvpgn/d2cs/t_connection# * bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
37
38 extern int bnetd_initcxx . . $ pvpgn/d2cs/bnetd_init(b126dc7c1de90089).(void)
39 {
40 return bnetd_checkcxx . . $ pvpgn/d2cs/bnetd_check(b126dc7c1de90089).();
41 }
42
43 extern int bnetd_checkcxx . . $ pvpgn/d2cs/bnetd_check(b126dc7c1de90089).(void)
44 {
45 static stdcxx . . $ std/::time_tcxx . . $ std/time_t# prev_connecting_checktime = 0;
46
47 if (bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection.) {
48 if (d2cs_conn_get_statecxx . . $ pvpgn/d2cs/d2cs_conn_get_state(d7c7cd454402ea03).(bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection.) == conn_state_connectingcxx . . $ pvpgn/d2cs/conn_state_connecting.) {
49 if (stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(nullptr) - prev_connecting_checktime > prefs_get_s2s_timeoutcxx . . $ pvpgn/d2cs/prefs_get_s2s_timeout(db52760e79bf9054).()) {
50 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "connection to bnetd s2s timeout");
51 d2cs_conn_set_statecxx . . $ pvpgn/d2cs/d2cs_conn_set_state(1e8a554d8269318).(bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection., conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy.);
52 return -1;
53 }
54 }
55 return 0;
56 }
57 if (!(bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection. = s2s_createcxx . . $ pvpgn/d2cs/s2s_create(9689145221fea1f6).(prefs_get_bnetdaddrcxx . . $ pvpgn/d2cs/prefs_get_bnetdaddr(33a1f659e94feb42).(), BNETD_SERV_PORTcxx . . $ BNETD_SERV_PORT., conn_class_bnetdcxx . . $ pvpgn/d2cs/conn_class_bnetd.))) {
58 return -1;
59 }
60 if (d2cs_conn_get_statecxx . . $ pvpgn/d2cs/d2cs_conn_get_state(d7c7cd454402ea03).(bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection.) == conn_state_initcxx . . $ pvpgn/d2cs/conn_state_init.) {
61 handle_bnetd_initcxx . . $ pvpgn/d2cs/handle_bnetd_init(2043ce9004c1cbc1).(bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection.);
62 }
63 else {
64 prev_connecting_checktime = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(nullptr);
65 }
66 return 0;
67 }
68
69
70 extern t_connectioncxx . . $ pvpgn/d2cs/t_connection# * bnetd_conncxx . . $ pvpgn/d2cs/bnetd_conn(2c2f9695855bd8ac).(void)
71 {
72 return bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection.;
73 }
74
75 extern int bnetd_set_connectioncxx . . $ pvpgn/d2cs/bnetd_set_connection(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c)
76 {
77 bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection. = c;
78 return 0;
79 }
80
81 extern int bnetd_destroycxx . . $ pvpgn/d2cs/bnetd_destroy(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c)
82 {
83 if (bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection. != c) {
84 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "bnetd connection do not match");
85 return -1;
86 }
87 bnetd_connectioncxx . . $ pvpgn/d2cs/bnetd_connection. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
88 return 0;
89 }
90
91 }
92
93 }