UPnP port mapping.
More...
|
| class | deinit_t |
| | RAII helper that runs shutdown cleanup when destroyed. More...
|
| struct | mapping_t |
| | UPnP port mapping description and lease state. More...
|
| class | urls_t |
| | Move-only RAII wrapper generated by KITTY_USING_MOVE_T. Alias for element type. More...
|
|
|
using | device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist> |
| | Owning pointer to miniupnpc device discovery results.
|
|
|
constexpr auto | INET6_ADDRESS_STRLEN = 46 |
| | Protocol or platform constant for inet6 address strlen.
|
|
constexpr auto | IPv4 = 0 |
| | I pv4.
|
|
constexpr auto | IPv6 = 1 |
| | I pv6.
|
|
constexpr auto | PORT_MAPPING_LIFETIME = 3600s |
| | GameStream port offset for port mapping lifetime.
|
|
constexpr auto | REFRESH_INTERVAL = 120s |
| | Protocol or platform constant for refresh interval.
|
◆ igd_status_e
Result codes returned by the installed MiniUPnPc library.
Project-owned equivalent of the UPNP_GetValidIGD() result codes. MiniUPnPc 2.2.8 (API version 18) introduced the private-address result, renumbering the values that follow it; the library's own UPNP_* symbolic names only exist starting with MiniUPnPc 2.3.0 (API version 19), so this enum centralizes the version-dependent numbering instead of relying on those names.
| Enumerator |
|---|
| none | No IGD was found.
|
| connected | A connected IGD was found.
|
| disconnected | A disconnected IGD was found.
|
| unknown_device | The device was not recognized as an IGD.
|
◆ is_valid_igd()
Check whether a UPNP_GetValidIGD() status code identifies a usable IGD.
Accepts every status code that identifies a valid IGD (connected, private-IP, or disconnected). The private_ip member only exists with MiniUPnPc >= 2.2.8 (API version 18); disconnected is 2 before API 18 and 3 starting with API 18, and unknown_device is 3 or 4 respectively. Callers don't need to handle the version difference themselves.
- Parameters
-
- Returns
- true if the status identifies a usable IGD, false otherwise.
◆ start()
Start UPnP port mapping and return its shutdown guard.
- Returns
- Start status.
◆ UPNP_GetValidIGDStatus()
Get the valid IGD status.
This function is a wrapper around UPNP_GetValidIGD() that returns the status code. There is a pre-processor check to determine which version of the function to call based on the version of the MiniUPnPc library.
- Parameters
-
| device | The device. |
| urls | The URLs. |
| data | The IGD data. |
| lan_addr | The LAN address. |
- Returns
- The IGD status as an igd_status_e value, converted from the raw UPNP_GetValidIGD() result.
- Return values
-