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  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
 ORDescription getByName(java.lang.String name)
          gets an onion router by it's name
 ORDescription getByRandom()
          selects a OR randomly
 ORDescription getByRandom(int length)
          selects a OR randomly tries to blanace the probability of exit and non-exit nodes
 ORDescription 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
 ORDescription getORDescription(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 parseDocument(byte[] strDocument)
          parses the document and creates a list with all ORDescriptions
 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

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

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 ORDescription 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

getByRandom

public ORDescription 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 ORDescription getByRandom()
selects a OR randomly

Returns:

getByRandom

public ORDescription 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:

getORDescription

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

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

parseDocument

private boolean parseDocument(byte[] strDocument)
                       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