anon.infoservice
Class MixInfo

java.lang.Object
  extended by anon.infoservice.AbstractDatabaseEntry
      extended by anon.infoservice.AbstractDistributableDatabaseEntry
          extended by anon.infoservice.AbstractDistributableCertifiedDatabaseEntry
              extended by anon.infoservice.MixInfo
All Implemented Interfaces:
IVerifyable, Database.IWebInfo, ICertifiedDatabaseEntry, IDistributable, IXMLEncodable

public class MixInfo
extends AbstractDistributableCertifiedDatabaseEntry
implements IVerifyable, Database.IWebInfo

Holds the information of one single mix.


Nested Class Summary
 
Nested classes/interfaces inherited from class anon.infoservice.AbstractDistributableDatabaseEntry
AbstractDistributableDatabaseEntry.SerialDBEntry, AbstractDistributableDatabaseEntry.Serials
 
Field Summary
static int FIRST_MIX
           
static java.lang.String INFOSERVICE_COMMAND_WEBINFO
           
static java.lang.String INFOSERVICE_COMMAND_WEBINFOS
           
static int LAST_MIX
           
private  boolean m_bFromCascade
          If this MixInfo has been recevied directly from a cascade connection.
private  boolean m_bPayment
           
private  boolean m_bSocks
           
private  boolean m_bUseCascadeNameFragment
           
private  DataRetentionInformation m_drInfo
           
private  boolean m_dynamic
          LERNGRUPPE Indicates if this mix is available for dynamic cascades
private  boolean m_freeMix
          Stores whether the mix is waiting for a cascade assignment.
private  long m_lastUpdate
          Time (see System.currentTimeMillis()) when the mix has sent this HELO message.
private  MultiCertPath m_mixCertPath
          Stores the certPath for this mix.
private  java.lang.String m_mixId
          This is the ID of the mix.
private  ServiceLocation m_mixLocation
          Some information about the location of the mix.
private  ServiceOperator m_mixOperator
          Some information about the operator of the mix.
private  XMLSignature m_mixSignature
          Stores the signature element for this mix.
private  ServiceSoftware m_mixSoftware
          Some information about the used mix software.
private  TermsAndConditionsMixInfo m_mixTnCInfo
           
private  java.lang.String m_name
          The name of the mix.
private  java.lang.String m_nameFragmentForCascade
          The name to contribute to the cascade name .
private  long m_prepaidInterval
          Amount of bytes that the JAP has to prepay with this Cascade
private  XMLPriceCertificate m_priceCert
          The price certificate for the Mix
private  long m_serial
           
private  int m_type
          LERNGRUPPE This is the type of the mix
private  java.util.Vector m_vecListenerAdresses
           
private  java.util.Vector m_vecListenerInterfaces
           
private  java.util.Vector m_vecListenerMonitoring
           
private  java.util.Vector m_vecVisibleAdresses
          Stores all exit IP addresses of this mix.
private  org.w3c.dom.Element m_xmlStructure
          Stores the XML structure for this mix.
static int MIDDLE_MIX
           
static java.lang.String NAME_TYPE_MIX
           
static java.lang.String NAME_TYPE_OPERATOR
           
private static java.lang.String XML_ATTR_PAYMENT
           
static java.lang.String XML_ATTRIBUTE_NAME_FOR_CASCADE
           
private static java.lang.String XML_ELEM_SERVER_MONITORING
           
static java.lang.String XML_ELEMENT_CONTAINER_NAME
           
static java.lang.String XML_ELEMENT_MIX_NAME
           
static java.lang.String XML_ELEMENT_NAME
           
private static java.lang.String XML_ELEMENT_WEBINFO
           
static java.lang.String XML_ELEMENT_WEBINFO_CONTAINER
           
 
Fields inherited from class anon.infoservice.AbstractDistributableDatabaseEntry
XML_ATTR_LAST_UPDATE, XML_ATTR_SERIAL, XML_ATTR_VALID, XML_ATTR_VERIFIED
 
Fields inherited from class anon.infoservice.AbstractDatabaseEntry
XML_LAST_UPDATE
 
Fields inherited from interface anon.infoservice.Database.IWebInfo
FIELD_XML_ELEMENT_WEBINFO_CONTAINER
 
Fields inherited from interface anon.infoservice.IDistributable
FIELD_HTTP_REQUEST_STRING, FIELD_HTTP_SERIALS_REQUEST_STRING
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
MixInfo(org.w3c.dom.Element a_mixNode)
          Creates a new MixInfo from XML description (Mix node).
