OPND, CLW1 and DATW States
State 07 - OPND - opened.
This is the state during which data may be transferred. Both RFC's have been sent. Allocation and RFNM activity are not considered in this state diagram, but until one end or the other tries to close the connection that activity proceeds at another level of the code. The exception is event TIME. After two minutes of inactivity on the socket, action ACKA (Check allocation) occurs. This action causes allocate resynchronizing to occur if the foreign host is known to understand that extension to the host-host protocol.
The remaining events and states are all associated with properly getting a connection closed and free, from the OPND state. This gets complicated. There are four initial events: closes done locally and closes from the remote end of the connection, each of which may be for a sending or a receiving connection. These are CLZR, CLZS, CLSR and CLSS.
- CLZR - The local program closes a connection which has been receiving. A CLS is sent (ACLS) and the state is stepped to CLW1 which is similar to CLSW except that the link tables must be closed when a CLS comes back.
- CLZS - The local program closes a connection which has been sending. The state is stepped to DATW and action AEOS is performed. AEOS (action end of send) sets a done flag which lower level routines use to signal the FSM when the last data has been sent and acknowledged by RFNM.
- CLSR - a CLS is received on a receive connection. This is the normal "end of file" case. Action AEOR (end of receive) occurs and the state moves to CLZW. AEOR causes the same flags to be set as AEOS, and in addition (if this connection is hooked to an NVT) causes an NVT DETACH to be performed.
- CLSS - a CLS is received on a send connection, before we (the sending end) had closed it. Action AESl occurs, which is the same as AEOS except that messages queued to go out are discarded. The state moves to RFN2 to await the final RFNM.
State 05 - CLW1 - Close wait sub 1.
This state is the same as CLSW except that a link table entry remains to be cleared out. A CLS has been sent and we await the matching CLS. When it arrives, or two minutes go by, the state is stepped to FREE and action ACLL (close link) is performed.
State 11 - DATW - Final data wait.
This state is NOT the normal waiting for data on an open connection. It is only during the sending of the last of the data on a send connection which has been locally closed but which has not yet had all the data accepted by the far end.
- RRFN - Received final RFNM - event is the desired one. When this occurs, all the data has been sent so we send a CLS (ACLS) and go to state CLW1 to await the matching CLS.
- TIME may also occur. If it does, we pretend we had seen the final RFNM and act as for RRFN. This timeout may occur either because an RFNM has been lost by the IMP or the subnet, or because of unresposiveness on the part of the foreign host. The latter could occur if the amount of data to be sent when the CLOSF is done exceeds the available allocation at that time. If the foreign host does not send allocation, or disagrees with us and thinks allocation is outstanding, the timeout will free the socket.
- CLSS may occur. If so, the far end has not accepted all the data, but wants to abort the connection. This is treated about as it was when it occurred from the OPND state, namely AES1 action, but must go to a different next state, RFN1, to distinguish the fact that a local CLOSF has already occurred.