Interface Transport

All Superinterfaces:
TransportBase
All Known Implementing Classes:
NetworkConnectionImpl.bogusTransport, TCPTransportImpl, TransportImpl, UDPTransport

public interface Transport extends TransportBase
Represents a peer Transport connection (eg. a network socket).
  • Field Details

  • Method Details

    • getMssSize

      int getMssSize()
    • setAlreadyRead

      void setAlreadyRead(ByteBuffer bytes_already_read)
      Inject the given already-read data back into the read stream.
      Parameters:
      bytes_already_read - data
    • getTransportStartpoint

      TransportStartpoint getTransportStartpoint()
    • getTransportEndpoint

      TransportEndpoint getTransportEndpoint()
      Get the socket channel used by the transport.
      Returns:
      the socket channel
    • isEncrypted

      boolean isEncrypted()
    • getEncryption

      String getEncryption(boolean verbose)
      Return a textual description of the encryption for this transport
      Returns:
    • getProtocol

      String getProtocol()
    • isSOCKS

      boolean isSOCKS()
    • getPluginProxy

      AEProxyFactory.PluginProxy getPluginProxy()
    • setReadyForRead

      void setReadyForRead()
      fake a wakeup so that a read cycle is attempted
    • write

      long write(ByteBuffer[] buffers, int array_offset, int length) throws IOException
      Write data to the transport from the given buffers. NOTE: Works like GatheringByteChannel.
      Parameters:
      buffers - from which bytes are to be retrieved
      array_offset - offset within the buffer array of the first buffer from which bytes are to be retrieved
      length - maximum number of buffers to be accessed
      Returns:
      number of bytes written
      Throws:
      IOException - on write error
    • read

      long read(ByteBuffer[] buffers, int array_offset, int length) throws IOException
      Read data from the transport into the given buffers. NOTE: Works like ScatteringByteChannel.
      Parameters:
      buffers - into which bytes are to be placed
      array_offset - offset within the buffer array of the first buffer into which bytes are to be placed
      length - maximum number of buffers to be accessed
      Returns:
      number of bytes read
      Throws:
      IOException - on read error
    • setTransportMode

      void setTransportMode(int mode)
      Set the transport to the given speed mode.
      Parameters:
      mode - to change to
    • getTransportMode

      int getTransportMode()
      Get the transport's speed mode.
      Returns:
      current mode
    • connectOutbound

      void connectOutbound(ByteBuffer initial_data, Transport.ConnectListener listener, int priority)
      Kick off an outbound connection
      Parameters:
      listener -
    • connectedInbound

      void connectedInbound()
      Indicate that inbound connection is complete
    • close

      void close(String reason)
      Close the transport connection.
    • isClosed

      boolean isClosed()
    • bindConnection

      void bindConnection(NetworkConnection connection)
    • unbindConnection

      void unbindConnection(NetworkConnection connection)
    • getUserData

      Object getUserData(Object key)
    • setUserData

      void setUserData(Object key, Object value)
    • setTrace

      void setTrace(boolean on)