public final class Connection extends Object
Constructor and Description |
---|
Connection(Session session,
Configuration initConfiguration,
InetSocketAddress inetAddress,
short initConnectionID)
Method to create and return a new, empty
Connection object with the configured layer of threading. |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method does all the necessary steps, which are needed when a connection should be closed.
|
short |
getConnectionID()
Returns the ID of this
Connection object. |
org.jscsi.utils.SerialArithmeticNumber |
getExpectedStatusSequenceNumber()
Returns the Expected Status Sequence Number of this
Connection object. |
Session |
getSession()
Returns the session, which contains this connection instance.
|
String |
getSetting(org.jscsi.parser.datasegment.OperationalTextKey textKey)
Returns the value of the given parameter as
String . |
boolean |
getSettingAsBoolean(org.jscsi.parser.datasegment.OperationalTextKey textKey)
Returns the value of the given parameter, which is parsed to an
boolean . |
int |
getSettingAsInt(org.jscsi.parser.datasegment.OperationalTextKey textKey)
Returns the value of the given parameter, which is parsed to an
integer . |
org.jscsi.parser.datasegment.SettingsMap |
getSettings()
Returns the settings of the given session and connection.
|
IState |
getState()
Returns the current state of this connection.
|
void |
incrementExpectedStatusSequenceNumber()
Increments the Expected Status Sequence Number as defined in RFC1982 where
SERIAL_BITS = 32 . |
void |
nextState(IState newState)
Switch to the new state.
|
org.jscsi.parser.ProtocolDataUnit |
receive()
Reads one
ProtocolDataUnit instance from the receivingQueue . |
void |
send(org.jscsi.parser.ProtocolDataUnit protocolDataUnit)
Enqueue this protocol data unit to the end of the sending queue.
|
void |
send(Queue<org.jscsi.parser.ProtocolDataUnit> protocolDataUnits)
Enqueue all protocol data units to the end of the sending queue.
|
void |
setExpectedStatusSequenceNumber(int newExpectedStatusSequenceNumber)
Sets the expected Status Sequence Number to the given one from the leading Login Response.
|
void |
update(org.jscsi.parser.datasegment.SettingsMap response)
Updates all entries of the given response key-values with the stored settings of this instance.
|
public Connection(Session session, Configuration initConfiguration, InetSocketAddress inetAddress, short initConnectionID) throws Exception
Connection
object with the configured layer of threading.session
- Reference to the AbsSession
object, which contains this connection.initConfiguration
- The configuration to use within this connection.inetAddress
- The InetSocketAddress
to which this connection should established.initConnectionID
- The ID of this connection.Exception
- If any error occurs.public final void update(org.jscsi.parser.datasegment.SettingsMap response) throws org.jscsi.exception.NoSuchSessionException
response
- The settings of the response.org.jscsi.exception.NoSuchSessionException
- if a session with this target name is not open.public final boolean getSettingAsBoolean(org.jscsi.parser.datasegment.OperationalTextKey textKey) throws org.jscsi.exception.OperationalTextKeyException
boolean
.textKey
- The name of the parameter.boolean
value of this parameter. So if the value is equal to Yes
, then
true
will be returned. Else false
is returned.org.jscsi.exception.OperationalTextKeyException
- If the given parameter cannot be found.public final int getSettingAsInt(org.jscsi.parser.datasegment.OperationalTextKey textKey) throws org.jscsi.exception.OperationalTextKeyException
integer
.textKey
- The name of the parameter.integer
value of this parameter.org.jscsi.exception.OperationalTextKeyException
- If the given parameter cannot be found.public final String getSetting(org.jscsi.parser.datasegment.OperationalTextKey textKey) throws org.jscsi.exception.OperationalTextKeyException
String
.textKey
- The name of the parameter.org.jscsi.exception.OperationalTextKeyException
- If the given parameter cannot be found.public final org.jscsi.parser.datasegment.SettingsMap getSettings()
public final void incrementExpectedStatusSequenceNumber()
SERIAL_BITS = 32
.public final org.jscsi.utils.SerialArithmeticNumber getExpectedStatusSequenceNumber()
Connection
object.public final void setExpectedStatusSequenceNumber(int newExpectedStatusSequenceNumber)
newExpectedStatusSequenceNumber
- The new value.public final void nextState(IState newState) throws org.jscsi.exception.InternetSCSIException
newState
- The new state.org.jscsi.exception.InternetSCSIException
- of any kindpublic final IState getState()
IState
instance of this Connection
instance.public final Session getSession()
public final short getConnectionID()
Connection
object.public final void close() throws IOException
IOException
- if an I/O error occurs.public final void send(org.jscsi.parser.ProtocolDataUnit protocolDataUnit) throws org.jscsi.exception.InternetSCSIException
protocolDataUnit
- The protocol data unit to add.org.jscsi.exception.InternetSCSIException
- for nearly everythingpublic final void send(Queue<org.jscsi.parser.ProtocolDataUnit> protocolDataUnits) throws org.jscsi.exception.InternetSCSIException
protocolDataUnits
- The list with all protocol data units to add.org.jscsi.exception.InternetSCSIException
- for nearly everythingpublic final org.jscsi.parser.ProtocolDataUnit receive() throws org.jscsi.exception.InternetSCSIException
ProtocolDataUnit
instance from the receivingQueue
.ProtocolDataUnit
.org.jscsi.exception.InternetSCSIException
- for nearly everythingCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.