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 Connection
length
- the length of the arraypublic void setSession(TargetSession session)
TargetSession
this connection belongs to.setSession
in interface Connection
session
- 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 Connection
DigestException
- 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 Connection
pdu
- the PDU to sendInterruptedException
IOException
org.jscsi.exception.InternetSCSIException
public 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 Connection
public 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 Connection
true
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 Connection
public Settings getSettings()
Settings
object with a snapshot of the current connection and session parameters.getSettings
in interface Connection
Settings
public ConnectionSettingsNegotiator getConnectionSettingsNegotiator()
getConnectionSettingsNegotiator
in interface Connection
public SerialArithmeticNumber getStatusSequenceNumber()
getStatusSequenceNumber
in interface Connection
public void setStatusSequenceNumber(int statusSequenceNumber)
setStatusSequenceNumber
in interface Connection
public boolean stop()
stop
in interface Connection
Copyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.