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

#include "EVECollectDisp.h"

Inheritance diagram for EVECollectDispatcher:
Collaboration diagram for EVECollectDispatcher:

Public Member Functions

 EVECollectDispatcher ()
 
virtual ~EVECollectDispatcher ()
 
- Public Member Functions inherited from EVEPacketDispatcher
bool DispatchPacket (PyPacket *packet)
 

Public Attributes

PyLookupResolver lookResolver
 

Protected Types

typedef void(EVECollectDispatcher::* _CallReqDispatch )(const PyPacket *packet, PyCallStream **call)
 
typedef void(EVECollectDispatcher::* _CallRspDispatch )(const PyPacket *packet, PyRepTuple **res)
 
typedef void(EVECollectDispatcher::* _NotifyDispatch )(const PyPacket *packet, EVENotificationStream **notify)
 
typedef void(EVECollectDispatcher::* _DestinyDispatch )(const PyPacket *packet, DoDestinyAction *action)
 

Protected Member Functions

virtual void Handle_AuthenticationReq (const PyPacket *packet, AuthenticationReq **call)
 
virtual void Handle_AuthenticationRsp (const PyPacket *packet, AuthenticationRsp **call)
 
virtual void Handle_CallReq (const PyPacket *packet, PyCallStream **call)
 
virtual void Handle_CallRsp (const PyPacket *packet, PyRepTuple **res)
 
virtual void Handle_Notify (const PyPacket *packet, EVENotificationStream **notify)
 
virtual void Handle_SessionChange (const PyPacket *packet, SessionChangeNotification **notify)
 
virtual void Handle_ErrorResponse (const PyPacket *packet, ErrorResponseBody **body)
 
virtual void Handle_Other (PyPacket **packet)
 
void _DumpBalls (const byte *data, uint32 len)
 
- Protected Member Functions inherited from EVEPacketDispatcher
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)
 

Protected Attributes

std::map< uint32, std::string > pendingCalls
 
std::map< uint32, std::string > pendingBinds
 
std::map< std::string,
_CallReqDispatch
m_callReqDisp
 
std::map< std::string,
_CallRspDispatch
m_callRspDisp
 
std::map< std::string,
_NotifyDispatch
m_notifyDisp
 
std::map< std::string,
_DestinyDispatch
m_destinyDisp
 

Detailed Description

Definition at line 9 of file EVECollectDisp.h.

Member Typedef Documentation

typedef void(EVECollectDispatcher::* EVECollectDispatcher::_CallReqDispatch)(const PyPacket *packet, PyCallStream **call)
protected

Definition at line 33 of file EVECollectDisp.h.

typedef void(EVECollectDispatcher::* EVECollectDispatcher::_CallRspDispatch)(const PyPacket *packet, PyRepTuple **res)
protected

Definition at line 34 of file EVECollectDisp.h.

typedef void(EVECollectDispatcher::* EVECollectDispatcher::_DestinyDispatch)(const PyPacket *packet, DoDestinyAction *action)
protected

Definition at line 49 of file EVECollectDisp.h.

typedef void(EVECollectDispatcher::* EVECollectDispatcher::_NotifyDispatch)(const PyPacket *packet, EVENotificationStream **notify)
protected

Definition at line 35 of file EVECollectDisp.h.

Constructor & Destructor Documentation

EVECollectDispatcher::EVECollectDispatcher ( )

Definition at line 16 of file EVECollectDisp.cpp.

18 {
19 #define CALL_REQ_HANDLER(c) m_callReqDisp[#c] = &EVECollectDispatcher::Req_##c;
20 #define CALL_RSP_HANDLER(c) m_callRspDisp[#c] = &EVECollectDispatcher::Rsp_##c;
21 #define BOUND_CALL_RSP_HANDLER(c) m_callRspDisp[#c] = &EVECollectDispatcher::Bound_Rsp_##c;
22 #define NOTIFY_HANDLER(c) m_notifyDisp[#c] = &EVECollectDispatcher::Notify_##c;
23  #include "method_types.h"
24 
25 #define DESTINY_HANDLER(c) m_destinyDisp[#c] = &EVECollectDispatcher::Destiny_##c;
26  #include "destiny_types.h"
27 }
EVECollectDispatcher::~EVECollectDispatcher ( )
virtual

Definition at line 29 of file EVECollectDisp.cpp.

29  {
30 }

Member Function Documentation

void EVECollectDispatcher::_DumpBalls ( const byte *  data,
uint32  len 
)
protected
void EVECollectDispatcher::Handle_AuthenticationReq ( const PyPacket packet,
AuthenticationReq **  call 
)
protectedvirtual

