User Call Processing, Network Control Processing and Error Handling
4.4.6 USER CALL PROCESSING
OPEN [See figure 3.1]
-
If the process calling does not own the specified local socket, return with <type 1><ELP 1 "connection illegal for this process">.
-
If no foreign socket is specified, construct a new TCB and add it to the list of existing TCB's. Select a new local connection name and return it along with <type 1><OLP 0 "success">. If there is no room for the TCB, respond with <type 1><ELT 4 "No room for TCB">.
-
If a foreign socket is specified, verify that there is no existing TCB with the same <local socket, foreign socket> pair (i.e. same connection), otherwise return <type l><ELP 6 "connection already open">. If there is no TCB space, return as in (2), otherwise, create the TCB and link it with the others, returning a local connection name with the success event code.
Note: if a TCB is created, be sure to copy the timeout parameter into it, and set the "U" bit to 0 if a foreign socket is specified, else set U to 1 (to show unspecified foreign socket).
SEND [see figure 3.2]
-
Search for TCB with local connection name specified. If none found, return <type 10><ELP 3 "connection not open">
-
If TCB is found, check foreign socket specification. If not set (i.e. U = 1 in TCB), return <type 10><ELT 5 "foreign socket unspecified">. If the connection is in the "closing" state (i.e. state 5 or 6), return <type 3><ELP 12 "connection closing"> and do not process the buffer.
-
Put the buffer on the Send buffer queue and signal the packetizer that there is work to do.
INTERRUPT [see figure 3.3]
-
Validate existence of the referenced connection, sending out error messages of the form <type 3><ELP 3 "connection not open"> or <type 3><ELT 5 "foreign socket unspecified"> as appropriate. If the local connection refers to a connection not accessible to the process interrupting, send <type 3><ELP 1 "connection illegal for this process">.
-
If the connection is in the "closing" state (i.e. states 5 or 6), return <type 3><ELT 12 "connection closing"> and do not send an INT packet to the destination.
-
Any pending SEND buffers should be returned with <type 10><ELP 10 "buffer flushed due to interrupt">. An INT packet should be created and placed on the output packet queue, and the output packet handler should be signaled.
RECEIVE [See figure 3.4]
-
If the caller does not have access to the referenced local connection name, return <type 20><ELP 1 "connection illegal for this process">. And if the connection is not open, return <type 20><ELP 3 "connection not open"). If the connection is in the closing state (e.g. a FIN has been received or a user CLOSE is being processed), return <type 20><ELP 12 "connection closing">.
-
Otherwise, put the buffer on the receive buffer queue and signal the reassembler that buffer space is available.
CLOSE [See figure 3.5]
-
If the connection is not accessible to the caller, return <type 2><ELP 1 "connection illegal for this process">. If there is no such connection respond with <type 2><ELP 3 "connection not open">.
-
If the R bit is 0 (i.e. connection is in state 1 or 2), simply remove the TCB.
-
If the R bit is set and the F bit is set, then remove the TCB.
-
Otherwise, if the R bit is set, but F is 0 (i.e. states 3 or 4), return all buffers to the User with <type x><ELP 12 "connection closing">, clear all output and input packet queues for this connection, create a FIN packet, and signal the output packet handler. Set the C and F bits to show this action.
STATUS [See figure 3.6]
-
If the connection is illegal for the caller to access, send <type 30><ELP 1 "connection illegal for this process">.
-
If the connection does not exist, return <type 30><ELP 3 "connection not open">.
-
Otherwise set status information from the TCB and return it via <type 30><O-T 0 "status data...">.
4.4.7 NETWORK CONTROL PROCESSING
The Input Packet Handler examines the header to see if there is any control information or error codes present. We do not discuss the action taken for various special function codes, as it is often implementation dependent, but we describe those that affect the state of the connection. After initial screening by the IPC [see section 4.4.2 and figure 2.2], control and error packets are processed as shown in figures 4.l-4.7. [ACK and data processing is done within the IPC.]
4.4.8 TCP ERROR HANDLING
Error messages have CD=001 and do not carry user data. Depending on the error, zero or more octets of error information will be carried in the packet text field. We explicitly assume that this data is restricted in length so as to fall below the GATEWAY fragmentation threshold (probably 512 bits of data and header). Errors generally refer to specific connections, so the source and destination socket identifiers are relevant here. The ACK field of an error packet contains the sequence number of the packet that caused the error, and the ACK bit is off. [RESET and STATUS special functions may use the ACK field in the same way.] This allows the receiver of an error message to determine which packet caused the error. Error packets are not ACK'ed or retransmitted.