Package com.biglybt.core.networkmanager
Interface Transport
- All Superinterfaces:
TransportBase
- All Known Implementing Classes:
NetworkConnectionImpl.bogusTransport
,TCPTransportImpl
,TransportImpl
,UDPTransport
Represents a peer Transport connection (eg. a network socket).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Listener for notification of connection establishment. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Object
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bindConnection
(NetworkConnection connection) void
Close the transport connection.void
Indicate that inbound connection is completevoid
connectOutbound
(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Kick off an outbound connectiongetEncryption
(boolean verbose) Return a textual description of the encryption for this transportint
Get the socket channel used by the transport.int
Get the transport's speed mode.getUserData
(Object key) boolean
isClosed()
boolean
boolean
isSOCKS()
long
read
(ByteBuffer[] buffers, int array_offset, int length) Read data from the transport into the given buffers.void
setAlreadyRead
(ByteBuffer bytes_already_read) Inject the given already-read data back into the read stream.void
fake a wakeup so that a read cycle is attemptedvoid
setTrace
(boolean on) void
setTransportMode
(int mode) Set the transport to the given speed mode.void
setUserData
(Object key, Object value) void
unbindConnection
(NetworkConnection connection) long
write
(ByteBuffer[] buffers, int array_offset, int length) Write data to the transport from the given buffers.Methods inherited from interface com.biglybt.core.networkmanager.TransportBase
getDescription, isReadyForRead, isReadyForWrite, isTCP
-
Field Details
-
KEY_CLOSE_REASON
-
CR_NONE
static final int CR_NONE- See Also:
-
CR_DUPLICATE_PEER_ID
static final int CR_DUPLICATE_PEER_ID- See Also:
-
CR_STOPPED_OR_REMOVED
static final int CR_STOPPED_OR_REMOVED- See Also:
-
CR_NO_MEMORY
static final int CR_NO_MEMORY- See Also:
-
CR_PORT_BLOCKED
static final int CR_PORT_BLOCKED- See Also:
-
CR_IP_BLOCKED
static final int CR_IP_BLOCKED- See Also:
-
CR_UPLOAD_TO_UPLOAD
static final int CR_UPLOAD_TO_UPLOAD- See Also:
-
CR_NOT_INTERESTED_UPLOAD_ONLY
static final int CR_NOT_INTERESTED_UPLOAD_ONLY- See Also:
-
CR_TIMEOUT
static final int CR_TIMEOUT- See Also:
-
CR_TIMEOUT_INTEREST
static final int CR_TIMEOUT_INTEREST- See Also:
-
CR_TIMEOUT_ACTIVITY
static final int CR_TIMEOUT_ACTIVITY- See Also:
-
CR_TIMEOUT_HANDSHAKE
static final int CR_TIMEOUT_HANDSHAKE- See Also:
-
CR_TIMEOUT_REQUEST
static final int CR_TIMEOUT_REQUEST- See Also:
-
CR_PROTOCOL_BLOCKED
static final int CR_PROTOCOL_BLOCKED- See Also:
-
CR_PEER_CHURN
static final int CR_PEER_CHURN- See Also:
-
CR_TOO_MANY_CONNECTIONS
static final int CR_TOO_MANY_CONNECTIONS- See Also:
-
CR_TOO_MANY_FILES
static final int CR_TOO_MANY_FILES- See Also:
-
CR_INVALID_INFO_HASH
static final int CR_INVALID_INFO_HASH- See Also:
-
CR_SELF_CONNECTION
static final int CR_SELF_CONNECTION- See Also:
-
CR_BAD_PIECE_DATA
static final int CR_BAD_PIECE_DATA- See Also:
-
CR_INTERNAL_CONNECT_FAILED
static final int CR_INTERNAL_CONNECT_FAILED- See Also:
-
TRANSPORT_MODE_NORMAL
static final int TRANSPORT_MODE_NORMAL- See Also:
-
TRANSPORT_MODE_FAST
static final int TRANSPORT_MODE_FAST- See Also:
-
TRANSPORT_MODE_TURBO
static final int TRANSPORT_MODE_TURBO- See Also:
-
-
Method Details
-
getMssSize
int getMssSize() -
setAlreadyRead
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
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
Write data to the transport from the given buffers. NOTE: Works like GatheringByteChannel.- Parameters:
buffers
- from which bytes are to be retrievedarray_offset
- offset within the buffer array of the first buffer from which bytes are to be retrievedlength
- maximum number of buffers to be accessed- Returns:
- number of bytes written
- Throws:
IOException
- on write error
-
read
Read data from the transport into the given buffers. NOTE: Works like ScatteringByteChannel.- Parameters:
buffers
- into which bytes are to be placedarray_offset
- offset within the buffer array of the first buffer into which bytes are to be placedlength
- 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
Kick off an outbound connection- Parameters:
listener
-
-
connectedInbound
void connectedInbound()Indicate that inbound connection is complete -
close
Close the transport connection. -
isClosed
boolean isClosed() -
bindConnection
-
unbindConnection
-
getUserData
-
setUserData
-
setTrace
void setTrace(boolean on)
-