Definition at line 33 of file EVECollectDisp.cpp.

References _log.

33  {
34  _log(COLLECT__MESSAGE, "Saw AuthenticationReq for %s", (*call)->login.c_str());
35 }
#define _log(type, fmt,...)
Definition: logsys.h:124
void EVECollectDispatcher::Handle_AuthenticationRsp ( const PyPacket packet,
AuthenticationRsp **  call 
)
protectedvirtual

Definition at line 37 of file EVECollectDisp.cpp.

References _log.

37  {
38  _log(COLLECT__MESSAGE, "Saw AuthenticationRsp");
39 }
#define _log(type, fmt,...)
Definition: logsys.h:124
void EVECollectDispatcher::Handle_CallReq ( const PyPacket packet,
PyCallStream **  call 
)
protectedvirtual

Definition at line 41 of file EVECollectDisp.cpp.

References _log, PyCallStream::arg_tuple, PyAddress::callID, PyPacket::dest, PyAddress::Dump(), PyCallStream::Dump(), is_log_enabled, lookResolver, m_callReqDisp, PyCallStream::method, pendingCalls, PRIu64, PyAddress::service, PyPacket::source, and PyTuple::visit().

41  {
42  PyCallStream *call = *in_call;
43  *in_call = NULL;
44 
45  pendingCalls[packet->source.callID] = call->method;
46 
47 
48  _log(COLLECT__CALL_SUMMARY, "Call ID %" PRIu64 ": %s (svc %s)", packet->source.callID, call->method.c_str(), packet->dest.service.c_str());
49  packet->source.Dump(COLLECT__PACKET_SRC, " Src: ");
50  packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: ");
51  if(is_log_enabled(COLLECT__CALL_DUMP)) {
52  PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP);
53  call->Dump(COLLECT__CALL_DUMP, &dumper);
54  }
55 
56 
57  if(call->method != "MachoBindObject") { //this is handled elsewhere...
58  if(is_log_enabled(COLLECT__CALL_XML)) {
59  printf("<element name=\"Call%s\">\n", call->method.c_str());
60  PyXMLGenerator gen(stdout);
61  call->arg_tuple->visit(&gen);
62  printf("</element>\n");
63  }
64  }
65 
66  //send it to a dispatcher if there is one registered
67  std::map<std::string, _CallReqDispatch>::const_iterator res;
68  res = m_callReqDisp.find(call->method);
69  if(res != m_callReqDisp.end()) {
70  _CallReqDispatch dsp = res->second;
71  (this->*dsp)(packet, &call);
72  }
73 
74  delete call;
75 }
int64 callID
Definition: PyPacket.h:90
void(EVECollectDispatcher::* _CallReqDispatch)(const PyPacket *packet, PyCallStream **call)
#define _log(type, fmt,...)
Definition: logsys.h:124
PyAddress dest
Definition: PyPacket.h:117
std::string method
Definition: PyPacket.h:157
void Dump(FILE *into, const char *pfx) const
Definition: PyPacket.cpp:284
#define is_log_enabled(type)
Definition: logsys.h:78
std::map< std::string, _CallReqDispatch > m_callReqDisp
PyTuple * arg_tuple
Definition: PyPacket.h:158
std::map< uint32, std::string > pendingCalls
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:580
#define PRIu64
Definition: eve-compat.h:85
PyLookupResolver lookResolver
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:553
std::string service
Definition: PyPacket.h:92
PyAddress source
Definition: PyPacket.h:116

Here is the call graph for this function:

void EVECollectDispatcher::Handle_CallRsp ( const PyPacket packet,
PyRepTuple **  res 
)
protectedvirtual

Definition at line 77 of file EVECollectDisp.cpp.

References _log, PyAddress::callID, PyPacket::dest, PyAddress::Dump(), is_log_enabled, lookResolver, m_callRspDisp, Agents::Type::None, pendingCalls, PRIu64, PyAddress::service, and PyPacket::source.

