3.1.5.1 Receiving a Packet

The client or server MUST do the following when receiving a packet:

  • Parse the header of the received packet to get the value of the SID field.

  • If the Session object corresponding to the value of the SID field of the received packet does not exist and the value of the FLAGS field of the packet is not equal to 0x01 (a SYN packet), an error is raised to the higher layer and the underlying transport connection is closed.

  • If the Session object is located, an error is raised to the higher layer and the underlying transport connection is closed if any of the following conditions are not met:

    • The value of the FLAGS field in the received packet is equal to 0x02 (ACK packet), 0x04 (FIN packet), or 0x08 (DATA packet).

    • The value of the WNDW field of the received packet is greater than or equal to the value of the HighWaterForSend variable of the Session object.

    • The SID field of the received packet matches the session identifier (SID) of the Session object.

    • The value of the SEQNUM field is less than or equal to the value of the HighWaterForRecv variable of the Session object.

  • If the value of the FLAGS field is equal to 0x08 (a DATA packet), parse the packet to get the user data (DATA field) while using the value of the LENGTH field of the packet to facilitate the parse.

    Note The length of the DATA field will be equal to the overall packet LENGTH minus the length of the Header (16 bytes).

The sections that follow describe the processing of received DATA, ACK, and FIN packets. Processing of received SYN packets is covered in the server- and client-specific sections.