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:
parent
8694d16149
commit
7dcf565a21
1 changed files with 25 additions and 0 deletions
25
src/main.cpp
25
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() {
|
||||
|
|
Loading…
Reference in a new issue