asio Namespace Reference


Classes

class  basic_datagram_socket
 Provides datagram-oriented socket functionality. More...
class  basic_deadline_timer
 Provides waitable timer functionality. More...
class  basic_io_object
 Base class for all I/O objects. More...
class  basic_socket
 Provides socket functionality. More...
class  basic_socket_acceptor
 Provides the ability to accept new connections. More...
class  basic_socket_iostream
 Iostream interface for a socket. More...
class  basic_socket_streambuf
 Iostream streambuf for a socket. More...
class  basic_stream_socket
 Provides stream-oriented socket functionality. More...
class  basic_streambuf
 Automatically resizable buffer class based on std::streambuf. More...
class  mutable_buffer
 Holds a buffer that can be modified. More...
class  mutable_buffers_1
class  const_buffer
 Holds a buffer that cannot be modified. More...
class  const_buffers_1
class  buffered_read_stream
 Adds buffering to the read-related operations of a stream. More...
class  buffered_stream
 Adds buffering to the read- and write-related operations of a stream. More...
class  buffered_write_stream
 Adds buffering to the write-related operations of a stream. More...
class  datagram_socket_service
 Default service implementation for a datagram socket. More...
class  deadline_timer_service
 Default service implementation for a timer. More...
class  error
 Contains error constants. More...
class  error_code
 Class to represent an error code value. More...
class  io_service
 Provides core I/O functionality. More...
class  service_already_exists
 Exception thrown when trying to add a duplicate service to an io_service. More...
class  invalid_service_owner
class  is_read_buffered
class  is_write_buffered
class  socket_acceptor_service
 Default service implementation for a socket acceptor. More...
class  socket_base
class  stream_socket_service
 Default service implementation for a stream socket. More...
class  system_error
class  thread
 A simple abstraction for starting threads. More...
struct  time_traits< boost::posix_time::ptime >
 Time traits specialised for posix_time. More...

Namespaces

namespace  detail
namespace  ip
namespace  placeholders
namespace  ssl

Typedefs

typedef basic_deadline_timer
< boost::posix_time::ptime > 
deadline_timer
 Typedef for the typical usage of timer.
typedef asio::io_service::strand strand
 Typedef for backwards compatibility.
typedef basic_streambuf streambuf
 Typedef for the typical usage of basic_streambuf.

Enumerations

enum  error_category {
  native_ecat = ASIO_WIN_OR_POSIX(0, 0), netdb_ecat = ASIO_WIN_OR_POSIX(native_ecat, 1), addrinfo_ecat = ASIO_WIN_OR_POSIX(native_ecat, 2), misc_ecat = ASIO_WIN_OR_POSIX(3, 3),
  ssl_ecat = ASIO_WIN_OR_POSIX(4, 4)
}
 Available error code categories. More...

Functions

mutable_buffers_1 buffer (const mutable_buffer &b)
 Create a new modifiable buffer from an existing buffer.
mutable_buffers_1 buffer (const mutable_buffer &b, std::size_t max_size_in_bytes)
 Create a new modifiable buffer from an existing buffer.
const_buffers_1 buffer (const const_buffer &b)
 Create a new non-modifiable buffer from an existing buffer.
const_buffers_1 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 buffer (void *data, std::size_t size_in_bytes)
 Create a new modifiable buffer that represents the given memory range.
const_buffers_1 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 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 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 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 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 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 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 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 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 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 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 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 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 buffer (const std::string &data)
 Create a new non-modifiable buffer that represents the given string.
const_buffers_1 buffer (const std::string &data, std::size_t max_size_in_bytes)
 Create a new non-modifiable buffer that represents the given string.
detail::transfer_all_t transfer_all ()
detail::transfer_at_least_t transfer_at_least (std::size_t minimum)
void * asio_handler_allocate (std::size_t size,...)
 Default allocation function for handlers.
void asio_handler_deallocate (void *pointer, std::size_t size,...)
 Default deallocation function for handlers.
template<typename Function>
void asio_handler_invoke (Function function,...)
 Default invoke function for handlers.
template<typename Service>
Service & use_service (io_service &ios)
template<typename Service>
void add_service (io_service &ios, Service *svc)
template<typename Service>
bool has_service (io_service &ios)
template<typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition>
std::size_t read (SyncReadStream &s, const MutableBufferSequence &buffers, CompletionCondition completion_condition, asio::error_code &ec)
 Attempt to read a certain amount of data from a stream before returning.
template<typename SyncReadStream, typename MutableBufferSequence>
std::size_t read (SyncReadStream &s, const MutableBufferSequence &buffers)
 Attempt to read a certain amount of data from a stream before returning.
