org.gudy.azureus2.core3.peer.util
Class PeerIdentityManager

java.lang.Object
  extended by org.gudy.azureus2.core3.peer.util.PeerIdentityManager

public class PeerIdentityManager
extends java.lang.Object

Maintains peer identity information.


Nested Class Summary
protected static class PeerIdentityManager.DataEntry
           
 
Constructor Summary
PeerIdentityManager()
           
 
Method Summary
static boolean addIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port, java.lang.String ip)
          Add a new peer identity to the manager.
static boolean containsIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port)
          Check if the manager already has the given peer identity.
static boolean containsIPAddress(PeerIdentityDataID data_id, java.lang.String ip)
          Check if the given IP address is already present in the manager's peer identity list for the given data item (i.e.
static PeerIdentityDataID createDataID(byte[] data)
           
static int getIdentityCount(PeerIdentityDataID data_id)
          Get the total number of peer identities managed for the given data item.
static int getTotalIdentityCount()
          Get the total number of peer identities managed.
static void removeIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port)
          Remove a peer identity from the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerIdentityManager

public PeerIdentityManager()
Method Detail

createDataID

public static PeerIdentityDataID createDataID(byte[] data)

addIdentity

public static boolean addIdentity(PeerIdentityDataID data_id,
                                  byte[] peer_id,
                                  int local_port,
                                  java.lang.String ip)
Add a new peer identity to the manager.

Parameters:
data_id - unique id for the data item associated with this connection
peer_id - unique id for this peer connection
ip - remote peer's ip address

removeIdentity

public static void removeIdentity(PeerIdentityDataID data_id,
                                  byte[] peer_id,
                                  int local_port)
Remove a peer identity from the manager.

Parameters:
data_id - id for the data item associated with this connection
peer_id - id for this peer connection

containsIdentity

public static boolean containsIdentity(PeerIdentityDataID data_id,
                                       byte[] peer_id,
                                       int local_port)
Check if the manager already has the given peer identity.

Parameters:
data_id - id for the data item associated with this connection
peer_id - id for this peer connection
Returns:
true if the peer identity is found, false if not found

getTotalIdentityCount

public static int getTotalIdentityCount()
Get the total number of peer identities managed.

Returns:
total number of peers over all data items

getIdentityCount

public static int getIdentityCount(PeerIdentityDataID data_id)
Get the total number of peer identities managed for the given data item.

Parameters:
data_id - data item to count over
Returns:
total number of peers for this data item

containsIPAddress

public static boolean containsIPAddress(PeerIdentityDataID data_id,
                                        java.lang.String ip)
Check if the given IP address is already present in the manager's peer identity list for the given data item (i.e. check if there is already a peer with that IP address).

Parameters:
data_id - id for the data item associated with this connection
ip - IP address to check for
Returns:
true if the IP is found, false if not found