Namespaces | Classes | Typedefs | Enumerations | Functions

ana Namespace Reference

Namespace for project ana, the entire API is under this namespce. More...

Namespaces

namespace  detail
 

Used for implementation purposes.


namespace  serializer
 

Module for object serialization and Marshalling.


namespace  time
 

Time conversion functions.


Classes

struct  listener_handler
 Class that should be implemented to handle incoming messages or disconnections. More...
struct  network_stats_logger
 Interface for every component that logs network statistics. More...
struct  connection_handler
 Class that should be implemented to handle new connection events. More...
struct  send_handler
 Class that should be implemented to handle send completion events. More...
struct  server
 A network server. More...
struct  client
 A network client. More...
struct  client_predicate
 A boolean predicate of client IDs. More...
struct  stats
 A network statistics object, describes statistics for a given time period. More...
class  timer
 General purpose asynchronous timer. More...

Typedefs

typedef boost::shared_ptr
< detail::read_buffer_implementation
read_buffer
 A shared pointer to a read_buffer, self destructs when no one is referencing it.
Timers

Definitions of timer related types.

typedef
boost::asio::basic_deadline_timer
< std::time_t,
detail::time_t_traits > 
boost_timer
 A boost::asio::basic_deadline_timer, can be used externally.

Enumerations

enum  stat_type {
  ACCUMULATED, SECONDS, MINUTES, HOURS,
  DAYS
}
 

Type of collected network statistics.

More...
enum  timeout_policy { NoTimeouts, FixedTime, TimePerKilobyte }
 

Timeout policies for send operations.

More...

Functions

template<class predicate >
_generic_client_predicate
< predicate > 
create_predicate (const predicate &pred)
 Creates a client predicate to be used in send operations.
Miscellaneous Functions

Functions for data conversions.

void network_to_host_long (ana_uint32 &value)
 Converts a 32 bit number in network byte order to a local number.
void host_to_network_long (ana_uint32 &value)
 Converts a 32 bit number into a network byte order number.
void network_to_host_short (ana_uint16 &value)
 Converts a 16 bit number in network byte order to a local number.
void host_to_network_short (ana_uint16 &value)
 Converts a 16 bit number into a network byte order number.
Buffer creation methods

boost::asio::mutable_buffers_1 buffer (const boost::asio::mutable_buffer &b)
boost::asio::mutable_buffers_1 buffer (const boost::asio::mutable_buffer &b, std::size_t max_size_in_bytes)
boost::asio::const_buffers_1 buffer (const boost::asio::const_buffer &b)
boost::asio::const_buffers_1 buffer (const boost::asio::const_buffer &b, std::size_t max_size_in_bytes)
boost::asio::mutable_buffers_1 buffer (void *data, std::size_t size_in_bytes)
boost::asio::const_buffers_1 buffer (const void *data, std::size_t size_in_bytes)
template<typename PodType , std::size_t N>
boost::asio::mutable_buffers_1 buffer (PodType &data)
template<typename PodType , std::size_t N>
boost::asio::mutable_buffers_1 buffer (PodType &data, std::size_t max_size_in_bytes)
template<typename PodType , std::size_t N>
boost::asio::const_buffers_1 buffer (const PodType &data)
template<typename PodType , std::size_t N>
boost::asio::const_buffers_1 buffer (const PodType &data, std::size_t max_size_in_bytes)
template<typename PodType , std::size_t N>
boost::asio::mutable_buffers_1 buffer (boost::array< PodType, N > &data)
template<typename PodType , std::size_t N>
boost::asio::mutable_buffers_1 buffer (boost::array< PodType, N > &data, std::size_t max_size_in_bytes)
template<typename PodType , std::size_t N>
boost::asio::const_buffers_1 buffer (boost::array< const PodType, N > &data)
template<typename PodType , std::size_t N>
boost::asio::const_buffers_1 buffer (boost::array< const PodType, N > &data, std::size_t max_size_in_bytes)
template<typename PodType , typename Allocator >
boost::asio::mutable_buffers_1 buffer (std::vector< PodType, Allocator > &data)
template<typename PodType , typename Allocator >
boost::asio::mutable_buffers_1 buffer (std::vector< PodType, Allocator > &data, std::size_t max_size_in_bytes)
template<typename PodType , typename Allocator >
boost::asio::const_buffers_1 buffer (const std::vector< PodType, Allocator > &data)
template<typename PodType , typename Allocator >
boost::asio::const_buffers_1 buffer (const std::vector< PodType, Allocator > &data, std::size_t max_size_in_bytes)
boost::asio::const_buffers_1 buffer (const std::string &data)
boost::asio::const_buffers_1 buffer (const std::string &data, std::size_t max_size_in_bytes)