77  {
78  PyRepTuple *result = *in_result;
79  *in_result = NULL;
80 
81  std::map<uint32, std::string>::iterator res;
82  res = pendingCalls.find(packet->dest.callID);
83  if(res != pendingCalls.end()) {
84  const char *pfx = "";
85  if(result->items.size() == 1 && result->items[0]->CheckType(PyRep::SubStream)) {
86  PyRepSubStream *ss = (PyRepSubStream *) result->items[0];
87  ss->DecodeData();
88  if(ss->decoded != NULL) {
89  if(ss->decoded->CheckType(PyRep::None))
90  pfx = "Empty ";
91 
92  //decode any nested substreams.
93  SubStreamDecoder ssd;
94  ss->decoded->visit(&ssd);
95  }
96  }
97 
98  _log(COLLECT__CALL_SUMMARY, "%sCall Response for ID %" PRIu64 ": %s (svc %s)", pfx, packet->dest.callID, res->second.c_str(), packet->source.service.c_str());
99 
100  packet->source.Dump(COLLECT__PACKET_SRC, " Src: ");
101  packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: ");
102 
103  if(is_log_enabled(COLLECT__CALL_DUMP)) {
104  if(res->second != "GetCachableObject") { //these get dumped elsewhere
105  SubStreamDecoder v;
106  result->visit(&v);
107  PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP);
108  result->visit(&dumper);
109  }
110  } //end "is dump enabled"
111 
112  if(is_log_enabled(COLLECT__CALLRSP_SQL)
113  && result != NULL
114  && res->second != "MachoBindObject" //bind object nested calls dumped elsewhere.
115  ) {
116  //run through the result looking for SQL tables, and dump them.
117  SetSQLDumper sql_dumper(stdout, res->second.c_str());
118  result->visit(&sql_dumper);
119  }
120 
121  if(is_log_enabled(COLLECT__CALLRSP_XML)
122  && result != NULL
123  && res->second != "MachoBindObject" //bind object nested calls dumped elsewhere.
124  ) {
125  printf("<element name=\"Rsp%s\">\n", res->second.c_str());
126  PyXMLGenerator gen(stdout);
127  result->visit(&gen);
128  printf("</element>\n");
129  }
130 
131  //send it to a dispatcher if there is one registered
132  std::map<std::string, _CallRspDispatch>::const_iterator res2;
133  res2 = m_callRspDisp.find(res->second);
134  if(res2 != m_callRspDisp.end()) {
135  _CallRspDispatch dsp = res2->second;
136  (this->*dsp)(packet, &result);
137  }/* else {
138  _log(COLLECT__ERROR, "Unable to find handler for '%s'", res->second.c_str());
139  }*/
140 
141  pendingCalls.erase(res);
142  } else {
143  _log(COLLECT__CALL_SUMMARY, "Call Response for unknonw call ID %" PRIu64, packet->dest.callID);
144  }
145  delete result;
146 }
int64 callID
Definition: PyPacket.h:90
#define _log(type, fmt,...)
Definition: logsys.h:124
PyAddress dest
Definition: PyPacket.h:117
Python object SQL dumper.
Definition: RowsetReader.h:191
void Dump(FILE *into, const char *pfx) const
Definition: PyPacket.cpp:284
#define is_log_enabled(type)
Definition: logsys.h:78
void(EVECollectDispatcher::* _CallRspDispatch)(const PyPacket *packet, PyRepTuple **res)
std::map< uint32, std::string > pendingCalls
#define PRIu64
Definition: eve-compat.h:85
PyLookupResolver lookResolver
std::string service
Definition: PyPacket.h:92
PyAddress source
Definition: PyPacket.h:116
std::map< std::string, _CallRspDispatch > m_callRspDisp

Here is the call graph for this function:

void EVECollectDispatcher::Handle_ErrorResponse ( const PyPacket packet,
ErrorResponseBody **  body 
)
protectedvirtual

Definition at line 182 of file EVECollectDisp.cpp.

References _log.

182  {
183  _log(COLLECT__ERROR, "Unprocessed ErrorResponse");
184 }
#define _log(type, fmt,...)
Definition: logsys.h:124
void EVECollectDispatcher::Handle_Notify ( const PyPacket packet,
EVENotificationStream **  notify 
)
protectedvirtual

Definition at line 148 of file EVECollectDisp.cpp.

References _log, EVENotificationStream::args, PyPacket::dest, PyAddress::Dump(), EVENotificationStream::Dump(), is_log_enabled, lookResolver, m_notifyDisp, PyAddress::service, PyPacket::source, and PyTuple::visit().

