1
0
Fork 0
mirror of https://bitbucket.org/King_DuckZ/keepupnpup.git synced 2024-11-07 21:29:00 +00:00

Implement add_port_mapping() method

This commit is contained in:
King_DuckZ 2016-08-25 03:28:23 +02:00
parent 8694d16149
commit 7dcf565a21

View file

@ -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() {