remove trailing whitespace from miniupnpc

This commit is contained in:
Shawn Landen 2012-02-29 17:51:24 -08:00
parent 5c224accbf
commit 6e14420ab1
25 changed files with 67 additions and 67 deletions

View File

@ -264,7 +264,7 @@ VERSION 1.2 :
small modif to make Clang happy :)
2008/07/17:
#define SOAPPREFIX "s" in miniupnpc.c in order to remove SOAP-ENV...
#define SOAPPREFIX "s" in miniupnpc.c in order to remove SOAP-ENV...
2008/07/14:
include declspec.h in installation (to /usr/include/miniupnpc)
@ -286,7 +286,7 @@ VERSION 1.1 :
improved python module error/exception reporting.
2008/04/23:
Completely rewrite igd_desc_parse.c in order to be compatible with
Completely rewrite igd_desc_parse.c in order to be compatible with
Linksys WAG200G
Added testigddescparse
updated python module
@ -309,7 +309,7 @@ VERSION 1.0 :
improved make install :)
2007/12/22:
Adding upnperrors.c/h to provide a strupnperror() function
Adding upnperrors.c/h to provide a strupnperror() function
used to translate UPnP error codes to string.
2007/12/19:

View File

@ -1,5 +1,5 @@
MiniUPnPc
Copyright (c) 2005-2011, Thomas BERNARD
Copyright (c) 2005-2011, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -43,7 +43,7 @@ Discovery process is speeded up when MiniSSDPd is running on the machine.
* Python module *
you can build a python module with 'make pythonmodule'
you can build a python module with 'make pythonmodule'
and install it with 'make installpythonmodule'.
setup.py (and setupmingw32.py) are included in the distribution.

View File

@ -36,7 +36,7 @@
#define _SYS_QUEUE_H_
/*
* This file defines five types of data structures: singly-linked lists,
* This file defines five types of data structures: singly-linked lists,
* lists, simple queues, tail queues, and circular queues.
*
*
@ -95,7 +95,7 @@
struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
@ -107,7 +107,7 @@ struct name { \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List access methods.
*/
@ -322,8 +322,8 @@ struct { \
struct type **tqe_prev; /* address of previous next element */ \
}
/*
* tail queue access methods
/*
* tail queue access methods
*/
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_END(head) NULL
@ -430,7 +430,7 @@ struct { \
}
/*
* Circular queue access methods
* Circular queue access methods
*/
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
#define CIRCLEQ_LAST(head) ((head)->cqh_last)

View File

@ -67,7 +67,7 @@ int connecthostport(const char * host, unsigned short port)
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
struct timeval timeout;
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
#ifdef USE_GETHOSTBYNAME
hp = gethostbyname(host);
if(hp == NULL)

View File

