17 #ifndef NETWORK_HPP_INCLUDED
18 #define NETWORK_HPP_INCLUDED
31 #include <boost/shared_ptr.hpp>
32 #include <boost/exception/error_info.hpp>
62 explicit manager(
size_t min_threads = 1,
size_t max_threads = 0);
220 connection
receive_data(
config& cfg, connection connection_num=0, bandwidth_in_ptr*
b = 0);
222 connection
receive_data(std::vector<char>&
buf, bandwidth_in_ptr* = 0);
High level network layer for config object transport.
void fresh_current(size_t len)
const int ping_interval
Minimum interval between pings.
void send_data_all_except(const config &cfg, connection connection_num, const std::string &packet_type)
Function to send data to all peers except 'connection_num'.
void add_bandwidth_in(const std::string &packet_type, size_t len)
void queue_disconnect(network::connection sock)
Function to queue a disconnection.
GLuint GLuint GLsizei GLenum type
void set_proxy_user(const std::string &)
Set the user to authenticate with the proxy.
bool operator==(const statistics &stats) const
connection receive_data(config &cfg, connection connection_num, unsigned int timeout, bandwidth_in_ptr *bandwidth_in)
void process_send_queue(connection, size_t)
Function to send any data that is in a connection's send_queue, up to a maximum of 'max_size' bytes �...
void enable_connection_through_proxy()
Attempt to connect through a proxy (as opposed to directly.)
void set_proxy_address(const std::string &)
Set the address of the proxy.
void operator=(const manager &)
GLdouble GLdouble GLdouble b
void send_file(const std::string &filename, connection connection_num, const std::string &packet_type)
size_t current_max
The current buffer size (i.e.
void set_proxy_port(const std::string &)
Set the port of the proxy.
manager(size_t min_threads=1, size_t max_threads=0)
pending_statistics get_pending_stats()
void set_type(const std::string &type)
GLenum GLuint GLsizei const char * buf
unsigned int ping_timeout
Amount of seconds after the last server ping when we assume to have timed out.
bool operator!=(const statistics &stats) const
void set_proxy_password(const std::string &)
Set the password to authenticate with the proxy.
GLuint GLuint64EXT address
size_t current
The current buffer accumulated bytes (sent/received.)
connection_stats(int sent, int received, int connected_at)
void send_raw_data(const char *buf, int len, connection connection_num, const std::string &packet_type)
CREATE_SERVER
Parameter to pass to the constructor.
statistics get_send_stats(connection handle)
Function to see the number of bytes being processed on the current socket.
size_t send_data(const config &cfg, connection connection_num, const std::string &packet_type)
Function to send data down a given connection, or broadcast to all peers if connection_num is 0...
GLbitfield GLuint64 timeout
Will throw exception on failure.
A server manager causes listening on a given port to occur for the duration of its lifetime...
boost::shared_ptr< bandwidth_in > bandwidth_in_ptr
server_manager(int port, CREATE_SERVER create_server=MUST_CREATE_SERVER)
connection accept_connection()
Function to accept a connection from a remote host.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
bool disconnect(connection s)
Function to disconnect from a certain host, or close all connections if connection_num is 0...
size_t nconnections()
The number of peers we are connected to.
boost::error_info< struct tag_connum, connection > connection_info
connection connect(const std::string &host, int port)
Function to attempt to connect to a remote host.
std::string ip_address(connection connection_num)
Function to get the remote ip address of a socket.
Base class for all the errors encountered by the engine.
void transfer(size_t size)
size_t total
The accumulated bytes of the session.
std::string get_bandwidth_stats_all()
bool is_server()
If we are currently accepting connections.
boost::error_info< struct tag_tcpsocket, TCPsocket > tcpsocket_info
std::string get_bandwidth_stats()
A config object defines a single node in a WML file, with access to child nodes.
statistics get_receive_stats(connection handle)
GLsizei const GLcharARB ** string
connection const null_connection
connection_stats get_connection_stats(connection connection_num)
boost::shared_ptr< halo_record > handle
void add_bandwidth_out(const std::string &packet_type, size_t len)