MixInfo(org.w3c.dom.Element a_mixNode, long a_expireTime)
          Creates a new MixInfo from XML description (Mix node).
MixInfo(org.w3c.dom.Element a_mixNode, long a_expireTime, boolean a_bFromCascade)
          Creates a new MixInfo from XML description (Mix node).
MixInfo(MultiCertPath a_certPath)
           
MixInfo(java.lang.String a_mixID, MultiCertPath a_certPath, XMLPriceCertificate a_priceCert, long a_prepaidInterval)
           
 
Method Summary
private  void appendListenerInterfaces(org.w3c.dom.Element a_rootElement, java.util.Vector a_listenerInterfaces)
           
 void deletePersistence()
           
 MultiCertPath getCertPath()
          Returns the CertPath of the mix For MixInfo-Objects in the InfoService the CertPath is null
 DataRetentionInformation getDataRetentionInformation()
           
 java.lang.String getFirstHostName()
          LERNGRUPPE Extracts the host name from first listenerinterface.
 int getFirstPort()
          LERNGRUPPE Extracts the port from first listenerinterface.
 java.lang.String getId()
          Returns the ID of the mix.
 long getLastUpdate()
          Returns the time (see System.currentTimeMillis()), when the mix has sent this MixInfo to an infoservice.
 java.util.Vector getListenerAddresses()
           
 java.util.Vector getListenerInterfaces()
           
 java.util.Vector getMonitoringListenerInterfaces()
           
 java.lang.String getName()
          Returns the name of the mix.
 java.lang.String getNameFragmentForCascade()
           
 java.lang.String getPostFile()
          This returns the filename (InfoService command), where this mix entry is posted at other InfoServices.
 long getPrepaidInterval()
           
 XMLPriceCertificate getPriceCertificate()
           
 ServiceLocation getServiceLocation()
          Returns the location of the mix.
 ServiceOperator getServiceOperator()
          Returns information about the operator of this mix.
 ServiceSoftware getServiceSoftware()
          Returns information about the used software in this mix.
 XMLSignature getSignature()
           
 TermsAndConditionsMixInfo getTermsAndConditionMixInfo()
           
 int getType()
          LERNGRUPPE Returns the type of this mix
 java.lang.String getTypeAsString()
          LERNGRUPPE Returns the type of this mix
 long getVersionNumber()
          Returns the time when this mix entry was created by the origin mix.
 java.util.Vector getVisibleAddresses()
           
 org.w3c.dom.Element getWebInfo(org.w3c.dom.Document webInfoDoc)
           
 org.w3c.dom.Element getXmlStructure()
          Returns the XML structure for this mix entry.
 boolean isCascadaNameFragmentUsed()
           
 boolean isDynamic()
          LERNGRUPPE Returns true if this mix is available for dynamic cascades, false otherwise.
 boolean isFreeMix()
          Returns whether the mix is waiting for a cascade assignment.
 boolean isFromCascade()
          Returns if this MixInfo has been received directly from a cascade connection.
 boolean isPayment()
           
 boolean isPersistanceDeletionAllowed()
           
 boolean isSocks5Supported()
           
 boolean isValid()
          Returns if the object is valid at this time
 boolean isVerified()
          Returns if this entry has been verified with a certificate chain.
private  void parseListenerAdresses(org.w3c.dom.Node nodeMix)
           
private  int parseMixType(java.lang.String nodeValue)
          LERNGRUPPE Parse the given textual MixType to our constants
private  void parseVisibleAdresses(org.w3c.dom.Node nodeMix)
           
private  void parseVisibleAdresses(org.w3c.dom.Node nodeMix, java.lang.String a_containerName, java.lang.String a_nodeName, java.util.Vector a_storage)
           
 void setFreeMix(boolean a_freeMix)
          Changes the state of this mix (whether it is free or not).
 void setPriceCertificate(XMLPriceCertificate newPriceCert)
           
 
Methods inherited from class anon.infoservice.AbstractDistributableCertifiedDatabaseEntry
checkId
 
Methods inherited from class anon.infoservice.AbstractDistributableDatabaseEntry
getHttpRequestString, getHttpSerialsRequestString, getPostData, getPostEncoding, toXmlElement
 
Methods inherited from class anon.infoservice.AbstractDatabaseEntry
getCreationTime, getExpireTime, isNewerThan, isUserDefined, resetCreationTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_TYPE_MIX

