⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stream.hpp

📁 这是国外的resip协议栈
💻 HPP
📖 第 1 页 / 共 2 页
字号:
   * ); @endcode   */  template <typename ShutdownHandler>  void async_shutdown(ShutdownHandler handler)  {    service_.async_shutdown(impl_, next_layer_, handler);  }  /// Write some data to the stream.  /**   * This function is used to write data on the stream. The function call will   * block until one or more bytes of data has been written successfully, or   * until an error occurs.   *   * @param buffers The data to be written.   *   * @returns The number of bytes written.   *   * @throws asio::system_error Thrown on failure.   *   * @note The write_some operation may not transmit all of the data to the   * peer. Consider using the @ref write function if you need to ensure that all   * data is written before the blocking operation completes.   */  template <typename ConstBufferSequence>  std::size_t write_some(const ConstBufferSequence& buffers)  {    asio::error_code ec;    std::size_t s = service_.write_some(impl_, next_layer_, buffers, ec);    asio::detail::throw_error(ec);    return s;  }  /// Write some data to the stream.  /**   * This function is used to write data on the stream. The function call will   * block until one or more bytes of data has been written successfully, or   * until an error occurs.   *   * @param buffers The data to be written to the stream.   *   * @param ec Set to indicate what error occurred, if any.   *   * @returns The number of bytes written. Returns 0 if an error occurred.   *   * @note The write_some operation may not transmit all of the data to the   * peer. Consider using the @ref write function if you need to ensure that all   * data is written before the blocking operation completes.   */  template <typename ConstBufferSequence>  std::size_t write_some(const ConstBufferSequence& buffers,      asio::error_code& ec)  {    return service_.write_some(impl_, next_layer_, buffers, ec);  }  /// Start an asynchronous write.  /**   * This function is used to asynchronously write one or more bytes of data to   * the stream. The function call always returns immediately.   *   * @param buffers The data to be written to the stream. Although the buffers   * object may be copied as necessary, ownership of the underlying buffers is   * retained by the caller, which must guarantee that they remain valid until   * the handler is called.   *   * @param handler The handler to be called when the write operation completes.   * Copies will be made of the handler as required. The equivalent function   * signature of the handler must be:   * @code void handler(   *   const asio::error_code& error, // Result of operation.   *   std::size_t bytes_transferred           // Number of bytes written.   * ); @endcode   *   * @note The async_write_some operation may not transmit all of the data to   * the peer. Consider using the @ref async_write function if you need to   * ensure that all data is written before the blocking operation completes.   */  template <typename ConstBufferSequence, typename WriteHandler>  void async_write_some(const ConstBufferSequence& buffers,      WriteHandler handler)  {    service_.async_write_some(impl_, next_layer_, buffers, handler);  }  /// Read some data from the stream.  /**   * This function is used to read data from the stream. The function call will   * block until one or more bytes of data has been read successfully, or until   * an error occurs.   *   * @param buffers The buffers into which the data will be read.   *   * @returns The number of bytes read.   *   * @throws asio::system_error Thrown on failure.   *   * @note The read_some operation may not read all of the requested number of   * bytes. Consider using the @ref read function if you need to ensure that the   * requested amount of data is read before the blocking operation completes.   */  template <typename MutableBufferSequence>  std::size_t read_some(const MutableBufferSequence& buffers)  {    asio::error_code ec;    std::size_t s = service_.read_some(impl_, next_layer_, buffers, ec);    asio::detail::throw_error(ec);    return s;  }  /// Read some data from the stream.  /**   * This function is used to read data from the stream. The function call will   * block until one or more bytes of data has been read successfully, or until   * an error occurs.   *   * @param buffers The buffers into which the data will be read.   *   * @param ec Set to indicate what error occurred, if any.   *   * @returns The number of bytes read. Returns 0 if an error occurred.   *   * @note The read_some operation may not read all of the requested number of   * bytes. Consider using the @ref read function if you need to ensure that the   * requested amount of data is read before the blocking operation completes.   */  template <typename MutableBufferSequence>  std::size_t read_some(const MutableBufferSequence& buffers,      asio::error_code& ec)  {    return service_.read_some(impl_, next_layer_, buffers, ec);  }  /// Start an asynchronous read.  /**   * This function is used to asynchronously read one or more bytes of data from   * the stream. The function call always returns immediately.   *   * @param buffers The buffers into which the data will be read. Although the   * buffers object may be copied as necessary, ownership of the underlying   * buffers is retained by the caller, which must guarantee that they remain   * valid until the handler is called.   *   * @param handler The handler to be called when the read operation completes.   * Copies will be made of the handler as required. The equivalent function   * signature of the handler must be:   * @code void handler(   *   const asio::error_code& error, // Result of operation.   *   std::size_t bytes_transferred           // Number of bytes read.   * ); @endcode   *   * @note The async_read_some operation may not read all of the requested   * number of bytes. Consider using the @ref async_read function if you need to   * ensure that the requested amount of data is read before the asynchronous   * operation completes.   */  template <typename MutableBufferSequence, typename ReadHandler>  void async_read_some(const MutableBufferSequence& buffers,      ReadHandler handler)  {    service_.async_read_some(impl_, next_layer_, buffers, handler);  }  /// Peek at the incoming data on the stream.  /**   * This function is used to peek at the incoming data on the stream, without   * removing it from the input queue. The function call will block until data   * has been read successfully or an error occurs.   *   * @param buffers The buffers into which the data will be read.   *   * @returns The number of bytes read.   *   * @throws asio::system_error Thrown on failure.   */  template <typename MutableBufferSequence>  std::size_t peek(const MutableBufferSequence& buffers)  {    asio::error_code ec;    std::size_t s = service_.peek(impl_, next_layer_, buffers, ec);    asio::detail::throw_error(ec);    return s;  }  /// Peek at the incoming data on the stream.  /**   * This function is used to peek at the incoming data on the stream, withoutxi   * removing it from the input queue. The function call will block until data   * has been read successfully or an error occurs.   *   * @param buffers The buffers into which the data will be read.   *   * @param ec Set to indicate what error occurred, if any.   *   * @returns The number of bytes read. Returns 0 if an error occurred.   */  template <typename MutableBufferSequence>  std::size_t peek(const MutableBufferSequence& buffers,      asio::error_code& ec)  {    return service_.peek(impl_, next_layer_, buffers, ec);  }  /// Determine the amount of data that may be read without blocking.  /**   * This function is used to determine the amount of data, in bytes, that may   * be read from the stream without blocking.   *   * @returns The number of bytes of data that can be read without blocking.   *   * @throws asio::system_error Thrown on failure.   */  std::size_t in_avail()  {    asio::error_code ec;    std::size_t s = service_.in_avail(impl_, next_layer_, ec);    asio::detail::throw_error(ec);    return s;  }  /// Determine the amount of data that may be read without blocking.  /**   * This function is used to determine the amount of data, in bytes, that may   * be read from the stream without blocking.   *   * @param ec Set to indicate what error occurred, if any.   *   * @returns The number of bytes of data that can be read without blocking.   */  std::size_t in_avail(asio::error_code& ec)  {    return service_.in_avail(impl_, next_layer_, ec);  }private:  /// The next layer.  Stream next_layer_;  /// The backend service implementation.  service_type& service_;  /// The underlying native implementation.  impl_type impl_;};} // namespace ssl} // namespace asio#include "asio/detail/pop_options.hpp"#endif // ASIO_SSL_STREAM_HPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -