Module jcifs

Class SmbComTransactionResponse

java.lang.Object
org.codelibs.jcifs.smb.internal.smb1.ServerMessageBlock
org.codelibs.jcifs.smb.internal.smb1.trans.SmbComTransactionResponse
All Implemented Interfaces:
Enumeration<SmbComTransactionResponse>, CommonServerMessageBlock, CommonServerMessageBlockRequest, CommonServerMessageBlockResponse, RequestWithPath, Message, Request, Response
Direct Known Subclasses:
NetServerEnum2Response, NetShareEnumResponse, SmbComNtTransactionResponse, Trans2FindFirst2Response, Trans2GetDfsReferralResponse, Trans2QueryFSInformationResponse, Trans2QueryPathInformationResponse, Trans2SetFileInformationResponse, TransCallNamedPipeResponse, TransPeekNamedPipeResponse, TransTransactNamedPipeResponse, TransWaitNamedPipeResponse

public abstract class SmbComTransactionResponse extends ServerMessageBlock implements Enumeration<SmbComTransactionResponse>
Base class for SMB1 transaction response messages. This abstract class handles the common functionality for all SMB1 transaction responses, including parameter and data buffer management, multi-part responses, and enumeration support.
  • Field Details

    • totalParameterCount

      protected int totalParameterCount
      Total number of parameter bytes the server is returning
    • totalDataCount

      protected int totalDataCount
      Total number of data bytes the server is returning
    • parameterCount

      protected int parameterCount
      Number of parameter bytes in this response
    • parameterOffset

      protected int parameterOffset
      Offset from the start of the SMB header to the parameter bytes
    • parameterDisplacement

      protected int parameterDisplacement
      Displacement of these parameter bytes from the start of the total parameter block
    • dataOffset

      protected int dataOffset
      Offset from the start of the SMB header to the data bytes
    • dataDisplacement

      protected int dataDisplacement
      Displacement of these data bytes from the start of the total data block
    • setupCount

      protected int setupCount
      Number of setup words in this response
    • bufParameterStart

      protected int bufParameterStart
      Start position of parameter data in the buffer
    • bufDataStart

      protected int bufDataStart
      Start position of data bytes in the buffer
  • Constructor Details

    • SmbComTransactionResponse

      protected SmbComTransactionResponse(Configuration config)
      Constructs a transaction response.
      Parameters:
      config - the configuration to use
    • SmbComTransactionResponse

      protected SmbComTransactionResponse(Configuration config, byte command, byte subcommand)
      Constructs a transaction response with specified command.
      Parameters:
      config - the configuration to use
      command - the SMB command code
      subcommand - the transaction subcommand code
  • Method Details

    • getDataCount

      protected final int getDataCount()
      Gets the data count for this transaction response
      Returns:
      the dataCount
    • setDataCount

      public final void setDataCount(int dataCount)
      Sets the data count for this transaction response
      Parameters:
      dataCount - the dataCount to set
    • setBuffer

      public void setBuffer(byte[] buffer)
      Sets the transaction buffer
      Parameters:
      buffer - the transaction buffer to use
    • releaseBuffer

      public byte[] releaseBuffer()
      Releases and returns the transaction buffer
      Returns:
      the txn_buf
    • getSubCommand

      public final byte getSubCommand()
      Gets the transaction subcommand
      Returns:
      the subCommand
    • setSubCommand

      public final void setSubCommand(byte subCommand)
      Sets the transaction subcommand
      Parameters:
      subCommand - the subCommand to set
    • getStatus

      public final int getStatus()
      Gets the response status code
      Returns:
      the status
    • setStatus

      protected final void setStatus(int status)
      Sets the response status code
      Parameters:
      status - the status to set
    • getNumEntries

      public final int getNumEntries()
      Gets the number of entries in the response
      Returns:
      the numEntries
    • setNumEntries

      protected final void setNumEntries(int numEntries)
      Sets the number of entries in the response
      Parameters:
      numEntries - the numEntries to set
    • getResults

      public final FileEntry[] getResults()
      Gets the file entry results from the response
      Returns:
      the results
    • setResults

      protected final void setResults(FileEntry[] results)
      Sets the file entry results for the response
      Parameters:
      results - the results to set
    • reset

      public void reset()
      Description copied from interface: CommonServerMessageBlock
      Resets this message to its initial state.
      Specified by:
      reset in interface CommonServerMessageBlock
      Specified by:
      reset in interface Response
      Overrides:
      reset in class ServerMessageBlock
    • hasMoreElements

      public boolean hasMoreElements()
      Specified by:
      hasMoreElements in interface Enumeration<SmbComTransactionResponse>
    • nextElement

      public SmbComTransactionResponse nextElement()
      Specified by:
      nextElement in interface Enumeration<SmbComTransactionResponse>
    • writeParameterWordsWireFormat

      protected int writeParameterWordsWireFormat(byte[] dst, int dstIndex)
      Description copied from class: ServerMessageBlock
      Writes the parameter words portion of the SMB message to the wire format.
      Specified by:
      writeParameterWordsWireFormat in class ServerMessageBlock
      Parameters:
      dst - the destination buffer
      dstIndex - the starting offset in the buffer
      Returns:
      the number of bytes written
    • writeBytesWireFormat

      protected int writeBytesWireFormat(byte[] dst, int dstIndex)
      Description copied from class: ServerMessageBlock
      Writes the data bytes portion of the SMB message to the wire format.
      Specified by:
      writeBytesWireFormat in class ServerMessageBlock
      Parameters:
      dst - the destination buffer
      dstIndex - the starting offset in the buffer
      Returns:
      the number of bytes written
    • decode

      public int decode(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingException
      Decode message data from the given byte array
      Specified by:
      decode in interface CommonServerMessageBlock
      Overrides:
      decode in class ServerMessageBlock
      Parameters:
      buffer - the byte array containing the message data
      bufferIndex - the starting index in the buffer
      Returns:
      message length
      Throws:
      SMBProtocolDecodingException - if decoding fails
      See Also:
    • readParameterWordsWireFormat

      protected int readParameterWordsWireFormat(byte[] buffer, int bufferIndex)
      Description copied from class: ServerMessageBlock
      Reads the parameter words portion of the SMB message from the wire format.
      Specified by:
      readParameterWordsWireFormat in class ServerMessageBlock
      Parameters:
      buffer - the buffer containing the message data
      bufferIndex - the starting offset in the buffer
      Returns:
      the number of bytes read
    • readBytesWireFormat

      protected int readBytesWireFormat(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingException
      Description copied from class: ServerMessageBlock
      Reads the data bytes portion of the SMB message from the wire format.
      Specified by:
      readBytesWireFormat in class ServerMessageBlock
      Parameters:
      buffer - the buffer containing the message data
      bufferIndex - the starting offset in the buffer
      Returns:
      the number of bytes read
      Throws:
      SMBProtocolDecodingException - if the data cannot be decoded
    • writeSetupWireFormat

      protected abstract int writeSetupWireFormat(byte[] dst, int dstIndex)
      Writes setup data in wire format
      Parameters:
      dst - destination buffer
      dstIndex - starting index in destination buffer
      Returns:
      number of bytes written
    • writeParametersWireFormat

      protected abstract int writeParametersWireFormat(byte[] dst, int dstIndex)
      Writes parameters in wire format
      Parameters:
      dst - destination buffer
      dstIndex - starting index in destination buffer
      Returns:
      number of bytes written
    • writeDataWireFormat

      protected abstract int writeDataWireFormat(byte[] dst, int dstIndex)
      Writes data in wire format
      Parameters:
      dst - destination buffer
      dstIndex - starting index in destination buffer
      Returns:
      number of bytes written
    • readSetupWireFormat

      protected abstract int readSetupWireFormat(byte[] buffer, int bufferIndex, int len)
      Reads setup data from wire format
      Parameters:
      buffer - source buffer
      bufferIndex - starting index in source buffer
      len - length of data to read
      Returns:
      number of bytes read
    • readParametersWireFormat

      protected abstract int readParametersWireFormat(byte[] buffer, int bufferIndex, int len) throws SMBProtocolDecodingException
      Reads parameters from wire format
      Parameters:
      buffer - source buffer
      bufferIndex - starting index in source buffer
      len - length of data to read
      Returns:
      number of bytes read
      Throws:
      SMBProtocolDecodingException - if decoding fails
    • readDataWireFormat

      protected abstract int readDataWireFormat(byte[] buffer, int bufferIndex, int len) throws SMBProtocolDecodingException
      Reads data from wire format
      Parameters:
      buffer - source buffer
      bufferIndex - starting index in source buffer
      len - length of data to read
      Returns:
      number of bytes read
      Throws:
      SMBProtocolDecodingException - if decoding fails
    • toString

      public String toString()
      Overrides:
      toString in class ServerMessageBlock