mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(trunk third-party) #2273: update to latest libnatpmp and miniupnpc libraries
This commit is contained in:
81
third-party/miniupnp/upnpcommands.c
vendored
81
third-party/miniupnp/upnpcommands.c
vendored
@@ -1,4 +1,4 @@
|
||||
/* $Id: upnpcommands.c,v 1.24 2009/04/17 21:21:19 nanard Exp $ */
|
||||
/* $Id: upnpcommands.c,v 1.25 2009/07/09 16:00:42 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2009 Thomas Bernard
|
||||
@@ -19,7 +19,7 @@ my_atoui(const char * s)
|
||||
|
||||
/*
|
||||
* */
|
||||
UNSIGNED_INTEGER
|
||||
LIBSPEC UNSIGNED_INTEGER
|
||||
UPNP_GetTotalBytesSent(const char * controlURL,
|
||||
const char * servicetype)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ UPNP_GetTotalBytesSent(const char * controlURL,
|
||||
|
||||
/*
|
||||
* */
|
||||
UNSIGNED_INTEGER
|
||||
LIBSPEC UNSIGNED_INTEGER
|
||||
UPNP_GetTotalBytesReceived(const char * controlURL,
|
||||
const char * servicetype)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ UPNP_GetTotalBytesReceived(const char * controlURL,
|
||||
|
||||
/*
|
||||
* */
|
||||
UNSIGNED_INTEGER
|
||||
LIBSPEC UNSIGNED_INTEGER
|
||||
UPNP_GetTotalPacketsSent(const char * controlURL,
|
||||
const char * servicetype)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ UPNP_GetTotalPacketsSent(const char * controlURL,
|
||||
|
||||
/*
|
||||
* */
|
||||
UNSIGNED_INTEGER
|
||||
LIBSPEC UNSIGNED_INTEGER
|
||||
UPNP_GetTotalPacketsReceived(const char * controlURL,
|
||||
const char * servicetype)
|
||||
{
|
||||
@@ -99,11 +99,12 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
|
||||
|
||||
/* UPNP_GetStatusInfo() call the corresponding UPNP method
|
||||
* returns the current status and uptime */
|
||||
int UPNP_GetStatusInfo(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * status,
|
||||
unsigned int * uptime,
|
||||
char * lastconnerror)
|
||||
LIBSPEC int
|
||||
UPNP_GetStatusInfo(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * status,
|
||||
unsigned int * uptime,
|
||||
char * lastconnerror)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
char buffer[4096];
|
||||
@@ -159,9 +160,10 @@ int UPNP_GetStatusInfo(const char * controlURL,
|
||||
|
||||
/* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method
|
||||
* returns the connection type */
|
||||
int UPNP_GetConnectionTypeInfo(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * connectionType)
|
||||
LIBSPEC int
|
||||
UPNP_GetConnectionTypeInfo(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * connectionType)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
char buffer[4096];
|
||||
@@ -198,7 +200,11 @@ int UPNP_GetConnectionTypeInfo(const char * controlURL,
|
||||
* One of the values can be null
|
||||
* Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
|
||||
* We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
|
||||
int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)
|
||||
LIBSPEC int
|
||||
UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
||||
const char * servicetype,
|
||||
unsigned int * bitrateDown,
|
||||
unsigned int* bitrateUp)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
char buffer[4096];
|
||||
@@ -226,16 +232,14 @@ int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicety
|
||||
if(down && up)
|
||||
ret = UPNPCOMMAND_SUCCESS;
|
||||
|
||||
if(bitrateDown)
|
||||
{
|
||||
if(bitrateDown) {
|
||||
if(down)
|
||||
sscanf(down,"%u",bitrateDown);
|
||||
else
|
||||
*bitrateDown = 0;
|
||||
}
|
||||
|
||||
if(bitrateUp)
|
||||
{
|
||||
if(bitrateUp) {
|
||||
if(up)
|
||||
sscanf(up,"%u",bitrateUp);
|
||||
else
|
||||
@@ -262,9 +266,10 @@ int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicety
|
||||
* 402 Invalid Args - See UPnP Device Architecture section on Control.
|
||||
* 501 Action Failed - See UPnP Device Architecture section on Control.
|
||||
*/
|
||||
int UPNP_GetExternalIPAddress(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * extIpAdd)
|
||||
LIBSPEC int
|
||||
UPNP_GetExternalIPAddress(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * extIpAdd)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
char buffer[4096];
|
||||
@@ -297,7 +302,7 @@ int UPNP_GetExternalIPAddress(const char * controlURL,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
LIBSPEC int
|
||||
UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
||||
const char * extPort,
|
||||
const char * inPort,
|
||||
@@ -351,7 +356,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
LIBSPEC int
|
||||
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
||||
const char * extPort, const char * proto,
|
||||
const char * remoteHost)
|
||||
@@ -391,17 +396,18 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
||||
const char * servicetype,
|
||||
const char * index,
|
||||
char * extPort,
|
||||
char * intClient,
|
||||
char * intPort,
|
||||
char * protocol,
|
||||
char * desc,
|
||||
char * enabled,
|
||||
char * rHost,
|
||||
char * duration)
|
||||
LIBSPEC int
|
||||
UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
||||
const char * servicetype,
|
||||
const char * index,
|
||||
char * extPort,
|
||||
char * intClient,
|
||||
char * intPort,
|
||||
char * protocol,
|
||||
char * desc,
|
||||
char * enabled,
|
||||
char * rHost,
|
||||
char * duration)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
struct UPNParg * GetPortMappingArgs;
|
||||
@@ -480,7 +486,10 @@ int UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
||||
return r;
|
||||
}
|
||||
|
||||
int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)
|
||||
LIBSPEC int
|
||||
UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
||||
const char * servicetype,
|
||||
unsigned int * numEntries)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
char buffer[4096];
|
||||
@@ -513,7 +522,7 @@ int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * ser
|
||||
/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
|
||||
* the result is returned in the intClient and intPort strings
|
||||
* please provide 16 and 6 bytes of data */
|
||||
int
|
||||
LIBSPEC int
|
||||
UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
||||
const char * servicetype,
|
||||
const char * extPort,
|
||||
|
||||
Reference in New Issue
Block a user