anon.tor.ordescription
Class ORList

java.lang.Object
  extended by anon.tor.ordescription.ORList

public final class ORList
extends java.lang.Object


Field Summary
private  int m_countHibernate
           
private  java.util.Date m_datePublished
           
private  java.util.Vector m_exitnodes
           
private  java.util.Vector m_middlenodes
           
private  java.util.Vector m_onionrouters
           
private  java.util.Hashtable m_onionroutersWithNames
           
private  ORListFetcher m_orlistFetcher
           
private  MyRandom m_rand
           
private static java.text.DateFormat ms_DateFormat
           
 
Constructor Summary
ORList(ORListFetcher fetcher)
          constructor
 
Method Summary
 int active()
           
 void add(ORDescriptor ord)
          add an onion rotuer
 ORDescriptor getByName(java.lang.String name)
          gets an onion router by it's name
 ORDescriptor getByRandom()
          selects a OR randomly (it should not hibernate)
 ORDescriptor getByRandom(int length)
          selects a OR randomly tries to blanace the probability of exit and non-exit nodes
 ORDescriptor getByRandom(java.util.Vector allowedNames)
          selects a OR randomly from a given list of allowed OR names
 java.util.Vector getList()
          returns a List of all onionrouters
 ORDescriptor getORDescriptor(java.lang.String name)
          returns a ORDescription to the given ORName
 java.util.Date getPublished()
          gets the date when the List was pubished
private  boolean parseFirstDocument(byte[] document)
          parses the document and creates a list with all ORDescriptions
private  boolean parseStatus(byte[] document, boolean change)
          parse router status
 void remove(java.lang.String name)
          removes an onion router
 void setFetcher(ORListFetcher fetcher)
           
 int size()
          size of the ORList
 boolean updateList()
          Updates the list of available ORRouters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_onionrouters

private java.util.Vector m_onionrouters

m_exitnodes

private java.util.Vector m_exitnodes

m_middlenodes

private java.util.Vector m_middlenodes

m_onionroutersWithNames

private java.util.Hashtable m_onionroutersWithNames

m_rand

private MyRandom m_rand

m_orlistFetcher

private ORListFetcher m_orlistFetcher

m_datePublished

private java.util.Date m_datePublished

m_countHibernate

private int m_countHibernate

ms_DateFormat

private static final java.text.DateFormat ms_DateFormat
Constructor Detail

ORList

public ORList(ORListFetcher fetcher)
constructor

Method Detail

size

public int size()
size of the ORList

Returns:
number of routers in the list

active

public int active()

setFetcher

public void setFetcher(ORListFetcher fetcher)

updateList

public boolean updateList()
Updates the list of available ORRouters.

Returns:
true if it was ok, false otherwise

getList

public java.util.Vector getList()
returns a List of all onionrouters

Returns:
List of ORDescriptions

getPublished

public java.util.Date getPublished()
gets the date when the List was pubished

Returns:
date

getByName

public ORDescriptor getByName(java.lang.String name)
gets an onion router by it's name

Parameters:
name - name of the OR
Returns:
ORDescription of the onion router

remove

public void remove(java.lang.String name)
removes an onion router

Parameters:
name - name of the OR

add

public void add(ORDescriptor ord)
add an onion rotuer

Parameters:
ord - descriptor for router

getByRandom

public ORDescriptor getByRandom(java.util.Vector allowedNames)
selects a OR randomly from a given list of allowed OR names

Parameters:
orlist - list of onionrouter names
Returns:

getByRandom

public ORDescriptor getByRandom()
selects a OR randomly (it should not hibernate)

Returns:

getByRandom

public ORDescriptor getByRandom(int length)
selects a OR randomly tries to blanace the probability of exit and non-exit nodes

Parameters:
length - length of the circuit
Returns:

getORDescriptor

public ORDescriptor getORDescriptor(java.lang.String name)
returns a ORDescription to the given ORName

Parameters:
name - ORName
Returns:
ORDescription if the OR exist, null else

parseStatus

private boolean parseStatus(byte[] document,
                            boolean change)
                     throws java.lang.Exception
parse router status

Throws:
java.lang.Exception

parseFirstDocument

private boolean parseFirstDocument(byte[] document)
                            throws java.lang.Exception
parses the document and creates a list with all ORDescriptions

Parameters:
strDocument -
Returns:
false if document is not a valid directory, true otherwise
Throws:
java.lang.Exception