@ -77,7 +77,7 @@ public class JavaBridgeTest {
if (ret != MiniupnpcLibrary.UPNPCOMMAND_SUCCESS)
System.out.println("GetSpecificPortMappingEntry() failed with code " + ret);
System.out.println("InternalIP:Port = " +
new String(intClient.array()) + ":" + new String(intPort.array()) +
new String(intClient.array()) + ":" + new String(intPort.array()) +
" (" + new String(desc.array()) + ")");
ret = miniupnpc.UPNP_DeletePortMapping(
urls.controlURL.getString(0),

View File

@ -120,7 +120,7 @@ getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath)
p += stsize;
tmp->buffer[urlsize+1+stsize] = '\0';
devlist = tmp;
/* added for compatibility with recent versions of MiniSSDPd
/* added for compatibility with recent versions of MiniSSDPd
* >= 2007/12/19 */
DECODELENGTH(usnsize, p);
p += usnsize;

View File

@ -328,7 +328,7 @@ upnpDiscover(int delay, const char * multicastif,
struct UPNPDev * tmp;
struct UPNPDev * devlist = 0;
int opt = 1;
static const char MSearchMsgFmt[] =
static const char MSearchMsgFmt[] =
"M-SEARCH * HTTP/1.1\r\n"
"HOST: %s:" XSTR(PORT) "\r\n"
"ST: %s\r\n"
@ -411,7 +411,7 @@ upnpDiscover(int delay, const char * multicastif,
p->sin_addr.s_addr = INADDR_ANY;
}
#ifdef _WIN32
/* This code could help us to use the right Network interface for
/* This code could help us to use the right Network interface for
* SSDP multicast traffic */
/* Get IP associated with the index given in the ip_forward struct
* in order to give this ip to setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF) */
@ -759,7 +759,7 @@ LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
strncpy(urls->controlURL, urls->ipcondescURL, n2);
strncpy(urls->controlURL_CIF, urls->ipcondescURL, n3);
strncpy(urls->controlURL_6FC, urls->ipcondescURL, n4);
url_cpy_or_cat(urls->ipcondescURL, data->first.scpdurl, n1);
url_cpy_or_cat(urls->controlURL, data->first.controlurl, n2);

View File

@ -72,7 +72,7 @@ UPnP_discover(UPnPObject *self)
{
freeUPNPDevlist(self->devlist);
self->devlist = 0;
}
}
Py_BEGIN_ALLOW_THREADS
self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,
0/* multicast if*/,
@ -215,7 +215,7 @@ Py_END_ALLOW_THREADS
}
/* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
* remoteHost)
* remoteHost)
* protocol is 'UDP' or 'TCP' */
static PyObject *
UPnP_addportmapping(UPnPObject *self, PyObject *args)
@ -300,7 +300,7 @@ Py_END_ALLOW_THREADS
}
}
/* GetSpecificPortMapping(ePort, proto)
/* GetSpecificPortMapping(ePort, proto)
* proto = 'UDP' or 'TCP' */
static PyObject *
UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
@ -488,7 +488,7 @@ static PyMethodDef miniupnpc_methods[] = {
#define PyMODINIT_FUNC void
#endif
PyMODINIT_FUNC
initminiupnpc(void)
initminiupnpc(void)
{
PyObject* m;

View File

@ -5,7 +5,7 @@
* Copyright (c) 2005-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -162,7 +162,7 @@ getHTTPResponse(int s, int * size)
linestart = i;
colon = linestart;
valuestart = 0;
}
}
}
/* copy the remaining of the received data back to buf */
n = header_buf_used - endofheaders;
@ -231,7 +231,7 @@ getHTTPResponse(int s, int * size)
} else {
content_buf_len = content_buf_used + (int)bytestocopy;
}
content_buf = (char *)realloc((void *)content_buf,
content_buf = (char *)realloc((void *)content_buf,
content_buf_len);
}
memcpy(content_buf + content_buf_used, buf + i, bytestocopy);
@ -255,7 +255,7 @@ getHTTPResponse(int s, int * size)
} else {
content_buf_len = content_buf_used + n;
}
content_buf = (char *)realloc((void *)content_buf,
content_buf = (char *)realloc((void *)content_buf,
content_buf_len);
}
memcpy(content_buf + content_buf_used, buf, n);
@ -419,7 +419,7 @@ miniwget2(const char * url, const char * host,
* url : source string not modified
* hostname : hostname destination string (size of MAXHOSTNAMELEN+1)
* port : port (destination)
* path : pointer to the path part of the URL
* path : pointer to the path part of the URL
*
* Return values :
* 0 - Failure

View File

@ -4,7 +4,7 @@
* webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
Copyright (c) 2005-2011, Thomas BERNARD
Copyright (c) 2005-2011, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -149,7 +149,7 @@ static void parseelt(struct xmlparser * p)
return;
}
if(memcmp(p->xml, "<![CDATA[", 9) == 0)
{
{
/* CDATA handling */
p->xml += 9;
data = p->xml;

View File

@ -82,7 +82,7 @@ static const struct event evtref[] =
{ELTEND, "elt2b", 5},
{ELTEND, "elt2a", 5},
{ELTEND, "xmlroot", 7}
};
};
void startelt(void * data, const char * p, int l)
{

View File

@ -1,7 +1,7 @@
/* $Id: portlistingparse.c,v 1.4 2011/03/18 11:02:17 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2011 Thomas Bernard
* (c) 2011 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#include <string.h>

View File

@ -1,7 +1,7 @@
/* $Id: portlistingparse.h,v 1.5 2012/01/21 13:30:33 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2011-2012 Thomas Bernard
* (c) 2011-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef __PORTLISTINGPARSE_H__
@ -11,7 +11,7 @@
/* for the definition of UNSIGNED_INTEGER */
#include "miniupnpctypes.h"
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#include "bsdqueue.h"
#else
#include <sys/queue.h>
@ -37,7 +37,7 @@ typedef enum { PortMappingEltNone,
PortMappingEntry, NewRemoteHost,
NewExternalPort, NewProtocol,
NewInternalPort, NewInternalClient,
NewEnabled, NewDescription,
NewEnabled, NewDescription,
NewLeaseTime } portMappingElt;
struct PortMapping {

View File

@ -70,7 +70,7 @@ receivedata(int socket, char * data, int length, int timeout)
return -1;
} else if(n == 0) {
return 0;
}
}
#endif
n = recv(socket, data, length, 0);
if(n<0) {

View File

@ -8,8 +8,8 @@
#ifndef __RECEIVEDATA_H__
#define __RECEIVEDATA_H__
/* Reads data from the specified socket.
* Returns the number of bytes read if successful, zero if no bytes were
/* Reads data from the specified socket.
* Returns the number of bytes read if successful, zero if no bytes were
* read or if we timed out. Returns negative if there was an error. */
int receivedata(int socket, char * data, int length, int timeout);

View File

@ -25,7 +25,7 @@ int test_igd_desc_parse(char * buffer, int len)
parser.data = &igd;
parser.starteltfunc = IGDstartelt;
parser.endeltfunc = IGDendelt;
parser.datafunc = IGDdata;
parser.datafunc = IGDdata;
parsexml(&parser);
printIGD(&igd);
GetUPNPUrls(&urls, &igd, "http://fake/desc/url/file.xml");

View File

@ -53,7 +53,7 @@ void burptest(const char * buffer, int bufsize)
parser.datafunc = printdata; */
parser.starteltfunc = IGDstartelt;
parser.endeltfunc = IGDendelt;
parser.datafunc = IGDdata;
parser.datafunc = IGDdata;
parsexml(&parser);
printIGD(&data);
}

View File

@ -18,7 +18,7 @@
#include "upnpcommands.h"
#include "upnperrors.h"
/* protofix() checks if protocol is "UDP" or "TCP"
/* protofix() checks if protocol is "UDP" or "TCP"
* returns NULL if not */
const char * protofix(const char * proto)
{
@ -26,7 +26,7 @@ const char * protofix(const char * proto)
static const char proto_udp[4] = { 'U', 'D', 'P', 0};
int i, b;
for(i=0, b=1; i<4; i++)
b = b && ( (proto[i] == proto_tcp[i])
b = b && ( (proto[i] == proto_tcp[i])
|| (proto[i] == (proto_tcp[i] | 32)) );
if(b)
return proto_tcp;
@ -211,7 +211,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
}
}
/* Test function
/* Test function
* 1 - get connection type
* 2 - get extenal ip address
* 3 - Add port mapping
@ -241,7 +241,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
fprintf(stderr, "invalid protocol\n");
return;
}
UPNP_GetExternalIPAddress(urls->controlURL,
data->first.servicetype,
externalIPAddress);
@ -249,7 +249,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
printf("ExternalIPAddress = %s\n", externalIPAddress);
else
printf("GetExternalIPAddress failed.\n");
r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
eport, iport, iaddr, 0, proto, 0, leaseDuration);
if(r!=UPNPCOMMAND_SUCCESS)
@ -264,7 +264,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
if(r!=UPNPCOMMAND_SUCCESS)
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
r, strupnperror(r));
if(intClient[0]) {
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
@ -303,7 +303,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
UPNP_GetFirewallStatus(urls->controlURL_6FC, data->IPv6FC.servicetype, &firewallEnabled, &inboundPinholeAllowed);
printf("FirewallEnabled: %d & Inbound Pinhole Allowed: %d\n", firewallEnabled, inboundPinholeAllowed);
printf("GetFirewallStatus:\n Firewall Enabled: %s\n Inbound Pinhole Allowed: %s\n", (firewallEnabled)? "Yes":"No", (inboundPinholeAllowed)? "Yes":"No");
bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->CIF.servicetype);
bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->CIF.servicetype);
packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->CIF.servicetype);
@ -312,7 +312,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
}
/* Test function
/* Test function
* 1 - Add pinhole
* 2 - Check if pinhole is working from the IGD side */
static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
@ -376,7 +376,7 @@ static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
}
}
/* Test function
/* Test function
* Get pinhole timeout
*/
static void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas * data,

