Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
upnp.h File Reference

Declarations for UPnP port mapping. More...

#include <cstddef>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include <miniupnpc/miniupnpc.h>
#include "platform/common.h"
Include dependency graph for upnp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  upnp::urls_t
 Owning wrapper for MiniUPnPc URLs. More...

Namespaces

namespace  upnp
 UPnP port mapping.

Typedefs

using upnp::device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist>
 Owning pointer to miniupnpc device discovery results.

Enumerations

enum class  upnp::igd_status_e : int { upnp::none = 0 , upnp::connected = 1 , upnp::disconnected , upnp::unknown_device }
 Result codes returned by the installed MiniUPnPc library. More...

Functions

bool upnp::is_valid_igd (igd_status_e status)
 Check whether a UPNP_GetValidIGD() status code identifies a usable IGD.
igd_status_e upnp::UPNP_GetValidIGDStatus (device_t &device, urls_t *urls, IGDdatas *data, std::array< char, INET6_ADDRESS_STRLEN > &lan_addr)
 Get the valid IGD status.
int upnp::shared_prefix_length (std::string_view a, std::string_view b)
 Count the leading bits two IPv4 addresses have in common.
std::string upnp::url_host (std::string_view url)
 Extract the host from a URL such as http://192.168.1.1:1900/rootDesc.xml.
std::size_t upnp::select_inner_igd (const std::vector< std::string > &igd_hosts, std::string_view lan_addr)
 Select the IGD of the network Hermes is attached to.
std::optional< std::size_t > upnp::select_outer_igd (const std::vector< std::string > &igd_hosts, std::size_t inner, std::string_view inner_external_addr)
 Select the IGD in front of the inner gateway when Hermes is behind two routers (double NAT).
std::unique_ptr< platf::deinit_t > upnp::start ()
 Start UPnP port mapping and return its shutdown guard.

Variables

constexpr auto upnp::INET6_ADDRESS_STRLEN = 46
 Buffer size for a textual IPv6 address.
constexpr auto upnp::IPv4 = 0
 IPv4 discovery.
constexpr auto upnp::IPv6 = 1
 IPv6 discovery.
constexpr auto upnp::PORT_MAPPING_LIFETIME = 3600s
 Requested finite mapping lifetime.
constexpr auto upnp::REFRESH_INTERVAL = 120s
 Interval between mapping refresh passes.

Detailed Description

Declarations for UPnP port mapping.

Definition in file upnp.h.