anon.pay
Class AIControlChannel

java.lang.Object
  extended by anon.client.AbstractChannel
      extended by anon.client.AbstractControlChannel
          extended by anon.client.StreamedControlChannel
              extended by anon.client.XmlControlChannel
                  extended by anon.pay.AIControlChannel

public class AIControlChannel
extends XmlControlChannel

This control channel is used for communication with the AI (AccountingInstance or Abrechnungsinstanz in German) which lives in the first mix. The AI sends a request when it wants a cost confirmation from us. This thread waits for incoming requests and sends the requested confirmations to the AI.

Version:
1.0
Author:
Bastian Voigt, Tobias Bayer

Field Summary
private static long BALANCE_MILLISECONDS
          How many milliseconds to wait before requesting a new account statement
private static double DIFFERENCE_THRESHOLD
          Threshold for warning the user of too large number of transferred bytes in cc (0-1)
private static int EVENT_UNREAL
           
private  java.util.Vector m_aiListeners
           
private  boolean m_bFirstBalance
           
private  int m_diff
           
private  long m_lastBalanceUpdate
           
private  long m_lastDiffBytes
           
private  PacketCounter m_packetCounter
           
private  IMutableProxyInterface m_proxys
           
private static long m_totalBytes
           
 
Constructor Summary
AIControlChannel(Multiplexer a_multiplexer, IMutableProxyInterface a_proxy, PacketCounter a_packetCounter, IServiceContainer a_serviceContainer)
           
 
Method Summary
 void addAIListener(IAIEventListener a_aiListener)
           
private  void fireAIEvent(int a_eventType, long a_additionalInfo)
           
static long getBytes()
           
private  void processChallenge(XMLChallenge chal)
          processChallenge
private  void processErrorMessage(XMLErrorMessage msg)
          processErrorMessage
private  void processInitialCC(XMLEasyCC a_cc)
           
private  void processPayRequest(XMLPayRequest request)
          processPayRequest
 void processXmlMessage(org.w3c.dom.Document docMsg)
          proccessXMLMessage - this is called when a new request is coming in.
 boolean sendAccountCert()
           
 
Methods inherited from class anon.client.XmlControlChannel
processMessage, sendXmlMessage
 
Methods inherited from class anon.client.StreamedControlChannel
processPacketData, sendByteMessage
 
Methods inherited from class anon.client.AbstractControlChannel
getServiceContainer, processReceivedPacket, sendRawMessage
 
Methods inherited from class anon.client.AbstractChannel
createEmptyMixPacket, deleteChannel, multiplexerClosed, sendPacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_UNREAL

private static final int EVENT_UNREAL
See Also:
Constant Field Values

BALANCE_MILLISECONDS

private static final long BALANCE_MILLISECONDS
How many milliseconds to wait before requesting a new account statement

See Also:
Constant Field Values

DIFFERENCE_THRESHOLD

private static final double DIFFERENCE_THRESHOLD
Threshold for warning the user of too large number of transferred bytes in cc (0-1)

See Also:
Constant Field Values

m_bFirstBalance

private boolean m_bFirstBalance

m_totalBytes

private static long m_totalBytes

m_lastBalanceUpdate

private long m_lastBalanceUpdate

m_aiListeners

private java.util.Vector m_aiListeners

m_proxys

private IMutableProxyInterface m_proxys

m_diff

private int m_diff

m_lastDiffBytes

private long m_lastDiffBytes

m_packetCounter

private PacketCounter m_packetCounter
Constructor Detail

AIControlChannel

public AIControlChannel(Multiplexer a_multiplexer,
                        IMutableProxyInterface a_proxy,
                        PacketCounter a_packetCounter,
                        IServiceContainer a_serviceContainer)
Method Detail

addAIListener

public void addAIListener(IAIEventListener a_aiListener)

processXmlMessage

public void processXmlMessage(org.w3c.dom.Document docMsg)
proccessXMLMessage - this is called when a new request is coming in.

Specified by:
processXmlMessage in class XmlControlChannel
Parameters:
docMsg - Document

processChallenge

private void processChallenge(XMLChallenge chal)
                       throws java.lang.Exception
processChallenge

Parameters:
xMLChallenge - XMLChallenge
Throws:
java.lang.Exception

processErrorMessage

private void processErrorMessage(XMLErrorMessage msg)
processErrorMessage

Parameters:
msg - XMLErrorMessage

processPayRequest

private void processPayRequest(XMLPayRequest request)
processPayRequest

Parameters:
request - XMLPayRequest

sendAccountCert

public boolean sendAccountCert()

fireAIEvent

private void fireAIEvent(int a_eventType,
                         long a_additionalInfo)

getBytes

public static long getBytes()

processInitialCC

private void processInitialCC(XMLEasyCC a_cc)