The Battle for Wesnoth  1.19.0-dev
Functions
network Namespace Reference

High level network layer for config object transport. More...

Functions

static size_t write_callback (char *contents, size_t size, size_t nmemb, void *buffer)
 
void download (const std::string &url, const std::string &local_path)
 Initiates a standalone download of a single file from an HTTPS URL. More...
 

Detailed Description

High level network layer for config object transport.

This module provides high level network access using an API similar to sockets, but primarily for the transport of config objects. This is how the games protocols work - data is sent via config objects.

A client would create a manager object to initialize the network layer, connect(), and then send_data(). A server would create a server_manager object, then accept_connection(), and finally receive_data().

Function Documentation

◆ download()

void network::download ( const std::string &  url,
const std::string &  local_path 
)

Initiates a standalone download of a single file from an HTTPS URL.

Parameters
urlThe URL of the file to download.
local_pathThe path on the local machine to store the file at.

Definition at line 38 of file network_download_file.cpp.

References _(), DBG_NW, e, ERR_NW, filesystem::file_exists(), gui2::OK, gui2::show_message(), write_callback(), filesystem::write_file(), and gui2::dialogs::message::yes_no_buttons.

Referenced by gui2::dialogs::mp_match_history::update_display().

◆ write_callback()

static size_t network::write_callback ( char *  contents,
size_t  size,
size_t  nmemb,
void *  buffer 
)
static

Definition at line 30 of file network_download_file.cpp.

References DBG_NW, and utf8::size().

Referenced by download().