network_worker.hpp

Go to the documentation of this file.
00001 /* $Id: network_worker.hpp 25339 2008-03-30 18:02:36Z dave $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 #ifndef NETWORK_WORKER_HPP_INCLUDED
00016 #define NETWORK_WORKER_HPP_INCLUDED
00017 
00018 #include <map>
00019 #include <vector>
00020 #include "config.hpp"
00021 #include "network.hpp"
00022 #include "SDL_net.h"
00023 
00024 namespace network_worker_pool
00025 {
00026 
00027 struct manager
00028 {
00029     explicit manager(size_t min_threads,size_t max_threads);
00030     ~manager();
00031 
00032 private:
00033     manager(const manager&);
00034     void operator=(const manager&);
00035 
00036     bool active_;
00037 };
00038 
00039 network::pending_statistics get_pending_stats();
00040 
00041 void set_raw_data_only();
00042 
00043 //! Function to asynchronously received data to the given socket.
00044 void receive_data(TCPsocket sock);
00045 
00046 TCPsocket get_received_data(TCPsocket sock, config& cfg);
00047 TCPsocket get_received_data(std::vector<char>& buf);
00048 
00049 void queue_raw_data(TCPsocket sock, const char* buf, int len);
00050 void queue_data(TCPsocket sock, const config& buf, const bool gzipped);
00051 bool is_locked(const TCPsocket sock);
00052 bool close_socket(TCPsocket sock, bool force=false);
00053 TCPsocket detect_error();
00054 
00055 std::pair<network::statistics,network::statistics> get_current_transfer_stats(TCPsocket sock);
00056 
00057 }
00058 
00059 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs