group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
GlobalDiscoveryProtocol.hpp File Reference

Shared wire helpers for global server browser and NAT assist. More...

#include "network/RelayToken.hpp"
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
Include dependency graph for GlobalDiscoveryProtocol.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  net::discovery::ServerInfo
struct  net::discovery::ServerRegistration
struct  net::discovery::RegisterAck
struct  net::discovery::PunchRequest
struct  net::discovery::PunchResponse
struct  net::discovery::UdpHello
struct  net::discovery::UdpPunchPeer

Namespaces

namespace  net
namespace  net::discovery

Enumerations

enum class  net::discovery::DirectoryMessage : std::uint8_t {
  net::discovery::RegisterServer = 1 , net::discovery::RegisterAck = 2 , net::discovery::Heartbeat = 3 , net::discovery::ListRequest = 4 ,
  net::discovery::ListResponse = 5 , net::discovery::PunchRequest = 6 , net::discovery::PunchResponse = 7 , net::discovery::PunchPeer = 8
}
enum class  net::discovery::DirectoryUdpMessage : std::uint8_t { net::discovery::Hello = 1 , net::discovery::PunchPeer = 2 , net::discovery::PunchProbe = 3 }
enum class  net::discovery::UdpRole : std::uint8_t { net::discovery::Server = 1 , net::discovery::Client = 2 }

Functions

std::vector< std::uint8_t > net::discovery::makeEnvelope (DirectoryMessage kind, const std::vector< std::uint8_t > &payload)
bool net::discovery::parseEnvelope (const void *data, std::size_t len, DirectoryMessage &kind, const std::uint8_t *&payload, std::size_t &payloadLen)
std::vector< std::uint8_t > net::discovery::encodeRegistration (DirectoryMessage kind, const ServerRegistration &reg)
std::optional< ServerRegistrationnet::discovery::decodeRegistration (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodeRegisterAck (const RegisterAck &ack)
std::optional< RegisterAcknet::discovery::decodeRegisterAck (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodeServerList (const std::vector< ServerInfo > &servers)
std::optional< std::vector< ServerInfo > > net::discovery::decodeServerList (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodePunchRequest (const PunchRequest &req)
std::optional< PunchRequestnet::discovery::decodePunchRequest (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodePunchResponse (const PunchResponse &resp)
std::optional< PunchResponsenet::discovery::decodePunchResponse (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodeUdpHello (const UdpHello &hello)
std::optional< UdpHellonet::discovery::decodeUdpHello (const std::uint8_t *data, std::size_t len)
std::vector< std::uint8_t > net::discovery::encodeUdpPunchPeer (const UdpPunchPeer &peer)
std::optional< UdpPunchPeernet::discovery::decodeUdpPunchPeer (const std::uint8_t *data, std::size_t len)
std::uint32_t net::discovery::randomNonce ()

Variables

constexpr std::uint16_t net::discovery::k_defaultDirectoryTcpPort = 10080
constexpr std::uint16_t net::discovery::k_defaultDirectoryUdpPort = 10081
constexpr std::uint64_t net::discovery::k_serverTtlMs = 15000

Detailed Description

Shared wire helpers for global server browser and NAT assist.