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

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

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbTreeDisconnectRequestPacket(SmbTreeDisconnectRequestPacket 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>
        /// to create a TreeDisconnect request packet.
        /// </summary>
        /// <param name="messageId">This field SHOULD be the multiplex ID that is used to associate a response with a
        /// request.</param>
        /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param>
        /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is
        /// accessing.</param>
        /// <param name="flags">An 8-bit field of 1-bit flags describing various features in effect for the
        /// message</param>
        /// <param name="flags2">A 16-bit field of 1-bit flags that represent various features in effect for the
        /// message. Unspecified bits are reserved and MUST be zero.</param>
        /// <returns>a TreeConnect request packet</returns>
        public SmbTreeDisconnectRequestPacket CreateTreeDisconnectRequest(
            ushort messageId,
            ushort uid,
            ushort treeId,
            SmbFlags flags,
            SmbFlags2 flags2)
        {
            SmbTreeDisconnectRequestPacket packet = new SmbTreeDisconnectRequestPacket();

            packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_TREE_DISCONNECT,
                messageId, uid, treeId, flags, flags2);

            SMB_COM_TREE_DISCONNECT_Request_SMB_Parameters smbParameters =
                new SMB_COM_TREE_DISCONNECT_Request_SMB_Parameters();
            smbParameters.WordCount = 0;

            SMB_COM_TREE_DISCONNECT_Request_SMB_Data smbData = new SMB_COM_TREE_DISCONNECT_Request_SMB_Data();
            smbData.ByteCount = 0;

            packet.SmbParameters = smbParameters;
            packet.SmbData = smbData;

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

            return response;
        }