Methods Summary |
---|
public void | addProtocol(ProtocolEndpoint ep)
if ( protocols == null ){
protocols = new ProtocolEndpoint[]{ ep };
}else{
for (int i=0;i<protocols.length;i++){
if ( protocols[i] == ep ){
return;
}
}
ProtocolEndpoint[] new_ep = new ProtocolEndpoint[ protocols.length + 1 ];
System.arraycopy( protocols, 0, new_ep, 0, protocols.length );
new_ep[ protocols.length ] = ep;
protocols = new_ep;
}
ep.setConnectionEndpoint( this );
|
public ConnectionAttempt | connectOutbound(boolean connect_with_crypto, boolean allow_fallback, byte[][] shared_secrets, java.nio.ByteBuffer initial_data, com.aelitis.azureus.core.networkmanager.Transport.ConnectListener listener)
ProtocolEndpoint protocol = protocols[0];
final Transport transport = protocol.connectOutbound( connect_with_crypto, allow_fallback, shared_secrets, initial_data, listener );
return(
new ConnectionAttempt()
{
public void
abandon()
{
if ( transport != null ){
transport.close( "Connection attempt abandoned" );
}
}
});
|
public java.lang.String | getDescription()
String str = "[";
for (int i=0;i<protocols.length;i++){
str += (i==0?"":",") + protocols[i].getDescription();
}
return( str + "]" );
|
public java.net.InetSocketAddress | getNotionalAddress()
return( notional_address );
|
public ProtocolEndpoint[] | getProtocols()
if ( protocols == null ){
return( new ProtocolEndpoint[0] );
}
return( protocols );
|
public boolean | matchIP(java.lang.String ip)
if ( matchIP( ip, notional_address )){
return( true );
}
ProtocolEndpoint[] peps = getProtocols();
for (int i=0;i<peps.length;i++){
ProtocolEndpoint pep = peps[i];
if ( pep.getType() == ProtocolEndpoint.PROTOCOL_TCP ){
ProtocolEndpointTCP tcp = (ProtocolEndpointTCP)pep;
if ( matchIP( ip, tcp.getAddress())){
return( true );
}
}else{
ProtocolEndpointUDP tcp = (ProtocolEndpointUDP)pep;
if ( matchIP( ip, tcp.getAddress())){
return( true );
}
}
}
return( false );
|
protected boolean | matchIP(java.lang.String ip, java.net.InetSocketAddress address)
return( ip.equals( address.getAddress().getHostAddress()));
|