#972: Update to the 2008/05/29 snapshot of libnatpmp

This commit is contained in:
Charles Kerr 2008-05-29 13:39:39 +00:00
parent eb02b3e494
commit 93ee8b8c49
4 changed files with 10 additions and 10 deletions

View File

@ -126,7 +126,7 @@ tr_natpmpPulse( struct tr_natpmp * nat, int port, int isEnabled )
const int val = readnatpmpresponseorretry( &nat->natpmp, &response );
logVal( "readnatpmpresponseorretry", val );
if( val >= 0 ) {
tr_ninf( getKey(), _( "Found public address \"%s\"" ), inet_ntoa( response.publicaddress.addr ) );
tr_ninf( getKey(), _( "Found public address \"%s\"" ), inet_ntoa( response.pnu.publicaddress.addr ) );
nat->state = TR_NATPMP_IDLE;
} else if( val != NATPMP_TRYAGAIN ) {
nat->state = TR_NATPMP_ERR;
@ -188,7 +188,7 @@ tr_natpmpPulse( struct tr_natpmp * nat, int port, int isEnabled )
nat->state = TR_NATPMP_IDLE;
nat->isMapped = 1;
nat->renewTime = time( NULL ) + LIFETIME_SECS;
nat->port = resp.newportmapping.privateport;
nat->port = resp.pnu.newportmapping.privateport;
tr_ninf( getKey(), _( "Port %d forwarded successfully" ), nat->port );
} else if( val != NATPMP_TRYAGAIN ) {
nat->state = TR_NATPMP_ERR;

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-20080428 snapshot
This code is from the libnatpmp-20080529 snapshot

View File

@ -1,4 +1,4 @@
/* $Id: natpmp.c,v 1.6 2008/04/28 02:58:34 nanard Exp $ */
/* $Id: natpmp.c,v 1.7 2008/05/29 08:06:01 nanard Exp $ */
/* libnatpmp
* Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
* http://miniupnp.free.fr/libnatpmp.html
@ -203,11 +203,11 @@ int readnatpmpresponse(natpmp_t * p, natpmpresp_t * response)
response->type = buf[1] & 0x7f;
if(buf[1] == 128)
//response->publicaddress.addr = *((uint32_t *)(buf + 8));
response->publicaddress.addr.s_addr = *((uint32_t *)(buf + 8));
response->pnu.publicaddress.addr.s_addr = *((uint32_t *)(buf + 8));
else {
response->newportmapping.privateport = ntohs(*((uint16_t *)(buf + 8)));
response->newportmapping.mappedpublicport = ntohs(*((uint16_t *)(buf + 10)));
response->newportmapping.lifetime = ntohl(*((uint32_t *)(buf + 12)));
response->pnu.newportmapping.privateport = ntohs(*((uint16_t *)(buf + 8)));
response->pnu.newportmapping.mappedpublicport = ntohs(*((uint16_t *)(buf + 10)));
response->pnu.newportmapping.lifetime = ntohl(*((uint32_t *)(buf + 12)));
}
n = 0;
}

View File

@ -1,4 +1,4 @@
/* $Id: natpmp.h,v 1.8 2008/04/28 02:58:34 nanard Exp $ */
/* $Id: natpmp.h,v 1.9 2008/05/29 08:06:01 nanard Exp $ */
/* libnatpmp
* Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
* http://miniupnp.free.fr/libnatpmp.html
@ -52,7 +52,7 @@ typedef struct {
uint16_t mappedpublicport;
uint32_t lifetime;
} newportmapping;
};
} pnu;
} natpmpresp_t;
/* possible values for type field of natpmpresp_t */