Project Alice
Loading...
Searching...
No Matches
network.cpp File Reference
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <string_view>
#include "system_state.hpp"
#include "commands.hpp"
#include "SPSCQueue.h"
#include "network.hpp"
#include "serialization.hpp"
#include "SHA512.hpp"
#include "gui_error_window.hpp"
#include "persistent_server_extensions.hpp"
#include "zstd.h"
#include <json.hpp>
Include dependency graph for network.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  network::local_addresses
 

Namespaces

namespace  network
 

Macros

#define ZSTD_STATIC_LINKING_ONLY
 
#define XXH_NAMESPACE   ZSTD_
 
#define HS_LOAD(x, y)
 
#define HS_SAVE(x, y)   data[x] = state.host_settings.y
 

Typedefs

using json = nlohmann::json
 

Functions

std::string network::get_last_error_msg ()
 
void network::clear_socket (sys::state &state, client_data &client)
 
void network::log_player_nations (sys::state &state)
 
dcon::mp_player_id network::create_mp_player (sys::state &state, sys::player_name &name, sys::player_password_raw &password)
 
dcon::mp_player_id network::load_mp_player (sys::state &state, sys::player_name &name, sys::player_password_hash &password_hash, sys::player_password_salt &password_salt)
 
void network::update_mp_player_password (sys::state &state, dcon::mp_player_id player_id, sys::player_password_raw &password)
 
dcon::mp_player_id network::find_mp_player (sys::state &state, sys::player_name name)
 
dcon::mp_player_id network::find_country_player (sys::state &state, dcon::nation_id nation)
 
void network::client_send_handshake (sys::state &state)
 
int network::client_process_handshake (sys::state &state)
 
void network::server_send_handshake (sys::state &state, network::client_data &client)
 
void network::init (sys::state &state)
 
void network::notify_player_joins (sys::state &state, sys::player_name name, dcon::nation_id nation, sys::player_password_raw password)
 
void network::notify_player_joins (sys::state &state, network::client_data &client)
 
void network::notify_player_joins_discovery (sys::state &state, network::client_data &client)
 
void network::send_savegame (sys::state &state, network::client_data &client, bool hotjoin=false)
 
void network::notify_start_game (sys::state &state, network::client_data &client)
 
void network::full_reset_after_oos (sys::state &state)
 
int network::server_process_handshake (sys::state &state, network::client_data &client)
 
int network::server_process_commands (sys::state &state, network::client_data &client)
 
bool network::pause_game (sys::state &state)
 
bool network::unpause_game (sys::state &state)
 
void network::write_network_save (sys::state &state)
 
void network::broadcast_save_to_clients (sys::state &state, command::payload &c, uint8_t const *buffer, uint32_t length, sys::checksum_key const &k)
 
void network::broadcast_to_clients (sys::state &state, command::payload &c)
 
void network::send_and_receive_commands (sys::state &state)
 
void network::finish (sys::state &state, bool notify_host)
 
void network::remove_player (sys::state &state, sys::player_name name)
 
void network::kick_player (sys::state &state, client_data &client)
 
void network::ban_player (sys::state &state, client_data &client)
 
void network::switch_player (sys::state &state, dcon::nation_id new_n, dcon::nation_id old_n)
 
void network::place_host_player_after_saveload (sys::state &state)
 
void network::load_host_settings (sys::state &state)
 
void network::save_host_settings (sys::state &state)
 

Variables

SHA512 network::sha512
 

Macro Definition Documentation

◆ HS_LOAD

#define HS_LOAD (   x,
 
)
Value:
if(!data[x].empty()) \
state.host_settings.y = data[x]

◆ HS_SAVE

#define HS_SAVE (   x,
 
)    data[x] = state.host_settings.y

◆ XXH_NAMESPACE

#define XXH_NAMESPACE   ZSTD_

Definition at line 36 of file network.cpp.

◆ ZSTD_STATIC_LINKING_ONLY

#define ZSTD_STATIC_LINKING_ONLY

Definition at line 35 of file network.cpp.

Typedef Documentation

◆ json

using json = nlohmann::json

Definition at line 45 of file network.cpp.