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 Summary
FieldsModifier and TypeFieldDescriptionprotected intStart position of data bytes in the bufferprotected intStart position of parameter data in the bufferprotected intDisplacement of these data bytes from the start of the total data blockprotected intOffset from the start of the SMB header to the data bytesprotected intNumber of parameter bytes in this responseprotected intDisplacement of these parameter bytes from the start of the total parameter blockprotected intOffset from the start of the SMB header to the parameter bytesprotected intNumber of setup words in this responseprotected intTotal number of data bytes the server is returningprotected intTotal number of parameter bytes the server is returningFields inherited from class org.codelibs.jcifs.smb.internal.smb1.ServerMessageBlock
batchLevel, byteCount, digest, errorCode, flags2, headerStart, length, mid, path, pid, SMB_COM_CHECK_DIRECTORY, SMB_COM_CLOSE, SMB_COM_CREATE_DIRECTORY, SMB_COM_DELETE, SMB_COM_DELETE_DIRECTORY, SMB_COM_ECHO, SMB_COM_FIND_CLOSE2, SMB_COM_LOCKING_ANDX, SMB_COM_LOGOFF_ANDX, SMB_COM_MOVE, SMB_COM_NEGOTIATE, SMB_COM_NT_CANCEL, SMB_COM_NT_CREATE_ANDX, SMB_COM_NT_TRANSACT, SMB_COM_NT_TRANSACT_SECONDARY, SMB_COM_OPEN_ANDX, SMB_COM_QUERY_INFORMATION, SMB_COM_READ_ANDX, SMB_COM_RENAME, SMB_COM_SEEK, SMB_COM_SESSION_SETUP_ANDX, SMB_COM_SET_INFORMATION, SMB_COM_TRANSACTION, SMB_COM_TRANSACTION_SECONDARY, SMB_COM_TRANSACTION2, SMB_COM_TREE_CONNECT_ANDX, SMB_COM_TREE_DISCONNECT, SMB_COM_WRITE, SMB_COM_WRITE_ANDX, tid, uid, wordCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a transaction response.protectedSmbComTransactionResponse(Configuration config, byte command, byte subcommand) Constructs a transaction response with specified command. -
Method Summary
Modifier and TypeMethodDescriptionintdecode(byte[] buffer, int bufferIndex) Decode message data from the given byte arrayprotected final intGets the data count for this transaction responsefinal intGets the number of entries in the responsefinal FileEntry[]Gets the file entry results from the responsefinal intGets the response status codefinal byteGets the transaction subcommandbooleanprotected intreadBytesWireFormat(byte[] buffer, int bufferIndex) Reads the data bytes portion of the SMB message from the wire format.protected abstract intreadDataWireFormat(byte[] buffer, int bufferIndex, int len) Reads data from wire formatprotected abstract intreadParametersWireFormat(byte[] buffer, int bufferIndex, int len) Reads parameters from wire formatprotected intreadParameterWordsWireFormat(byte[] buffer, int bufferIndex) Reads the parameter words portion of the SMB message from the wire format.protected abstract intreadSetupWireFormat(byte[] buffer, int bufferIndex, int len) Reads setup data from wire formatbyte[]Releases and returns the transaction buffervoidreset()Resets this message to its initial state.voidsetBuffer(byte[] buffer) Sets the transaction bufferfinal voidsetDataCount(int dataCount) Sets the data count for this transaction responseprotected final voidsetNumEntries(int numEntries) Sets the number of entries in the responseprotected final voidsetResults(FileEntry[] results) Sets the file entry results for the responseprotected final voidsetStatus(int status) Sets the response status codefinal voidsetSubCommand(byte subCommand) Sets the transaction subcommandtoString()protected intwriteBytesWireFormat(byte[] dst, int dstIndex) Writes the data bytes portion of the SMB message to the wire format.protected abstract intwriteDataWireFormat(byte[] dst, int dstIndex) Writes data in wire formatprotected abstract intwriteParametersWireFormat(byte[] dst, int dstIndex) Writes parameters in wire formatprotected intwriteParameterWordsWireFormat(byte[] dst, int dstIndex) Writes the parameter words portion of the SMB message to the wire format.protected abstract intwriteSetupWireFormat(byte[] dst, int dstIndex) Writes setup data in wire formatMethods inherited from class org.codelibs.jcifs.smb.internal.smb1.ServerMessageBlock
addFlags2, allowChain, clearReceived, createCancel, encode, equals, error, exception, getByteCount, getCommand, getConfig, getCreditCost, getDigest, getDomain, getErrorCode, getException, getExpiration, getFlags, getFlags2, getFullUNCPath, getGrantedCredits, getLength, getMid, getNext, getNextResponse, getOverrideTimeout, getPath, getPid, getRawPayload, getResponse, getServer, getSignSeq, getTid, getUid, hashCode, ignoreDisconnect, isAsync, isCancel, isError, isExtendedSecurity, isForceUnicode, isReceived, isResolveInDfs, isResponse, isResponseAsync, isRetainPayload, isUseUnicode, isVerifyFailed, prepare, readHeaderWireFormat, readString, readString, readString, readStringLength, received, remFlags2, retainPayload, setCommand, setDigest, setErrorCode, setExpiration, setExtendedSecurity, setFlags, setFlags2, setFullUNCPath, setMid, setOverrideTimeout, setPath, setPid, setRawPayload, setRequestCredits, setResolveInDfs, setResponse, setSessionId, setSignSeq, setTid, setUid, setUseUnicode, size, split, stringWireLength, verifySignature, writeHeaderWireFormat, writeString, writeStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIterator
-
Field Details
-
totalParameterCount
protected int totalParameterCountTotal number of parameter bytes the server is returning -
totalDataCount
protected int totalDataCountTotal number of data bytes the server is returning -
parameterCount
protected int parameterCountNumber of parameter bytes in this response -
parameterOffset
protected int parameterOffsetOffset from the start of the SMB header to the parameter bytes -
parameterDisplacement
protected int parameterDisplacementDisplacement of these parameter bytes from the start of the total parameter block -
dataOffset
protected int dataOffsetOffset from the start of the SMB header to the data bytes -
dataDisplacement
protected int dataDisplacementDisplacement of these data bytes from the start of the total data block -
setupCount
protected int setupCountNumber of setup words in this response -
bufParameterStart
protected int bufParameterStartStart position of parameter data in the buffer -
bufDataStart
protected int bufDataStartStart position of data bytes in the buffer
-
-
Constructor Details
-
SmbComTransactionResponse
Constructs a transaction response.- Parameters:
config- the configuration to use
-
SmbComTransactionResponse
Constructs a transaction response with specified command.- Parameters:
config- the configuration to usecommand- the SMB command codesubcommand- 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
Gets the file entry results from the response- Returns:
- the results
-
setResults
Sets the file entry results for the response- Parameters:
results- the results to set
-
reset
public void reset()Description copied from interface:CommonServerMessageBlockResets this message to its initial state.- Specified by:
resetin interfaceCommonServerMessageBlock- Specified by:
resetin interfaceResponse- Overrides:
resetin classServerMessageBlock
-
hasMoreElements
public boolean hasMoreElements()- Specified by:
hasMoreElementsin interfaceEnumeration<SmbComTransactionResponse>
-
nextElement
- Specified by:
nextElementin interfaceEnumeration<SmbComTransactionResponse>
-
writeParameterWordsWireFormat
protected int writeParameterWordsWireFormat(byte[] dst, int dstIndex) Description copied from class:ServerMessageBlockWrites the parameter words portion of the SMB message to the wire format.- Specified by:
writeParameterWordsWireFormatin classServerMessageBlock- Parameters:
dst- the destination bufferdstIndex- the starting offset in the buffer- Returns:
- the number of bytes written
-
writeBytesWireFormat
protected int writeBytesWireFormat(byte[] dst, int dstIndex) Description copied from class:ServerMessageBlockWrites the data bytes portion of the SMB message to the wire format.- Specified by:
writeBytesWireFormatin classServerMessageBlock- Parameters:
dst- the destination bufferdstIndex- the starting offset in the buffer- Returns:
- the number of bytes written
-
decode
Decode message data from the given byte array- Specified by:
decodein interfaceCommonServerMessageBlock- Overrides:
decodein classServerMessageBlock- Parameters:
buffer- the byte array containing the message databufferIndex- 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:ServerMessageBlockReads the parameter words portion of the SMB message from the wire format.- Specified by:
readParameterWordsWireFormatin classServerMessageBlock- Parameters:
buffer- the buffer containing the message databufferIndex- 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:ServerMessageBlockReads the data bytes portion of the SMB message from the wire format.- Specified by:
readBytesWireFormatin classServerMessageBlock- Parameters:
buffer- the buffer containing the message databufferIndex- 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 bufferdstIndex- 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 bufferdstIndex- 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 bufferdstIndex- 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 bufferbufferIndex- starting index in source bufferlen- 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 bufferbufferIndex- starting index in source bufferlen- 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 bufferbufferIndex- starting index in source bufferlen- length of data to read- Returns:
- number of bytes read
- Throws:
SMBProtocolDecodingException- if decoding fails
-
toString
- Overrides:
toStringin classServerMessageBlock
-