![]() |
Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
|
Implements host record models and utilities. More...
#include "src/app/host_records.h"#include <algorithm>#include <cctype>#include <cstddef>#include <limits>#include <utility>#include <vector>#include "src/platform/error_utils.h"Functions | |
| void | app::append_parsed_host_record (std::string_view line, std::size_t lineNumber, ParseHostRecordsResult *result) |
| Parse one serialized host-record line and append it to the accumulated result. | |
| std::string | app::build_default_host_display_name (std::string_view normalizedAddress) |
| Build a controller-friendly default display name for a host. | |
| bool | app::contains_host_address (const std::vector< HostRecord > &records, std::string_view normalizedAddress, uint16_t port=0) |
| Return whether a host list already contains an endpoint. | |
| uint16_t | app::effective_host_port (uint16_t port) |
| Return the effective TCP port for a host record. | |
| bool | app::host_matches_endpoint (const HostRecord &host, std::string_view normalizedAddress, uint16_t port) |
| Return whether a host record matches a specific endpoint. | |
| bool | app::is_valid_ipv4_address (std::string_view address) |
| Return whether a string is a valid IPv4 address. | |
| std::string | app::normalize_ipv4_address (std::string_view address) |
| Normalize a user-provided IPv4 address. | |
| ParseHostRecordsResult | app::parse_host_records (std::string_view serializedRecords) |
| Parse host records from the stable serialized text format. | |
| std::string | app::serialize_host_records (const std::vector< HostRecord > &records) |
| Serialize host records into a stable tab-separated text format. | |
| const char * | app::to_string (HostReachability reachability) |
| Return a stable lowercase label for a host reachability state. | |
| const char * | app::to_string (PairingState pairingState) |
| Return a stable lowercase label for a pairing state. | |
| bool | app::try_parse_host_port (std::string_view portText, uint16_t *parsedPort) |
| Parse a user-supplied TCP port string. | |
| bool | app::validate_host_record (const HostRecord &record, std::string *errorMessage=nullptr) |
| Validate a host record before saving or serializing it. | |
Implements host record models and utilities.
| void app::append_parsed_host_record | ( | std::string_view | line, |
| std::size_t | lineNumber, | ||
| ParseHostRecordsResult * | result ) |
Parse one serialized host-record line and append it to the accumulated result.
| line | Raw tab-separated line to parse. |
| lineNumber | One-based line number used in parse errors. |
| result | Aggregate parse result to update. |
| std::string app::build_default_host_display_name | ( | std::string_view | normalizedAddress | ) |
Build a controller-friendly default display name for a host.
| normalizedAddress | Canonical IPv4 address. |
| bool app::contains_host_address | ( | const std::vector< HostRecord > & | records, |
| std::string_view | normalizedAddress, | ||
| uint16_t | port = 0 ) |
Return whether a host list already contains an endpoint.
| records | Saved hosts to search. |
| normalizedAddress | Canonical IPv4 address to match. |
| port | Stored port override to match. |
| uint16_t app::effective_host_port | ( | uint16_t | port | ) |
Return the effective TCP port for a host record.
| port | Stored port override where zero means default. |
| bool app::host_matches_endpoint | ( | const HostRecord & | host, |
| std::string_view | normalizedAddress, | ||
| uint16_t | port ) |
Return whether a host record matches a specific endpoint.
A host matches when the canonical host address equals normalizedAddress and port matches any known effective host endpoint (stored HTTP port, resolved HTTP port, or HTTPS port).
| host | Host record to test. |
| normalizedAddress | Canonical IPv4 address to compare. |
| port | Endpoint port where zero means DEFAULT_HOST_PORT. |
| bool app::is_valid_ipv4_address | ( | std::string_view | address | ) |
Return whether a string is a valid IPv4 address.
| address | Candidate IPv4 address. |
| std::string app::normalize_ipv4_address | ( | std::string_view | address | ) |
Normalize a user-provided IPv4 address.
| address | Candidate IPv4 address. |
| ParseHostRecordsResult app::parse_host_records | ( | std::string_view | serializedRecords | ) |
Parse host records from the stable serialized text format.
| serializedRecords | Serialized host record text. |
| std::string app::serialize_host_records | ( | const std::vector< HostRecord > & | records | ) |
Serialize host records into a stable tab-separated text format.
The serialized form preserves the saved host identity plus any cached app-list entries and their local visibility or artwork metadata.
| records | Host records to serialize. |
| const char * app::to_string | ( | HostReachability | reachability | ) |
Return a stable lowercase label for a host reachability state.
| reachability | Reachability state to stringify. |
| const char * app::to_string | ( | PairingState | pairingState | ) |
Return a stable lowercase label for a pairing state.
| pairingState | Pairing state to stringify. |
| bool app::try_parse_host_port | ( | std::string_view | portText, |
| uint16_t * | parsedPort ) |
Parse a user-supplied TCP port string.
| portText | Text entered by the user. |
| parsedPort | Output port override where zero means default. |
| bool app::validate_host_record | ( | const HostRecord & | record, |
| std::string * | errorMessage = nullptr ) |
Validate a host record before saving or serializing it.
| record | Host record to validate. |
| errorMessage | Optional output for a validation error. |