private void doRecvSMB1 ( CommonServerMessageBlock resp ) throws IOException, SMBProtocolDecodingException {
        byte[] buffer = getContext().getBufferCache().getBuffer();
        try {
            System.arraycopy(this.sbuf, 0, buffer, 0, 4 + SMB1_HEADER_LENGTH);
            int size = ( Encdec.dec_uint16be(buffer, 2) & 0xFFFF );
            if ( size < ( SMB1_HEADER_LENGTH + 1 ) || ( 4 + size ) > Math.min(0xFFFF, getContext().getConfig().getMaximumBufferSize()) ) {
                throw new IOException("Invalid payload size: " + size);
            }
            int errorCode = Encdec.dec_uint32le(buffer, 9) & 0xFFFFFFFF;
            if ( resp.getCommand() == ServerMessageBlock.SMB_COM_READ_ANDX
                    && ( errorCode == 0 || errorCode == NtStatus.NT_STATUS_BUFFER_OVERFLOW ) ) {
                // overflow indicator normal for pipe
                SmbComReadAndXResponse r = (SmbComReadAndXResponse) resp;
                int off = SMB1_HEADER_LENGTH;
                /* WordCount thru dataOffset always 27 */
                readn(this.in, buffer, 4 + off, 27);
                off += 27;
                resp.decode(buffer, 4);
                /* EMC can send pad w/o data */
                int pad = r.getDataOffset() - off;
                if ( r.getByteCount() > 0 && pad > 0 && pad < 4 )
                    readn(this.in, buffer, 4 + off, pad);

                if ( r.getDataLength() > 0 ) {
                    readn(this.in, r.getData(), r.getOffset(), r.getDataLength()); /* read direct */
                }
            }
            else {
                readn(this.in, buffer, 4 + SMB1_HEADER_LENGTH, size - SMB1_HEADER_LENGTH);
                resp.decode(buffer, 4);
            }
        }
        finally {
            getContext().getBufferCache().releaseBuffer(buffer);
        }
    }
private void doRecvSMB1 ( CommonServerMessageBlock resp ) throws IOException , SMBProtocolDecodingException { byte [ ] buffer = getContext ( ) . getBufferCache ( ) . getBuffer ( ) ; try { System . arraycopy ( this . sbuf , 0 , buffer , 0 , 4 + SMB1_HEADER_LENGTH ) ; int size = ( Encdec . dec_uint16be ( buffer , 2 ) & 0xFFFF ) ; if ( size < ( SMB1_HEADER_LENGTH + 1 ) || ( 4 + size ) > Math . min ( 0xFFFF , getContext ( ) . getConfig ( ) . getMaximumBufferSize ( ) ) ) { throw new IOException ( "Invalid payload size: " + size ) ; } int errorCode = Encdec . dec_uint32le ( buffer , 9 ) & 0xFFFFFFFF ; if ( resp . getCommand ( ) == ServerMessageBlock . SMB_COM_READ_ANDX && ( errorCode == 0 || errorCode == NtStatus . NT_STATUS_BUFFER_OVERFLOW ) ) { SmbComReadAndXResponse r = ( SmbComReadAndXResponse ) resp ; int off = SMB1_HEADER_LENGTH ; readn ( this . in , buffer , 4 + off , 27 ) ; off += 27 ; resp . decode ( buffer , 4 ) ; int pad = r . getDataOffset ( ) - off ; if ( r . getByteCount ( ) > 0 && pad > 0 && pad < 4 ) readn ( this . in , buffer , 4 + off , pad ) ; if ( r . getDataLength ( ) > 0 ) { readn ( this . in , r . getData ( ) , r . getOffset ( ) , r . getDataLength ( ) ) ; } } else { readn ( this . in , buffer , 4 + SMB1_HEADER_LENGTH , size - SMB1_HEADER_LENGTH ) ; resp . decode ( buffer , 4 ) ; } } finally { getContext ( ) . getBufferCache ( ) . releaseBuffer ( buffer ) ; } }
@param resp
@throws IOException
@throws SMBProtocolDecodingException