View File

@ -119,7 +119,7 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
LIBSPEC int
UPNP_GetStatusInfo(const char * controlURL,
const char * servicetype,
char * status,
char * status,
unsigned int * uptime,
char * lastconnerror)
{
@ -221,8 +221,8 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
/* 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,
@ -285,7 +285,7 @@ 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.
@ -746,11 +746,11 @@ UPNP_GetListOfPortMappings(const char * controlURL,
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;
@ -912,7 +912,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
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);
}

View File

@ -62,12 +62,12 @@ UPNP_GetConnectionTypeInfo(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
* at least 16 bytes must be available
*
* Return values :
* 0 : SUCCESS
* NON ZERO : ERROR Either an UPnP error code or an unknown error.
*
*
* possible UPnP Errors :
* 402 Invalid Args - See UPnP Device Architecture section on Control.
* 501 Action Failed - See UPnP Device Architecture section on Control. */
@ -95,7 +95,7 @@ UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
* Return values :
* 0 : SUCCESS
* NON ZERO : ERROR. Either an UPnP error code or an unknown error.
*
*
* List of possible UPnP errors for AddPortMapping :
* errorCode errorDescription (short) - Description (long)
* 402 Invalid Args - See UPnP Device Architecture section on Control.
@ -106,7 +106,7 @@ UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
* 718 ConflictInMappingEntry - The port mapping entry specified conflicts
* with a mapping assigned previously to another client
* 724 SamePortValuesRequired - Internal and External port values
* must be the same
* must be the same
* 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
* permanent lease times on port mappings
* 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
@ -221,11 +221,11 @@ UPNP_GetListOfPortMappings(const char * controlURL,
const char * numberOfPorts,
struct PortMappingParserData * data);
/* 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);
LIBSPEC int

View File

@ -15,7 +15,7 @@ extern "C" {
#endif
/* strupnperror()
* Return a string description of the UPnP error code
* Return a string description of the UPnP error code
* or NULL for undefinded errors */
LIBSPEC const char * strupnperror(int err);

View File

@ -1,7 +1,7 @@
/* $Id: upnpreplyparse.c,v 1.11 2011/02/07 16:17:06 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2011 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -90,7 +90,7 @@ ClearNameValueList(struct NameValueParserData * pdata)
}
}
char *
char *
GetValueFromNameValueList(struct NameValueParserData * pdata,
const char * Name)
{
@ -131,7 +131,7 @@ GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
}
#endif
/* debug all-in-one function
/* debug all-in-one function
* do parsing then display to stdout */
#ifdef DEBUG
void

View File

@ -1,14 +1,14 @@
/* $Id: upnpreplyparse.h,v 1.12 2012/01/21 13:30:33 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef __UPNPREPLYPARSE_H__
#define __UPNPREPLYPARSE_H__
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#include "bsdqueue.h"
#else
#include <sys/queue.h>

View File

@ -26,7 +26,7 @@ int main(int argc, char * * argv) {
dwBuildNumber :
The build number of the operating system.
dwPlatformId
The operating system platform. This member can be the following value.
The operating system platform. This member can be the following value.
szCSDVersion
A null-terminated string, such as "Service Pack 3", that indicates the
latest Service Pack installed on the system. If no Service Pack has