public static final java.lang.String NAME_TYPE_MIX
See Also:
Constant Field Values

NAME_TYPE_OPERATOR

public static final java.lang.String NAME_TYPE_OPERATOR
See Also:
Constant Field Values

XML_ELEMENT_CONTAINER_NAME

public static final java.lang.String XML_ELEMENT_CONTAINER_NAME
See Also:
Constant Field Values

XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
See Also:
Constant Field Values

XML_ELEMENT_MIX_NAME

public static final java.lang.String XML_ELEMENT_MIX_NAME
See Also:
Constant Field Values

XML_ATTRIBUTE_NAME_FOR_CASCADE

public static final java.lang.String XML_ATTRIBUTE_NAME_FOR_CASCADE
See Also:
Constant Field Values

XML_ELEMENT_WEBINFO_CONTAINER

public static final java.lang.String XML_ELEMENT_WEBINFO_CONTAINER
See Also:
Constant Field Values

INFOSERVICE_COMMAND_WEBINFOS

public static final java.lang.String INFOSERVICE_COMMAND_WEBINFOS
See Also:
Constant Field Values

INFOSERVICE_COMMAND_WEBINFO

public static final java.lang.String INFOSERVICE_COMMAND_WEBINFO
See Also:
Constant Field Values

XML_ELEMENT_WEBINFO

private static final java.lang.String XML_ELEMENT_WEBINFO
See Also:
Constant Field Values

XML_ELEM_SERVER_MONITORING

private static final java.lang.String XML_ELEM_SERVER_MONITORING
See Also:
Constant Field Values

XML_ATTR_PAYMENT

private static final java.lang.String XML_ATTR_PAYMENT
See Also:
Constant Field Values

FIRST_MIX

public static final int FIRST_MIX
See Also:
Constant Field Values

MIDDLE_MIX

public static final int MIDDLE_MIX
See Also:
Constant Field Values

LAST_MIX

public static final int LAST_MIX
See Also:
Constant Field Values

m_type

private int m_type
LERNGRUPPE This is the type of the mix


m_drInfo

private DataRetentionInformation m_drInfo

m_bPayment

private boolean m_bPayment

m_dynamic

private boolean m_dynamic
LERNGRUPPE Indicates if this mix is available for dynamic cascades


m_bSocks

private boolean m_bSocks

m_vecVisibleAdresses

private final java.util.Vector m_vecVisibleAdresses
Stores all exit IP addresses of this mix.


m_vecListenerAdresses

private final java.util.Vector m_vecListenerAdresses

m_vecListenerInterfaces

private final java.util.Vector m_vecListenerInterfaces

m_vecListenerMonitoring

private final java.util.Vector m_vecListenerMonitoring

m_mixId

private java.lang.String m_mixId
This is the ID of the mix.


m_lastUpdate

private long m_lastUpdate
Time (see System.currentTimeMillis()) when the mix has sent this HELO message.


m_serial

private long m_serial

m_name

private java.lang.String m_name
The name of the mix.


m_nameFragmentForCascade

private java.lang.String m_nameFragmentForCascade
The name to contribute to the cascade name .


m_bUseCascadeNameFragment

private boolean m_bUseCascadeNameFragment

m_mixLocation

private ServiceLocation m_mixLocation
Some information about the location of the mix.


m_mixOperator

private ServiceOperator m_mixOperator
Some information about the operator of the mix.


m_mixSoftware

private ServiceSoftware m_mixSoftware
Some information about the used mix software.


m_freeMix

private boolean m_freeMix
Stores whether the mix is waiting for a cascade assignment. This value is only true, if the mix is sending configure requests instead of HELO messages and if it is not already assigned to a cascade. This value is only meaningful within the context of the infoservice.


m_xmlStructure

private org.w3c.dom.Element m_xmlStructure
Stores the XML structure for this mix.


m_mixCertPath

private MultiCertPath m_mixCertPath
Stores the certPath for this mix. The CertPath is not set (null) if the MixInfo-Object is in the InfoService


m_priceCert

private XMLPriceCertificate m_priceCert
The price certificate for the Mix


m_prepaidInterval

private long m_prepaidInterval
Amount of bytes that the JAP has to prepay with this Cascade


m_mixSignature

private XMLSignature m_mixSignature
Stores the signature element for this mix. The CertPath is not set (null) if the MixInfo-Object is in the InfoService


m_bFromCascade

private boolean m_bFromCascade
If this MixInfo has been recevied directly from a cascade connection.


m_mixTnCInfo

