The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Typedefs | Functions | Variables
network.hpp File Reference
#include "exceptions.hpp"
#include <SDL_net.h>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/exception/error_info.hpp>
Include dependency graph for network.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  network::pending_statistics
 
struct  network::manager
 
struct  network::server_manager
 A server manager causes listening on a given port to occur for the duration of its lifetime. More...
 
struct  network::bandwidth_in
 
struct  network::connection_stats
 
struct  network::error
 
struct  network::statistics
 

Namespaces

 threading
 
 network
 High level network layer for config object transport.
 

Typedefs

typedef int network::connection
 
typedef boost::shared_ptr
< bandwidth_in > 
network::bandwidth_in_ptr
 
typedef boost::error_info
< struct tag_tcpsocket,
TCPsocket > 
network::tcpsocket_info
 
typedef boost::error_info
< struct tag_connum,
connection > 
network::connection_info
 

Functions

pending_statistics network::get_pending_stats ()
 
void network::set_raw_data_only ()
 
size_t network::nconnections ()
 The number of peers we are connected to. More...
 
bool network::is_server ()
 If we are currently accepting connections. More...
 
connection network::connect (const std::string &host, int port=15000)
 Function to attempt to connect to a remote host. More...
 
connection network::connect (const std::string &host, int port, threading::waiter &waiter)
 
connection network::accept_connection ()
 Function to accept a connection from a remote host. More...
 
bool network::disconnect (connection connection_num=0)
 Function to disconnect from a certain host, or close all connections if connection_num is 0. More...
 
void network::queue_disconnect (connection connection_num)
 Function to queue a disconnection. More...
 
std::string network::get_bandwidth_stats ()
 
std::string network::get_bandwidth_stats_all ()
 
std::string network::get_bandwidth_stats (int hour)
 
void network::add_bandwidth_out (const std::string &packet_type, size_t len)
 
void network::add_bandwidth_in (const std::string &packet_type, size_t len)
 
connection network::receive_data (config &cfg, connection connection_num=0, bandwidth_in_ptr *b=0)
 Function to receive data from either a certain connection, or all connections if connection_num is 0. More...
 
connection network::receive_data (config &cfg, connection connection_num, unsigned int timeout, bandwidth_in_ptr *bandwidth_in)
 
connection network::receive_data (std::vector< char > &buf, bandwidth_in_ptr *bandwidth_in)
 
void network::send_file (const std::string &filename, connection connection_num, const std::string &packet_type)
 
size_t network::send_data (const config &cfg, connection connection_num=0, const std::string &packet_type="unknown")
 Function to send data down a given connection, or broadcast to all peers if connection_num is 0. More...
 
void network::send_raw_data (const char *buf, int len, connection connection_num, const std::string &packet_type)
 
void network::process_send_queue (connection connection_num=0, size_t max_size=0)
 Function to send any data that is in a connection's send_queue, up to a maximum of 'max_size' bytes – or the entire send queue if 'max_size' bytes is 0. More...
 
void network::send_data_all_except (const config &cfg, connection connection_num, const std::string &packet_type="unknown")
 Function to send data to all peers except 'connection_num'. More...
 
std::string network::ip_address (connection connection_num)
 Function to get the remote ip address of a socket. More...
 
connection_stats network::get_connection_stats (connection connection_num)
 
statistics network::get_send_stats (connection handle)
 Function to see the number of bytes being processed on the current socket. More...
 
statistics network::get_receive_stats (connection handle)
 
Proxy Settings Methods

Methods to configure the connection of a client through a proxy server.

void network::enable_connection_through_proxy ()
 Attempt to connect through a proxy (as opposed to directly.) More...
 
void network::set_proxy_address (const std::string &address)
 Set the address of the proxy. More...
 
void network::set_proxy_port (const std::string &port)
 Set the port of the proxy. More...
 
void network::set_proxy_user (const std::string &user)
 Set the user to authenticate with the proxy. More...
 
void network::set_proxy_password (const std::string &password)
 Set the password to authenticate with the proxy. More...
 

Variables

connection const network::null_connection = 0
 
const int network::ping_interval = 30
 Minimum interval between pings. More...