/// <summary>
 /// to new a Smb response packet in type of the Command in SmbHeader.
 /// </summary>
 /// <param name="request">the request of the response.</param>
 /// <param name="smbHeader">the SMB header of the packet.</param>
 /// <param name="channel">the channel started with SmbParameters.</param>
 /// <returns>
 /// the new response packet.
 /// the null means that the utility don't know how to create the response.
 /// </returns>
 protected virtual SmbPacket CreateSmbResponsePacket(
     SmbPacket request,
     SmbHeader smbHeader,
     Channel channel)
 {
     return(CifsMessageUtils.CreateSmbResponsePacket(request, smbHeader, channel));
 }
        /// <summary>
        /// to read the andx packet from the channel
        /// </summary>
        /// <param name="smbRequest">the request of the response.</param>
        /// <param name="channel">the channel started with the SmbParameters of the andx.</param>
        /// <returns>the size in bytes of the SmbParameters, SmbData and andx if existed of the andx.</returns>
        internal int ReadAndxFromChannel(SmbPacket smbRequest, Channel channel)
        {
            int consumedLen = 0;

            if (this.AndxCommand != SmbCommand.SMB_COM_NO_ANDX_COMMAND)
            {
                SmbHeader andxHeader = this.SmbHeader;
                andxHeader.Command        = this.AndxCommand;
                andxHeader.Protocol       = CifsMessageUtils.SMB_PROTOCOL_ANDXPACKET;
                this.andxPacket           = CifsMessageUtils.CreateSmbResponsePacket(smbRequest, andxHeader, channel);
                this.andxPacket.SmbHeader = andxHeader;
                consumedLen += this.andxPacket.ReadParametersFromChannel(channel);
                consumedLen += this.andxPacket.ReadDataFromChannel(channel);
                SmbBatchedResponsePacket batchedResponse = this.andxPacket as SmbBatchedResponsePacket;
                if (batchedResponse != null)
                {
                    consumedLen += batchedResponse.ReadAndxFromChannel(smbRequest, channel);
                }
            }
            return(consumedLen);
        }