Shared types for automatic NAT port forwarding (UPnP IGD + NAT-PMP) More...
#include <cstdint>#include <string>#include <functional>Go to the source code of this file.
Classes | |
| struct | librats::PortMapResult |
| Result of a port mapping attempt. More... | |
| struct | librats::PortMappingConfig |
| Configuration for automatic port forwarding (see PortMappingService). More... | |
Namespaces | |
| namespace | librats |
Typedefs | |
| using | librats::PortMapCallback = std::function< void(const PortMapResult &)> |
| Callback invoked whenever a mapping is established, refreshed, removed or fails. | |
Enumerations | |
| enum class | librats::PortMapProtocol : uint8_t { librats::TCP , librats::UDP } |
| Transport protocol of a port mapping. More... | |
| enum class | librats::PortMapTransport : uint8_t { librats::UPnP , librats::NatPMP } |
| Which NAT traversal backend produced a result. More... | |
Functions | |
| const char * | librats::to_string (PortMapProtocol p) |
| Human readable protocol name ("TCP"/"UDP"). | |
| const char * | librats::to_string (PortMapTransport t) |
| Human readable transport name ("UPnP"/"NAT-PMP"). | |
Shared types for automatic NAT port forwarding (UPnP IGD + NAT-PMP)
Both the UPnP (UpnpClient) and NAT-PMP (NatPmpClient) backends ask a home router to forward an external (WAN) port to a local (LAN) port so that inbound peer connections can reach a host behind NAT. They share the small set of vocabulary types defined here: the transport protocol of the mapping, which backend produced a result, and the result/callback shape PortMappingService consumes.
Definition in file port_mapping.h.