EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EVEPacketDispatcher Class Reference

#include "EVEPktDispatch.h"

Inheritance diagram for EVEPacketDispatcher:

Public Member Functions

bool DispatchPacket (PyPacket *packet)
 

Protected Member Functions

virtual bool Handle_AuthenticationReq (PyPacket *packet, AuthenticationReq &req)
 
virtual bool Handle_AuthenticationRsp (PyPacket *packet, AuthenticationRsp &rsp)
 
virtual bool Handle_CallReq (PyPacket *packet, PyCallStream &req)
 
virtual bool Handle_CallRsp (PyPacket *packet)
 
virtual bool Handle_ErrorResponse (PyPacket *packet, ErrorResponse &error)
 
virtual bool Handle_Notify (PyPacket *packet)
 
virtual bool Handle_SessionChange (PyPacket *packet, SessionChangeNotification &sessionChange)
 
virtual bool Handle_PingReq (PyPacket *packet)
 
virtual bool Handle_PingRsp (PyPacket *packet)
 
virtual bool Handle_Other (PyPacket *packet)
 

Detailed Description

Definition at line 38 of file EVEPktDispatch.h.

Member Function Documentation

bool EVEPacketDispatcher::DispatchPacket ( PyPacket packet)

Definition at line 36 of file EVEPktDispatch.cpp.

References AUTHENTICATION_REQ, AUTHENTICATION_RSP, CALL_REQ, CALL_RSP, PyCallStream::Decode(), ERRORRESPONSE, Handle_AuthenticationReq(), Handle_AuthenticationRsp(), Handle_CallReq(), Handle_CallRsp(), Handle_ErrorResponse(), Handle_Notify(), Handle_Other(), Handle_PingReq(), Handle_PingRsp(), Handle_SessionChange(), NOTIFICATION, PyPacket::payload, PING_REQ, PING_RSP, SESSIONCHANGENOTIFICATION, sLog, PyPacket::type, and PyPacket::type_string.

Referenced by Client::ProcessNet(), and tcp_callback().

37 {
38  switch(packet->type) {
39  case AUTHENTICATION_REQ: {
40  //check the string part, just for good measure
41  if (packet->type_string != "macho.AuthenticationReq") {
42  sLog.Error("EVEPacketDispatcher","Received AUTHENTICATION_RSP with invalid type string '%s'", packet->type_string.c_str());
43  return false;
44  }
45 
46  AuthenticationReq req;
47  if (!req.Decode(packet->payload)) {
48  sLog.Error("EVEPacketDispatcher","Failed to decode AuthenticationReq");
49  return false;
50  }
51 
52  return Handle_AuthenticationReq(packet, req);
53  }
54  case AUTHENTICATION_RSP: {
55  //check the string part, just for good measure
56  if (packet->type_string != "macho.AuthenticationRsp") {
57  sLog.Error("EVEPacketDispatcher","Received AUTHENTICATION_RSP with invalid type string '%s'", packet->type_string.c_str());
58  return false;
59  }
60 
61  AuthenticationRsp rsp;
62  if (!rsp.Decode(packet->payload)) {
63  sLog.Error("EVEPacketDispatcher","Failed to decode AuthenticationRsp");
64  return false;
65  }
66 
67  return Handle_AuthenticationRsp(packet, rsp);
68  }
69  case CALL_REQ: {
70  //check the string part, just for good measure
71  if (packet->type_string != "macho.CallReq") {
72  sLog.Error("EVEPacketDispatcher","Received CALL_REQ with invalid type string '%s'", packet->type_string.c_str());
73  return false;
74  }
75 
76  PyCallStream call;
77  if (!call.Decode(packet->type_string, packet->payload)) {
78  sLog.Error("EVEPacketDispatcher","Failed to convert packet into a call stream");
79  return false;
80  }
81 
82  return Handle_CallReq(packet, call);
83  }
84  case CALL_RSP: {
85  //check the string part, just for good measure
86  if (packet->type_string != "macho.CallRsp") {
87  sLog.Error("EVEPacketDispatcher","Received CALL_RSP with invalid type string '%s'", packet->type_string.c_str());
88  return false;
89  }
90 
91  //TODO: decode substream in tuple
92 
93  return Handle_CallRsp(packet);
94  }
95  case NOTIFICATION: {
96  //check the string part, just for good measure
97  if (packet->type_string != "macho.Notification") {
98  sLog.Error("EVEPacketDispatcher","Received NOTIFICATION with invalid type string '%s'", packet->type_string.c_str());
99  return false;
100  }
101 
102  return Handle_Notify(packet);
103  }
104  case ERRORRESPONSE: {
105  //check the string part, just for good measure
106  if (packet->type_string != "macho.ErrorResponse") {
107  sLog.Error("EVEPacketDispatcher","Received ERRORRESPONSE with invalid type string '%s'", packet->type_string.c_str());
108  return false;
109  }
110 
111  ErrorResponse error;
112  if (!error.Decode(packet->payload)) {
113  sLog.Error("EVEPacketDispatcher","Failed to decode Error Response");
114  return false;
115  }
116 
117  return Handle_ErrorResponse(packet, error);
118  }
120  //check the string part, just for good measure
121  if (packet->type_string != "macho.SessionChangeNotification") {
122  sLog.Error("EVEPacketDispatcher","Received SESSIONCHANGENOTIFICATION with invalid type string '%s'", packet->type_string.c_str());
123  return false;
124  }
125 
126  SessionChangeNotification sessionChange;
127  if (!sessionChange.Decode(packet->payload)) {
128  sLog.Error("EVEPacketDispatcher","Failed to decode session change notification");
129  return false;
130  }
131 
132  return Handle_SessionChange(packet, sessionChange);
133  }
134  case PING_REQ: {
135  //check the string part, just for good measure
136  if (packet->type_string != "macho.PingReq") {
137  sLog.Error("EVEPacketDispatcher","Received PING_REQ with invalid type string '%s'", packet->type_string.c_str());
138  return false;
139  }
140 
141  return Handle_PingReq(packet);
142  }
143  case PING_RSP: {
144  //check the string part, just for good measure
145  if (packet->type_string != "macho.PingRsp") {
146  sLog.Error("EVEPacketDispatcher","Received PING_RSP with invalid type string '%s'", packet->type_string.c_str());
147  return false;
148  }
149 
150  return Handle_PingRsp(packet);
151  }
152  default:
153  return Handle_Other(packet);
154  }
155 }
virtual bool Handle_AuthenticationReq(PyPacket *packet, AuthenticationReq &req)
virtual bool Handle_SessionChange(PyPacket *packet, SessionChangeNotification &sessionChange)
virtual bool Handle_ErrorResponse(PyPacket *packet, ErrorResponse &error)
PyTuple * payload
Definition: PyPacket.h:119
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
MACHONETMSG_TYPE type
Definition: PyPacket.h:115
virtual bool Handle_AuthenticationRsp(PyPacket *packet, AuthenticationRsp &rsp)
virtual bool Handle_PingRsp(PyPacket *packet)
virtual bool Handle_Other(PyPacket *packet)
virtual bool Handle_CallRsp(PyPacket *packet)
bool Decode(const std::string &type, PyTuple *&payload)
Definition: PyPacket.cpp:598
virtual bool Handle_PingReq(PyPacket *packet)
virtual bool Handle_Notify(PyPacket *packet)
std::string type_string
Definition: PyPacket.h:112
virtual bool Handle_CallReq(PyPacket *packet, PyCallStream &req)

