EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyPacket.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #ifndef EVE_PY_PACKET_H
27 #define EVE_PY_PACKET_H
28 
29 #include "network/packet_types.h"
30 
31 class PyRep;
32 class PyTuple;
33 class PyDict;
34 class PyVisitor;
35 
36 class PyAddress {
37 public:
38  PyAddress();
39 
40  void Dump(FILE *into, const char *pfx) const;
41  void Dump(LogType type, const char *pfx) const;
42  bool Decode(PyRep *&object); //consumes object
43  PyRep *Encode();
44  void operator=(const PyAddress &right);
45 
46  /*
47  def __setstate__(self, state):
48  if state[0] == const.ADDRESS_TYPE_CLIENT:
49  self.addressType, self.clientID, self.callID, self.service = state
50  elif state[0] == const.ADDRESS_TYPE_BROADCAST:
51  self.addressType, self.broadcastID, self.narrowcast, self.idtype = state
52  elif state[0] == const.ADDRESS_TYPE_ANY:
53  self.addressType, self.service, self.callID = state
54  else:
55  self.addressType, self.nodeID, self.service, self.callID = state
56  */
57  typedef enum {
58  Node = 1,
59  /*
60  * [0] addressType
61  * [1] nodeID
62  * [2] service
63  * [3] callID
64  */
65  Client = 2,
66  /* "because it's ID doesn't match"
67  * [0] addressType
68  * [1] clientID
69  * [2] callID
70  * [3] service
71  */
72  Broadcast = 4,
73  /*
74  * [0] addressType
75  * [1] broadcastID
76  * [2] narrowcast // this part is not understood yet... something about specific nodes for bcast types
77  * [3] idtype
78  */
79  Any = 8,
80  /*
81  * [0] addressType
82  * [1] service
83  * [2] callID
84  */
85  Invalid = 'I' //not real
86  } AddrType;
87 
89  int64 objectID; //node id, client id, etc...
91 
92  std::string service; //broadcastID for a broadcast.
93  std::string bcast_idtype;
94 
95 protected:
96  bool _DecodeService(PyRep *rep);
97  bool _DecodeCallID(PyRep *rep);
98  bool _DecodeObjectID(PyRep *rep);
99 };
100 
101 class PyPacket {
102 public:
103  PyPacket();
104  ~PyPacket();
105 
106  void Dump(LogType type, PyVisitor& dumper);
107  bool Decode(PyRep **packet); //consumes packet
108  PyRep *Encode();
109  PyPacket *Clone() const;
110 
111  //the "type" of object this represents
112  std::string type_string;
113 
114  //the contents tuple:
122 
123 #if 0
124  //options:
125  enum {
126  oCompressedPayload = 0x0001,
127  oMachoVersion = 0x0002,
128  oChannel = 0x0004,
129  oSequenceNumber = 0x0008
130  //joinExisting: bool
131  //temporary: bool
132  };
133  uint32 included_options;
134  uint8 macho_version; //if oMachoVersion. this is used for cached calls. If the value of this is a single
135  // digit/entry, it is ignored, but if it is a list, with a timestamp and
136  //(something else, probably version), then it is telling the server what cached
137  //version of this call the client has cached, so the server can return "cache
138  //OK" if possible
139  std::string channel;
140  uint32 sequence_number;
141 #endif
142 };
143 
145 public:
146  PyCallStream();
147  ~PyCallStream();
148 
149  void Dump(LogType type, PyVisitor& dumper);
150  bool Decode(const std::string &type, PyTuple *&payload); //consumes substream
151  PyTuple *Encode();
152  PyCallStream *Clone() const;
153 
154  uint32 remoteObject; //seen 1, hack: 0 means it was a string
155  std::string remoteObjectStr;
156 
157  std::string method;
159  PyDict *arg_dict; //named parameters
160 };
161 
163 public:
166 
167  void Dump(LogType type, PyVisitor& dumper);
168  bool Decode(const std::string &pkt_type, const std::string &notify_type, PyTuple *&payload); //consumes substream
169  PyTuple *Encode();
170  EVENotificationStream *Clone() const;
171 
172  std::string notifyType; //not encoded by Encode() since it is in the address part, mainly here for convenience.
173 
174  uint32 remoteObject; //seen 1, hack: 0 means it was a string
175  std::string remoteObjectStr;
176 
178 };
179 
180 
181 #endif
182 
183 /*{'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251801, 'label': u'ACCOUNTBANNED'}(u'Your connection to the server has been terminated because your account has been banned. Contact customer support for further information.', None, None)
184  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251802, 'label': u'ACCOUNTNOTACTIVE'}(u'Your connection to the server has been terminated because your account is no longer active. Please check your subscription details.', None, None)
185  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251803, 'label': u'ACL_ACCEPTDELAY'}(u'Starting up...({[numeric]seconds} sec.)', None, {u'{[numeric]seconds}': {'conditionalValues': [], 'variableType': 9, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'seconds'}})
186  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251804, 'label': u'ACL_CLUSTERFULL'}(u'Cluster full (limit={[numeric]limit})', None, {u'{[numeric]limit}': {'conditionalValues': [], 'variableType': 9, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'limit'}})
187  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251809, 'label': u'ACL_IPADDRESSBAN'}(u'Your IP address ({address}) has been banned', None, {u'{address}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'address'}})
188  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251810, 'label': u'ACL_IPADDRESSNOTALLOWED'}(u'Your IP address ({address}) has not been specifically allowed and the cluster is running in exclusive mode', None, {u'{address}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'address'}})
189  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251811, 'label': u'ACL_NOTACCEPTING'}(u'The cluster is not currently accepting connections', None, None)
190  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251812, 'label': u'ACL_PROXYFULL'}(u'Proxy full (limit={[numeric]limit})', None, {u'{[numeric]limit}': {'conditionalValues': [], 'variableType': 9, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'limit'}})
191  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251813, 'label': u'ACL_PROXYNOTCONNECTED'}(u'Proxy not connected to sol servers', None, None)
192  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251814, 'label': u'ACL_SHUTTINGDOWN'}(u'The cluster is shutting down @ {when}', None, {u'{when}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'when'}})
193  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251815, 'label': u'CLIENTDISCONNECTED'}(u'Connection Closed - Client initiated disconnect', None, None)
194  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251816, 'label': u'GAMETIMEEXPIRED'}(u'Connection Closed - Game Time Expired', None, None)
195  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251817, 'label': u'HANDSHAKE_CORRUPT'}(u'Connection Fault - Handshake Corrupt', None, None)
196  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251818, 'label': u'HANDSHAKE_FAILEDHASHMISMATCH'}(u'Handshake Failed - Incorrect Response to Server Challenge - Hash Mismatch', None, None)
197  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251819, 'label': u'HANDSHAKE_FAILEDVERIFICATION'}(u'Connection Failure - Handshake Error', None, None)
198  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251820, 'label': u'HANDSHAKE_FAILEDVIPKEY'}(u'Handshake Failed - VIP Key must match user name', None, None)
199  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251821, 'label': u'HANDSHAKE_INCOMPATIBLEBUILD'}(u'Incompatible (Build)', None, None)
200  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251822, 'label': u'HANDSHAKE_INCOMPATIBLEPROTOCOL'}(u'Incompatible (Protocol)', None, None)
201  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251823, 'label': u'HANDSHAKE_INCOMPATIBLEPUBLICKEY'}(u'Incompatible (Public Key)', None, None)
202  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251824, 'label': u'HANDSHAKE_INCOMPATIBLEREGION'}(u'Incompatible (Region)', None, None)
203  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251825, 'label': u'HANDSHAKE_INCOMPATIBLERELEASE'}(u'Incompatible (Release)', None, None)
204  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251826, 'label': u'HANDSHAKE_INCOMPATIBLEVERSION'}(u'Incompatible (Version)', None, None)
205  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251827, 'label': u'HANDSHAKE_INCORRECTPADDING'}(u'Handshake Failed - Incorrect Handshake Padding - Length is {[numeric]current} but should be {[numeric]expected}', None, {u'{[numeric]expected}': {'conditionalValues': [], 'variableType': 9, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'expected'}, u'{[numeric]current}': {'conditionalValues': [], 'variableType': 9, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'current'}})
206  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251828, 'label': u'HANDSHAKE_SERVERFAILURE'}(u'Handshake Failed - Server Failure', None, None)
207  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251829, 'label': u'HANDSHAKE_TIMEOUT_AUTHENTICATED'}(u'Connection Timeout - The client stalled after authentication for an unreasonable amount of time', None, None)
208  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251830, 'label': u'HANDSHAKE_TIMEOUT_CLIENTCOMPATIBILITYHANDSHAKE'}(u'Connection Timeout - The client did not respond to the compatibility-handshake within a reasonable amount of time', None, None)
209  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251831, 'label': u'HANDSHAKE_TIMEOUT_CLIENTRESPONSETOSERVERCHALLENGE'}(u"Connection Timeout - The client did not respond to the server's secure challenge within a reasonable amount of time", None, None)
210  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251832, 'label': u'HANDSHAKE_TIMEOUT_CLIENTSECUREHANDSHAKE'}(u'Connection Timeout - The client did not initiate the secure-handshake within a reasonable amount of time', None, None)
211  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251833, 'label': u'HANDSHAKE_TIMEOUT_FAILEDSERVERINITIATECOMPATIBILITYHANDSHAKE'}(u'Connection Timeout - The server did not initiate the compatibility-handshake within a reasonable amount of time', None, None)
212  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251834, 'label': u'HANDSHAKE_TIMEOUT_SERVERDIDNOTACKNOWLEDGECHALLENGERESPONSE'}(u"Server didn't Acknowledge our Challenge-Response", None, None)
213  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251835, 'label': u'HANDSHAKE_TIMEOUT_SERVERKEYEXCHANGE'}(u"The server failed to respond to the client's queuing and key exchange request within a reasonable amount of time", None, None)
214  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251836, 'label': u'HANDSHAKE_TIMEOUT_SERVERRESPONSETOCLIENTCHALLENGE'}(u"Connection Timeout - The server failed to acknowledge the client's response to the server's challenge within a reasonable amount of time", None, None)
215  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251837, 'label': u'HANDSHAKE_TIMEOUT_SERVERSECUREHANDSHAKE'}(u"Connection Timeout - The server did not respond to the client's secure-handshake request within a reasonable amount of time", None, None)
216  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251838, 'label': u'HANDSHAKE_VERIFICATIONFAILURE'}(u'Handshake Failed - Incorrect Response to Server Challenge - Verification Failure - {verification}', None, {u'{verification}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'verification'}})
217  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251839, 'label': u'HANDSHAKE_VERSIONCHECKCOMPLETE'}(u'OK', None, None)
218  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251840, 'label': u'KEEPALIVEEXPIRED'}(u"Connection Closed - The connection's keep-alive timer expired", None, None)
219  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251841, 'label': u'NODEDEATH'}(u'Connection Lost - A server process that you were using has gone offline', None, None)
220  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251842, 'label': u'SOCKETCLOSED'}(u'Connection Lost - Socket Closed', None, None)
221  * {'FullPath': u'/Carbon/MachoNet/TransportClosed', 'messageID': 251843, 'label': u'UNHANDLEDEXCEPTION'}(u'Connection Lost - An unexpected error has occurred', None, None)
222  */
PyDict * arg_dict
Definition: PyPacket.h:159
Base Python wire object.
Definition: PyRep.h:66
uint32 remoteObject
Definition: PyPacket.h:154
unsigned __int8 uint8
Definition: eve-compat.h:46
int64 callID
Definition: PyPacket.h:90
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:811
PyPacket()
Definition: PyPacket.cpp:62
Python's dictionary.
Definition: PyRep.h:719
PyAddress dest
Definition: PyPacket.h:117
int64 objectID
Definition: PyPacket.h:89
PyRep * Encode()
Definition: PyPacket.cpp:467
MACHONETMSG_TYPE
Definition: packet_types.h:70
std::string method
Definition: PyPacket.h:157
void operator=(const PyAddress &right)
Definition: PyPacket.cpp:324
Python tuple.
Definition: PyRep.h:567
PyCallStream * Clone() const
Definition: PyPacket.cpp:566
PyTuple * payload
Definition: PyPacket.h:119
void Dump(FILE *into, const char *pfx) const
Definition: PyPacket.cpp:284
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:95
std::string notifyType
Definition: PyPacket.h:172
MACHONETMSG_TYPE type
Definition: PyPacket.h:115
PyRep * contextKey
Definition: PyPacket.h:121
AddrType type
Definition: PyPacket.h:88
PyTuple * arg_tuple
Definition: PyPacket.h:158
bool Decode(const std::string &pkt_type, const std::string &notify_type, PyTuple *&payload)
Definition: PyPacket.cpp:823
Definition: Client.h:66
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:580
std::string bcast_idtype
Definition: PyPacket.h:93
bool Decode(PyRep *&object)
Definition: PyPacket.cpp:332
unsigned __int32 uint32
Definition: eve-compat.h:50
PyTuple * Encode()
Definition: PyPacket.cpp:763
PyRep * Encode()
Definition: PyPacket.cpp:240
PyPacket * Clone() const
Definition: PyPacket.cpp:79
bool Decode(const std::string &type, PyTuple *&payload)
Definition: PyPacket.cpp:598
signed __int64 int64
Definition: eve-compat.h:51
LogType
Definition: logsys.h:59
EVENotificationStream * Clone() const
Definition: PyPacket.cpp:805
bool _DecodeObjectID(PyRep *rep)
Definition: PyPacket.cpp:547
bool Decode(PyRep **packet)
Definition: PyPacket.cpp:115
uint32 userid
Definition: PyPacket.h:118
PyDict * named_payload
Definition: PyPacket.h:120
~PyPacket()
Definition: PyPacket.cpp:73
std::string service
Definition: PyPacket.h:92
bool _DecodeCallID(PyRep *rep)
Definition: PyPacket.cpp:542
std::string remoteObjectStr
Definition: PyPacket.h:155
PyAddress source
Definition: PyPacket.h:116
std::string type_string
Definition: PyPacket.h:112
bool _DecodeService(PyRep *rep)
Definition: PyPacket.cpp:537
std::string remoteObjectStr
Definition: PyPacket.h:175