public static class Connection.TargetConnection extends Object implements Connection
Connection.TargetConnection| Constructor and Description |
|---|
Connection.TargetConnection(SocketChannel socketChannel,
boolean isLeadingConnection)
The
Connection.TargetConnection constructor. |
| Modifier and Type | Method and Description |
|---|---|
Void |
call()
Starts the processing of PDUs by this connection.
|
ConnectionSettingsNegotiator |
getConnectionSettingsNegotiator() |
byte[] |
getDataInArray(int length)
Returns a byte array that can be used for holding data segment data of Data In PDUs sent during the
ReadStage. |
Settings |
getSettings()
Returns a
Settings object with a snapshot of the current connection and session parameters. |
SerialArithmeticNumber |
getStatusSequenceNumber() |
TargetSession |
getTargetSession() |
void |
initializeConnectionSettingsNegotiator(SessionSettingsNegotiator sessionSettingsNegotiator)
Initializes
connectionSettingsNegotiator. |
boolean |
isLeadingConnection()
Returns
true if this is the leading connection, i.e. |
org.jscsi.parser.ProtocolDataUnit |
receivePdu()
Returns the next
ProtocolDataUnit to be received on the connection. |
void |
sendPdu(org.jscsi.parser.ProtocolDataUnit pdu)
Serializes and sends a
ProtocolDataUnit over the connection. |
void |
setSession(TargetSession session)
Sets the
TargetSession this connection belongs to. |
void |
setStatusSequenceNumber(int statusSequenceNumber) |
boolean |
stop() |
public Connection.TargetConnection(SocketChannel socketChannel, boolean isLeadingConnection)
Connection.TargetConnection constructor.socketChannel - used for sending and receiving PDUsisLeadingConnection - true if and only if this connection is the first connection
associated with its enclosing sessionpublic byte[] getDataInArray(int length)
ReadStage.getDataInArray in interface Connectionlength - the length of the arraypublic void setSession(TargetSession session)
TargetSession this connection belongs to.setSession in interface Connectionsession - the TargetSession this connection belongs topublic org.jscsi.parser.ProtocolDataUnit receivePdu()
throws DigestException,
org.jscsi.exception.InternetSCSIException,
IOException,
SettingsException
ProtocolDataUnit to be received on the connection.
The method will block until a PDU has been completely received.
receivePdu in interface ConnectionDigestException - if a digest error has occuredorg.jscsi.exception.InternetSCSIException - if a general iSCSI protocol error has been detectedIOException - if the connection was closedSettingsException - will not happenpublic void sendPdu(org.jscsi.parser.ProtocolDataUnit pdu)
throws InterruptedException,
IOException,
org.jscsi.exception.InternetSCSIException
ProtocolDataUnit over the connection.sendPdu in interface Connectionpdu - the PDU to sendInterruptedExceptionIOExceptionorg.jscsi.exception.InternetSCSIExceptionpublic Void call()
For this method to work properly, the leading PDU send by the initiator over this connection must have been
received via receivePdu().
public TargetSession getTargetSession()
getTargetSession in interface Connectionpublic boolean isLeadingConnection()
true if this is the leading connection, i.e. the first TargetConnection in the
connection's TargetSession. Otherwise false is returned.isLeadingConnection in interface Connectiontrue if this is the leading connectionpublic void initializeConnectionSettingsNegotiator(SessionSettingsNegotiator sessionSettingsNegotiator)
connectionSettingsNegotiator.
This method must be be called after the this connection has been added to its session.
initializeConnectionSettingsNegotiator in interface Connectionpublic Settings getSettings()
Settings object with a snapshot of the current connection and session parameters.getSettings in interface ConnectionSettingspublic ConnectionSettingsNegotiator getConnectionSettingsNegotiator()
getConnectionSettingsNegotiator in interface Connectionpublic SerialArithmeticNumber getStatusSequenceNumber()
getStatusSequenceNumber in interface Connectionpublic void setStatusSequenceNumber(int statusSequenceNumber)
setStatusSequenceNumber in interface Connectionpublic boolean stop()
stop in interface ConnectionCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.