Here is the call graph for this function:

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_AuthenticationReq ( PyPacket packet,
AuthenticationReq &  req 
)
protectedvirtual

Definition at line 158 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

159 {
160  sLog.Error("EVEPacketDispatcher","Unhandled Authentication Request");
161  return false;
162 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_AuthenticationRsp ( PyPacket packet,
AuthenticationRsp &  rsp 
)
protectedvirtual

Definition at line 163 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

164 {
165  sLog.Error("EVEPacketDispatcher","Unhandled Authentication Response");
166  return false;
167 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_CallReq ( PyPacket packet,
PyCallStream req 
)
protectedvirtual

Reimplemented in Client.

Definition at line 169 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

170 {
171  sLog.Error("EVEPacketDispatcher","Unhandled Call Request");
172  return false;
173 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_CallRsp ( PyPacket packet)
protectedvirtual

Definition at line 174 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

175 {
176  sLog.Error("EVEPacketDispatcher","Unhandled Call Response");
177  return false;
178 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_ErrorResponse ( PyPacket packet,
ErrorResponse &  error 
)
protectedvirtual

Definition at line 179 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

180 {
181  sLog.Error("EVEPacketDispatcher","Unhandled Error Response");
182  return false;
183 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_Notify ( PyPacket packet)
protectedvirtual

Reimplemented in Client.

Definition at line 185 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

186 {
187  sLog.Error("EVEPacketDispatcher","Unhandled Notification");
188  return false;
189 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_Other ( PyPacket packet)
protectedvirtual

Definition at line 207 of file EVEPktDispatch.cpp.

References MACHONETMSG_TYPE_NAMES, sLog, and PyPacket::type.

Referenced by DispatchPacket().

208 {
209  sLog.Error("EVEPacketDispatcher","Unhandled Packet of type %s (%i)", MACHONETMSG_TYPE_NAMES[ packet->type ], (int)packet->type);
210  return false;
211 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
MACHONETMSG_TYPE type
Definition: PyPacket.h:115
const char * MACHONETMSG_TYPE_NAMES[MACHONETMSG_TYPE_COUNT]
Definition: PyPacket.cpp:36

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_PingReq ( PyPacket packet)
protectedvirtual

Reimplemented in Client.

Definition at line 196 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

197 {
198  sLog.Error("EVEPacketDispatcher","Unhandled Ping Request.");
199  return false;
200 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_PingRsp ( PyPacket packet)
protectedvirtual

Reimplemented in Client.

Definition at line 201 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

202 {
203  sLog.Error("EVEPacketDispatcher","Unhandled Ping Response.");
204  return false;
205 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

bool EVEPacketDispatcher::Handle_SessionChange ( PyPacket packet,
SessionChangeNotification &  sessionChange 
)
protectedvirtual

Definition at line 190 of file EVEPktDispatch.cpp.

References sLog.

Referenced by DispatchPacket().

191 {
192  sLog.Error("EVEPacketDispatcher","Unhandled SessionChange");
193  return false;
194 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:


The documentation for this class was generated from the following files: