FileDocCategorySizeDatePackage
PEPeer.javaAPI DocAzureus 3.0.3.48599Wed Sep 05 14:50:16 BST 2007org.gudy.azureus2.core3.peer

PEPeer

public interface PEPeer
author
Olivier
author
MjrTom 2005/Oct/08: lastPiece handling

Fields Summary
public static final int
CONNECTING
public static final int
HANDSHAKING
public static final int
TRANSFERING
public static final int
CLOSING
public static final int
DISCONNECTED
public static final String[]
StateNames
public static final int
MESSAGING_BT_ONLY
public static final int
MESSAGING_AZMP
public static final int
MESSAGING_LTEP
public static final int
MESSAGING_EXTERN
Constructors Summary
Methods Summary
public voidaddListener(PEPeerListener listener)
Add peer listener.

param
listener

public voidaddRateLimiter(com.aelitis.azureus.core.networkmanager.LimitedRateGroup limiter, boolean upload)

public voidclearRequestHint()

public com.aelitis.azureus.core.peermanager.piecepicker.util.BitFlagsgetAvailable()

public java.lang.StringgetClient()

public java.lang.StringgetClientNameFromExtensionHandshake()

public java.lang.StringgetClientNameFromPeerID()

public intgetConsecutiveNoRequestCount()

public java.lang.ObjectgetData(java.lang.String key)
To retreive arbitrary objects against a peer.

public intgetDownloadRateLimitBytesPerSecond()

public java.lang.StringgetEncryption()
Returns name of encryption used by the peer

return

public byte[]getHandshakeReservedBytes()

public java.lang.StringgetIPHostName()
Gets the host name for the IP, if possible, IP as string otherwise

return
hostname or IP

public byte[]getId()

public intgetIncomingRequestCount()

public int[]getIncomingRequestedPieceNumbers()
get a list of piece numbers the peer has requested

return
list of Long() representing the piece number requested, in order

public java.lang.StringgetIp()

public intgetLastPiece()

public PEPeerManagergetManager()

public intgetMessagingMode()

Return
the handshaked messaging type, {@link PEPeer} constants

public intgetOutboundDataQueueSize()
amount of data queued for delivery to peer

return

public intgetOutgoingRequestCount()

public int[]getOutgoingRequestedPieceNumbers()
get a list of piece numbers the we have requested from peer

return
list of Long() representing the piece number requested, oldest to newest

public java.lang.StringgetPeerSource()

public intgetPeerState()

public intgetPercentDoneInThousandNotation()
Get the peer's torrent completion percentage in thousand-notation, i.e. 53.7% is returned as the value 0537.

return
the percentage the peer has complete

public intgetPercentDoneOfCurrentIncomingRequest()

public intgetPercentDoneOfCurrentOutgoingRequest()

public org.gudy.azureus2.plugins.network.ConnectiongetPluginConnection()
Get the connection that backs this peer.

return
connection

public intgetPort()
Get the peer's local TCP connection port.

return
local port

public int[]getRequestHint()
Get current request hint for a given piece for this peer.

return
null if no hint int[]{ piece_number, offset, length } if hint found

public intgetReservedPieceNumber()
Get the reserved piece for piece picking by this peer

public longgetSnubbedTime()

public PEPeerStatsgetStats()

public com.aelitis.azureus.core.peermanager.messaging.Message[]getSupportedMessages()
Get the list of messages that this peer and us both understand.

return
messages available for use, or null of supported is yet unknown or unavailable

public intgetTCPListenPort()
Get the TCP port this peer is listening for incoming connections on.

return
TCP port, or 0 if port is unknown

public longgetTimeSinceConnectionEstablished()
Get the time since this connection was first established. NOTE: This method will always return 0 at any time before the underlying transport is fully connected, i.e. before handshaking begins.

return
time count in ms

public intgetUDPListenPort()
Get the UDP port this peer is listening for incoming connections on.

return
UDP port, or 0 if port is unknown

public intgetUDPNonDataListenPort()
Get the UDP port this peer is listening on for non-data connections

return

public intgetUniqueAnnounce()

public intgetUploadHint()

public intgetUploadRateLimitBytesPerSecond()

public booleanhasReceivedBitField()

public booleanisChokedByMe()
Am I choking the peer.

return
true if the peer is choked, false if not

public booleanisChokingMe()
Is the peer choking me.

return
true if I am choked by the peer, false if not

public booleanisDownloadPossible()
checks several factors within the object so the caller wouldn't need to for convienience and speed.

return
true if none of several criteria indicate a request can't be made of the peer

public booleanisIncoming()

public booleanisInterested()
Is the peer Interested in me.

return
true if the peer is interested in me, false if not

public booleanisInteresting()
Am I Interested in the peer.

return
true if peer is interesting, false if not

public booleanisLANLocal()

public booleanisOptimisticUnchoke()

public booleanisPieceAvailable(int pieceNumber)

param
pieceNumber int
return
true if this peers makes this piece available

public booleanisSeed()

public booleanisSnubbed()

public voidremoveListener(PEPeerListener listener)
Remove peer listener.

param
listener

public voidremoveRateLimiter(com.aelitis.azureus.core.networkmanager.LimitedRateGroup limiter, boolean upload)

public booleansendRequestHint(int piece_number, int offset, int length, int life)
Send a request hint to the peer.

param
piece_number
param
offset
param
length
param
life
return
true if sent, false otherwise

public voidsetConsecutiveNoRequestCount(int num)

public voidsetData(java.lang.String key, java.lang.Object value)
To store arbitrary objects against a peer.

public voidsetDownloadRateLimitBytesPerSecond(int bytes)

public voidsetHaveAggregationEnabled(boolean enabled)

public voidsetLastPiece(int i)

public voidsetOptimisticUnchoke(boolean is_optimistic)

public voidsetReservedPieceNumber(int pieceNumber)
Sets the reserved piece for piece picking by this peer

public voidsetSnubbed(boolean b)

public voidsetUniqueAnnounce(int uniquePieceNumber)

public voidsetUploadHint(int timeToSpread)

public voidsetUploadRateLimitBytesPerSecond(int bytes)

public booleansupportsMessaging()
Whether or not this peer supports the advanced messaging API.

return
true if extended messaging is supported, false if not

public booleantransferAvailable()