PageRenderTime 61ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/src/server/ipc/ZmqListener.h

https://gitlab.com/IlluminatiCore/IlluminatiCore
C Header | 51 lines | 20 code | 7 blank | 24 comment | 0 complexity | 6b437aee92d520975afa88bd7cfbb1cd MD5 | raw file
Possible License(s): GPL-2.0, BSD-2-Clause
  1. /*
  2. * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the
  6. * Free Software Foundation; either version 2 of the License, or (at your
  7. * option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef __ZMQLISTENER_H
  18. #define __ZMQLISTENER_H
  19. #include "ZMQTask.h"
  20. #include <zmqpp/zmqpp.hpp>
  21. class ZmqListener : public ZMQTask
  22. {
  23. /*
  24. * Read broadcasts from remote PUB socket, and forward them to
  25. * another socket.
  26. *
  27. * from - client SUB socket
  28. * to - listen PUSH socket
  29. *
  30. */
  31. public:
  32. ZmqListener(std::string const& from, std::string const& to);
  33. ~ZmqListener();
  34. void Run() override;
  35. void Subscribe(std::string const& keyword);
  36. void Unsubscribe(std::string const& keyword);
  37. protected:
  38. void HandleOpen() override;
  39. void HandleClose() override;
  40. private:
  41. zmqpp::socket* _from;
  42. zmqpp::socket* _to;
  43. };
  44. #endif