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. |
SerialArithmeticNumber |
getExpectedStatusSequenceNumber()
Returns the Expected Status Sequence Number of this
Connection object. |
Session |
getSession()
Returns the session, which contains this connection instance.
|
String |
getSetting(OperationalTextKey textKey)
Returns the value of the given parameter as
String. |
boolean |
getSettingAsBoolean(OperationalTextKey textKey)
Returns the value of the given parameter, which is parsed to an
boolean. |
int |
getSettingAsInt(OperationalTextKey textKey)
Returns the value of the given parameter, which is parsed to an
integer. |
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.
|
ProtocolDataUnit |
receive()
Reads one
ProtocolDataUnit instance from the receivingQueue. |
void |
send(ProtocolDataUnit protocolDataUnit)
Enqueue this protocol data unit to the end of the sending queue.
|
void |
send(Queue<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(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(SettingsMap response) throws NoSuchSessionException
response - The settings of the response.NoSuchSessionException - if a session with this target name is not open.public final boolean getSettingAsBoolean(OperationalTextKey textKey) throws 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.OperationalTextKeyException - If the given parameter cannot be found.public final int getSettingAsInt(OperationalTextKey textKey) throws OperationalTextKeyException
integer.textKey - The name of the parameter.integer value of this parameter.OperationalTextKeyException - If the given parameter cannot be found.public final String getSetting(OperationalTextKey textKey) throws OperationalTextKeyException
String.textKey - The name of the parameter.OperationalTextKeyException - If the given parameter cannot be found.public final SettingsMap getSettings()
public final void incrementExpectedStatusSequenceNumber()
SERIAL_BITS = 32.public final SerialArithmeticNumber getExpectedStatusSequenceNumber()
Connection object.public final void setExpectedStatusSequenceNumber(int newExpectedStatusSequenceNumber)
newExpectedStatusSequenceNumber - The new value.public final void nextState(IState newState) throws InternetSCSIException
newState - The new state.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(ProtocolDataUnit protocolDataUnit) throws InternetSCSIException
protocolDataUnit - The protocol data unit to add.InternetSCSIException - for nearly everythingpublic final void send(Queue<ProtocolDataUnit> protocolDataUnits) throws InternetSCSIException
protocolDataUnits - The list with all protocol data units to add.InternetSCSIException - for nearly everythingpublic final ProtocolDataUnit receive() throws InternetSCSIException
ProtocolDataUnit instance from the receivingQueue.ProtocolDataUnit.InternetSCSIException - for nearly everythingCopyright © 2018. All rights reserved.