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 short
SMB2_CANCEL
protected static short
SMB2_CHANGE_NOTIFY
protected static short
SMB2_CLOSE
protected static short
SMB2_CREATE
protected static short
SMB2_ECHO
static int
SMB2_FLAGS_ASYNC_COMMAND
static int
SMB2_FLAGS_DFS_OPERATIONS
static int
SMB2_FLAGS_PRIORITY_MASK
static int
SMB2_FLAGS_RELATED_OPERATIONS
static int
SMB2_FLAGS_REPLAY_OPERATION
static int
SMB2_FLAGS_SERVER_TO_REDIR
static int
SMB2_FLAGS_SIGNED
protected static short
SMB2_FLUSH
protected static short
SMB2_IOCTL
protected static short
SMB2_LOCK
protected static short
SMB2_LOGOFF
protected static short
SMB2_NEGOTIATE
protected static short
SMB2_OPLOCK_BREAK
protected static short
SMB2_QUERY_DIRECTORY
protected static short
SMB2_QUERY_INFO
protected static short
SMB2_READ
protected static short
SMB2_SESSION_SETUP
protected static short
SMB2_SET_INFO
protected static short
SMB2_TREE_CONNECT
protected static short
SMB2_TREE_DISCONNECT
protected static short
SMB2_WRITE
-
Constructor Summary
Constructors Modifier Constructor Description protected
ServerMessageBlock2(Configuration config)
protected
ServerMessageBlock2(Configuration config, int command)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addFlags(int flag)
boolean
chain(ServerMessageBlock2 n)
void
clearFlags(int flag)
int
decode(byte[] buffer, int bufferIndex)
Decode message data from the given byte arrayint
decode(byte[] buffer, int bufferIndex, boolean compound)
int
encode(byte[] dst, int dstIndex)
boolean
equals(Object obj)
long
getAsyncId()
int
getCommand()
protected Configuration
getConfig()
int
getCredit()
int
getCreditCharge()
Smb2SigningDigest
getDigest()
byte
getErrorContextCount()
byte[]
getErrorData()
int
getFlags()
int
getHeaderStart()
int
getLength()
long
getMid()
protected ServerMessageBlock2
getNext()
int
getNextCommandOffset()
byte[]
getRawPayload()
ServerMessageBlock2Response
getResponse()
long
getSessionId()
int
getStatus()
int
getTreeId()
int
hashCode()
protected void
haveResponse(byte[] buffer, int start, int len)
boolean
isAsync()
protected boolean
isErrorResponseStatus()
boolean
isRetainPayload()
protected int
pad8(int dstIndex)
protected abstract int
readBytesWireFormat(byte[] buffer, int bufferIndex)
protected int
readErrorResponse(byte[] buffer, int bufferIndex)
protected int
readHeaderWireFormat(byte[] buffer, int bufferIndex)
void
reset()
void
retainPayload()
Indicate that this message should retain it's raw payloadvoid
setAsyncId(long asyncId)
void
setCommand(int command)
void
setCredit(int credit)
void
setDigest(SMBSigningDigest digest)
void
setExtendedSecurity(boolean extendedSecurity)
void
setMid(long mid)
protected void
setNext(ServerMessageBlock2 n)
void
setRawPayload(byte[] rawPayload)
void
setReadSize(int readSize)
void
setResponse(CommonServerMessageBlockResponse msg)
void
setSessionId(long sessionId)
void
setTreeId(int treeId)
void
setUid(int uid)
protected static int
size8(int size)
protected static int
size8(int size, int align)
String
toString()
protected abstract int
writeBytesWireFormat(byte[] dst, int dstIndex)
protected int
writeHeaderWireFormat(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:
reset
in interfaceCommonServerMessageBlock
-
getCommand
public final int getCommand()
- Specified by:
getCommand
in 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:
setCommand
in 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:Message
Indicate that this message should retain it's raw payload- Specified by:
retainPayload
in interfaceMessage
-
isRetainPayload
public boolean isRetainPayload()
- Specified by:
isRetainPayload
in interfaceMessage
- Returns:
- whether to retain the message payload
-
getRawPayload
public byte[] getRawPayload()
- Specified by:
getRawPayload
in interfaceMessage
- Returns:
- the raw response message
-
setRawPayload
public void setRawPayload(byte[] rawPayload)
- Specified by:
setRawPayload
in interfaceMessage
-
getDigest
public Smb2SigningDigest getDigest()
- Specified by:
getDigest
in interfaceCommonServerMessageBlock
- Returns:
- the signing digest
- See Also:
CommonServerMessageBlock.getDigest()
-
setDigest
public void setDigest(SMBSigningDigest digest)
- Specified by:
setDigest
in 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:
setSessionId
in interfaceCommonServerMessageBlock
- Parameters:
sessionId
- the sessionId to set
-
setExtendedSecurity
public void setExtendedSecurity(boolean extendedSecurity)
- Specified by:
setExtendedSecurity
in interfaceCommonServerMessageBlock
- See Also:
CommonServerMessageBlock.setExtendedSecurity(boolean)
-
setUid
public void setUid(int uid)
- Specified by:
setUid
in 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:
getMid
in interfaceCommonServerMessageBlock
- Returns:
- the mid
-
setMid
public final void setMid(long mid)
- Specified by:
setMid
in 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:
getResponse
in interfaceCommonServerMessageBlock
- Returns:
- the response
-
setResponse
public void setResponse(CommonServerMessageBlockResponse msg)
- Specified by:
setResponse
in 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:
encode
in 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 SMBProtocolDecodingException
Description copied from interface:CommonServerMessageBlock
Decode message data from the given byte array- Specified by:
decode
in 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:
Smb2ProtocolDecodingException
SMBProtocolDecodingException
-
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
-
-