template<typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition>
std::size_t read (SyncReadStream &s, const MutableBufferSequence &buffers, CompletionCondition completion_condition)
 Attempt to read a certain amount of data from a stream before returning.
template<typename SyncReadStream, typename Allocator, typename CompletionCondition>
std::size_t read (SyncReadStream &s, basic_streambuf< Allocator > &b, CompletionCondition completion_condition, asio::error_code &ec)
 Attempt to read a certain amount of data from a stream before returning.
template<typename SyncReadStream, typename Allocator>
std::size_t read (SyncReadStream &s, basic_streambuf< Allocator > &b)
 Attempt to read a certain amount of data from a stream before returning.
template<typename SyncReadStream, typename Allocator, typename CompletionCondition>
std::size_t read (SyncReadStream &s, basic_streambuf< Allocator > &b, CompletionCondition completion_condition)
 Attempt to read a certain amount of data from a stream before returning.
template<typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler>
void async_read (AsyncReadStream &s, const MutableBufferSequence &buffers, CompletionCondition completion_condition, ReadHandler handler)
template<typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler>
void async_read (AsyncReadStream &s, const MutableBufferSequence &buffers, ReadHandler handler)
template<typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler>
void async_read (AsyncReadStream &s, asio::basic_streambuf< Allocator > &b, CompletionCondition completion_condition, ReadHandler handler)
template<typename AsyncReadStream, typename Allocator, typename ReadHandler>
void async_read (AsyncReadStream &s, asio::basic_streambuf< Allocator > &b, ReadHandler handler)
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, char delim)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, char delim, asio::error_code &ec)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const std::string &delim)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const std::string &delim, asio::error_code &ec)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const boost::regex &expr)
 Read data into a streambuf until a regular expression is located.
template<typename SyncReadStream, typename Allocator>
std::size_t read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const boost::regex &expr, asio::error_code &ec)
 Read data into a streambuf until a regular expression is located.
template<typename AsyncReadStream, typename Allocator, typename ReadHandler>
void async_read_until (AsyncReadStream &s, asio::basic_streambuf< Allocator > &b, char delim, ReadHandler handler)
template<typename AsyncReadStream, typename Allocator, typename ReadHandler>
void async_read_until (AsyncReadStream &s, asio::basic_streambuf< Allocator > &b, const std::string &delim, ReadHandler handler)
template<typename AsyncReadStream, typename Allocator, typename ReadHandler>
void async_read_until (AsyncReadStream &s, asio::basic_streambuf< Allocator > &b, const boost::regex &expr, ReadHandler handler)
template<typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition>
std::size_t write (SyncWriteStream &s, const ConstBufferSequence &buffers, CompletionCondition completion_condition, asio::error_code &ec)
 Write a certain amount of data to a stream before returning.
template<typename SyncWriteStream, typename ConstBufferSequence>
std::size_t write (SyncWriteStream &s, const ConstBufferSequence &buffers)
 Write all of the supplied data to a stream before returning.
template<typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition>
std::size_t write (SyncWriteStream &s, const ConstBufferSequence &buffers, CompletionCondition completion_condition)
 Write a certain amount of data to a stream before returning.
template<typename SyncWriteStream, typename Allocator, typename CompletionCondition>
std::size_t write (SyncWriteStream &s, basic_streambuf< Allocator > &b, CompletionCondition completion_condition, asio::error_code &ec)
 Write a certain amount of data to a stream before returning.
template<typename SyncWriteStream, typename Allocator>
std::size_t write (SyncWriteStream &s, basic_streambuf< Allocator > &b)
 Write a certain amount of data to a stream before returning.
template<typename SyncWriteStream, typename Allocator, typename CompletionCondition>
std::size_t write (SyncWriteStream &s, basic_streambuf< Allocator > &b, CompletionCondition completion_condition)
 Write a certain amount of data to a stream before returning.
template<typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler>
void async_write (AsyncWriteStream &s, const ConstBufferSequence &buffers, CompletionCondition completion_condition, WriteHandler handler)
template<typename AsyncWriteStream, typename ConstBufferSequence, typename WriteHandler>
void async_write (AsyncWriteStream &s, const ConstBufferSequence &buffers, WriteHandler handler)
template<typename AsyncWriteStream, typename Allocator, typename CompletionCondition, typename WriteHandler>
void async_write (AsyncWriteStream &s, asio::basic_streambuf< Allocator > &b, CompletionCondition completion_condition, WriteHandler handler)
template<typename AsyncWriteStream, typename Allocator, typename WriteHandler>
void async_write (AsyncWriteStream &s, asio::basic_streambuf< Allocator > &b, WriteHandler handler)


