15 #ifndef CAMPAIGN_SERVER_HPP_INCLUDED
16 #define CAMPAIGN_SERVER_HPP_INCLUDED
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/unordered_map.hpp>
31 class server :
private boost::noncopyable
35 size_t min_threads = 10,
36 size_t max_threads = 0);
90 boost::scoped_ptr<input_stream>
input_;
92 std::map<std::string, std::string>
hooks_;
High level network layer for config object transport.
std::string feedback_url_format_
void handle_request_terms(const request &)
void handle_delete(const request &)
Client request information object.
config & campaigns()
Retrieves the contents of the [campaigns] WML node.
const config & server_info() const
Retrieves the contents of the [server_info] WML node.
void fire(const std::string &hook, const std::string &addon)
Fires a hook script.
request_handlers_table handlers_
std::map< std::string, std::string > hooks_
void load_blacklist()
Reads the add-ons upload blacklist from WML.
void register_handlers()
Registers client request handlers.
const std::string cfg_file_
std::map< std::string, request_handler > request_handlers_table
const config & campaigns() const
Retrieves the contents of the [campaigns] WML node.
std::string blacklist_file_
const network::connection sock
void handle_change_passphrase(const request &)
const network::manager net_manager_
request(const std::string &reqcmd, const config &reqcfg, network::connection reqsock)
Constructor.
void send_error(const std::string &msg, network::connection sock)
Send a client an error message.
void write_config()
Writes the server configuration WML back to disk.
const network::server_manager server_manager_
boost::scoped_ptr< input_stream > input_
Server control socket.
config & server_info()
Retrieves the contents of the [server_info] WML node.
void handle_request_campaign(const request &)
A server manager causes listening on a given port to occur for the duration of its lifetime...
void send_message(const std::string &msg, network::connection sock)
Send a client an informational message.
int load_config()
Reads the server configuration from WML.
void register_handler(const std::string &cmd, const request_handler &func)
Registers a single request handler.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
void handle_request_campaign_list(const request &)
std::function< void(server *, const request &req)> request_handler
std::string ip_address(connection connection_num)
Function to get the remote ip address of a socket.
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
config & find_child(const std::string &key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
server(const std::string &cfg_file, size_t min_threads=10, size_t max_threads=0)
A config object defines a single node in a WML file, with access to child nodes.
void run()
Runs the server request processing loop.
void handle_upload(const request &)
GLsizei const GLcharARB ** string
config & get_campaign(const std::string &id)
Retrieves a campaign by id if found, or a null config otherwise.
int compress_level_
Used for add-on archives.