/**
  * This function is used to modify the non-blocking mode of the underlying
  * native descriptor. It has no effect on the behaviour of the descriptor
  * object's synchronous operations.
  *
  * @param mode If @c true, the underlying descriptor is put into non-blocking
  * mode and direct system calls may fail with boost::asio::error::would_block
  * (or the equivalent system error).
  *
  * @param ec Set to indicate what error occurred, if any. If the @c mode is
  * @c false, but the current value of @c non_blocking() is @c true, this
  * function fails with boost::asio::error::invalid_argument, as the
  * combination does not make sense.
  */
 BOOST_ASIO_SYNC_OP_VOID native_non_blocking(
     bool mode, boost::system::error_code& ec)
 {
   this->get_service().native_non_blocking(
       this->get_implementation(), mode, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #2
0
 BOOST_ASIO_SYNC_OP_VOID set_verify_callback(VerifyCallback callback,
     boost::system::error_code& ec)
 {
   core_.engine_.set_verify_callback(
       new detail::verify_callback<VerifyCallback>(callback), ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #3
0
 BOOST_ASIO_SYNC_OP_VOID handshake(handshake_type type,
     const ConstBufferSequence& buffers, boost::system::error_code& ec)
 {
   detail::io(next_layer_, core_,
       detail::buffered_handshake_op<ConstBufferSequence>(type, buffers), ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
inline BOOST_ASIO_SYNC_OP_VOID connect_pair(
    basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket1,
    basic_socket<Protocol BOOST_ASIO_SVC_TARG1>& socket2,
    boost::system::error_code& ec)
{
  // Check that this function is only being used with a UNIX domain socket.
  boost::asio::local::basic_endpoint<Protocol>* tmp
    = static_cast<typename Protocol::endpoint*>(0);
  (void)tmp;

  Protocol protocol;
  boost::asio::detail::socket_type sv[2];
  if (boost::asio::detail::socket_ops::socketpair(protocol.family(),
        protocol.type(), protocol.protocol(), sv, ec)
      == boost::asio::detail::socket_error_retval)
    BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);

  socket1.assign(protocol, sv[0], ec);
  if (ec)
  {
    boost::system::error_code temp_ec;
    boost::asio::detail::socket_ops::state_type state[2] = { 0, 0 };
    boost::asio::detail::socket_ops::close(sv[0], state[0], true, temp_ec);
    boost::asio::detail::socket_ops::close(sv[1], state[1], true, temp_ec);
    BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
  }

  socket2.assign(protocol, sv[1], ec);
  if (ec)
  {
    boost::system::error_code temp_ec;
    socket1.close(temp_ec);
    boost::asio::detail::socket_ops::state_type state = 0;
    boost::asio::detail::socket_ops::close(sv[1], state, true, temp_ec);
    BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
  }

  BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
Example #5
0
 /**
  * This function is used to perform SSL handshaking on the stream. The
  * function call will block until handshaking is complete or an error occurs.
  *
  * @param type The type of handshaking to be performed, i.e. as a client or as
  * a server.
  *
  * @param ec Set to indicate what error occurred, if any.
  */
 BOOST_ASIO_SYNC_OP_VOID handshake(handshake_type type,
     boost::system::error_code& ec)
 {
   detail::io(next_layer_, core_, detail::handshake_op(type), ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #6
0
 /**
  * This function may be used to configure the maximum verification depth
  * allowed by the stream.
  *
  * @param depth Maximum depth for the certificate chain verification that
  * shall be allowed.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
  * @note Calls @c SSL_set_verify_depth.
  */
 BOOST_ASIO_SYNC_OP_VOID set_verify_depth(
     int depth, boost::system::error_code& ec)
 {
   core_.engine_.set_verify_depth(depth, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #7
0
 /**
  * This function may be used to configure the peer verification mode used by
  * the stream. The new mode will override the mode inherited from the context.
  *
  * @param v A bitmask of peer verification modes. See @ref verify_mode for
  * available values.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
  * @note Calls @c SSL_set_verify.
  */
 BOOST_ASIO_SYNC_OP_VOID set_verify_mode(
     verify_mode v, boost::system::error_code& ec)
 {
   core_.engine_.set_verify_mode(v, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /// Send a break sequence to the serial port.
 BOOST_ASIO_SYNC_OP_VOID send_break(implementation_type& impl,
     boost::system::error_code& ec)
 {
   service_impl_.send_break(impl, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl,
     GettableSerialPortOption& option, boost::system::error_code& ec) const
 {
   service_impl_.get_option(impl, option, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 BOOST_ASIO_SYNC_OP_VOID io_control(IoControlCommand& command,
     boost::system::error_code& ec)
 {
   this->get_service().io_control(this->get_implementation(), command, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /// Open a serial port.
 BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl,
     const std::string& device, boost::system::error_code& ec)
 {
   service_impl_.open(impl, device, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #12
0
 /**
  * This function causes all outstanding asynchronous read or write operations
  * to finish immediately, and the handlers for cancelled operations will be
  * passed the boost::asio::error::operation_aborted error.
  *
  * @param ec Set to indicate what error occurred, if any.
  */
 BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec)
 {
   this->get_service().cancel(this->get_implementation(), ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #13
0
 /*
  * This function opens the handle to hold an existing native handle.
  *
  * @param handle A native handle.
  *
  * @param ec Set to indicate what error occurred, if any.
  */
 BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& handle,
     boost::system::error_code& ec)
 {
   this->get_service().assign(this->get_implementation(), handle, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /// Close the stream.
 BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec)
 {
   stream_impl_.close(ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /**
  * This function removes the specified signal from the set. It has no effect
  * if the signal is not in the set.
  *
  * @param signal_number The signal to be removed from the set.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
  * @note Removes any notifications that have been queued for the specified
  * signal number.
  */
 BOOST_ASIO_SYNC_OP_VOID remove(int signal_number,
     boost::system::error_code& ec)
 {
   this->get_service().remove(this->get_implementation(), signal_number, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /**
  * This function is used to perform a blocking wait for a descriptor to enter
  * a ready to read, write or error condition state.
  *
  * @param w Specifies the desired descriptor state.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
  * @par Example
  * Waiting for a descriptor to become readable.
  * @code
  * boost::asio::posix::stream_descriptor descriptor(io_context);
  * ...
  * boost::system::error_code ec;
  * descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec);
  * @endcode
  */
 BOOST_ASIO_SYNC_OP_VOID wait(wait_type w, boost::system::error_code& ec)
 {
   this->get_service().wait(this->get_implementation(), w, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
 /// Assign an existing native handle to a serial port.
 BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl,
     const native_handle_type& handle, boost::system::error_code& ec)
 {
   service_impl_.assign(impl, handle, ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }
Example #18
0
 /// Close the stream.
 BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec)
 {
   next_layer_.close(ec);
   BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
 }