diff --git a/src/main.cpp b/src/main.cpp index a5b0d6d..14429b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -183,6 +183,31 @@ namespace { } while (not r); return retval; } + + void add_port_mapping ( + const UPNPUrlsResource& parResource, + uint16_t parExtPort, + uint16_t parIntPort, + const std::string& parAddr, + const std::string& parDesc, + uint32_t parDuration, + Protocol parProtocol + ) { + const auto r = UPNP_AddPortMapping( + parResource.urls()->controlURL, + parResource.data()->first.servicetype, + std::to_string(parExtPort).c_str(), + std::to_string(parIntPort).c_str(), + parAddr.c_str(), + parDesc.c_str(), + parProtocol._to_string(), + 0, + std::to_string(parDuration).c_str() + ); + //if (UPNPCOMMAND_SUCCESS != r) + //printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", + //eport, iport, iaddr, r, strupnperror(r)); + } } //unnamed namespace int main() {