Module jcifs

Class Smb2IoctlResponse

All Implemented Interfaces:
CommonServerMessageBlock, CommonServerMessageBlockResponse, Message, Response

public class Smb2IoctlResponse extends ServerMessageBlock2Response
SMB2 IOCTL response message. This response contains the result of a device control operation on the server.
Author:
mbechler
  • Constructor Details

    • Smb2IoctlResponse

      public Smb2IoctlResponse(Configuration config)
      Constructs an SMB2 IOCTL response with the given configuration.
      Parameters:
      config - the configuration for this response
    • Smb2IoctlResponse

      public Smb2IoctlResponse(Configuration config, byte[] outputBuffer)
      Constructs an SMB2 IOCTL response with the given configuration and output buffer.
      Parameters:
      config - the configuration for this response
      outputBuffer - the buffer to receive output data
    • Smb2IoctlResponse

      public Smb2IoctlResponse(Configuration config, byte[] outputBuffer, int ctlCode)
      Constructs an SMB2 IOCTL response with the given configuration, output buffer and control code.
      Parameters:
      config - the configuration for this response
      outputBuffer - the buffer to receive output data
      ctlCode - the IOCTL control code
  • Method Details

    • getCtlCode

      public int getCtlCode()
      Gets the IOCTL control code from the response.
      Returns:
      the ctlCode
    • getIoctlFlags

      public int getIoctlFlags()
      Gets the IOCTL flags from the response.
      Returns:
      the ioctlFlags
    • getFileId

      public byte[] getFileId()
      Gets the file identifier from the response.
      Returns:
      the fileId
    • getOutputData

      public Decodable getOutputData()
      Gets the decoded output data from the response.
      Returns:
      the outputData
    • getOutputLength

      public int getOutputLength()
      Gets the length of the output data.
      Returns:
      the outputLength
    • getInputData

      public Decodable getInputData()
      Gets the decoded input data from the response.
      Returns:
      the inputData
    • writeBytesWireFormat

      protected int writeBytesWireFormat(byte[] dst, int dstIndex)
      Writes the message body to the wire format.
      Specified by:
      writeBytesWireFormat in class ServerMessageBlock2
      Parameters:
      dst - the destination buffer
      dstIndex - the starting position in the buffer
      Returns:
      number of bytes written
      See Also:
    • isErrorResponseStatus

      protected boolean isErrorResponseStatus()
      Checks if this message has an error status.
      Overrides:
      isErrorResponseStatus in class ServerMessageBlock2
      Returns:
      true if the message has an error status
      See Also:
    • readBytesWireFormat

      protected int readBytesWireFormat(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingException
      Reads the message body from the wire format.
      Specified by:
      readBytesWireFormat in class ServerMessageBlock2
      Parameters:
      buffer - the buffer to read from
      bufferIndex - the starting position in the buffer
      Returns:
      number of bytes read
      Throws:
      SMBProtocolDecodingException - if decoding fails
      See Also:
    • createOutputDecodable

      protected Decodable createOutputDecodable()
      Creates a decodable object for the output data based on the control code.
      Returns:
      the appropriate decodable object for the control code, or null if not recognized
    • createInputDecodable

      protected Decodable createInputDecodable()
      Creates a decodable object for the input data based on the control code.
      Returns:
      the appropriate decodable object for the control code, or null if not recognized
    • getOutputData

      public <T extends Decodable> T getOutputData(Class<T> responseType) throws SmbException
      Gets the output data decoded as the specified response type.
      Type Parameters:
      T - the type of the decoded response data
      Parameters:
      responseType - the class of the expected response type
      Returns:
      decoded data
      Throws:
      SmbException - if decoding fails or the response type is incompatible