rtcpchainablehandler.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Copyright (c) 2020 Filip Klembara (in2core)
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef RTC_RTCP_CHAINABLE_HANDLER_H
  18. #define RTC_RTCP_CHAINABLE_HANDLER_H
  19. #if RTC_ENABLE_MEDIA
  20. #include "rtcphandler.hpp"
  21. #include "messagehandlerrootelement.hpp"
  22. namespace rtc {
  23. class RTC_CPP_EXPORT RtcpChainableHandler : public RtcpHandler {
  24. const std::shared_ptr<MessageHandlerRootElement> root;
  25. std::shared_ptr<MessageHandlerElement> leaf;
  26. std::mutex inoutMutex;
  27. std::optional<message_ptr> handleIncomingBinary(message_ptr);
  28. std::optional<message_ptr> handleIncomingControl(message_ptr);
  29. std::optional<message_ptr> handleOutgoingBinary(message_ptr);
  30. std::optional<message_ptr> handleOutgoingControl(message_ptr);
  31. bool sendProduct(ChainedOutgoingResponseProduct product);
  32. public:
  33. RtcpChainableHandler(std::shared_ptr<MessageHandlerRootElement> root);
  34. ~RtcpChainableHandler();
  35. message_ptr incoming(message_ptr ptr) override;
  36. message_ptr outgoing(message_ptr ptr) override;
  37. bool send(message_ptr msg);
  38. /// Adds element to chain
  39. /// @param chainable Chainable element
  40. void addToChain(std::shared_ptr<MessageHandlerElement> chainable);
  41. };
  42. } // namespace rtc
  43. #endif // RTC_ENABLE_MEDIA
  44. #endif // RTC_RTCP_CHAINABLE_HANDLER_H