Namespaces | Defines | Functions | Variables

network_ana.cpp File Reference

Network API implementation using ana. More...

#include "network.hpp"
#include "network_manager_ana.hpp"
#include "global.hpp"
#include "config.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/parser.hpp"
#include "thread.hpp"
#include "util.hpp"
#include "filesystem.hpp"
#include <cerrno>
#include <queue>
#include <iomanip>
#include <set>
#include <cstring>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <fcntl.h>
Include dependency graph for network_ana.cpp:

Go to the source code of this file.

Namespaces

namespace  network
 

High level network layer for config object transport.


Defines

#define SOCKET   int
#define DBG_NW   LOG_STREAM(debug, log_network)
#define LOG_NW   LOG_STREAM(info, log_network)
#define WRN_NW   LOG_STREAM(warn, log_network)
#define ERR_NW   LOG_STREAM(err, log_network)

Functions

connection_stats network::get_connection_stats (connection connection_num)
pending_statistics network::get_pending_stats ()
void network::set_raw_data_only ()
size_t network::nconnections ()
 The number of peers we are connected to.
bool network::is_server ()
 If we are currently accepting connections.
connection network::connect (const std::string &host, int port=15000)
 Function to attempt to connect to a remote host.
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.
bool network::disconnect (connection connection_num=0)
 Function to disconnect from a certain host, or close all connections if connection_num is 0.
void network::queue_disconnect (connection connection_num)
 Function to queue a disconnection.
connection network::receive_data (config &cfg, connection connection_num, unsigned int timeout, bandwidth_in_ptr *bandwidth_in)
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.
connection network::receive_data (std::vector< char > &buf, bandwidth_in_ptr *bandwidth_in)
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)
std::string network::get_bandwidth_stats_all ()
std::string network::get_bandwidth_stats ()
std::string network::get_bandwidth_stats (int hour)
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.
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.
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'.
std::string network::ip_address (connection connection_num)
 Function to get the remote ip address of a socket.
statistics network::get_send_stats (connection handle)
 Function to see the number of bytes being processed on the current socket.
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.
void network::set_proxy_address (const std::string &address)
 Set the address of the proxy.
void network::set_proxy_port (const std::string &port)
 Set the port of the proxy.
void network::set_proxy_user (const std::string &user)
 Set the user to authenticate with the proxy.
void network::set_proxy_password (const std::string &password)
 Set the password to authenticate with the proxy.

Variables

static lg::log_domain log_network ("network")

Detailed Description

Network API implementation using ana.

Copyright (C) 2010 - 2012 Guillermo Biset.

Part of the Battle for Wesnoth Project http://www.wesnoth.org/

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

See the COPYING file for more details.

Definition in file network_ana.cpp.


Define Documentation

#define DBG_NW   LOG_STREAM(debug, log_network)

Definition at line 63 of file network_ana.cpp.

#define ERR_NW   LOG_STREAM(err, log_network)

Definition at line 66 of file network_ana.cpp.

#define LOG_NW   LOG_STREAM(info, log_network)

Definition at line 64 of file network_ana.cpp.

#define SOCKET   int

Definition at line 59 of file network_ana.cpp.

#define WRN_NW   LOG_STREAM(warn, log_network)

Definition at line 65 of file network_ana.cpp.


Variable Documentation

lg::log_domain log_network("network") [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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