/// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbTreeDisconnectResponsePacket(SmbTreeDisconnectResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbTreeDisconnectResponsePacket(SmbTreeDisconnectResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// Expect client send tree disconnect and server will send back treeDisconnect response
        /// </summary>
        /// <param name="timeout">Timeout</param>
        /// <returns>The endpoint of client</returns>
        public override FsEndpoint ExpectTreeDisconnect(TimeSpan timeout)
        {
            CifsServerPerConnection connection;

            SmbTreeDisconnectRequestPacket request =
                this.cifsServer.ExpectPacket(timeout, out connection) as SmbTreeDisconnectRequestPacket;

            SmbTreeDisconnectResponsePacket response = this.cifsServer.CreateTreeDisconnectResponse(connection, request);

            this.cifsServer.SendPacket(response, connection);

            return(this.fsEndpoints[connection.Identity]);
        }
        /// <summary>
        /// server response the tree connect request from client.
        /// </summary>
        /// <param name="treeConnect">the tree connect between server and client</param>
        public override void SendTreeDisconnectResponse(IFileServiceServerTreeConnect treeConnect)
        {
            CifsServerPerConnection connection = treeConnect.Session.Connection as CifsServerPerConnection;

            foreach (SmbTreeDisconnectRequestPacket request in connection.PendingRequestTable)
            {
                if (request != null &&
                    request.SmbHeader.Uid == treeConnect.Session.SessionId &&
                    request.SmbHeader.Tid == treeConnect.TreeConnectId)
                {
                    SmbTreeDisconnectResponsePacket response = this.cifsServer.CreateTreeDisconnectResponse(
                        connection, request);

                    this.cifsServer.SendPacket(response, connection);
                    return;
                }
            }
        }
        public SmbTreeDisconnectResponsePacket CreateTreeDisconnectResponse(
            CifsServerPerConnection connection,
            SmbTreeDisconnectRequestPacket request)
        {
            SmbTreeDisconnectResponsePacket response = new SmbTreeDisconnectResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            return response;
        }