This is Unofficial EPICS BASE Doxygen Site
abstractResponseHandler.cpp
Go to the documentation of this file.
1 
7 #include <osiSock.h>
8 
9 #include <pv/byteBuffer.h>
10 #include <pv/reftrack.h>
11 
12 #define epicsExportSharedSymbols
13 #include <pv/remote.h>
14 #include <pv/hexDump.h>
15 
16 using namespace epics::pvData;
17 
18 namespace epics {
19 namespace pvAccess {
20 
21 size_t ResponseHandler::num_instances;
22 
23 ResponseHandler::ResponseHandler(Context* context, const std::string& description)
24  :_description(description)
25  ,_debugLevel(context->getConfiguration()->getPropertyAsInteger(PVACCESS_DEBUG, 0)) // actually $EPICS_PVA_DEBUG
26 {
27  REFTRACE_INCREMENT(num_instances);
28 }
29 
31 {
32  REFTRACE_DECREMENT(num_instances);
33 }
34 
36  Transport::shared_pointer const & transport, int8 version, int8 command,
37  size_t payloadSize, ByteBuffer* payloadBuffer) {
38  if(_debugLevel >= 3) { // TODO make a constant of sth (0 - off, 1 - debug, 2 - more/trace, 3 - messages)
39  char ipAddrStr[24];
40  ipAddrToDottedIP(&responseFrom->ia, ipAddrStr, sizeof(ipAddrStr));
41 
42  std::cerr<<"Message [0x"<<std::hex<<(int)command<<", v0x"<<std::hex
43  <<int(version)<<"] received from "<<ipAddrStr<<" on "<<transport->getRemoteName()
44  <<" : "<<_description<<"\n"
45  <<HexDump(*payloadBuffer, payloadSize).limit(0xffff);
46  }
47 }
48 }
49 }
int8_t int8
Definition: pvType.h:75
epics::pvData::int32 _debugLevel
Definition: remote.h:344
virtual void handleResponse(osiSockAddr *responseFrom, Transport::shared_pointer const &transport, epics::pvData::int8 version, epics::pvData::int8 command, std::size_t payloadSize, epics::pvData::ByteBuffer *payloadBuffer)
struct sockaddr_in ia
Definition: osiSock.h:157
epicsShareExtern const std::string PVACCESS_DEBUG
Definition: pvaConstants.h:88
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
pvData
Definition: monitor.h:428
HexDump & limit(size_t n=(size_t)-1)
safety limit on max bytes printed
Definition: hexDump.h:44
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
Definition: byteBuffer.h:233
Definition: tool_lib.h:64
unsigned epicsStdCall ipAddrToDottedIP(const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize)
Definition: osiSock.c:144