Typedef Documentation

typedef basic_deadline_timer<boost::posix_time::ptime> asio::deadline_timer

Typedef for the typical usage of timer.

Definition at line 31 of file deadline_timer.hpp.

Typedef for backwards compatibility.

Definition at line 160 of file strand.hpp.

Typedef for the typical usage of basic_streambuf.

Definition at line 25 of file streambuf.hpp.


Enumeration Type Documentation

Available error code categories.

Enumerator:
native_ecat  Native error codes.
netdb_ecat  Error codes from NetDB functions.
addrinfo_ecat  Error codes from getaddrinfo.
misc_ecat  Miscellaneous error codes.
ssl_ecat  SSL error codes.

Definition at line 36 of file error_code.hpp.


Function Documentation

template<typename Service>
void asio::add_service ( io_service &  ios,
Service *  svc 
) [inline]

This function is used to add a service to the io_service.

Parameters:
ios The io_service object that owns the service.
svc The service object. On success, ownership of the service object is transferred to the io_service. When the io_service object is destroyed, it will destroy the service object by performing:
 delete static_cast<io_service::service*>(svc) 
Exceptions:
asio::service_already_exists Thrown if a service of the given type is already present in the io_service.
asio::invalid_service_owner Thrown if the service's owning io_service is not the io_service object specified by the ios parameter.

Definition at line 187 of file io_service.ipp.

References asio::io_service::io_service(), asio::io_service::service_registry_, and throw_exception().

void* asio::asio_handler_allocate ( std::size_t  size,
  ... 
) [inline]

Default allocation function for handlers.

Asynchronous operations may need to allocate temporary objects. Since asynchronous operations have a handler function object, these temporary objects can be said to be associated with the handler.

Implement asio_handler_allocate and asio_handler_deallocate for your own handlers to provide custom allocation for these temporary objects.

This default implementation is simply:

 return ::operator new(bytes);

Note:
All temporary objects associated with a handler will be deallocated before the upcall to the handler is performed. This allows the same memory to be reused for a subsequent asynchronous operation initiated by the handler.
Example
 class my_handler;

 void* asio_handler_allocate(std::size_t size, my_handler* context)
 {
   return ::operator new(size);
 }

 void asio_handler_deallocate(void* pointer, std::size_t size,
     my_handler* context)
 {
   ::operator delete(pointer);
 }

Definition at line 61 of file handler_alloc_hook.hpp.

void asio::asio_handler_deallocate ( void *  pointer,
std::size_t  size,
  ... 
) [inline]

Default deallocation function for handlers.

Implement asio_handler_allocate and asio_handler_deallocate for your own handlers to provide custom allocation for the associated temporary objects.

This default implementation is simply:

 ::operator delete(pointer);

See also:
asio_handler_allocate.

Definition at line 78 of file handler_alloc_hook.hpp.

template<typename Function>
void asio::asio_handler_invoke ( Function  function,
  ... 
) [inline]

Default invoke function for handlers.

Completion handlers for asynchronous operations are invoked by the io_service associated with the corresponding object (e.g. a socket or deadline_timer). Certain guarantees are made on when the handler may be invoked, in particular that a handler can only be invoked from a thread that is currently calling asio::io_service::run() on the corresponding io_service object. Handlers may subsequently be invoked through other objects (such as asio::strand objects) that provide additional guarantees.

When asynchronous operations are composed from other asynchronous operations, all intermediate handlers should be invoked using the same method as the final handler. This is required to ensure that user-defined objects are not accessed in a way that may violate the guarantees. This hooking function ensures that the invoked method used for the final handler is accessible at each intermediate step.

Implement asio_handler_invoke for your own handlers to specify a custom invocation strategy.

This default implementation is simply:

 function();

Example
 class my_handler;

 template <typename Function>
 void asio_handler_invoke(Function function, my_handler* context)
 {
   context->strand_.dispatch(function);
 }

Definition at line 60 of file handler_invoke_hook.hpp.

template<typename Service>
bool asio::has_service ( io_service &  ios  )  [inline]

This function is used to determine whether the io_service contains a service object corresponding to the given service type.

Parameters:
ios The io_service object that owns the service.
Returns:
A boolean indicating whether the io_service contains the service.

Definition at line 200 of file io_service.ipp.

References asio::io_service::service_registry_.

template<typename Service>
Service& asio::use_service ( io_service &  ios  )  [inline]

This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the io_service will create a new instance of the service.

Parameters:
ios The io_service object that owns the service.
Returns:
The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.

Definition at line 177 of file io_service.ipp.

References asio::io_service::service_registry_.


Generated on Sun May 25 00:21:25 2008 by  doxygen 1.5.6