private TermsAndConditionsMixInfo m_mixTnCInfo
Constructor Detail

MixInfo

public MixInfo(org.w3c.dom.Element a_mixNode)
        throws XMLParseException
Creates a new MixInfo from XML description (Mix node). The state of the mix will be set to non-free (only meaningful within the context of the infoservice).

Parameters:
a_mixNode - The Mix node from an XML document.
Throws:
XMLParseException

MixInfo

public MixInfo(org.w3c.dom.Element a_mixNode,
               long a_expireTime)
        throws XMLParseException
Creates a new MixInfo from XML description (Mix node). The state of the mix will be set to non-free (only meaningful within the context of the infoservice).

Parameters:
a_mixNode - The Mix node from an XML document.
a_expireTime - forces a specific expire time; takes default expire time if <= 0
Throws:
XMLParseException

MixInfo

public MixInfo(MultiCertPath a_certPath)

MixInfo

public MixInfo(java.lang.String a_mixID,
               MultiCertPath a_certPath,
               XMLPriceCertificate a_priceCert,
               long a_prepaidInterval)

MixInfo

public MixInfo(org.w3c.dom.Element a_mixNode,
               long a_expireTime,
               boolean a_bFromCascade)
        throws XMLParseException
Creates a new MixInfo from XML description (Mix node). The state of the mix will be set to non-free (only meaningful within the context of the infoservice).

Parameters:
a_mixNode - The Mix node from an XML document.
a_expireTime - forces a specific expire time; takes default expire time if <= 0
a_bFromCascade - if this is a MixInfo node directly received from a cascade (it is stripped) if true, the last update value is set to 0
Throws:
XMLParseException
Method Detail

parseListenerAdresses

private void parseListenerAdresses(org.w3c.dom.Node nodeMix)

parseVisibleAdresses

private void parseVisibleAdresses(org.w3c.dom.Node nodeMix)

parseVisibleAdresses

private void parseVisibleAdresses(org.w3c.dom.Node nodeMix,
                                  java.lang.String a_containerName,
                                  java.lang.String a_nodeName,
                                  java.util.Vector a_storage)

parseMixType

private int parseMixType(java.lang.String nodeValue)
                  throws XMLParseException
LERNGRUPPE Parse the given textual MixType to our constants

Parameters:
nodeValue - The textual MixType (FirstMix, MiddleMix, LastMix)
Returns:
FIRST_MIX, MIDDLE_MIX or LAST_MIX
Throws:
XMLParseException

isPersistanceDeletionAllowed

public boolean isPersistanceDeletionAllowed()
Overrides:
isPersistanceDeletionAllowed in class AbstractDatabaseEntry

deletePersistence

public void deletePersistence()
Overrides:
deletePersistence in class AbstractDatabaseEntry

getVisibleAddresses

public java.util.Vector getVisibleAddresses()

getListenerAddresses

public java.util.Vector getListenerAddresses()

getListenerInterfaces

public java.util.Vector getListenerInterfaces()

getMonitoringListenerInterfaces

public java.util.Vector getMonitoringListenerInterfaces()

getId

public java.lang.String getId()
Returns the ID of the mix.

Specified by:
getId in interface IDistributable
Specified by:
getId in class AbstractDatabaseEntry
Returns:
The ID of this mix.

isSocks5Supported

public boolean isSocks5Supported()

isFromCascade

public boolean isFromCascade()
Returns if this MixInfo has been received directly from a cascade connection.

Returns:
if this MixInfo has been received directly from a cascade connection

getLastUpdate

public long getLastUpdate()
Returns the time (see System.currentTimeMillis()), when the mix has sent this MixInfo to an infoservice.

Specified by:
getLastUpdate in class AbstractDatabaseEntry
Returns:
The send time of this MixInfo from the mix.

getVersionNumber

public long getVersionNumber()
Returns the time when this mix entry was created by the origin mix.

Specified by:
getVersionNumber in class AbstractDatabaseEntry
Returns:
A version number which is used to determine the more recent mix entry, if two entries are compared (higher version number -> more recent entry); 0 if no version number was found in this MixInfo object

getName

public java.lang.String getName()
Returns the name of the mix.

Returns:
The name of this mix.

getDataRetentionInformation

public DataRetentionInformation getDataRetentionInformation()

isVerified

public boolean isVerified()
Description copied from class: AbstractDistributableCertifiedDatabaseEntry
Returns if this entry has been verified with a certificate chain.

