TCP 发给用户的消息
2.4.1 类型代码(TYPE CODES)
所有消息都包含一个类型代码,用以标识该消息所对应的用户调用类型。类型如下:
0 - General message, does not apply to a particular user call
1 - Applies to OPEN
2 - Applies to CLOSE
3 - Applies to INTERRUPT
10 - Applies to SEND
20 - Applies to RECEIVE
30 - Applies to STATUS
2.4.2 消息格式[概念性]
所有消息都包含以下三个字段:
Type code
Local connection name
Event code
对于消息类型 0-3[通用、Open、Close、Interrupt],只需要这三个字段。
对于消息类型 10[Send],还需要一个附加字段:
Buffer address
对于消息类型 20[Receive],还需要三个附加字段:
Buffer address
Byte count
End-of-letter flag
对于消息类型 30[status],附加数据可能包括:
Local socket, foreign socket
Send window [measures buffer space at foreign TCP]
Receive window [measures buffer space at local TCP]
Connection state [see section 4.3.6]
Number of letters awaiting acknowledgment
Number of letters awaiting receipt
Retransmission timeout
2.4.3 事件代码(EVENT CODES)
事件代码指明 TCP 希望向用户传达的具体事件。
除事件代码之外,还可以用三个标志把事件归入几个大类,以方便用户处理事件:
E flag: set if event is an error
L/F flag: indicates whether event was generated by Local TCP, or
Foreign TCP or network
P/T flag: indicates whether the event is Permanent or Temporary
[retry may succeed]
事件被编码为 8 位,其高位分别用来表示 E、L/F 和 P/T 标志的状态。
迄今已规定的事件连同其代码和标志设置列于下方。“*”表示某个标志对该事件不适用,或可取两种值。在实验过程中可能会定义更多事件。
0 0** general success
1 ELP connection illegal for this process
2 OF* unspecified foreign socket has become bound
3 ELP connection not open
4 ELT no room for TCB
5 ELT foreign socket unspecified
6 ELP connection already open
EFP unacceptable SYN [or SYN/ACK] arrived at foreign
TCP. Note: This is not a misprint, the local meaning is different
from foreign.
7 EFP connection does not exist at foreign TCP
8 EFT foreign TCP inaccessible [may have subcases]
9 ELT retransmission timeout
10 E*P buffer flushed due to interrupt
11 OF* interrupt to user
12 **P connection closing
13 E** general error
14 E*P connection reset
各消息类型可能出现的事件如下:
Type 0[general]: 2,11,12,14
Type 1[open]: 0,1,4,6,13
Type 2[close]: 0,1,3,13
Type 3[interrupt]: 0,1,3,5,7,8,9,12,13
Type 10[send]: 0,1,3,5,7,8,9,10,11,12,13
Type 20[receive]: 0,1,3,10,12,13
Type 30[status]: 0,1,13
请注意,事件 6(远端)、7、8 由远端 TCP 或网络产生,并且这些相同的代码也用于互联网络分组的错误字段[见第 4.2.1 节]。