ms-tds protocol and test suite - microsoft · ms-tds protocol and test suite introduction baoming...
TRANSCRIPT
MS-TDS Protocol and Test Suite Introduction
Baoming Yu
SQL OIPI Test Development Team
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
What is TDS?The Tabular Data Stream (TDS) protocol is an application layer request/response protocol that facilitates interaction with a database server and provides for the following:
✓ Authentication and channel encryption negotiation.
✓ Specification of requests in SQL (including Bulk Insert).
✓ Invocation of a stored procedure or user-defined function,
also known as a remote procedure call (RPC).
✓ The return of data.
✓ Transaction manager requests.
How does TDS work?
Disco
nn
ect
Time Line
* N
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
The TDS protocol does not prescribe a specific underlying transport protocol to use on the Internet or on other networks. TDS only presumes a reliable transport that guarantees in-sequence delivery of data.
Transport Layers
The chosen transport can be either stream-oriented or message-oriented. If a message-
oriented transport is used, any TDS packet sent from a TDS client to a TDS server MUST be
contained within a single transport data unit.
The current version of the TDS protocol has implementations over the following transports:
✓ TCP [RFC793].
✓ A reliable transport over the Virtual Interface Architecture (VIA) interface [VIA2002].
✓ Named Pipes [MSDN-NP].
✓ Shared memory [MSDN-TDSENDPT].
Transport LayersTransport LayersOptionally, the TDS protocol has implementations for the following two protocols on top of the preceding transports:
✓ Transport Layer Security (TLS)
[RFC2246]/Secure Socket Layer (SSL), in
case TLS/SSL encryption is negotiated.
✓ Session Multiplex Protocol (SMP) [MC-
SMP], in case the Multiple Active Result
Sets (MARS) feature [MSDN-MARS] is
requested.
TDS
Network Transport(TCP/IP)
Demo
FOR MARS
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
Disco
nn
ect
* N
TLS
/SSL
Tra
nsp
ort
Lay
er T
LS/S
SL T
ransp
ort Laye
r
Typical Message Sequence (Pre-login)
Created connection successfully (Pre-login state)
Initial Pre-Login Request with ENCRYPTION_ON
Initial Pre-Login Response with ENCRYPTION_ON
Login state
TLS Exchange 1 Request
TLS Exchange 1 Response
TLS Exchange 2 Request
TLS Exchange 2 Response
TLS Handshakes
• Client Hello
• Client Key Exchange• Change Cipher Spec• Client Finished Message• …
• Server Hello• Server Certificate• Server Hello Done• …
• Change Cipher Spec• Server Finished Message
Typical Message Sequence (Login State)
Created connection successfully (Pre-login state)
Login7 Request with SPNEGO Exchange 1
SPNEGO Exchange 1 Response
SPNEGO Exchange 2 Request
Login7 Response (LOGINACK)
Post-Login Success State
Disco
nn
ect
* N
Typical Message Sequence (Post-Login Success)
Post-Login Success State
(Server is now ready to accept command from client)
SQL Command Request
Table Response
SQL Command Request
Table Response with attention acknowledgement
Attention Request
Post-Login Success State
(Server is now ready to accept command from client)
Typical Message Sequence (Post-Login Success)Post-Login Success State
(Server is now ready to accept command from client)
Remote Procedure Call Request
Table Response
Remote Procedure Call Request
Table Response with attention acknowledgement
Attention Request
Post-Login Success State
(Server is now ready to accept command from client)
Typical Message Sequence (Post-Login Success)Post-Login Success State
(Server is now ready to accept command from client)
Transaction Manager Request
Table Response
Transaction Manager Request
Table Response with attention acknowledgement
Attention Request
Post-Login Success State
(Server is now ready to accept command from client)
Typical Message Sequence (Post-Login Success)Post-Login Success State
(Server is now ready to accept command from client)
SQL Command with Insert Bulk
Table Response
SQL Command with Binary Data (Bulk Load Data)
Table Response
Post-Login Success State
(Server is now ready to accept command from client)
SQL Command with Insert Bulk
Table Response
SQL Command with Binary Data (Bulk Load Data)
Table Response with attention acknowledgement
Attention Request
Demo
FOR BULK INSERT
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
Typical Protocol Objects
LOGIN7: Defines the authentication rules for use between client and server.
• Packet Header type 0x10.• The length of a LOGIN7 stream
MUST NOT be longer than 128K-1(byte) bytes.
• …
LOGINACK: Used to send a response to a login request (LOGIN7) to the client.
LOGINACK
The identifier of the stream LOGINACK
The total length of the stream LOGINACK
The interface type accepted by server
The TDS version used by server side
The server name
The server version number
Typical Protocol Objects
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
Test Suite Production Workflow
Test Suite(Simulates protocol client)
Requirement SpecificationOpen Specification
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
Test Suite Architecture
Test Case
Protocol Adapter
SUT Control Adapter
Transport Layer
Server
SUT
SQL Server
Client
Test Suite Architecture
Test Case
Protocol Adapter
SUT Control Adapter
Transport Layer
Server
SUT
SQL Server
Client
Agenda
TDS Introduction
Transport Layers
Typical Message Sequence
Typical Protocol Objects
Test Suite Overview
Test Suite Architecture
Resource
Resource
MS-TDS Protocol:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/MS-
TDS/b46a581a-39de-4745-b076-ec4dbb7d13ec
TLS/SSL Details:
https://docs.microsoft.com/en-us/previous-versions/windows/it-
pro/windows-server-2003/cc785811(v=ws.10)
Named Pipes:
https://docs.microsoft.com/en-us/windows/desktop/ipc/named-pipes