Package jcifs.internal.smb2
Class ServerMessageBlock2
- java.lang.Object
-
- jcifs.internal.smb2.ServerMessageBlock2
-
- All Implemented Interfaces:
CommonServerMessageBlock,Message
- Direct Known Subclasses:
ServerMessageBlock2Request,ServerMessageBlock2Response,Smb2CancelRequest
public abstract class ServerMessageBlock2 extends Object implements CommonServerMessageBlock
- Author:
- mbechler
-
-
Field Summary
Fields Modifier and Type Field Description protected static shortSMB2_CANCELprotected static shortSMB2_CHANGE_NOTIFYprotected static shortSMB2_CLOSEprotected static shortSMB2_CREATEprotected static shortSMB2_ECHOstatic intSMB2_FLAGS_ASYNC_COMMANDstatic intSMB2_FLAGS_DFS_OPERATIONSstatic intSMB2_FLAGS_PRIORITY_MASKstatic intSMB2_FLAGS_RELATED_OPERATIONSstatic intSMB2_FLAGS_REPLAY_OPERATIONstatic intSMB2_FLAGS_SERVER_TO_REDIRstatic intSMB2_FLAGS_SIGNEDprotected static shortSMB2_FLUSHprotected static shortSMB2_IOCTLprotected static shortSMB2_LOCKprotected static shortSMB2_LOGOFFprotected static shortSMB2_NEGOTIATEprotected static shortSMB2_OPLOCK_BREAKprotected static shortSMB2_QUERY_DIRECTORYprotected static shortSMB2_QUERY_INFOprotected static shortSMB2_READprotected static shortSMB2_SESSION_SETUPprotected static shortSMB2_SET_INFOprotected static shortSMB2_TREE_CONNECTprotected static shortSMB2_TREE_DISCONNECTprotected static shortSMB2_WRITE
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerMessageBlock2(Configuration config)protectedServerMessageBlock2(Configuration config, int command)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddFlags(int flag)booleanchain(ServerMessageBlock2 n)voidclearFlags(int flag)intdecode(byte[] buffer, int bufferIndex)Decode message data from the given byte arrayintdecode(byte[] buffer, int bufferIndex, boolean compound)intencode(byte[] dst, int dstIndex)booleanequals(Object obj)longgetAsyncId()intgetCommand()protected ConfigurationgetConfig()intgetCredit()intgetCreditCharge()Smb2SigningDigestgetDigest()bytegetErrorContextCount()byte[]getErrorData()intgetFlags()intgetHeaderStart()intgetLength()longgetMid()protected ServerMessageBlock2getNext()intgetNextCommandOffset()byte[]getRawPayload()ServerMessageBlock2ResponsegetResponse()longgetSessionId()intgetStatus()intgetTreeId()inthashCode()protected voidhaveResponse(byte[] buffer, int start, int len)booleanisAsync()protected booleanisErrorResponseStatus()booleanisRetainPayload()protected intpad8(int dstIndex)protected abstract intreadBytesWireFormat(byte[] buffer, int bufferIndex)protected intreadErrorResponse(byte[] buffer, int bufferIndex)protected intreadHeaderWireFormat(byte[] buffer, int bufferIndex)voidreset()voidretainPayload()Indicate that this message should retain it's raw payloadvoidsetAsyncId(long asyncId)voidsetCommand(int command)voidsetCredit(int credit)voidsetDigest(SMBSigningDigest digest)voidsetExtendedSecurity(boolean extendedSecurity)voidsetMid(long mid)protected voidsetNext(ServerMessageBlock2 n)voidsetRawPayload(byte[] rawPayload)voidsetReadSize(int readSize)voidsetResponse(CommonServerMessageBlockResponse msg)voidsetSessionId(long sessionId)voidsetTreeId(int treeId)voidsetUid(int uid)protected static intsize8(int size)protected static intsize8(int size, int align)StringtoString()protected abstract intwriteBytesWireFormat(byte[] dst, int dstIndex)protected intwriteHeaderWireFormat(byte[] dst, int dstIndex)
-
-
-
Field Detail
-
SMB2_NEGOTIATE
protected static final short SMB2_NEGOTIATE
- See Also:
- Constant Field Values
-
SMB2_SESSION_SETUP
protected static final short SMB2_SESSION_SETUP
- See Also:
- Constant Field Values
-
SMB2_LOGOFF
protected static final short SMB2_LOGOFF
- See Also:
- Constant Field Values
-
SMB2_TREE_CONNECT
protected static final short SMB2_TREE_CONNECT
- See Also:
- Constant Field Values
-
SMB2_TREE_DISCONNECT
protected static final short SMB2_TREE_DISCONNECT
- See Also:
- Constant Field Values
-
SMB2_CREATE
protected static final short SMB2_CREATE
- See Also:
- Constant Field Values
-
SMB2_CLOSE
protected static final short SMB2_CLOSE
- See Also:
- Constant Field Values
-
SMB2_FLUSH
protected static final short SMB2_FLUSH
- See Also:
- Constant Field Values
-
SMB2_READ
protected static final short SMB2_READ
- See Also:
- Constant Field Values
-
SMB2_WRITE
protected static final short SMB2_WRITE
- See Also:
- Constant Field Values
-
SMB2_LOCK
protected static final short SMB2_LOCK
- See Also:
- Constant Field Values
-
SMB2_IOCTL
protected static final short SMB2_IOCTL
- See Also:
- Constant Field Values
-
SMB2_CANCEL
protected static final short SMB2_CANCEL
- See Also:
- Constant Field Values
-
SMB2_ECHO
protected static final short SMB2_ECHO
- See Also:
- Constant Field Values
-
SMB2_QUERY_DIRECTORY
protected static final short SMB2_QUERY_DIRECTORY
- See Also:
- Constant Field Values
-
SMB2_CHANGE_NOTIFY
protected static final short SMB2_CHANGE_NOTIFY
- See Also:
- Constant Field Values
-
SMB2_QUERY_INFO
protected static final short SMB2_QUERY_INFO
- See Also:
- Constant Field Values
-
SMB2_SET_INFO
protected static final short SMB2_SET_INFO
- See Also:
- Constant Field Values
-
SMB2_OPLOCK_BREAK
protected static final short SMB2_OPLOCK_BREAK
- See Also:
- Constant Field Values
-
SMB2_FLAGS_SERVER_TO_REDIR
public static final int SMB2_FLAGS_SERVER_TO_REDIR
- See Also:
- Constant Field Values
-
SMB2_FLAGS_ASYNC_COMMAND
public static final int SMB2_FLAGS_ASYNC_COMMAND
- See Also:
- Constant Field Values
-
SMB2_FLAGS_RELATED_OPERATIONS
public static final int SMB2_FLAGS_RELATED_OPERATIONS
- See Also:
- Constant Field Values
-
SMB2_FLAGS_SIGNED
public static final int SMB2_FLAGS_SIGNED
- See Also:
- Constant Field Values
-
SMB2_FLAGS_PRIORITY_MASK
public static final int SMB2_FLAGS_PRIORITY_MASK
- See Also:
- Constant Field Values
-
SMB2_FLAGS_DFS_OPERATIONS
public static final int SMB2_FLAGS_DFS_OPERATIONS
- See Also:
- Constant Field Values
-
SMB2_FLAGS_REPLAY_OPERATION
public static final int SMB2_FLAGS_REPLAY_OPERATION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerMessageBlock2
protected ServerMessageBlock2(Configuration config)
-
ServerMessageBlock2
protected ServerMessageBlock2(Configuration config, int command)
-
-
Method Detail
-
getConfig
protected Configuration getConfig()
- Returns:
- the config
-
reset
public void reset()
- Specified by:
resetin interfaceCommonServerMessageBlock
-
getCommand
public final int getCommand()
- Specified by:
getCommandin interfaceCommonServerMessageBlock- Returns:
- the command
-
getNextCommandOffset
public final int getNextCommandOffset()
- Returns:
- offset to next compound command
-
setReadSize
public void setReadSize(int readSize)
- Parameters:
readSize- the readSize to set
-
isAsync
public boolean isAsync()
- Returns:
- the async
-
setCommand
public final void setCommand(int command)
- Specified by:
setCommandin interfaceCommonServerMessageBlock- Parameters:
command- the command to set
-
getTreeId
public final int getTreeId()
- Returns:
- the treeId
-
setTreeId
public final void setTreeId(int treeId)
- Parameters:
treeId- the treeId to set
-
getAsyncId
public final long getAsyncId()
- Returns:
- the asyncId
-
setAsyncId
public final void setAsyncId(long asyncId)
- Parameters:
asyncId- the asyncId to set
-
getCredit
public final int getCredit()
- Returns:
- the credit
-
setCredit
public final void setCredit(int credit)
- Parameters:
credit- the credit to set
-
getCreditCharge
public final int getCreditCharge()
- Returns:
- the creditCharge
-
retainPayload
public void retainPayload()
Description copied from interface:MessageIndicate that this message should retain it's raw payload- Specified by:
retainPayloadin interfaceMessage
-
isRetainPayload
public boolean isRetainPayload()
- Specified by:
isRetainPayloadin interfaceMessage- Returns:
- whether to retain the message payload
-
getRawPayload
public byte[] getRawPayload()
- Specified by:
getRawPayloadin interfaceMessage- Returns:
- the raw response message
-
setRawPayload
public void setRawPayload(byte[] rawPayload)
- Specified by:
setRawPayloadin interfaceMessage
-
getDigest
public Smb2SigningDigest getDigest()
- Specified by:
getDigestin interfaceCommonServerMessageBlock- Returns:
- the signing digest
- See Also:
CommonServerMessageBlock.getDigest()
-
setDigest
public void setDigest(SMBSigningDigest digest)
- Specified by:
setDigestin interfaceCommonServerMessageBlock- See Also:
CommonServerMessageBlock.setDigest(jcifs.internal.SMBSigningDigest)
-
getStatus
public final int getStatus()
- Returns:
- the status
-
getSessionId
public long getSessionId()
- Returns:
- the sessionId
-
setSessionId
public final void setSessionId(long sessionId)
- Specified by:
setSessionIdin interfaceCommonServerMessageBlock- Parameters:
sessionId- the sessionId to set
-
setExtendedSecurity
public void setExtendedSecurity(boolean extendedSecurity)
- Specified by:
setExtendedSecurityin interfaceCommonServerMessageBlock- See Also:
CommonServerMessageBlock.setExtendedSecurity(boolean)
-
setUid
public void setUid(int uid)
- Specified by:
setUidin interfaceCommonServerMessageBlock- See Also:
CommonServerMessageBlock.setUid(int)
-
getFlags
public final int getFlags()
- Returns:
- the flags
-
addFlags
public final void addFlags(int flag)
- Parameters:
flag-
-
clearFlags
public final void clearFlags(int flag)
- Parameters:
flag-
-
getMid
public final long getMid()
- Specified by:
getMidin interfaceCommonServerMessageBlock- Returns:
- the mid
-
setMid
public final void setMid(long mid)
- Specified by:
setMidin interfaceCommonServerMessageBlock- Parameters:
mid- the mid to set
-
chain
public boolean chain(ServerMessageBlock2 n)
- Parameters:
n-- Returns:
- whether chaining was successful
-
getNext
protected ServerMessageBlock2 getNext()
-
setNext
protected void setNext(ServerMessageBlock2 n)
-
getResponse
public ServerMessageBlock2Response getResponse()
- Specified by:
getResponsein interfaceCommonServerMessageBlock- Returns:
- the response
-
setResponse
public void setResponse(CommonServerMessageBlockResponse msg)
- Specified by:
setResponsein interfaceCommonServerMessageBlock- See Also:
CommonServerMessageBlock.setResponse(jcifs.internal.CommonServerMessageBlockResponse)
-
getErrorData
public final byte[] getErrorData()
- Returns:
- the errorData
-
getErrorContextCount
public final byte getErrorContextCount()
- Returns:
- the errorContextCount
-
getHeaderStart
public final int getHeaderStart()
- Returns:
- the headerStart
-
getLength
public final int getLength()
- Returns:
- the length
-
encode
public int encode(byte[] dst, int dstIndex)- Specified by:
encodein interfaceCommonServerMessageBlock- Returns:
- message length
-
size8
protected static final int size8(int size)
-
size8
protected static final int size8(int size, int align)
-
pad8
protected final int pad8(int dstIndex)
- Parameters:
dstIndex-- Returns:
-
decode
public int decode(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingExceptionDescription copied from interface:CommonServerMessageBlockDecode message data from the given byte array- Specified by:
decodein interfaceCommonServerMessageBlock- Returns:
- message length
- Throws:
SMBProtocolDecodingException
-
decode
public int decode(byte[] buffer, int bufferIndex, boolean compound) throws SMBProtocolDecodingException- Parameters:
buffer-bufferIndex-compound-- Returns:
- decoded length
- Throws:
SMBProtocolDecodingException
-
isErrorResponseStatus
protected boolean isErrorResponseStatus()
-
haveResponse
protected void haveResponse(byte[] buffer, int start, int len) throws SMBProtocolDecodingException- Parameters:
buffer-start-len-- Throws:
SMBProtocolDecodingException
-
readErrorResponse
protected int readErrorResponse(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingException- Parameters:
buffer-bufferIndex-- Returns:
- Throws:
Smb2ProtocolDecodingExceptionSMBProtocolDecodingException
-
writeHeaderWireFormat
protected int writeHeaderWireFormat(byte[] dst, int dstIndex)
-
readHeaderWireFormat
protected int readHeaderWireFormat(byte[] buffer, int bufferIndex)
-
writeBytesWireFormat
protected abstract int writeBytesWireFormat(byte[] dst, int dstIndex)
-
readBytesWireFormat
protected abstract int readBytesWireFormat(byte[] buffer, int bufferIndex) throws SMBProtocolDecodingException- Throws:
SMBProtocolDecodingException
-
-