docs(src): add examples alias and general cleanup (#2763)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file src/network.h
|
||||
* @brief todo
|
||||
* @brief Declarations for networking related functions.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -17,6 +17,15 @@ namespace net {
|
||||
void
|
||||
free_host(ENetHost *host);
|
||||
|
||||
/**
|
||||
* @brief Map a specified port based on the base port.
|
||||
* @param port The port to map as a difference from the base port.
|
||||
* @return The mapped port number.
|
||||
* @examples
|
||||
* std::uint16_t mapped_port = net::map_port(1);
|
||||
* @examples_end
|
||||
* @todo Ensure port is not already in use by another application.
|
||||
*/
|
||||
std::uint16_t
|
||||
map_port(int port);
|
||||
|
||||
@@ -25,14 +34,14 @@ namespace net {
|
||||
using packet_t = util::safe_ptr<ENetPacket, enet_packet_destroy>;
|
||||
|
||||
enum net_e : int {
|
||||
PC,
|
||||
LAN,
|
||||
WAN
|
||||
PC, ///< PC
|
||||
LAN, ///< LAN
|
||||
WAN ///< WAN
|
||||
};
|
||||
|
||||
enum af_e : int {
|
||||
IPV4,
|
||||
BOTH
|
||||
IPV4, ///< IPv4 only
|
||||
BOTH ///< IPv4 and IPv6
|
||||
};
|
||||
|
||||
net_e
|
||||
@@ -47,15 +56,15 @@ namespace net {
|
||||
host_create(af_e af, ENetAddress &addr, std::size_t peers, std::uint16_t port);
|
||||
|
||||
/**
|
||||
* @brief Returns the `af_e` enum value for the `address_family` config option value.
|
||||
* @brief Get the address family enum value from a string.
|
||||
* @param view The config option value.
|
||||
* @return The `af_e` enum value.
|
||||
* @return The address family enum value.
|
||||
*/
|
||||
af_e
|
||||
af_from_enum_string(const std::string_view &view);
|
||||
|
||||
/**
|
||||
* @brief Returns the wildcard binding address for a given address family.
|
||||
* @brief Get the wildcard binding address for a given address family.
|
||||
* @param af Address family.
|
||||
* @return Normalized address.
|
||||
*/
|
||||
@@ -63,7 +72,7 @@ namespace net {
|
||||
af_to_any_address_string(af_e af);
|
||||
|
||||
/**
|
||||
* @brief Converts an address to a normalized form.
|
||||
* @brief Convert an address to a normalized form.
|
||||
* @details Normalization converts IPv4-mapped IPv6 addresses into IPv4 addresses.
|
||||
* @param address The address to normalize.
|
||||
* @return Normalized address.
|
||||
@@ -72,7 +81,7 @@ namespace net {
|
||||
normalize_address(boost::asio::ip::address address);
|
||||
|
||||
/**
|
||||
* @brief Returns the given address in normalized string form.
|
||||
* @brief Get the given address in normalized string form.
|
||||
* @details Normalization converts IPv4-mapped IPv6 addresses into IPv4 addresses.
|
||||
* @param address The address to normalize.
|
||||
* @return Normalized address in string form.
|
||||
@@ -81,7 +90,7 @@ namespace net {
|
||||
addr_to_normalized_string(boost::asio::ip::address address);
|
||||
|
||||
/**
|
||||
* @brief Returns the given address in a normalized form for in the host portion of a URL.
|
||||
* @brief Get the given address in a normalized form for the host portion of a URL.
|
||||
* @details Normalization converts IPv4-mapped IPv6 addresses into IPv4 addresses.
|
||||
* @param address The address to normalize and escape.
|
||||
* @return Normalized address in URL-escaped string.
|
||||
@@ -90,7 +99,7 @@ namespace net {
|
||||
addr_to_url_escaped_string(boost::asio::ip::address address);
|
||||
|
||||
/**
|
||||
* @brief Returns the encryption mode for the given remote endpoint address.
|
||||
* @brief Get the encryption mode for the given remote endpoint address.
|
||||
* @param address The address used to look up the desired encryption mode.
|
||||
* @return The WAN or LAN encryption mode, based on the provided address.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user