Specified by:
isVerified in interface IVerifyable
Specified by:
isVerified in interface ICertifiedDatabaseEntry
Specified by:
isVerified in class AbstractDistributableCertifiedDatabaseEntry
Returns:
if this entry has been verified with a certificate chain

isValid

public boolean isValid()
Description copied from interface: IVerifyable
Returns if the object is valid at this time

Specified by:
isValid in interface IVerifyable
Specified by:
isValid in interface ICertifiedDatabaseEntry
Returns:
if the object is valid at this time

getPriceCertificate

public XMLPriceCertificate getPriceCertificate()

getPrepaidInterval

public long getPrepaidInterval()

setPriceCertificate

public void setPriceCertificate(XMLPriceCertificate newPriceCert)

getCertPath

public MultiCertPath getCertPath()
Returns the CertPath of the mix For MixInfo-Objects in the InfoService the CertPath is null

Specified by:
getCertPath in interface IVerifyable
Specified by:
getCertPath in interface ICertifiedDatabaseEntry
Returns:
the CertPath of the mix

getSignature

public XMLSignature getSignature()
Specified by:
getSignature in interface ICertifiedDatabaseEntry
Specified by:
getSignature in class AbstractDistributableCertifiedDatabaseEntry

getServiceLocation

public ServiceLocation getServiceLocation()
Returns the location of the mix.

Returns:
The location information for this mix.

getServiceOperator

public ServiceOperator getServiceOperator()
Returns information about the operator of this mix.

Returns:
The operator information for this mix.

getServiceSoftware

public ServiceSoftware getServiceSoftware()
Returns information about the used software in this mix.

Returns:
The software information for this mix.

isFreeMix

public boolean isFreeMix()
Returns whether the mix is waiting for a cascade assignment. This value is only true, if the mix is sending configure requests instead of HELO messages and if it is not already assigned to a cascade. The returned value is only meaningful within the context of the infoservice.

Returns:
Whether this mix is currently free and can be assigned to a mixcascade.

setFreeMix

public void setFreeMix(boolean a_freeMix)
Changes the state of this mix (whether it is free or not). If the mix is free, it will appear in the list of free mixes. This mixes can be assigned to new cascades. If the specified value is false, it will not appear in the list and cannot be assigned to new cascades. This value is only meaningful within the context of the infoservice.

Parameters:
a_freeMix - Whether to treat this mix as free (true) or not (false).

getPostFile

public java.lang.String getPostFile()
This returns the filename (InfoService command), where this mix entry is posted at other InfoServices. It's '/helo' if the mix is not treated as free of '/configure' if this mix is currently free and needs to be assigned to a mixcascade.

Specified by:
getPostFile in interface IDistributable
Returns:
The filename where the information about this mix is posted at other infoservices when this entry is forwarded.

getXmlStructure

public org.w3c.dom.Element getXmlStructure()
Returns the XML structure for this mix entry.

Specified by:
getXmlStructure in class AbstractDistributableDatabaseEntry
Returns:
The XML node for this mix entry (Mix node).

getType

public int getType()
LERNGRUPPE Returns the type of this mix

Returns:
The type

isPayment

public boolean isPayment()

getTypeAsString

public java.lang.String getTypeAsString()
LERNGRUPPE Returns the type of this mix

Returns:
The type as string

isDynamic

public boolean isDynamic()
LERNGRUPPE Returns true if this mix is available for dynamic cascades, false otherwise.

Returns:
Returns true if this mix is available for dynamic cascades, false otherwise.

getFirstHostName

public java.lang.String getFirstHostName()
                                  throws java.lang.Exception
LERNGRUPPE Extracts the host name from first listenerinterface.

Returns:
host
Throws:
java.lang.Exception

getFirstPort

public int getFirstPort()
                 throws java.lang.Exception
LERNGRUPPE Extracts the port from first listenerinterface.

Returns:
host
Throws:
java.lang.Exception

isCascadaNameFragmentUsed

public boolean isCascadaNameFragmentUsed()

getNameFragmentForCascade

public java.lang.String getNameFragmentForCascade()

getTermsAndConditionMixInfo

public TermsAndConditionsMixInfo getTermsAndConditionMixInfo()

getWebInfo

public org.w3c.dom.Element getWebInfo(org.w3c.dom.Document webInfoDoc)
Specified by:
getWebInfo in interface Database.IWebInfo

appendListenerInterfaces

private void appendListenerInterfaces(org.w3c.dom.Element a_rootElement,
                                      java.util.Vector a_listenerInterfaces)