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

            this.smbParameters.WordCount    = packet.SmbParameters.WordCount;
            this.smbParameters.AndXCommand  = packet.SmbParameters.AndXCommand;
            this.smbParameters.AndXReserved = packet.SmbParameters.AndXReserved;
            this.smbParameters.AndXOffset   = packet.SmbParameters.AndXOffset;
            this.smbData.ByteCount          = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbLogoffAndxResponsePacket(SmbLogoffAndxResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            this.smbParameters.AndXCommand = packet.SmbParameters.AndXCommand;
            this.smbParameters.AndXReserved = packet.SmbParameters.AndXReserved;
            this.smbParameters.AndXOffset = packet.SmbParameters.AndXOffset;
            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// Expect log off and server will send back log off response
        /// </summary>
        /// <param name="timeout">Timeout</param>
        /// <returns>The endpoint of client</returns>
        public override FsEndpoint ExpectLogOff(TimeSpan timeout)
        {
            CifsServerPerConnection connection;

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

            SmbLogoffAndxResponsePacket response = this.cifsServer.CreateLogoffAndxResponse(connection, request, null);

            this.cifsServer.SendPacket(response, connection);

            return(this.fsEndpoints[connection.Identity]);
        }
        public SmbLogoffAndxResponsePacket CreateLogoffAndxResponse(
            CifsServerPerConnection connection,
            SmbLogoffAndxRequestPacket request,
            SmbPacket andxPacket)
        {
            SmbLogoffAndxResponsePacket response = new SmbLogoffAndxResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            SMB_COM_LOGOFF_ANDX_Response_SMB_Parameters smbParameters = response.SmbParameters;
            smbParameters.AndXCommand =
                andxPacket != null ? andxPacket.SmbHeader.Command : SmbCommand.SMB_COM_NO_ANDX_COMMAND;
            smbParameters.AndXReserved = 0x00;
            smbParameters.AndXOffset = (ushort)(response.HeaderSize + Marshal.SizeOf(response.SmbParameters)
                    + Marshal.SizeOf(response.SmbData));
            smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
            response.SmbParameters = smbParameters;

            SMB_COM_LOGOFF_ANDX_Response_SMB_Data smbData = response.SmbData;
            smbData.ByteCount = 0x0000;

            response.AndxPacket = andxPacket;
            response.UpdateHeader();

            return response;
        }