Type and constant definitions

Definitions of main types and relevant constants.



typedef boost::uint32_t ana_uint32
 Standard unsigned int, with fixed size to 32 bits.
typedef boost::int32_t ana_int32
 Standard int, with fixed size to 32 bits.
typedef boost::uint16_t ana_uint16
 Standard unsigned int, with fixed size to 16 bits.
typedef boost::int16_t ana_int16
 Standard int, with fixed size to 16 bits.
typedef ana_uint32 message_size
 Message size type.
typedef size_t net_id
 IDs of connected components, unique, non zero.
typedef size_t operation_id
 IDs of network operations, unique, zero = no-op.
typedef std::string port
 Port type, a std::string (instead of a short.
typedef std::string address
 Address type, a string.
typedef bool send_type
 Send operation type, true to copy the buffer.
typedef boost::system::error_code error_code
 Standard error code, can evaluate to bool.
const ana::error_code operation_aborted
 The default timeout error.
const ana::error_code timeout_error
 The default timeout error.
const ana::error_code generic_error
 A generic error.
const operation_id no_operation = 0
 A network operation that didn't do anything.
const operation_id invalid_net_id = 0
 An invalid net_id.
const send_type ZERO_COPY = false
 Don't copy the buffer.
const send_type COPY_BUFFER = true
 Copy the buffer.
const message_size HEADER_LENGTH = sizeof(ana_uint32)
 Length of message header, 4 bytes.
const message_size INITIAL_RAW_MODE_BUFFER_SIZE = 256
 Initial length of raw message buffer.

Detailed Description

Namespace for project ana, the entire API is under this namespce.


Typedef Documentation

typedef std::string ana::address

Address type, a string.

Either IP of hostname.

Definition at line 74 of file common.hpp.

typedef boost::int16_t ana::ana_int16

Standard int, with fixed size to 16 bits.

Definition at line 59 of file common.hpp.

typedef boost::int32_t ana::ana_int32

Standard int, with fixed size to 32 bits.

Definition at line 53 of file common.hpp.

typedef boost::uint16_t ana::ana_uint16

Standard unsigned int, with fixed size to 16 bits.

Definition at line 56 of file common.hpp.

typedef boost::uint32_t ana::ana_uint32

Standard unsigned int, with fixed size to 32 bits.

Definition at line 50 of file common.hpp.

typedef boost::asio::basic_deadline_timer<std::time_t,detail::time_t_traits> ana::boost_timer

A boost::asio::basic_deadline_timer, can be used externally.

Definition at line 159 of file timers.hpp.

typedef boost::system::error_code ana::error_code

Standard error code, can evaluate to bool.

Definition at line 80 of file common.hpp.

Message size type.

Definition at line 62 of file common.hpp.

typedef size_t ana::net_id

IDs of connected components, unique, non zero.

Definition at line 65 of file common.hpp.

typedef size_t ana::operation_id

IDs of network operations, unique, zero = no-op.

Definition at line 68 of file common.hpp.

typedef std::string ana::port

Port type, a std::string (instead of a short.

)

Definition at line 71 of file common.hpp.

A shared pointer to a read_buffer, self destructs when no one is referencing it.

Definition at line 171 of file buffers.hpp.

typedef bool ana::send_type

Send operation type, true to copy the buffer.

Definition at line 77 of file common.hpp.


Enumeration Type Documentation

Type of collected network statistics.

Enumerator:
ACCUMULATED 

Statistics accumulated since creation of the network component.

SECONDS 

Network statistics for the last second.

MINUTES 

Network statistics for the last minute.

HOURS 

Network statistics for the last hour.

DAYS 

Network statistics for the last day.

Definition at line 41 of file stats.hpp.

Timeout policies for send operations.

See also:
timer
Enumerator:
NoTimeouts 

Don't use timers in any operation.

FixedTime 

Use timers with a fixed time for every operation.

TimePerKilobyte 

Use timers, calculating the necessary time from the size of the buffer that is to be sent.

Definition at line 102 of file timers.hpp.


Function Documentation

template<class predicate >
_generic_client_predicate<predicate> ana::create_predicate ( const predicate &  pred  ) 

Creates a client predicate to be used in send operations.

This function can be used to create predicate objects from the standard library's bind1st objects and from boost::bind too.

Examples:

  • server_->send_if(boost::asio::buffer( str ), this, create_predicate( boost::bind( std::not_equal_to<net_id>(), client, _1) ) );
Parameters:
pred Predicate of the queried client.
Returns:
Predicate for client selection.

Definition at line 112 of file predicates.hpp.

Referenced by asio_server::send_all_except(), and asio_server::send_one().

Here is the caller graph for this function:

void ana::host_to_network_long ( ana_uint32 &  value  )  [inline]

Converts a 32 bit number into a network byte order number.

Definition at line 96 of file ana.hpp.

Referenced by ana_network_manager::handle_receive(), and asio_sender::send().

Here is the caller graph for this function:

void ana::host_to_network_short ( ana_uint16 &  value  )  [inline]

Converts a 16 bit number into a network byte order number.

Definition at line 106 of file ana.hpp.

void ana::network_to_host_long ( ana_uint32 &  value  )  [inline]

Converts a 32 bit number in network byte order to a local number.

Definition at line 91 of file ana.hpp.

Referenced by ana_network_manager::create_client_and_connect(), asio_listener::handle_header(), and ana_network_manager::handle_receive().

Here is the caller graph for this function:

void ana::network_to_host_short ( ana_uint16 &  value  )  [inline]

Converts a 16 bit number in network byte order to a local number.

Definition at line 101 of file ana.hpp.


Variable Documentation

Copy the buffer.

Definition at line 105 of file common.hpp.

Initial value:
                    boost::asio::error::make_error_code( boost::asio::error::fault )

A generic error.

Used to describe an undefined error.

Definition at line 91 of file common.hpp.

Referenced by asio_client::connect(), proxy_connection::do_connect(), proxy_connection::handle_response(), and asio_listener::listen_one_message().

Length of message header, 4 bytes.

Definition at line 108 of file common.hpp.

Referenced by asio_listener::handle_header(), asio_listener::listen_one_message(), and asio_sender::send().

Initial length of raw message buffer.

Definition at line 111 of file common.hpp.

An invalid net_id.

Useful for error checking.

Definition at line 98 of file common.hpp.

Referenced by ana_network_manager::create_client_and_connect().

A network operation that didn't do anything.

Definition at line 95 of file common.hpp.

Referenced by asio_server::send_all(), and asio_server::send_if().

Initial value:
                    boost::asio::error::make_error_code( boost::asio::error::operation_aborted )

The default timeout error.

Definition at line 83 of file common.hpp.

Referenced by asio_listener::handle_timeout(), asio_client::handle_timeout(), and network_asio::connection::poll().

Initial value:
                    boost::asio::error::make_error_code( boost::asio::error::timed_out )

The default timeout error.

Definition at line 87 of file common.hpp.

Referenced by ChatClient::handle_receive(), asio_listener::handle_timeout(), ana_multiple_receive_handler::wait_completion(), and ana_receive_handler::wait_completion().

const send_type ana::ZERO_COPY = false

Don't copy the buffer.

Definition at line 102 of file common.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:17:58 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs