18 #ifndef INCLUDED_RPC_CLIENT_HPP
19 #define INCLUDED_RPC_CLIENT_HPP
21 #include <boost/asio.hpp>
22 #include <boost/smart_ptr.hpp>
23 #include <boost/thread/thread.hpp>
24 #include <boost/thread/condition_variable.hpp>
28 namespace uhd {
namespace usrprio_rpc {
37 const std::string& server,
38 const std::string& port,
39 boost::uint32_t process_id,
40 boost::uint32_t host_id);
43 const boost::system::error_code&
call(
47 boost::posix_time::milliseconds timeout);
49 inline const boost::system::error_code&
status()
const {
62 void _handle_response_hdr(
const boost::system::error_code& err,
size_t transferred,
size_t expected);
63 void _handle_response_data(
const boost::system::error_code& err,
size_t transferred,
size_t expected);
64 void _wait_for_next_response_header();
66 inline void _stop_io_service() {
67 if (_io_service_thread.get()) {
68 UHD_LOG <<
"rpc_client stopping..." << std::endl;
70 _io_service_thread->join();
71 _io_service_thread.reset();
72 UHD_LOG <<
"rpc_client stopped." << std::endl;
77 boost::asio::io_service _io_service;
78 boost::scoped_ptr<boost::thread> _io_service_thread;
79 boost::asio::ip::tcp::socket _socket;
81 hshake_args_t _hshake_args_client;
82 hshake_args_t _hshake_args_server;
84 func_xport_buf_t _request;
85 func_xport_buf_t _response;
88 boost::condition_variable _exec_gate;
89 boost::system::error_code _exec_err;