22 #include "IPollLoop.h"
24 #include <sys/socket.h>
29 #define BUFFER_SIZE (32 * 1024)
32 public std::enable_shared_from_this<DobbyLogRelay>
36 const std::string &destinationSocketPath);
40 void process(
const std::shared_ptr<AICommon::IPollLoop> &pollLoop, epoll_event event)
override;
41 void addToPollLoop(
const std::shared_ptr<AICommon::IPollLoop> &pollLoop);
48 const std::string mSourceSocketPath;
49 const std::string mDestinationSocketPath;
52 int mDestinationSocketFd;
54 sockaddr_un mDestinationSocketAddress;
56 char mBuf[BUFFER_SIZE];
Definition: IPollLoop.h:40
Definition: DobbyLogRelay.h:33
DobbyLogRelay(const std::string &sourceSocketPath, const std::string &destinationSocketPath)
Create relay between two UNIX datagram sockets.
Definition: DobbyLogRelay.cpp:40
void addToPollLoop(const std::shared_ptr< AICommon::IPollLoop > &pollLoop)
Adds the log relay to a given poll loop so that the process() method is called when the source socket...
Definition: DobbyLogRelay.cpp:105
void removeFromPollLoop(const std::shared_ptr< AICommon::IPollLoop > &pollLoop)
Removes the log relay to a given poll loop.
Definition: DobbyLogRelay.cpp:116
void process(const std::shared_ptr< AICommon::IPollLoop > &pollLoop, epoll_event event) override
Called on the poll loop. Forwards the data from the source to the destination socket.
Definition: DobbyLogRelay.cpp:128
int createDgramSocket(const std::string &path)
Create a SOCK_DGRAM AF_UNIX socket at the given path. Removes the socket at the given path if it exis...
Definition: DobbyLogRelay.cpp:182