BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Namespaces | Classes | Functions
fc::asio Namespace Reference

defines fc wrappers for boost::asio functions. More...

Namespaces

 detail
 internal implementation types/methods for fc::asio
 
 tcp
 
 udp
 

Classes

class  default_io_service_scope
 
class  istream
 
class  ostream
 

Functions

boost::asio::io_service & default_io_service ()
 
template<typename AsyncReadStream , typename MutableBufferSequence >
size_t read (AsyncReadStream &s, const MutableBufferSequence &buf)
 wraps boost::asio::async_read More...
 
template<typename AsyncReadStream , typename MutableBufferSequence >
future< size_t > read_some (AsyncReadStream &s, const MutableBufferSequence &buf)
 
template<typename AsyncReadStream >
future< size_t > read_some (AsyncReadStream &s, char *buffer, size_t length, size_t offset=0)
 
template<typename AsyncReadStream >
future< size_t > read_some (AsyncReadStream &s, const std::shared_ptr< char > &buffer, size_t length, size_t offset)
 
template<typename AsyncReadStream , typename MutableBufferSequence >
void async_read_some (AsyncReadStream &s, const MutableBufferSequence &buf, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
void async_read_some (AsyncReadStream &s, char *buffer, size_t length, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
void async_read_some (AsyncReadStream &s, const std::shared_ptr< char > &buffer, size_t length, size_t offset, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
size_t read_some (AsyncReadStream &s, boost::asio::streambuf &buf)
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
size_t write (AsyncWriteStream &s, const ConstBufferSequence &buf)
 wraps boost::asio::async_write More...
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
future< size_t > write_some (AsyncWriteStream &s, const ConstBufferSequence &buf)
 wraps boost::asio::async_write_some More...
 
template<typename AsyncWriteStream >
future< size_t > write_some (AsyncWriteStream &s, const char *buffer, size_t length, size_t offset=0)
 
template<typename AsyncWriteStream >
future< size_t > write_some (AsyncWriteStream &s, const std::shared_ptr< const char > &buffer, size_t length, size_t offset)
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
void async_write_some (AsyncWriteStream &s, const ConstBufferSequence &buf, promise< size_t >::ptr completion_promise)
 wraps boost::asio::async_write_some More...
 
template<typename AsyncWriteStream >
void async_write_some (AsyncWriteStream &s, const char *buffer, size_t length, promise< size_t >::ptr completion_promise)
 
template<typename AsyncWriteStream >
void async_write_some (AsyncWriteStream &s, const std::shared_ptr< const char > &buffer, size_t length, size_t offset, promise< size_t >::ptr completion_promise)
 

Detailed Description

defines fc wrappers for boost::asio functions.

Function Documentation

◆ async_read_some() [1/3]

template<typename AsyncReadStream >
void fc::asio::async_read_some ( AsyncReadStream &  s,
char *  buffer,
size_t  length,
promise< size_t >::ptr  completion_promise 
)

Definition at line 154 of file asio.hpp.

◆ async_read_some() [2/3]

template<typename AsyncReadStream , typename MutableBufferSequence >
void fc::asio::async_read_some ( AsyncReadStream &  s,
const MutableBufferSequence &  buf,
promise< size_t >::ptr  completion_promise 
)

Definition at line 148 of file asio.hpp.

◆ async_read_some() [3/3]

template<typename AsyncReadStream >
void fc::asio::async_read_some ( AsyncReadStream &  s,
const std::shared_ptr< char > &  buffer,
size_t  length,
size_t  offset,
promise< size_t >::ptr  completion_promise 
)

Definition at line 161 of file asio.hpp.

◆ async_write_some() [1/3]

template<typename AsyncWriteStream >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const char *  buffer,
size_t  length,
promise< size_t >::ptr  completion_promise 
)

Definition at line 225 of file asio.hpp.

◆ async_write_some() [2/3]

template<typename AsyncWriteStream , typename ConstBufferSequence >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf,
promise< size_t >::ptr  completion_promise 
)

wraps boost::asio::async_write_some

Precondition
s.non_blocking() == true
Returns
the number of bytes written

Definition at line 220 of file asio.hpp.

◆ async_write_some() [3/3]

template<typename AsyncWriteStream >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const std::shared_ptr< const char > &  buffer,
size_t  length,
size_t  offset,
promise< size_t >::ptr  completion_promise 
)

Definition at line 232 of file asio.hpp.

◆ default_io_service()

boost::asio::io_service & fc::asio::default_io_service ( )
Returns
the default boost::asio::io_service for use with fc::asio

This IO service is automatically running in its own thread to service asynchronous requests without blocking any other threads.

Definition at line 219 of file asio.cpp.

◆ read()

template<typename AsyncReadStream , typename MutableBufferSequence >
size_t fc::asio::read ( AsyncReadStream &  s,
const MutableBufferSequence &  buf 
)

wraps boost::asio::async_read

Precondition
s.non_blocking() == true
Returns
the number of bytes read.

Definition at line 103 of file asio.hpp.

◆ read_some() [1/4]

template<typename AsyncReadStream >
size_t fc::asio::read_some ( AsyncReadStream &  s,
boost::asio::streambuf &  buf 
)

Definition at line 168 of file asio.hpp.

◆ read_some() [2/4]

template<typename AsyncReadStream >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
char *  buffer,
size_t  length,
size_t  offset = 0 
)

Definition at line 130 of file asio.hpp.

◆ read_some() [3/4]

template<typename AsyncReadStream , typename MutableBufferSequence >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
const MutableBufferSequence &  buf 
)

This method will read at least 1 byte from the stream and will cooperatively block until that byte is available or an error occurs.

If the stream is not in 'non-blocking' mode it will be put in 'non-blocking' mode it the stream supports s.non_blocking() and s.non_blocking(bool).

If in non blocking mode, the call will be synchronous avoiding heap allocs and context switching. If the sync call returns 'would block' then an promise is created and an async read is generated.

Returns
the number of bytes read.

Definition at line 122 of file asio.hpp.

◆ read_some() [4/4]

template<typename AsyncReadStream >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
const std::shared_ptr< char > &  buffer,
size_t  length,
size_t  offset 
)

Definition at line 139 of file asio.hpp.

◆ write()

template<typename AsyncWriteStream , typename ConstBufferSequence >
size_t fc::asio::write ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf 
)

wraps boost::asio::async_write

Returns
the number of bytes written

Definition at line 180 of file asio.hpp.

◆ write_some() [1/3]

template<typename AsyncWriteStream >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const char *  buffer,
size_t  length,
size_t  offset = 0 
)

Definition at line 199 of file asio.hpp.

◆ write_some() [2/3]

template<typename AsyncWriteStream , typename ConstBufferSequence >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf 
)

wraps boost::asio::async_write_some

Precondition
s.non_blocking() == true
Returns
the number of bytes written

Definition at line 192 of file asio.hpp.

◆ write_some() [3/3]

template<typename AsyncWriteStream >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const std::shared_ptr< const char > &  buffer,
size_t  length,
size_t  offset 
)

Definition at line 207 of file asio.hpp.