Functions | |
| mutable_buffers_1 | asio::buffer (const mutable_buffer &b) |
| Create a new modifiable buffer from an existing buffer. | |
| mutable_buffers_1 | asio::buffer (const mutable_buffer &b, std::size_t max_size_in_bytes) |
| Create a new modifiable buffer from an existing buffer. | |
| const_buffers_1 | asio::buffer (const const_buffer &b) |
| Create a new non-modifiable buffer from an existing buffer. | |
| const_buffers_1 | asio::buffer (const const_buffer &b, std::size_t max_size_in_bytes) |
| Create a new non-modifiable buffer from an existing buffer. | |
| mutable_buffers_1 | asio::buffer (void *data, std::size_t size_in_bytes) |
| Create a new modifiable buffer that represents the given memory range. | |
| const_buffers_1 | asio::buffer (const void *data, std::size_t size_in_bytes) |
| Create a new non-modifiable buffer that represents the given memory range. | |
| template<typename PodType, std::size_t N> | |
| mutable_buffers_1 | asio::buffer (PodType(&data)[N]) |
| Create a new modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| mutable_buffers_1 | asio::buffer (PodType(&data)[N], std::size_t max_size_in_bytes) |
| Create a new modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| const_buffers_1 | asio::buffer (const PodType(&data)[N]) |
| Create a new non-modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| const_buffers_1 | asio::buffer (const PodType(&data)[N], std::size_t max_size_in_bytes) |
| Create a new non-modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| mutable_buffers_1 | asio::buffer (boost::array< PodType, N > &data) |
| Create a new modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| mutable_buffers_1 | asio::buffer (boost::array< PodType, N > &data, std::size_t max_size_in_bytes) |
| Create a new modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| const_buffers_1 | asio::buffer (boost::array< const PodType, N > &data) |
| Create a new non-modifiable buffer that represents the given POD array. | |
| template<typename PodType, std::size_t N> | |
| const_buffers_1 | asio::buffer (boost::array< const PodType, N > &data, std::size_t max_size_in_bytes) |
| Create a new non-modifiable buffer that represents the given POD array. | |
| template<typename PodType, typename Allocator> | |
| mutable_buffers_1 | asio::buffer (std::vector< PodType, Allocator > &data) |
| Create a new modifiable buffer that represents the given POD vector. | |
| template<typename PodType, typename Allocator> | |
| mutable_buffers_1 | asio::buffer (std::vector< PodType, Allocator > &data, std::size_t max_size_in_bytes) |
| Create a new modifiable buffer that represents the given POD vector. | |
| template<typename PodType, typename Allocator> | |
| const_buffers_1 | asio::buffer (const std::vector< PodType, Allocator > &data) |
| Create a new non-modifiable buffer that represents the given POD vector. | |
| template<typename PodType, typename Allocator> | |
| const_buffers_1 | asio::buffer (const std::vector< PodType, Allocator > &data, std::size_t max_size_in_bytes) |
| Create a new non-modifiable buffer that represents the given POD vector. | |
| const_buffers_1 | asio::buffer (const std::string &data) |
| Create a new non-modifiable buffer that represents the given string. | |
| const_buffers_1 | asio::buffer (const std::string &data, std::size_t max_size_in_bytes) |
| Create a new non-modifiable buffer that represents the given string. | |
The simplest use case involves reading or writing a single buffer of a specified size:
sock.write(asio::buffer(data, size));
In the above example, the return value of asio::buffer meets the requirements of the ConstBufferSequence concept so that it may be directly passed to the socket's write function. A buffer created for modifiable memory also meets the requirements of the MutableBufferSequence concept.
An individual buffer may be created from a builtin array, std::vector or boost::array of POD elements. This helps prevent buffer overruns by automatically determining the size of the buffer:
char d1[128]; size_t bytes_transferred = sock.read(asio::buffer(d1)); std::vector<char> d2(128); bytes_transferred = sock.read(asio::buffer(d2)); boost::array<char, 128> d3; bytes_transferred = sock.read(asio::buffer(d3));
To read or write using multiple buffers (i.e. scatter-gather I/O), multiple buffer objects may be assigned into a container that supports the MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
char d1[128]; std::vector<char> d2(128); boost::array<char, 128> d3; boost::array<mutable_buffer, 3> bufs1 = { asio::buffer(d1), asio::buffer(d2), asio::buffer(d3) }; bytes_transferred = sock.read(bufs1); std::vector<const_buffer> bufs2; bufs2.push_back(asio::buffer(d1)); bufs2.push_back(asio::buffer(d2)); bufs2.push_back(asio::buffer(d3)); bytes_transferred = sock.write(bufs2);
| const_buffers_1 asio::buffer | ( | const std::string & | data, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer that represents the given string.
Definition at line 763 of file buffer.hpp.
Referenced by ConvertInt64ToString(), ConvertUInt64ToString(), Curl_debug(), Curl_file(), curl_formget(), Curl_getFormData(), Curl_strerror(), Curl_telnet(), CCrc32Static::FileCrc32Streams(), FormAdd(), ftp_state_mdtm_resp(), vmsHash::Hash_CRC32(), memdup(), NWindows::NFile::NDirectory::MyGetFullPathName(), NWindows::NFile::NFind::MyGetLogicalDriveStrings(), OpenArchive(), throw_exception(), and libtorrent::torrent::verify_piece().
| const_buffers_1 asio::buffer | ( | const std::string & | data | ) | [inline] |
Create a new non-modifiable buffer that represents the given string.
Definition at line 749 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const std::vector< PodType, Allocator > & | data, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer that represents the given POD vector.
Definition at line 729 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const std::vector< PodType, Allocator > & | data | ) | [inline] |
Create a new non-modifiable buffer that represents the given POD vector.
Definition at line 710 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | std::vector< PodType, Allocator > & | data, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new modifiable buffer that represents the given POD vector.
Definition at line 689 of file buffer.hpp.
References asio::placeholders::iterator.
| mutable_buffers_1 asio::buffer | ( | std::vector< PodType, Allocator > & | data | ) | [inline] |
Create a new modifiable buffer that represents the given POD vector.
Definition at line 671 of file buffer.hpp.
References asio::placeholders::iterator.
| const_buffers_1 asio::buffer | ( | boost::array< const PodType, N > & | data, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer that represents the given POD array.
Definition at line 635 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | boost::array< const PodType, N > & | data | ) | [inline] |
Create a new non-modifiable buffer that represents the given POD array.
Definition at line 627 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | boost::array< PodType, N > & | data, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new modifiable buffer that represents the given POD array.
Definition at line 616 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | boost::array< PodType, N > & | data | ) | [inline] |
Create a new modifiable buffer that represents the given POD array.
Definition at line 608 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const PodType(&) | data[N], | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer that represents the given POD array.
Definition at line 528 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const PodType(&) | data[N] | ) | [inline] |
Create a new non-modifiable buffer that represents the given POD array.
Definition at line 521 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | PodType(&) | data[N], | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new modifiable buffer that represents the given POD array.
Definition at line 510 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | PodType(&) | data[N] | ) | [inline] |
Create a new modifiable buffer that represents the given POD array.
Definition at line 503 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const void * | data, | |
| std::size_t | size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer that represents the given memory range.
Definition at line 495 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | void * | data, | |
| std::size_t | size_in_bytes | |||
| ) | [inline] |
Create a new modifiable buffer that represents the given memory range.
Definition at line 489 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const const_buffer & | b, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
Create a new non-modifiable buffer from an existing buffer.
Definition at line 475 of file buffer.hpp.
| const_buffers_1 asio::buffer | ( | const const_buffer & | b | ) | [inline] |
Create a new non-modifiable buffer from an existing buffer.
Definition at line 469 of file buffer.hpp.
| mutable_buffers_1 asio::buffer | ( | const mutable_buffer & | b, | |
| std::size_t | max_size_in_bytes | |||
| ) | [inline] |
| mutable_buffers_1 asio::buffer | ( | const mutable_buffer & | b | ) | [inline] |
Create a new modifiable buffer from an existing buffer.
Definition at line 449 of file buffer.hpp.
Referenced by libtorrent::udp_tracker_connection::announce_response(), asio::buffered_read_stream< asio::buffered_write_stream & >::async_fill(), asio::buffered_write_stream< Stream >::async_flush(), asio::detail::reactive_socket_service< Protocol, Reactor >::async_receive(), asio::detail::reactive_socket_service< Protocol, Reactor >::async_send(), libtorrent::udp_tracker_connection::connect_response(), libtorrent::http_tracker_connection::connected(), asio::basic_streambuf< Allocator >::data(), asio::detail::const_buffers_iterator< ConstBufferSequence >::decrement(), libtorrent::dht::dht_tracker::dht_tracker(), asio::ssl::detail::openssl_operation< Stream >::do_async_read(), asio::ssl::detail::openssl_operation< Stream >::do_async_write(), asio::ssl::detail::openssl_operation< Stream >::do_sync_read(), asio::ssl::detail::openssl_operation< Stream >::do_sync_write(), asio::buffered_read_stream< asio::buffered_write_stream & >::fill(), asio::buffered_write_stream< Stream >::flush(), asio::detail::consuming_buffers_iterator< Buffer, Buffer_Iterator >::increment(), libtorrent::dht::dht_tracker::on_receive(), libtorrent::bt_peer_connection::on_receive(), asio::detail::reactive_socket_service< Protocol, Reactor >::receive_from_handler< MutableBufferSequence, Handler >::operator()(), asio::detail::reactive_socket_service< Protocol, Reactor >::receive_handler< MutableBufferSequence, Handler >::operator()(), asio::detail::reactive_socket_service< Protocol, Reactor >::send_to_handler< ConstBufferSequence, Handler >::operator()(), asio::detail::reactive_socket_service< Protocol, Reactor >::send_handler< ConstBufferSequence, Handler >::operator()(), asio::basic_socket_streambuf< Protocol, StreamSocketService >::overflow(), asio::basic_streambuf< Allocator >::prepare(), libtorrent::http_tracker_connection::receive(), asio::detail::reactive_socket_service< Protocol, Reactor >::receive(), asio::detail::reactive_socket_service< Protocol, Reactor >::receive_from(), libtorrent::udp_tracker_connection::scrape_response(), asio::detail::reactive_socket_service< Protocol, Reactor >::send(), libtorrent::dht::dht_tracker::send_packet(), asio::detail::reactive_socket_service< Protocol, Reactor >::send_to(), libtorrent::udp_tracker_connection::send_udp_announce(), libtorrent::udp_tracker_connection::send_udp_connect(), libtorrent::udp_tracker_connection::send_udp_scrape(), libtorrent::http_tracker_connection::sent(), libtorrent::peer_connection::setup_receive(), libtorrent::peer_connection::setup_send(), and asio::basic_socket_streambuf< Protocol, StreamSocketService >::underflow().
1.5.6