Handler.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ///
  2. /// \file Remote/Handler.hpp
  3. ///
  4. /// Proxy server instance handler.
  5. ///
  6. /// \copyright
  7. /// Copyright (c) 2013-2014 Josh Blum
  8. /// SPDX-License-Identifier: BSL-1.0
  9. ///
  10. #pragma once
  11. #include <Pothos/Config.hpp>
  12. #include <string>
  13. #include <iosfwd>
  14. namespace Pothos {
  15. /*!
  16. * A server handler runs the Proxy service over an iostream.
  17. */
  18. class POTHOS_API RemoteHandler
  19. {
  20. public:
  21. //! Make a new handler
  22. RemoteHandler(void);
  23. //! Make a new handler given the peer address
  24. RemoteHandler(const std::string &peerAddr);
  25. /*!
  26. * Run a handler for a remote proxy that is interfaced over an iostream.
  27. * This call blocks until the client's remote environment session destructs.
  28. */
  29. void runHandler(std::istream &is, std::ostream &os);
  30. /*!
  31. * Run a handler for a remote proxy that is interfaced over an iostream.
  32. * This call blocks until the client's remote environment session destructs.
  33. */
  34. void runHandler(std::iostream &io);
  35. /*!
  36. * Run the handler for a single request/response transaction.
  37. * \return done true when the client shuts-down the environment
  38. */
  39. bool runHandlerOnce(std::istream &is, std::ostream &os);
  40. private:
  41. const std::string _peerAddr;
  42. };
  43. } //namespace Pothos