When code was updated for 64-bit Windows configurations, some changes were not applied.
Details : cast for connect() sendto() arguments remove unecessary p = NULL; remove unecessary code printf format fixes in ssdpDiscoverDevices() fixes #311 Signed-off-by: Thomas Bernard <miniupnp@free.fr>
This commit is contained in:
parent
ef179a45e3
commit
bded13f390
|
@ -48,6 +48,12 @@
|
||||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define MSC_CAST_INT (int)
|
||||||
|
#else
|
||||||
|
#define MSC_CAST_INT
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__amigaos__) || defined(__amigaos4__)
|
#if defined(__amigaos__) || defined(__amigaos4__)
|
||||||
#define herror(A) printf("%s\n", A)
|
#define herror(A) printf("%s\n", A)
|
||||||
#endif
|
#endif
|
||||||
|
@ -183,7 +189,7 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
||||||
#endif
|
#endif
|
||||||
return INVALID_SOCKET;
|
return INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
s = -1;
|
s = INVALID_SOCKET;
|
||||||
for(p = ai; p; p = p->ai_next)
|
for(p = ai; p; p = p->ai_next)
|
||||||
{
|
{
|
||||||
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
||||||
|
@ -208,7 +214,7 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
n = connect(s, p->ai_addr, p->ai_addrlen);
|
n = connect(s, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
|
||||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||||
/* EINTR The system call was interrupted by a signal that was caught
|
/* EINTR The system call was interrupted by a signal that was caught
|
||||||
* EINPROGRESS The socket is nonblocking and the connection cannot
|
* EINPROGRESS The socket is nonblocking and the connection cannot
|
||||||
|
@ -261,4 +267,3 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
||||||
#endif /* #ifdef USE_GETHOSTBYNAME */
|
#endif /* #ifdef USE_GETHOSTBYNAME */
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,10 @@ int soapPostSubmit(SOCKET fd,
|
||||||
const char * body,
|
const char * body,
|
||||||
const char * httpversion)
|
const char * httpversion)
|
||||||
{
|
{
|
||||||
int bodysize;
|
|
||||||
char headerbuf[512];
|
char headerbuf[512];
|
||||||
int headerssize;
|
int headerssize;
|
||||||
char portstr[8];
|
char portstr[8];
|
||||||
bodysize = (int)strlen(body);
|
int bodysize = (int)strlen(body);
|
||||||
/* We are not using keep-alive HTTP connections.
|
/* We are not using keep-alive HTTP connections.
|
||||||
* HTTP/1.1 needs the header Connection: close to do that.
|
* HTTP/1.1 needs the header Connection: close to do that.
|
||||||
* This is the default with HTTP/1.0
|
* This is the default with HTTP/1.0
|
||||||
|
|
|
@ -60,6 +60,12 @@ struct sockaddr_un {
|
||||||
#define closesocket close
|
#define closesocket close
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define MSC_CAST_INT (int)
|
||||||
|
#else
|
||||||
|
#define MSC_CAST_INT
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "miniupnpc_socketdef.h"
|
#include "miniupnpc_socketdef.h"
|
||||||
|
|
||||||
#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__)
|
#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__)
|
||||||
|
@ -561,18 +567,18 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||||
dwRetVal = GetIpAddrTable( pIPAddrTable, &dwSize, 0 );
|
dwRetVal = GetIpAddrTable( pIPAddrTable, &dwSize, 0 );
|
||||||
if (dwRetVal == NO_ERROR) {
|
if (dwRetVal == NO_ERROR) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("\tNum Entries: %ld\n", pIPAddrTable->dwNumEntries);
|
printf("\tNum Entries: %lu\n", pIPAddrTable->dwNumEntries);
|
||||||
#endif
|
#endif
|
||||||
for (i=0; i < (int) pIPAddrTable->dwNumEntries; i++) {
|
for (i=0; i < (int) pIPAddrTable->dwNumEntries; i++) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("\n\tInterface Index[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwIndex);
|
printf("\n\tInterface Index[%d]:\t%lu\n", i, pIPAddrTable->table[i].dwIndex);
|
||||||
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwAddr;
|
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwAddr;
|
||||||
printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
|
printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
|
||||||
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwMask;
|
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwMask;
|
||||||
printf("\tSubnet Mask[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
|
printf("\tSubnet Mask[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
|
||||||
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwBCastAddr;
|
IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwBCastAddr;
|
||||||
printf("\tBroadCast[%d]: \t%s (%ld)\n", i, inet_ntoa(IPAddr), pIPAddrTable->table[i].dwBCastAddr);
|
printf("\tBroadCast[%d]: \t%s (%lu)\n", i, inet_ntoa(IPAddr), pIPAddrTable->table[i].dwBCastAddr);
|
||||||
printf("\tReassembly size[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwReasmSize);
|
printf("\tReassembly size[%d]:\t%lu\n", i, pIPAddrTable->table[i].dwReasmSize);
|
||||||
printf("\tType and State[%d]:", i);
|
printf("\tType and State[%d]:", i);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -592,7 +598,6 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(pIPAddrTable);
|
free(pIPAddrTable);
|
||||||
pIPAddrTable = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
@ -780,7 +785,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for(p = servinfo; p; p = p->ai_next) {
|
for(p = servinfo; p; p = p->ai_next) {
|
||||||
n = sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen);
|
n = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||||
|
|
|
@ -32,13 +32,13 @@ MINIUPNP_LIBSPEC int
|
||||||
connectToMiniSSDPD(const char * socketpath);
|
connectToMiniSSDPD(const char * socketpath);
|
||||||
|
|
||||||
MINIUPNP_LIBSPEC int
|
MINIUPNP_LIBSPEC int
|
||||||
disconnectFromMiniSSDPD(int fd);
|
disconnectFromMiniSSDPD(int s);
|
||||||
|
|
||||||
MINIUPNP_LIBSPEC int
|
MINIUPNP_LIBSPEC int
|
||||||
requestDevicesFromMiniSSDPD(int fd, const char * devtype);
|
requestDevicesFromMiniSSDPD(int s, const char * devtype);
|
||||||
|
|
||||||
MINIUPNP_LIBSPEC struct UPNPDev *
|
MINIUPNP_LIBSPEC struct UPNPDev *
|
||||||
receiveDevicesFromMiniSSDPD(int fd, int * error);
|
receiveDevicesFromMiniSSDPD(int s, int * error);
|
||||||
|
|
||||||
#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */
|
#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ static char *
|
||||||
build_absolute_url(const char * baseurl, const char * descURL,
|
build_absolute_url(const char * baseurl, const char * descURL,
|
||||||
const char * url, unsigned int scope_id)
|
const char * url, unsigned int scope_id)
|
||||||
{
|
{
|
||||||
int l, n;
|
size_t l, n;
|
||||||
char * s;
|
char * s;
|
||||||
const char * base;
|
const char * base;
|
||||||
char * p;
|
char * p;
|
||||||
|
@ -573,7 +573,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
||||||
int ndev = 0;
|
int ndev = 0;
|
||||||
int i;
|
int i;
|
||||||
int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
|
int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
|
||||||
int n_igd = 0;
|
|
||||||
char extIpAddr[16];
|
char extIpAddr[16];
|
||||||
char myLanAddr[40];
|
char myLanAddr[40];
|
||||||
int status_code = -1;
|
int status_code = -1;
|
||||||
|
@ -588,12 +587,10 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
||||||
/* counting total number of devices in the list */
|
/* counting total number of devices in the list */
|
||||||
for(dev = devlist; dev; dev = dev->pNext)
|
for(dev = devlist; dev; dev = dev->pNext)
|
||||||
ndev++;
|
ndev++;
|
||||||
if(ndev > 0)
|
/* ndev is always > 0 */
|
||||||
{
|
|
||||||
desc = calloc(ndev, sizeof(struct xml_desc));
|
desc = calloc(ndev, sizeof(struct xml_desc));
|
||||||
if(!desc)
|
if(!desc)
|
||||||
return -1; /* memory allocation error */
|
return -1; /* memory allocation error */
|
||||||
}
|
|
||||||
/* Step 1 : downloading descriptions and testing type */
|
/* Step 1 : downloading descriptions and testing type */
|
||||||
for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
|
for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
|
||||||
{
|
{
|
||||||
|
@ -617,7 +614,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
||||||
"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:"))
|
"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:"))
|
||||||
{
|
{
|
||||||
desc[i].is_igd = 1;
|
desc[i].is_igd = 1;
|
||||||
n_igd++;
|
|
||||||
if(lanaddr)
|
if(lanaddr)
|
||||||
strncpy(lanaddr, myLanAddr, lanaddrlen);
|
strncpy(lanaddr, myLanAddr, lanaddrlen);
|
||||||
}
|
}
|
||||||
|
@ -685,14 +681,9 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
free_and_return:
|
free_and_return:
|
||||||
if(desc) {
|
for(i = 0; i < ndev; i++)
|
||||||
for(i = 0; i < ndev; i++) {
|
|
||||||
if(desc[i].xml) {
|
|
||||||
free(desc[i].xml);
|
free(desc[i].xml);
|
||||||
}
|
|
||||||
}
|
|
||||||
free(desc);
|
free(desc);
|
||||||
}
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,7 +708,6 @@ UPNP_GetIGDFromUrl(const char * rootdescurl,
|
||||||
memset(urls, 0, sizeof(struct UPNPUrls));
|
memset(urls, 0, sizeof(struct UPNPUrls));
|
||||||
parserootdesc(descXML, descXMLsize, data);
|
parserootdesc(descXML, descXMLsize, data);
|
||||||
free(descXML);
|
free(descXML);
|
||||||
descXML = NULL;
|
|
||||||
GetUPNPUrls(urls, data, rootdescurl, 0);
|
GetUPNPUrls(urls, data, rootdescurl, 0);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -243,7 +243,7 @@ getHTTPResponse(SOCKET s, int * size, int * status_code)
|
||||||
/* reading chunk size */
|
/* reading chunk size */
|
||||||
if(chunksize_buf_index == 0) {
|
if(chunksize_buf_index == 0) {
|
||||||
/* skipping any leading CR LF */
|
/* skipping any leading CR LF */
|
||||||
if(i<n && buf[i] == '\r') i++;
|
if(buf[i] == '\r') i++;
|
||||||
if(i<n && buf[i] == '\n') i++;
|
if(i<n && buf[i] == '\n') i++;
|
||||||
}
|
}
|
||||||
while(i<n && isxdigit(buf[i])
|
while(i<n && isxdigit(buf[i])
|
||||||
|
@ -350,7 +350,7 @@ getHTTPResponse(SOCKET s, int * size, int * status_code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end_of_stream:
|
end_of_stream:
|
||||||
free(header_buf); header_buf = NULL;
|
free(header_buf);
|
||||||
*size = content_buf_used;
|
*size = content_buf_used;
|
||||||
if(content_buf_used == 0)
|
if(content_buf_used == 0)
|
||||||
{
|
{
|
||||||
|
@ -559,7 +559,7 @@ parseURL(const char * url,
|
||||||
#else
|
#else
|
||||||
/* under windows, scope is numerical */
|
/* under windows, scope is numerical */
|
||||||
char tmp[8];
|
char tmp[8];
|
||||||
int l;
|
size_t l;
|
||||||
scope++;
|
scope++;
|
||||||
/* "%25" is just '%' in URL encoding */
|
/* "%25" is just '%' in URL encoding */
|
||||||
if(scope[0] == '2' && scope[1] == '5')
|
if(scope[0] == '2' && scope[1] == '5')
|
||||||
|
@ -659,4 +659,3 @@ miniwget_getaddr(const char * url, int * size,
|
||||||
#endif
|
#endif
|
||||||
return miniwget2(hostname, port, path, size, addr, addrlen, scope_id, status_code);
|
return miniwget2(hostname, port, path, size, addr, addrlen, scope_id, status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* */
|
* */
|
||||||
#ifndef MINIXML_H_INCLUDED
|
#ifndef MINIXML_H_INCLUDED
|
||||||
#define MINIXML_H_INCLUDED
|
#define MINIXML_H_INCLUDED
|
||||||
#define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n'))
|
#define IS_WHITE_SPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n')
|
||||||
|
|
||||||
/* if a callback function pointer is set to NULL,
|
/* if a callback function pointer is set to NULL,
|
||||||
* the function is not called */
|
* the function is not called */
|
||||||
|
|
|
@ -33,11 +33,11 @@ UPNP_GetTotalBytesSent(const char * controlURL,
|
||||||
char * p;
|
char * p;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetTotalBytesSent", 0, &bufsize))) {
|
"GetTotalBytesSent", 0, &bufsize))) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent");
|
p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent");
|
||||||
r = my_atoui(p);
|
r = my_atoui(p);
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
|
@ -57,11 +57,11 @@ UPNP_GetTotalBytesReceived(const char * controlURL,
|
||||||
char * p;
|
char * p;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetTotalBytesReceived", 0, &bufsize))) {
|
"GetTotalBytesReceived", 0, &bufsize))) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "NewTotalBytesReceived");
|
p = GetValueFromNameValueList(&pdata, "NewTotalBytesReceived");
|
||||||
r = my_atoui(p);
|
r = my_atoui(p);
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
|
@ -81,11 +81,11 @@ UPNP_GetTotalPacketsSent(const char * controlURL,
|
||||||
char * p;
|
char * p;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetTotalPacketsSent", 0, &bufsize))) {
|
"GetTotalPacketsSent", 0, &bufsize))) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsSent");
|
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsSent");
|
||||||
r = my_atoui(p);
|
r = my_atoui(p);
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
|
@ -105,11 +105,11 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
|
||||||
char * p;
|
char * p;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetTotalPacketsReceived", 0, &bufsize))) {
|
"GetTotalPacketsReceived", 0, &bufsize))) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsReceived");
|
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsReceived");
|
||||||
r = my_atoui(p);
|
r = my_atoui(p);
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
|
@ -142,7 +142,7 @@ UPNP_GetStatusInfo(const char * controlURL,
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
up = GetValueFromNameValueList(&pdata, "NewUptime");
|
up = GetValueFromNameValueList(&pdata, "NewUptime");
|
||||||
p = GetValueFromNameValueList(&pdata, "NewConnectionStatus");
|
p = GetValueFromNameValueList(&pdata, "NewConnectionStatus");
|
||||||
err = GetValueFromNameValueList(&pdata, "NewLastConnectionError");
|
err = GetValueFromNameValueList(&pdata, "NewLastConnectionError");
|
||||||
|
@ -202,7 +202,7 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "NewConnectionType");
|
p = GetValueFromNameValueList(&pdata, "NewConnectionType");
|
||||||
/*p = GetValueFromNameValueList(&pdata, "NewPossibleConnectionTypes");*/
|
/*p = GetValueFromNameValueList(&pdata, "NewPossibleConnectionTypes");*/
|
||||||
/* PossibleConnectionTypes will have several values.... */
|
/* PossibleConnectionTypes will have several values.... */
|
||||||
|
@ -251,7 +251,7 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
/*down = GetValueFromNameValueList(&pdata, "NewDownstreamMaxBitRate");*/
|
/*down = GetValueFromNameValueList(&pdata, "NewDownstreamMaxBitRate");*/
|
||||||
/*up = GetValueFromNameValueList(&pdata, "NewUpstreamMaxBitRate");*/
|
/*up = GetValueFromNameValueList(&pdata, "NewUpstreamMaxBitRate");*/
|
||||||
down = GetValueFromNameValueList(&pdata, "NewLayer1DownstreamMaxBitRate");
|
down = GetValueFromNameValueList(&pdata, "NewLayer1DownstreamMaxBitRate");
|
||||||
|
@ -315,7 +315,7 @@ UPNP_GetExternalIPAddress(const char * controlURL,
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
/*printf("external ip = %s\n", GetValueFromNameValueList(&pdata, "NewExternalIPAddress") );*/
|
/*printf("external ip = %s\n", GetValueFromNameValueList(&pdata, "NewExternalIPAddress") );*/
|
||||||
p = GetValueFromNameValueList(&pdata, "NewExternalIPAddress");
|
p = GetValueFromNameValueList(&pdata, "NewExternalIPAddress");
|
||||||
if(p) {
|
if(p) {
|
||||||
|
@ -385,7 +385,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
||||||
/*buffer[bufsize] = '\0';*/
|
/*buffer[bufsize] = '\0';*/
|
||||||
/*puts(buffer);*/
|
/*puts(buffer);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal) {
|
if(resVal) {
|
||||||
/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
|
/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
|
||||||
|
@ -446,7 +446,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal) {
|
if(resVal) {
|
||||||
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||||
|
@ -501,7 +501,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal) {
|
if(resVal) {
|
||||||
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||||
|
@ -549,7 +549,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal) {
|
if(resVal) {
|
||||||
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||||
|
@ -597,7 +597,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
|
p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
|
||||||
if(p && rHost)
|
if(p && rHost)
|
||||||
|
@ -677,7 +677,7 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
||||||
DisplayNameValueList(buffer, bufsize);
|
DisplayNameValueList(buffer, bufsize);
|
||||||
#endif
|
#endif
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
|
p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
|
||||||
if(numEntries && p) {
|
if(numEntries && p) {
|
||||||
|
@ -739,7 +739,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
p = GetValueFromNameValueList(&pdata, "NewInternalClient");
|
p = GetValueFromNameValueList(&pdata, "NewInternalClient");
|
||||||
if(p) {
|
if(p) {
|
||||||
|
@ -836,7 +836,7 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
||||||
|
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
/*p = GetValueFromNameValueList(&pdata, "NewPortListing");*/
|
/*p = GetValueFromNameValueList(&pdata, "NewPortListing");*/
|
||||||
/*if(p) {
|
/*if(p) {
|
||||||
|
@ -898,7 +898,7 @@ UPNP_GetFirewallStatus(const char * controlURL,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
fe = GetValueFromNameValueList(&pdata, "FirewallEnabled");
|
fe = GetValueFromNameValueList(&pdata, "FirewallEnabled");
|
||||||
ipa = GetValueFromNameValueList(&pdata, "InboundPinholeAllowed");
|
ipa = GetValueFromNameValueList(&pdata, "InboundPinholeAllowed");
|
||||||
if(ipa && fe)
|
if(ipa && fe)
|
||||||
|
@ -960,7 +960,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal)
|
if(resVal)
|
||||||
{
|
{
|
||||||
|
@ -1037,7 +1037,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
p = GetValueFromNameValueList(&pdata, "UniqueID");
|
p = GetValueFromNameValueList(&pdata, "UniqueID");
|
||||||
if(p)
|
if(p)
|
||||||
{
|
{
|
||||||
|
@ -1087,7 +1087,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal)
|
if(resVal)
|
||||||
{
|
{
|
||||||
|
@ -1129,7 +1129,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||||
if(resVal)
|
if(resVal)
|
||||||
{
|
{
|
||||||
|
@ -1171,7 +1171,7 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
p = GetValueFromNameValueList(&pdata, "IsWorking");
|
p = GetValueFromNameValueList(&pdata, "IsWorking");
|
||||||
if(p)
|
if(p)
|
||||||
|
@ -1218,7 +1218,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer);
|
||||||
|
|
||||||
p = GetValueFromNameValueList(&pdata, "PinholePackets");
|
p = GetValueFromNameValueList(&pdata, "PinholePackets");
|
||||||
if(p)
|
if(p)
|
||||||
|
@ -1237,5 +1237,3 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
||||||
MINIUPNP_LIBSPEC int
|
MINIUPNP_LIBSPEC int
|
||||||
UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
||||||
const char * servicetype,
|
const char * servicetype,
|
||||||
unsigned int * num);
|
unsigned int * numEntries);
|
||||||
|
|
||||||
/* UPNP_GetSpecificPortMappingEntry()
|
/* UPNP_GetSpecificPortMappingEntry()
|
||||||
* retrieves an existing port mapping
|
* retrieves an existing port mapping
|
||||||
|
|
Loading…
Reference in New Issue