148  {
149  EVENotificationStream *notify = *in_notify;
150  *in_notify = NULL;
151 
152  _log(COLLECT__NOTIFY_SUMMARY, "Notification of type %s", packet->dest.service.c_str());
153  packet->source.Dump(COLLECT__PACKET_SRC, " Src: ");
154  packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: ");
155  if(is_log_enabled(COLLECT__NOTIFY_DUMP)) {
156  PyLookupDump dumper(&lookResolver, COLLECT__NOTIFY_DUMP);
157  notify->Dump(COLLECT__NOTIFY_DUMP, &dumper);
158  }
159 
160  if(is_log_enabled(COLLECT__NOTIFY_XML)) {
161  printf("<element name=\"Notify%s\">\n", packet->dest.service.c_str());
162  PyXMLGenerator gen(stdout);
163  notify->args->visit(&gen);
164  printf("</element>\n");
165  }
166 
167  //send it to a dispatcher if there is one registered
168  std::map<std::string, _NotifyDispatch>::const_iterator res;
169  res = m_notifyDisp.find(packet->dest.service);
170  if(res != m_notifyDisp.end()) {
171  _NotifyDispatch dsp = res->second;
172  (this->*dsp)(packet, &notify);
173  }
174 
175  delete notify;
176 }
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:811
#define _log(type, fmt,...)
Definition: logsys.h:124
PyAddress dest
Definition: PyPacket.h:117
void(EVECollectDispatcher::* _NotifyDispatch)(const PyPacket *packet, EVENotificationStream **notify)
void Dump(FILE *into, const char *pfx) const
Definition: PyPacket.cpp:284
#define is_log_enabled(type)
Definition: logsys.h:78
std::map< std::string, _NotifyDispatch > m_notifyDisp
PyLookupResolver lookResolver
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:553
std::string service
Definition: PyPacket.h:92
PyAddress source
Definition: PyPacket.h:116

Here is the call graph for this function:

void EVECollectDispatcher::Handle_Other ( PyPacket **  packet)
protectedvirtual

Definition at line 186 of file EVECollectDisp.cpp.

References _log, PyPacket::dest, PyAddress::Dump(), PyPacket::Dump(), is_log_enabled, lookResolver, PyPacket::payload, PyPacket::source, and PyTuple::visit().

186  {
187  PyPacket *packet = *in_packet;
188  *in_packet = NULL;
189 
190  //everything else...
191  if(is_log_enabled(COLLECT__CALL_DUMP)) {
192  //semi-hack: if we are dumping general stuff, dump the misc packets directly.
193 
194  //decode substreams to facilitate dumping better:
195  SubStreamDecoder v;
196  packet->payload->visit(&v);
197 
198  _log(COLLECT__OTHER_DUMP, "Misc Packet:");
199 
200  packet->source.Dump(COLLECT__PACKET_SRC, " Src: ");
201  packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: ");
202 
203  PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP);
204  packet->Dump(COLLECT__CALL_DUMP, &dumper);
205  }
206  if(is_log_enabled(COLLECT__MISC_XML)) {
207  printf("<element name=\"??\">\n");
208  PyXMLGenerator gen(stdout);
209  packet->payload->visit(&gen);
210  printf("</element>\n");
211  }
212 
213  delete packet;
214 }
#define _log(type, fmt,...)
Definition: logsys.h:124
PyAddress dest
Definition: PyPacket.h:117
PyTuple * payload
Definition: PyPacket.h:119
void Dump(FILE *into, const char *pfx) const
Definition: PyPacket.cpp:284
#define is_log_enabled(type)
Definition: logsys.h:78
void Dump(LogType type, PyVisitor &dumper)
Definition: PyPacket.cpp:95
PyLookupResolver lookResolver
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:553
PyAddress source
Definition: PyPacket.h:116

Here is the call graph for this function:

void EVECollectDispatcher::Handle_SessionChange ( const PyPacket packet,
SessionChangeNotification **  notify 
)
protectedvirtual

Definition at line 178 of file EVECollectDisp.cpp.

References _log.

178  {
179  _log(COLLECT__ERROR, "Unprocessed SessionChange");
180 }
#define _log(type, fmt,...)
Definition: logsys.h:124

Member Data Documentation

PyLookupResolver EVECollectDispatcher::lookResolver
std::map<std::string, _CallReqDispatch> EVECollectDispatcher::m_callReqDisp
protected

Definition at line 36 of file EVECollectDisp.h.

Referenced by Handle_CallReq().

std::map<std::string, _CallRspDispatch> EVECollectDispatcher::m_callRspDisp
protected

Definition at line 37 of file EVECollectDisp.h.

Referenced by Handle_CallRsp().

std::map<std::string, _DestinyDispatch> EVECollectDispatcher::m_destinyDisp
protected

Definition at line 50 of file EVECollectDisp.h.

std::map<std::string, _NotifyDispatch> EVECollectDispatcher::m_notifyDisp
protected

Definition at line 38 of file EVECollectDisp.h.

Referenced by Handle_Notify().

std::map<uint32, std::string> EVECollectDispatcher::pendingBinds
protected

Definition at line 28 of file EVECollectDisp.h.

std::map<uint32, std::string> EVECollectDispatcher::pendingCalls
protected

Definition at line 27 of file EVECollectDisp.h.

Referenced by Handle_CallReq(), and Handle_CallRsp().


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