| 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_CONNECTION_H |
| 19 | #define INCLUDED_CONNECTION_Hcxx . . $ `src/d2cs/connection.h:19:9`! |
| 20 | |
| 21 | #include "common/queue.h"cxx . . $ `<file>/src/common/queue.h`/ |
| 22 | #include "common/hashtable.h"cxx . . $ `<file>/src/common/hashtable.h`/ |
| 23 | #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/ |
| 24 | #include "common/fdwatch.h"cxx . . $ `<file>/src/common/fdwatch.h`/ |
| 25 | #include "d2charfile.h"cxx . . $ `<file>/src/d2cs/d2charfile.h`/ |
| 26 | #include "gamequeue.h"cxx . . $ `<file>/src/d2cs/gamequeue.h`/ |
| 27 | |
| 28 | namespace pvpgncxx . . $ pvpgn/ |
| 29 | { |
| 30 | |
| 31 | namespace d2cscxx . . $ pvpgn/d2cs/ |
| 32 | { |
| 33 | |
| 34 | typedef enumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_0# |
| 35 | { |
| 36 | conn_state_nonecxx . . $ pvpgn/d2cs/conn_state_none. = 0x00, |
| 37 | conn_state_initcxx . . $ pvpgn/d2cs/conn_state_init. = 0x01, |
| 38 | conn_state_connectingcxx . . $ pvpgn/d2cs/conn_state_connecting. = 0x02, |
| 39 | conn_state_connectedcxx . . $ pvpgn/d2cs/conn_state_connected. = 0x04, |
| 40 | conn_state_authedcxx . . $ pvpgn/d2cs/conn_state_authed. = 0x08, |
| 41 | conn_state_char_authedcxx . . $ pvpgn/d2cs/conn_state_char_authed. = 0x10, |
| 42 | conn_state_destroycxx . . $ pvpgn/d2cs/conn_state_destroy. = 0x20, |
| 43 | conn_state_destroyingcxx . . $ pvpgn/d2cs/conn_state_destroying. = 0x40, |
| 44 | conn_state_anycxx . . $ pvpgn/d2cs/conn_state_any. = 0xff |
| 45 | } t_conn_statecxx . . $ pvpgn/d2cs/t_conn_state#; |
| 46 | |
| 47 | typedef enumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_1# |
| 48 | { |
| 49 | conn_class_nonecxx . . $ pvpgn/d2cs/conn_class_none., |
| 50 | conn_class_initcxx . . $ pvpgn/d2cs/conn_class_init., |
| 51 | conn_class_d2cscxx . . $ pvpgn/d2cs/conn_class_d2cs., |
| 52 | conn_class_d2gscxx . . $ pvpgn/d2cs/conn_class_d2gs., |
| 53 | conn_class_bnetdcxx . . $ pvpgn/d2cs/conn_class_bnetd. |
| 54 | } t_conn_classcxx . . $ pvpgn/d2cs/t_conn_class#; |
| 55 | |
| 56 | typedef structcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2# |
| 57 | { |
| 58 | char const * charnamecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname.; |
| 59 | char const * accountcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#account.; |
| 60 | int sockcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sock.; |
| 61 | int fdw_idxcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#fdw_idx.; |
| 62 | unsigned int socket_flagcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#socket_flag.; |
| 63 | unsigned int addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#addr.; |
| 64 | unsigned int local_addrcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#local_addr.; |
| 65 | unsigned short portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#port.; |
| 66 | unsigned short local_portcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#local_port.; |
| 67 | unsigned int last_activecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#last_active.; |
| 68 | t_conn_classcxx . . $ pvpgn/d2cs/t_conn_class# cclasscxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#cclass.; |
| 69 | t_conn_statecxx . . $ pvpgn/d2cs/t_conn_state# statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#state.; |
| 70 | unsigned int sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum.; |
| 71 | t_queuecxx . . $ pvpgn/t_queue# * outqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outqueue.; |
| 72 | unsigned int outsizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsize.; |
| 73 | unsigned int outsizepcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#outsizep.; |
| 74 | t_packetcxx . . $ pvpgn/t_packet# * inqueuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#inqueue.; |
| 75 | unsigned int insizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#insize.; |
| 76 | t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfocxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charinfo.; |
| 77 | unsigned int d2gs_idcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#d2gs_id.; |
| 78 | t_gqcxx . . $ pvpgn/d2cs/t_gq# * gamequeuecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#gamequeue.; |
| 79 | unsigned int bnetd_sessionnumcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#bnetd_sessionnum.; |
| 80 | unsigned int sessionnum_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#sessionnum_hash.; |
| 81 | unsigned int charname_hashcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_2#charname_hash.; |
| 82 | } t_connectioncxx . . $ pvpgn/d2cs/t_connection#; |
| 83 | |
| 84 | typedef int ( * packet_handle_funccxx . . $ pvpgn/d2cs/packet_handle_func#) (t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet); |
| 85 | typedef structcxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3# |
| 86 | { |
| 87 | unsigned int sizecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#size.; |
| 88 | unsigned statecxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#state.; |
| 89 | packet_handle_funccxx . . $ pvpgn/d2cs/packet_handle_func# handlercxx . . $ pvpgn/d2cs/$anonymous_type_bc33202f3cc24593_3#handler.; |
| 90 | } t_packet_handle_tablecxx . . $ pvpgn/d2cs/t_packet_handle_table#; |
| 91 | |
| 92 | #define SOCKET_FLAG_READcxx . . $ `src/d2cs/connection.h:92:9`! 0x1 |
| 93 | #define SOCKET_FLAG_WRITEcxx . . $ `src/d2cs/connection.h:93:9`! 0x2 |
| 94 | |
| 95 | extern t_hashtablecxx . . $ pvpgn/t_hashtable# * d2cs_connlistcxx . . $ pvpgn/d2cs/d2cs_connlist(be8548fcc1b5d2a).(void); |
| 96 | extern int d2cs_connlist_destroycxx . . $ pvpgn/d2cs/d2cs_connlist_destroy(b126dc7c1de90089).(void); |
| 97 | extern int d2cs_connlist_reapcxx . . $ pvpgn/d2cs/d2cs_connlist_reap(b126dc7c1de90089).(void); |
| 98 | extern int d2cs_connlist_createcxx . . $ pvpgn/d2cs/d2cs_connlist_create(b126dc7c1de90089).(void); |
| 99 | extern int conn_check_multilogincxx . . $ pvpgn/d2cs/conn_check_multilogin(636e7872f5a2b03c).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c,char const * charname); |
| 100 | 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); |
| 101 | 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); |
| 102 | extern int conn_handle_socketcxx . . $ pvpgn/d2cs/conn_handle_socket(2043ce9004c1cbc1).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 103 | 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, |
| 104 | unsigned int addr, unsigned short port); |
| 105 | extern int d2cs_conn_destroycxx . . $ pvpgn/d2cs/d2cs_conn_destroy(1db121a5d939189b).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_elemcxx . . $ pvpgn/t_elem# ** elem); |
| 106 | extern int d2cs_conn_get_socketcxx . . $ pvpgn/d2cs/d2cs_conn_get_socket(5cce2089e3f63aaf).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 107 | extern unsigned int d2cs_conn_get_sessionnumcxx . . $ pvpgn/d2cs/d2cs_conn_get_sessionnum(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 108 | 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); |
| 109 | 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); |
| 110 | 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); |
| 111 | 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); |
| 112 | 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); |
| 113 | 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); |
| 114 | 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); |
| 115 | extern unsigned int d2cs_conn_get_in_sizecxx . . $ pvpgn/d2cs/d2cs_conn_get_in_size(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 116 | extern unsigned int d2cs_conn_get_out_sizecxx . . $ pvpgn/d2cs/d2cs_conn_get_out_size(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 117 | extern int conn_push_outqueuecxx . . $ pvpgn/d2cs/conn_push_outqueue(5937b18ec8c7bf53).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# * packet); |
| 118 | extern t_packetcxx . . $ pvpgn/t_packet# * conn_peek_outqueuecxx . . $ pvpgn/d2cs/conn_peek_outqueue(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 119 | extern t_packetcxx . . $ pvpgn/t_packet# * conn_pull_outqueuecxx . . $ pvpgn/d2cs/conn_pull_outqueue(6c0ef7f20a17d55d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c); |
| 120 | extern int conn_add_socket_flagcxx . . $ pvpgn/d2cs/conn_add_socket_flag(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int flag); |
| 121 | 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, |
| 122 | unsigned int table_size); |
| 123 | extern int d2cs_conn_set_accountcxx . . $ pvpgn/d2cs/d2cs_conn_set_account(127e6fcf538cb408).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, char const * account); |
| 124 | extern int d2cs_conn_set_charnamecxx . . $ pvpgn/d2cs/d2cs_conn_set_charname(127e6fcf538cb408).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, char const * charname); |
| 125 | extern char const * d2cs_conn_get_accountcxx . . $ pvpgn/d2cs/d2cs_conn_get_account(204e3869d17161f9).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 126 | extern char const * d2cs_conn_get_charnamecxx . . $ pvpgn/d2cs/d2cs_conn_get_charname(204e3869d17161f9).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 127 | 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); |
| 128 | extern unsigned int conn_get_charinfo_laddercxx . . $ pvpgn/d2cs/conn_get_charinfo_ladder(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 129 | extern unsigned int conn_get_charinfo_expansioncxx . . $ pvpgn/d2cs/conn_get_charinfo_expansion(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 130 | extern unsigned int conn_get_charinfo_hardcorecxx . . $ pvpgn/d2cs/conn_get_charinfo_hardcore(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 131 | extern unsigned int conn_get_charinfo_deadcxx . . $ pvpgn/d2cs/conn_get_charinfo_dead(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 132 | extern unsigned int conn_get_charinfo_difficultycxx . . $ pvpgn/d2cs/conn_get_charinfo_difficulty(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 133 | extern unsigned int conn_get_charinfo_levelcxx . . $ pvpgn/d2cs/conn_get_charinfo_level(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 134 | extern unsigned int conn_get_charinfo_classcxx . . $ pvpgn/d2cs/conn_get_charinfo_class(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 135 | extern unsigned int conn_get_d2gs_idcxx . . $ pvpgn/d2cs/conn_get_d2gs_id(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 136 | extern int conn_set_d2gs_idcxx . . $ pvpgn/d2cs/conn_set_d2gs_id(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int d2gs_id); |
| 137 | extern unsigned int d2cs_conn_get_addrcxx . . $ pvpgn/d2cs/d2cs_conn_get_addr(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 138 | extern unsigned short d2cs_conn_get_portcxx . . $ pvpgn/d2cs/d2cs_conn_get_port(8f34d5366750eb9d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 139 | extern t_gqcxx . . $ pvpgn/d2cs/t_gq# * conn_get_gamequeuecxx . . $ pvpgn/d2cs/conn_get_gamequeue(21f4c4cb9db64b4d).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 140 | 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); |
| 141 | extern int conn_set_bnetd_sessionnumcxx . . $ pvpgn/d2cs/conn_set_bnetd_sessionnum(2fb9731f9a7a8931).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# * c, unsigned int sessionnum); |
| 142 | extern unsigned int conn_get_bnetd_sessionnumcxx . . $ pvpgn/d2cs/conn_get_bnetd_sessionnum(efed4e5eb0be6497).(t_connectioncxx . . $ pvpgn/d2cs/t_connection# const * c); |
| 143 | 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); |
| 144 | extern int connlist_check_timeoutcxx . . $ pvpgn/d2cs/connlist_check_timeout(b126dc7c1de90089).(void); |
| 145 | |
| 146 | } |
| 147 | |
| 148 | } |
| 149 | |
| 150 | #endif |