diff options
Diffstat (limited to '3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c')
-rw-r--r-- | 3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c b/3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c index 1114759..ad69781 100644 --- a/3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c +++ b/3rdParty/LibMiniUPnPc/src/miniupnpc/upnpcommands.c @@ -1,10 +1,10 @@ -/* $Id: upnpcommands.c,v 1.37 2011/06/04 15:56:23 nanard Exp $ */ +/* $Id: upnpcommands.c,v 1.42 2014/01/31 13:18:25 nanard Exp $ */ /* Project : miniupnp * Author : Thomas Bernard - * Copyright (c) 2005-2011 Thomas Bernard + * Copyright (c) 2005-2012 Thomas Bernard * This software is subject to the conditions detailed in the * LICENCE file provided in this distribution. * */ #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -116,13 +116,13 @@ UPNP_GetTotalPacketsReceived(const char * controlURL, /* UPNP_GetStatusInfo() call the corresponding UPNP method * returns the current status and uptime */ LIBSPEC int UPNP_GetStatusInfo(const char * controlURL, const char * servicetype, - char * status, + char * status, unsigned int * uptime, char * lastconnerror) { struct NameValueParserData pdata; char * buffer; int bufsize; @@ -218,14 +218,14 @@ UPNP_GetConnectionTypeInfo(const char * controlURL, ClearNameValueList(&pdata); return ret; } /* UPNP_GetLinkLayerMaxBitRate() call the corresponding UPNP method. * Returns 2 values: Downloadlink bandwidth and Uplink bandwidth. - * One of the values can be null - * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only + * One of the values can be null + * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only * We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */ LIBSPEC int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int * bitrateUp) @@ -282,13 +282,13 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL, } /* UPNP_GetExternalIPAddress() call the corresponding UPNP method. * if the third arg is not null the value is copied to it. * at least 16 bytes must be available - * + * * Return values : * 0 : SUCCESS * NON ZERO : ERROR Either an UPnP error code or an unknown error. * * 402 Invalid Args - See UPnP Device Architecture section on Control. * 501 Action Failed - See UPnP Device Architecture section on Control. @@ -575,13 +575,14 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL, * the result is returned in the intClient and intPort strings * please provide 16 and 6 bytes of data */ LIBSPEC int UPNP_GetSpecificPortMappingEntry(const char * controlURL, const char * servicetype, const char * extPort, - const char * proto, + const char * proto, + const char * remoteHost, char * intClient, char * intPort, char * desc, char * enabled, char * leaseDuration) { @@ -594,13 +595,13 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL, if(!intPort || !intClient || !extPort || !proto) return UPNPCOMMAND_INVALID_ARGS; GetPortMappingArgs = calloc(4, sizeof(struct UPNParg)); GetPortMappingArgs[0].elt = "NewRemoteHost"; - /* TODO : add remote host ? */ + GetPortMappingArgs[0].val = remoteHost; GetPortMappingArgs[1].elt = "NewExternalPort"; GetPortMappingArgs[1].val = extPort; GetPortMappingArgs[2].elt = "NewProtocol"; GetPortMappingArgs[2].val = proto; if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype, "GetSpecificPortMappingEntry", @@ -738,31 +739,31 @@ UPNP_GetListOfPortMappings(const char * controlURL, if(p) { ret = UPNPCOMMAND_UNKNOWN_ERROR; sscanf(p, "%d", &ret); } ClearNameValueList(&pdata); - //printf("%.*s", bufsize, buffer); + /*printf("%.*s", bufsize, buffer);*/ return ret; } -/* IGD:2, functions for service WANIPv6FirewallControl:1 */ +/* IGD:2, functions for service WANIPv6FirewallControl:1 */ LIBSPEC int UPNP_GetFirewallStatus(const char * controlURL, const char * servicetype, - int * firewallEnabled, + int * firewallEnabled, int * inboundPinholeAllowed) { struct NameValueParserData pdata; char * buffer; int bufsize; char * fe, *ipa, *p; int ret = UPNPCOMMAND_UNKNOWN_ERROR; - if(!firewallEnabled && !inboundPinholeAllowed) + if(!firewallEnabled || !inboundPinholeAllowed) return UPNPCOMMAND_INVALID_ARGS; buffer = simpleUPnPcommand(-1, controlURL, servicetype, "GetFirewallStatus", 0, &bufsize); if(!buffer) { return UPNPCOMMAND_HTTP_ERROR; @@ -865,13 +866,13 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype, int ret; if(!intPort || !intClient || !proto || !remoteHost || !remotePort || !leaseTime) return UPNPCOMMAND_INVALID_ARGS; AddPinholeArgs = calloc(7, sizeof(struct UPNParg)); - // RemoteHost can be wilcarded + /* RemoteHost can be wilcarded */ if(strncmp(remoteHost, "empty", 5)==0) { AddPinholeArgs[0].elt = "RemoteHost"; AddPinholeArgs[0].val = ""; } else @@ -909,13 +910,13 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype, strncpy(uniqueID, p, 8); uniqueID[7] = '\0'; } resVal = GetValueFromNameValueList(&pdata, "errorCode"); if(resVal) { - //printf("AddPortMapping errorCode = '%s'\n", resVal); + /*printf("AddPortMapping errorCode = '%s'\n", resVal);*/ ret = UPNPCOMMAND_UNKNOWN_ERROR; sscanf(resVal, "%d", &ret); } else { ret = UPNPCOMMAND_SUCCESS; |