1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-06 11:38:21 +00:00

(trunk libT) update to the newest versions of miniupnp and libnatpmp

This commit is contained in:
Charles Kerr 2009-02-07 00:11:58 +00:00
parent 3821413390
commit ae985a5abb
10 changed files with 71 additions and 24 deletions

View file

@ -133,7 +133,7 @@ tr_upnpPulse( tr_upnp * handle,
tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port );
UPNP_DeletePortMapping( handle->urls.controlURL,
handle->data.servicetype,
portStr, "TCP" );
portStr, "TCP", NULL );
tr_ninf( getKey( ),
_(
"Stopping port forwarding through \"%s\", service \"%s\"" ),
@ -165,7 +165,7 @@ tr_upnpPulse( tr_upnp * handle,
err = UPNP_AddPortMapping( handle->urls.controlURL,
handle->data.servicetype,
portStr, portStr, handle->lanaddr,
desc, "TCP" );
desc, "TCP", NULL );
handle->isMapped = !err;
}
tr_ninf( getKey( ),

View file

@ -1,4 +1,4 @@
libnatpmp is written by Thomas Bernard.
Its homepage is http://miniupnp.tuxfamily.org/libnatpmp.html
This code is from the libnatpmp-20081006 snapshot
This code is from the libnatpmp-20090129 snapshot

View file

@ -1,6 +1,24 @@
$Id: Changelog.txt,v 1.72 2008/09/25 18:02:50 nanard Exp $
$Id: Changelog.txt,v 1.77 2008/12/18 17:47:32 nanard Exp $
miniUPnP client Changelog.
2008/12/18:
cleanup in Makefile (thanks to Paul de Weerd)
minissdpc.c : win32 compatibility
miniupnpc.c : changed xmlns prefix from 'm' to 'u'
Removed NDEBUG (using DEBUG)
2008/10/14:
Added the ExternalHost argument to DeletePortMapping()
2008/10/11:
Added the ExternalHost argument to AddPortMapping()
Put a correct User-Agent: header in HTTP requests.
VERSION 1.2 :
2008/10/07:
Update docs
2008/09/25:
Integrated sameport patch from Dario Meloni : Added a "sameport"
argument to upnpDiscover().

View file

@ -1,3 +1,3 @@
MiniUPnP is written by Thomas Bernard.
Its homepage is http://miniupnp.free.fr/
This is from the miniupnpc-1.2 tarball (7 Oct 2008)
This is from miniupnpc-20090129.tar.gz

View file

@ -1,4 +1,4 @@
/* $Id: minisoap.c,v 1.15 2008/02/17 17:57:07 nanard Exp $ */
/* $Id: minisoap.c,v 1.16 2008/10/11 16:39:29 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005 Thomas Bernard
@ -19,6 +19,7 @@
#include <sys/socket.h>
#endif
#include "minisoap.h"
#include "miniupnpcstrings.h"
/* only for malloc */
#include <stdlib.h>
@ -92,7 +93,7 @@ int soapPostSubmit(int fd,
"POST %s HTTP/1.1\r\n"
/* "POST %s HTTP/1.0\r\n"*/
"Host: %s%s\r\n"
"User-Agent: POSIX, UPnP/1.0, miniUPnPc/1.0\r\n"
"User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
"Content-Length: %d\r\n"
"Content-Type: text/xml\r\n"
"SOAPAction: \"%s\"\r\n"

View file

@ -1,4 +1,4 @@
/* $Id: minissdpc.c,v 1.6 2008/10/06 23:08:39 nanard Exp $ */
/* $Id: minissdpc.c,v 1.7 2008/12/18 17:45:48 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas BERNARD
* copyright (c) 2005-2008 Thomas Bernard
@ -10,8 +10,14 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#ifdef WIN32
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <io.h>
#else
#include <sys/socket.h>
#include <sys/un.h>
#endif
#include "minissdpc.h"
#include "miniupnpc.h"

View file

@ -1,4 +1,4 @@
/* $Id: miniupnpc.c,v 1.55 2008/09/25 18:02:50 nanard Exp $ */
/* $Id: miniupnpc.c,v 1.57 2008/12/18 17:46:36 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas BERNARD
* copyright (c) 2005-2007 Thomas Bernard
@ -8,13 +8,19 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
/* Win32 Specific includes and defines */
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <io.h>
#define snprintf _snprintf
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define strncasecmp _memicmp
#else
#define strncasecmp memicmp
#endif
#define MAXHOSTNAMELEN 64
#else
/* Standard POSIX includes */
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
@ -39,6 +45,8 @@
#endif
#define SOAPPREFIX "s"
#define SERVICEPREFIX "u"
#define SERVICEPREFIX2 'u'
/* root description parsing */
void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
@ -53,7 +61,7 @@ void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
parser.datafunc = IGDdata;
parser.attfunc = 0;
parsexml(&parser);
#ifndef NDEBUG
#ifdef DEBUG
printIGD(data);
#endif
}
@ -150,8 +158,8 @@ int simpleUPnPcommand(int s, const char * url, const char * service,
"xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<" SOAPPREFIX ":Body>"
"<m:%s xmlns:m=\"%s\">"
"</m:%s>"
"<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">"
"</" SERVICEPREFIX ":%s>"
"</" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>"
"\r\n", action, service, action);
}
@ -166,7 +174,7 @@ int simpleUPnPcommand(int s, const char * url, const char * service,
"xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<" SOAPPREFIX ":Body>"
"<m:%s xmlns:m=\"%s\">",
"<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">",
action, service);
p = soapbody + soapbodylen;
while(args->elt)
@ -198,7 +206,7 @@ int simpleUPnPcommand(int s, const char * url, const char * service,
}
*(p++) = '<';
*(p++) = '/';
*(p++) = 'm';
*(p++) = SERVICEPREFIX2;
*(p++) = ':';
pe = action;
while(*pe)

