Class TransferControl

java.lang.Object
de.das.encrypter.processors.TransferControl
All Implemented Interfaces:
DataReceiver

public class TransferControl extends Object implements DataReceiver
Class for managing the transmission process between a block sender and the associated receiver. It implements the DataReceiver interface
  • Field Details

    • PARTNER_ID

      public static final String PARTNER_ID
      String used for testing whether a receiver is available. Together with this string the ID of the current key is sent and the recipient replies with "Ready:OK" if he also has exactly this key, otherwise with "Ready:NOK".
      See Also:
    • PARTNER_RESPONSE

      public static final String PARTNER_RESPONSE
      String that the receiver sends as a response if it was addressed by the sender with the PARTNER_ID + key ID. It completes the response with "OK" if it also possesses the key with the sent key ID and with "NOK" if it does not possess this key.
      See Also:
    • TRANSFER_BREAK

      public static final String TRANSFER_BREAK
      String that the receiver sends as a response if errors occur during reception and evaluation or use of the received data and regular reception cannot be performed.
      See Also:
    • NO_RESULT

      public static final int NO_RESULT
      This flag indicates that not yet any result has been detected.
      See Also:
    • SUCCESS

      public static final int SUCCESS
      The result of a performed transfer indicates that the transfer was performed successfully.
      See Also:
    • FAILURE

      public static final int FAILURE
      The result of a performed transfer indicates that the transfer was performed with an error.
      See Also:
  • Constructor Details

    • TransferControl

      public TransferControl(ResultReceiver rr)
      Creates a new instance of a transfer control.
      Parameters:
      rr - an instance of a class which implements the interface ResultReceiver.
  • Method Details

    • setupSender

      public void setupSender(String host, int port) throws Exception
      Parameters:
      host -
      port -
      Throws:
      Exception
    • setHost

      public void setHost(String host, int port) throws Exception
      Throws:
      Exception
    • isResponse

      public boolean isResponse()
    • setResponse

      public void setResponse(boolean response)
    • isWaitForResponse

      public boolean isWaitForResponse()
    • setWaitForResponse

      public void setWaitForResponse(boolean waitForResponse)
    • isNextFrame

      public boolean isNextFrame()
    • setNextFrame

      public void setNextFrame(boolean nextFrame)
    • getFrameId

      public int getFrameId()
    • setFrameId

      public void setFrameId(int frameId)
    • isBreakSender

      public boolean isBreakSender()
    • setBreakSender

      public void setBreakSender(boolean breakSender)
    • getSender

      public UdpSender getSender()
    • isWaitingForInfo

      public boolean isWaitingForInfo()
    • setWaitingForInfo

      public void setWaitingForInfo(boolean b)
    • setData

      public void setData(String host, byte[] bytes)
      Description copied from interface: DataReceiver
      Passes the received data and the IP-address of the sender to the instance of the class that implements the DataReceiver interface and has registered with the UDP receiver.
      Specified by:
      setData in interface DataReceiver
      Parameters:
      host - the IP address of the sender.
      bytes - the byte array received by a UDP receiver.
    • setData

      public void setData(byte[] data)
      Description copied from interface: DataReceiver
      Passes the received data to the instance of the class that implements the DataReceiver interface and has registered with the UDP receiver.
      Specified by:
      setData in interface DataReceiver
      Parameters:
      data - the byte array received by a UDP receiver.
    • setTransferResult

      public void setTransferResult(int res)
      Sets the result of the performed transfer.
      Parameters:
      res - the result of the performed transfer.
    • getTransferResult

      public int getTransferResult()
      Returns the result of a performed transfer.
      Returns:
      the result of a performed transfer.