3.3.5.1 Initial State

The TDS 4.2 server receives the first packet from the client. The packet SHOULD be a PRELOGIN packet to set up context for login. A pre-login message is indicated by the PRELOGIN (0x12) message type. The TDS 4.2 server SHOULD close the underlying transport connection, indicate an error to the upper layer, and enter the final state if the first packet is not a structurally correct PRELOGIN packet. For instance, the PRELOGIN packet will not contain the client version as the first option token. Otherwise, the TDS 4.2 server MUST do one of the following:

  • Return to the client a PRELOGIN structure wrapped in a table response (0x04) packet with Encryption and enter the TLS/SSL Negotiation state if encryption is negotiated.

  • Return to the client a PRELOGIN structure wrapped in a table response (0x04) packet without Encryption and enter the unencrypted Login Ready state if encryption is not negotiated.