Lines 13-20
Link Here
|
13 |
#include <assert.h> |
13 |
#include <assert.h> |
14 |
#include <errno.h> |
14 |
#include <errno.h> |
15 |
|
15 |
|
|
|
16 |
#ifdef SYSTEM_MINIUPNP |
17 |
#include <miniupnpc/miniupnpc.h> |
18 |
#include <miniupnpc/upnpcommands.h> |
19 |
#else |
16 |
#include <miniupnp/miniupnpc.h> |
20 |
#include <miniupnp/miniupnpc.h> |
17 |
#include <miniupnp/upnpcommands.h> |
21 |
#include <miniupnp/upnpcommands.h> |
|
|
22 |
#endif |
18 |
|
23 |
|
19 |
#include "transmission.h" |
24 |
#include "transmission.h" |
20 |
#include "port-forwarding.h" |
25 |
#include "port-forwarding.h" |
Lines 97-103
tr_upnpPulse( tr_upnp * handle,
Link Here
|
97 |
{ |
102 |
{ |
98 |
struct UPNPDev * devlist; |
103 |
struct UPNPDev * devlist; |
99 |
errno = 0; |
104 |
errno = 0; |
|
|
105 |
#ifdef HAVE_MINIUPNP_16 |
106 |
devlist = upnpDiscover( 2000, NULL, NULL, 0, 0, &errno ); |
107 |
#else |
100 |
devlist = upnpDiscover( 2000, NULL, NULL, 0 ); |
108 |
devlist = upnpDiscover( 2000, NULL, NULL, 0 ); |
|
|
109 |
#endif |
101 |
if( devlist == NULL ) |
110 |
if( devlist == NULL ) |
102 |
{ |
111 |
{ |
103 |
tr_ndbg( |
112 |
tr_ndbg( |
Lines 144-152
tr_upnpPulse( tr_upnp * handle,
Link Here
|
144 |
|
153 |
|
145 |
tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port ); |
154 |
tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port ); |
146 |
if( UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL, handle->data.first.servicetype, |
155 |
if( UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL, handle->data.first.servicetype, |
|
|
156 |
#ifdef HAVE_MINIUPNP_16 |
157 |
portStr, "TCP", intClient, intPort, NULL, NULL, NULL ) != UPNPCOMMAND_SUCCESS || |
158 |
#else |
147 |
portStr, "TCP", intClient, intPort ) != UPNPCOMMAND_SUCCESS || |
159 |
portStr, "TCP", intClient, intPort ) != UPNPCOMMAND_SUCCESS || |
|
|
160 |
#endif |
148 |
UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL, handle->data.first.servicetype, |
161 |
UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL, handle->data.first.servicetype, |
|
|
162 |
#ifdef HAVE_MINIUPNP_16 |
163 |
portStr, "UDP", intClient, intPort, NULL, NULL, NULL ) != UPNPCOMMAND_SUCCESS ) |
164 |
#else |
149 |
portStr, "UDP", intClient, intPort ) != UPNPCOMMAND_SUCCESS ) |
165 |
portStr, "UDP", intClient, intPort ) != UPNPCOMMAND_SUCCESS ) |
|
|
166 |
#endif |
150 |
{ |
167 |
{ |
151 |
tr_ninf( getKey( ), _( "Port %d isn't forwarded" ), handle->port ); |
168 |
tr_ninf( getKey( ), _( "Port %d isn't forwarded" ), handle->port ); |
152 |
handle->isMapped = false; |
169 |
handle->isMapped = false; |
Lines 198-204
tr_upnpPulse( tr_upnp * handle,
Link Here
|
198 |
err_tcp = UPNP_AddPortMapping( handle->urls.controlURL, |
215 |
err_tcp = UPNP_AddPortMapping( handle->urls.controlURL, |
199 |
handle->data.first.servicetype, |
216 |
handle->data.first.servicetype, |
200 |
portStr, portStr, handle->lanaddr, |
217 |
portStr, portStr, handle->lanaddr, |
|
|
218 |
#ifdef HAVE_MINIUPNP_16 |
219 |
desc, "TCP", NULL, NULL ); |
220 |
#else |
201 |
desc, "TCP", NULL ); |
221 |
desc, "TCP", NULL ); |
|
|
222 |
#endif |
202 |
if( err_tcp ) |
223 |
if( err_tcp ) |
203 |
tr_ndbg( getKey( ), "TCP Port forwarding failed with error %d (errno %d - %s)", |
224 |
tr_ndbg( getKey( ), "TCP Port forwarding failed with error %d (errno %d - %s)", |
204 |
err_tcp, errno, tr_strerror( errno ) ); |
225 |
err_tcp, errno, tr_strerror( errno ) ); |
Lines 207-213
tr_upnpPulse( tr_upnp * handle,
Link Here
|
207 |
err_udp = UPNP_AddPortMapping( handle->urls.controlURL, |
228 |
err_udp = UPNP_AddPortMapping( handle->urls.controlURL, |
208 |
handle->data.first.servicetype, |
229 |
handle->data.first.servicetype, |
209 |
portStr, portStr, handle->lanaddr, |
230 |
portStr, portStr, handle->lanaddr, |
|
|
231 |
#ifdef HAVE_MINIUPNP_16 |
232 |
desc, "UDP", NULL, NULL ); |
233 |
#else |
210 |
desc, "UDP", NULL ); |
234 |
desc, "UDP", NULL ); |
|
|
235 |
#endif |
211 |
if( err_udp ) |
236 |
if( err_udp ) |
212 |
tr_ndbg( getKey( ), "UDP Port forwarding failed with error %d (errno %d - %s)", |
237 |
tr_ndbg( getKey( ), "UDP Port forwarding failed with error %d (errno %d - %s)", |
213 |
err_udp, errno, tr_strerror( errno ) ); |
238 |
err_udp, errno, tr_strerror( errno ) ); |