View file

@ -1,4 +1,4 @@
/* $Id: miniwget.c,v 1.19 2007/11/02 14:16:19 nanard Exp $ */
/* $Id: miniwget.c,v 1.21 2008/12/18 17:45:18 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005 Thomas Bernard
@ -31,6 +31,8 @@
#include <utility.h>
#endif
#include "miniupnpcstrings.h"
/* miniwget2() :
* */
static void *
@ -96,6 +98,8 @@ miniwget2(const char * url, const char * host,
"GET %s HTTP/1.1\r\n"
"Host: %s:%d\r\n"
"Connection: Close\r\n"
"User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
"\r\n",
path, host, port);
/*write(s, buf, strlen(buf));*/
@ -137,7 +141,7 @@ miniwget2(const char * url, const char * host,
}
}
*size = allreadyread;
#ifndef NDEBUG
#ifdef DEBUG
printf("%d bytes read\n", *size);
#endif
closesocket(s);

View file

@ -1,7 +1,7 @@
/* $Id: upnpcommands.c,v 1.19 2008/02/18 13:27:23 nanard Exp $ */
/* $Id: upnpcommands.c,v 1.22 2008/12/18 17:45:18 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005 Thomas Bernard
* Copyright (c) 2005-2008 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution.
* */
@ -303,7 +303,8 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
const char * inPort,
const char * inClient,
const char * desc,
const char * proto)
const char * proto,
const char * remoteHost)
{
struct UPNParg * AddPortMappingArgs;
char buffer[4096];
@ -317,6 +318,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
AddPortMappingArgs = calloc(9, sizeof(struct UPNParg));
AddPortMappingArgs[0].elt = "NewRemoteHost";
AddPortMappingArgs[0].val = remoteHost;
AddPortMappingArgs[1].elt = "NewExternalPort";
AddPortMappingArgs[1].val = extPort;
AddPortMappingArgs[2].elt = "NewProtocol";
@ -351,7 +353,8 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
int
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
const char * extPort, const char * proto)
const char * extPort, const char * proto,
const char * remoteHost)
{
/*struct NameValueParserData pdata;*/
struct UPNParg * DeletePortMappingArgs;
@ -366,6 +369,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
DeletePortMappingArgs = calloc(4, sizeof(struct UPNParg));
DeletePortMappingArgs[0].elt = "NewRemoteHost";
DeletePortMappingArgs[0].val = remoteHost;
DeletePortMappingArgs[1].elt = "NewExternalPort";
DeletePortMappingArgs[1].val = extPort;
DeletePortMappingArgs[2].elt = "NewProtocol";
@ -484,7 +488,7 @@ int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * ser
char* p;
int ret = UPNPCOMMAND_UNKNOWN_ERROR;
simpleUPnPcommand(-1, controlURL, servicetype, "GetPortMappingNumberOfEntries", 0, buffer, &bufsize);
#ifndef NDEBUG
#ifdef DEBUG
DisplayNameValueList(buffer, bufsize);
#endif
ParseNameValue(buffer, bufsize, &pdata);

View file

@ -1,4 +1,4 @@
/* $Id: upnpcommands.h,v 1.14 2008/09/25 18:02:50 nanard Exp $ */
/* $Id: upnpcommands.h,v 1.16 2008/10/14 18:05:28 nanard Exp $ */
/* Miniupnp project : http://miniupnp.free.fr/
* Author : Thomas Bernard
* Copyright (c) 2005-2008 Thomas Bernard
@ -86,6 +86,8 @@ UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
unsigned int * bitrateUp);
/* UPNP_AddPortMapping()
* if desc is NULL, it will be defaulted to "libminiupnpc"
* remoteHost is usually NULL because IGD don't support it.
*
* Return values :
* 0 : SUCCESS
@ -114,9 +116,12 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
const char * inPort,
const char * inClient,
const char * desc,
const char * proto);
const char * proto,
const char * remoteHost);
/* UPNP_DeletePortMapping()
* Use same argument values as what was used for AddPortMapping().
* remoteHost is usually NULL because IGD don't support it.
* Return Values :
* 0 : SUCCESS
* NON ZERO : error. Either an UPnP error code or an undefined error.
@ -126,7 +131,8 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
* 714 NoSuchEntryInArray - The specified value does not exist in the array */
LIBSPEC int
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
const char * extPort, const char * proto);
const char * extPort, const char * proto,
const char * remoteHost);
/* UPNP_GetPortMappingNumberOfEntries()
* not supported by all routers */