LimeWire Consolidated API

com.limegroup.gnutella
Interface PushEndpoint

All Superinterfaces:
Address, HTTPHeaderValue, IpPort
All Known Implementing Classes:
AbstractPushEndpoint, PushEndpointImpl, SelfEndpoint

public interface PushEndpoint
extends HTTPHeaderValue, IpPort, Address

a class that represents an endpoint behind one or more PushProxies. almost everything is immutable including the contents of the set. the network format this is serialized to is: byte 0 (from right-to-left): - bits 0-2 how many push proxies we have (so max is 7) - bits 3-4 the version of the f2f transfer protocol this altloc supports - bits 5-6 other possible features. - bit 7 set if the TLS-capable push proxy indexes byte is included bytes 1-16 : the guid bytes 17-22: ip:port of the address (if FWT version > 0) followed by a byte of TLS-capable PushProxy indexes (if bit 7 of features is set) followed by 6 bytes per PushProxy the http format this is serialized to is an ascii string consisting of ';'-delimited tokens. The first token is the client GUID represented in hex and is the only required token. The other tokens can be addresses of push proxies or various feature headers. At most one of the tokens should be the external ip and port of the firewalled node in a port:ip format. Currently the only feature header we parse is the fwawt header that contains the version number of the firewall to firewall transfer protocol supported by the altloc. In addition, the 'pptls=' field can indicate which, if any, push proxies support TLS. If the field is present, it must be immediately before the listing of the push proxies. The hexadecimal string after the '=' is a bit-representation of which push proxies are valid for TLS. A PE does not need to know the actual external address of the firewalled host, however without that knowledge we cannot do firewall-to-firewall transfer with the given host. Also, the RemoteFileDesc objects requires a valid IP for construction, so in the case we do not know the external address we return a BOGUS_IP. Examples: //altloc with 2 proxies and supports firewall transfer 1 : ;fwt/1.0;20.30.40.50:60;1.2.3.4:5567 //altloc with 1 proxy and doesn't support firewall transfer, with external address: ;1.2.3.4:5564;6346:2.3.4.5 //altloc with 1 proxy and supports two features we don't know/care about : ;someFeature/3.2;10.20.30.40:5564;otherFeature/0.4 //altloc with 1 proxy (the first) that's TLS capable, 1 that isn't: ;fwt/1.0;pptls=8;20.30.40.50:60;1.2.3.4:5567 //altloc without any proxies and doesn't support any features // not very useful, but still valid


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.limewire.io.IpPort
IpPort.IpComparator, IpPort.IpPortComparator
 
Nested classes/interfaces inherited from interface org.limewire.io.Address
Address.EventType
 
Field Summary
static byte FEATURES_MASK
           
static byte FWT_VERSION_MASK
           
static int HEADER_SIZE
           
static int MAX_PROXIES
          The maximum number of proxies to use.
static byte PLAIN
           
static byte PPTLS_BINARY
           
static String PPTLS_HTTP
          The pptls portion constant.
static int PROXY_SIZE
           
static byte SIZE_MASK
           
 
Fields inherited from interface org.limewire.io.IpPort
COMPARATOR, EMPTY_LIST, EMPTY_SET, IP_COMPARATOR
 
Method Summary
 PushEndpoint createClone()
          Can return null if no valid push endpoint can be cloned.
 boolean equals(Object other)
          Equality should be based on the equality of the value of getClientGUID().
 String getAddress()
          Assessor for the address string.
 byte[] getClientGUID()
          Returns the GUID of the client that can be reached through the pushproxies.
 byte getFeatures()
           
 int getFWTVersion()
           
 Set<? extends IpPort> getProxies()
           
 IpPort getValidExternalAddress()
          Returns an IpPort representing the valid external address of this push endpoint if it is known, otherwise null.
 int hashCode()
          Should return the GUID.hashCode() of getClientGUID().
 boolean isLocal()
           
 byte[] toBytes(boolean includeTLS)
           
 void toBytes(byte[] where, int offset, boolean includeTLS)
          creates a byte packet representation of this
 void updateProxies(boolean good)
          Updates either the PushEndpoint or the GUID_PROXY_MAP to ensure that GUID_PROXY_MAP has a reference to all live PE GUIDs and all live PE's reference the same GUID object as in GUID_PROXY_MAP.
 
Methods inherited from interface com.limegroup.gnutella.http.HTTPHeaderValue
httpStringValue
 
Methods inherited from interface org.limewire.io.IpPort
getInetAddress, getInetSocketAddress, getPort
 
Methods inherited from interface org.limewire.io.Address
getAddressDescription
 

Field Detail

HEADER_SIZE

static final int HEADER_SIZE
See Also:
Constant Field Values

PROXY_SIZE

static final int PROXY_SIZE
See Also:
Constant Field Values

PLAIN

static final byte PLAIN
See Also:
Constant Field Values

PPTLS_BINARY

static final byte PPTLS_BINARY
See Also:
Constant Field Values

SIZE_MASK

static final byte SIZE_MASK
See Also:
Constant Field Values

FWT_VERSION_MASK

static final byte FWT_VERSION_MASK
See Also:
Constant Field Values

FEATURES_MASK

static final byte FEATURES_MASK
See Also:
Constant Field Values

PPTLS_HTTP

static final String PPTLS_HTTP
The pptls portion constant.

See Also:
Constant Field Values

MAX_PROXIES

static final int MAX_PROXIES
The maximum number of proxies to use.

See Also:
Constant Field Values
Method Detail

toBytes

byte[] toBytes(boolean includeTLS)
Returns:
a byte-packed representation of this

toBytes

void toBytes(byte[] where,
             int offset,
             boolean includeTLS)
creates a byte packet representation of this

Parameters:
where - the byte [] to serialize to
offset - the offset within that byte [] to serialize

getClientGUID

byte[] getClientGUID()
Returns the GUID of the client that can be reached through the pushproxies.


getProxies

Set<? extends IpPort> getProxies()
Returns:
a view of the current set of proxies, never returns null

getFWTVersion

int getFWTVersion()
Returns:
which version of F2F transfers this PE supports. This always returns the most current version we know the PE supports unless it has never been put in the map.

hashCode

int hashCode()
Should return the GUID.hashCode() of getClientGUID().

Specified by:
hashCode in interface Address
Overrides:
hashCode in class Object

equals

boolean equals(Object other)
Equality should be based on the equality of the value of getClientGUID().

Specified by:
equals in interface Address
Overrides:
equals in class Object

getFeatures

byte getFeatures()
Returns:
the various features this PE reports. This always returns the most current features, or the ones it was created with if they have never been updated.

isLocal

boolean isLocal()
Returns:
true if this is the push endpoint for the local node

updateProxies

void updateProxies(boolean good)
Updates either the PushEndpoint or the GUID_PROXY_MAP to ensure that GUID_PROXY_MAP has a reference to all live PE GUIDs and all live PE's reference the same GUID object as in GUID_PROXY_MAP. If this method is not called, the PE will know only about the set of proxies the remote host had when it was created. Otherwise it will point to the most recent known set.


createClone

PushEndpoint createClone()
Can return null if no valid push endpoint can be cloned.


getValidExternalAddress

IpPort getValidExternalAddress()
Returns an IpPort representing the valid external address of this push endpoint if it is known, otherwise null.


getAddress

String getAddress()
Description copied from interface: IpPort
Assessor for the address string.

Specified by:
getAddress in interface IpPort
Returns:
the external address if known otherwise RemoteFileDesc.BOGUS_IP

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.