tr_bencDictAddStr( &d, "download-dir", tr_sessionGetDownloadDir( h ) );
tr_bencDictAddInt( &d, "peer-limit", tr_sessionGetPeerLimit( h ) );
tr_bencDictAddInt( &d, "pex-allowed", tr_sessionIsPexEnabled( h ) );
- tr_bencDictAddInt( &d, "port", tr_sessionGetPublicPort( h ) );
+ tr_bencDictAddInt( &d, "port", tr_sessionGetPeerPort( h ) );
tr_bencDictAddInt( &d, "port-forwarding-enabled",
tr_sessionIsPortForwardingEnabled( h ) );
tr_bencDictAddStr( &d, "rpc-acl", tr_sessionGetRPCACL( h ) );
else if( !strcmp( key, PREF_KEY_PORT ) )
{
const int port = pref_int_get( key );
- tr_sessionSetPublicPort( tr, port );
+ tr_sessionSetPeerPort( tr, port );
}
else if( !strcmp( key, PREF_KEY_DL_LIMIT_ENABLED ) )
{
hig_workarea_add_row_w( t, &row, w, w2, NULL );
hig_workarea_add_section_title (t, &row, _( "Ports" ) );
-
- s = _("_Forward port from router" );
- w = new_check_button( s, PREF_KEY_NAT, core );
- hig_workarea_add_wide_control( t, &row, w );
h = gtk_hbox_new( FALSE, GUI_PAD_BIG );
w2 = new_spin_button( PREF_KEY_PORT, core, 1, INT_MAX, 1 );
l = gtk_label_new( NULL );
gtk_misc_set_alignment( GTK_MISC(l), 0.0f, 0.5f );
gtk_box_pack_start( GTK_BOX(h), l, FALSE, FALSE, 0 );
- hig_workarea_add_row( t, &row, _("Incoming _port:"), h, w );
+ hig_workarea_add_row( t, &row, _("Listen for _peers on port:"), h, w );
g_object_set_data( G_OBJECT(l), "tr-port-spin", w2 );
g_object_set_data( G_OBJECT(l), "alive", alive );
g_object_set_data( G_OBJECT(l), "handle", tr_core_handle( TR_CORE( core ) ) );
testing_port_cb( NULL, l );
- g_signal_connect( w, "toggled", G_CALLBACK(testing_port_cb), l );
- g_signal_connect( w2, "value-changed", G_CALLBACK(testing_port_cb), l );
-
s = _( "Listen for _RPC requests on port:" );
w = new_check_button( s, PREF_KEY_RPC_ENABLED, core );
w2 = new_spin_button( PREF_KEY_RPC_PORT, core, 0, 65535, 1 );
gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_RPC_ENABLED ) );
g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
hig_workarea_add_row_w( t, &row, w, w2, NULL );
+
+ s = _("_Forward these port(s) from my router" );
+ w = new_check_button( s, PREF_KEY_NAT, core );
+ hig_workarea_add_wide_control( t, &row, w );
+
+ g_signal_connect( w, "toggled", G_CALLBACK(testing_port_cb), l );
+ g_signal_connect( w2, "value-changed", G_CALLBACK(testing_port_cb), l );
hig_workarea_finish( t, &row );
return t;
tr_bencInitDict( &val, 4 );
tr_bencDictAddInt( &val, "e", msgs->handle->encryptionMode != TR_PLAINTEXT_PREFERRED );
- tr_bencDictAddInt( &val, "p", tr_sessionGetPublicPort( msgs->handle ) );
+ tr_bencDictAddInt( &val, "p", tr_sessionGetPeerPort( msgs->handle ) );
tr_bencDictAddStr( &val, "v", TR_NAME " " USERAGENT_PREFIX );
m = tr_bencDictAddDict( &val, "m", 1 );
if( pex )
}
int
-tr_sharedGetPublicPort( const tr_shared * s )
+tr_sharedGetPeerPort( const tr_shared * s )
{
return s->publicPort;
}
typedef struct tr_shared tr_shared;
-tr_shared* tr_sharedInit ( tr_handle *, int isEnabled,
- int publicPort );
-void tr_sharedShuttingDown ( tr_shared * );
-void tr_sharedSetPort ( tr_shared *, int publicPort );
-void tr_sharedTraversalEnable ( tr_shared *, int isEnabled );
-int tr_sharedGetPublicPort ( const tr_shared * s );
-int tr_sharedTraversalIsEnabled( const tr_shared * s );
-int tr_sharedTraversalStatus ( const tr_shared * );
+tr_shared* tr_sharedInit ( tr_handle *, int isEnabled,
+ int publicPort );
+void tr_sharedShuttingDown ( tr_shared * );
+void tr_sharedSetPort ( tr_shared *, int publicPort );
+void tr_sharedTraversalEnable ( tr_shared *, int isEnabled );
+int tr_sharedGetPeerPort ( const tr_shared * s );
+int tr_sharedTraversalIsEnabled ( const tr_shared * s );
+int tr_sharedTraversalStatus ( const tr_shared * );
#endif
if( tr_bencDictFindInt( args_in, "pex-allowed", &i ) )
tr_sessionSetPexEnabled( h, i );
if( tr_bencDictFindInt( args_in, "port", &i ) )
- tr_sessionSetPublicPort( h, i );
+ tr_sessionSetPeerPort( h, i );
if( tr_bencDictFindInt( args_in, "port-forwarding-enabled", &i ) )
tr_sessionSetPortForwardingEnabled( h, i );
if( tr_bencDictFindInt( args_in, "speed-limit-down", &i ) )
tr_bencDictAddInt( d, "pex-allowed",
tr_sessionIsPexEnabled( h ) );
tr_bencDictAddInt( d, "port",
- tr_sessionGetPublicPort( h ) );
+ tr_sessionGetPeerPort( h ) );
tr_bencDictAddInt( d, "port-forwarding-enabled",
tr_sessionIsPortForwardingEnabled( h ) );
tr_bencDictAddInt( d, "speed-limit-up",
}
void
-tr_sessionSetPublicPort( tr_handle * handle, int port )
+tr_sessionSetPeerPort( tr_handle * handle, int port )
{
struct bind_port_data * data = tr_new( struct bind_port_data, 1 );
data->handle = handle;
}
int
-tr_sessionGetPublicPort( const tr_handle * h )
+tr_sessionGetPeerPort( const tr_handle * h )
{
assert( h != NULL );
- return tr_sharedGetPublicPort( h->shared );
+ return tr_sharedGetPeerPort( h->shared );
}
tr_port_forwarding
tr_peerMgrAddTorrent( h->peerMgr, tor );
if( !h->isPortSet )
- tr_sessionSetPublicPort( h, TR_DEFAULT_PORT );
+ tr_sessionSetPeerPort( h, TR_DEFAULT_PORT );
assert( !tor->downloadedCur );
assert( !tor->uploadedCur );
#include "bencode.h"
#include "completion.h"
#include "net.h"
-#include "port-forwarding.h"
#include "publish.h"
#include "torrent.h"
#include "tracker.h"
strchr(ann, '?') ? '&' : '?',
t->escaped,
t->peer_id,
- tr_sharedGetPublicPort( t->session->shared ),
+ tr_sessionGetPeerPort( t->session ),
torrent->uploadedCur,
torrent->downloadedCur,
torrent->corruptCur,
int tr_sessionIsPortForwardingEnabled( const tr_handle * );
-void tr_sessionSetPublicPort( tr_handle *, int );
+void tr_sessionSetPeerPort( tr_handle *, int );
-int tr_sessionGetPublicPort( const tr_handle * );
+int tr_sessionGetPeerPort( const tr_handle * );
typedef enum
{
IBOutlet NSImageView * fPortStatusImage;
IBOutlet NSProgressIndicator * fPortStatusProgress;
NSTimer * fPortStatusTimer;
- int fPublicPort, fNatStatus;
+ int fPeerPort, fNatStatus;
}
- (id) initWithHandle: (tr_handle *) handle;
{
int port = [sender intValue];
[fDefaults setInteger: port forKey: @"BindPort"];
- tr_sessionSetPublicPort(fHandle, port);
+ tr_sessionSetPeerPort(fHandle, port);
- fPublicPort = -1;
+ fPeerPort = -1;
[self updatePortStatus];
}
- (void) updatePortStatus
{
const tr_port_forwarding fwd = tr_sessionGetPortForwarding(fHandle);
- const int port = tr_sessionGetPublicPort(fHandle);
+ const int port = tr_sessionGetPeerPort(fHandle);
- if (fNatStatus != fwd || fPublicPort != port )
+ if (fNatStatus != fwd || fPeerPort != port )
{
fNatStatus = fwd;
- fPublicPort = port;
+ fPeerPort = port;
[fPortStatusField setStringValue: [NSLocalizedString(@"Checking port status", "Preferences -> Network -> port status")
stringByAppendingEllipsis]];
[fPortChecker cancelProbe];
[fPortChecker release];
}
- fPortChecker = [[PortChecker alloc] initForPort: fPublicPort withDelegate: self];
+ fPortChecker = [[PortChecker alloc] initForPort: fPeerPort withDelegate: self];
}
}