java.lang.Object
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2Response
- All Implemented Interfaces:
CommonServerMessageBlock,CommonServerMessageBlockResponse,Message,Response
- Direct Known Subclasses:
Smb2ChangeNotifyResponse,Smb2CloseResponse,Smb2CreateResponse,Smb2EchoResponse,Smb2FlushResponse,Smb2IoctlResponse,Smb2LockResponse,Smb2LogoffResponse,Smb2NegotiateResponse,Smb2OplockBreakNotification,Smb2QueryDirectoryResponse,Smb2QueryInfoResponse,Smb2ReadResponse,Smb2SessionSetupResponse,Smb2SetInfoResponse,Smb2TreeConnectResponse,Smb2TreeDisconnectResponse,Smb2WriteResponse
public abstract class ServerMessageBlock2Response
extends ServerMessageBlock2
implements CommonServerMessageBlockResponse
Base class for SMB2/SMB3 response messages.
This abstract class provides common functionality for handling
response messages in the SMB2/SMB3 protocol.
- Author:
- mbechler
-
Field Summary
Fields inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
SMB2_CANCEL, SMB2_CHANGE_NOTIFY, SMB2_CLOSE, SMB2_CREATE, SMB2_ECHO, SMB2_FLAGS_ASYNC_COMMAND, SMB2_FLAGS_DFS_OPERATIONS, SMB2_FLAGS_PRIORITY_MASK, SMB2_FLAGS_RELATED_OPERATIONS, SMB2_FLAGS_REPLAY_OPERATION, SMB2_FLAGS_SERVER_TO_REDIR, SMB2_FLAGS_SIGNED, SMB2_FLUSH, SMB2_IOCTL, SMB2_LOCK, SMB2_LOGOFF, SMB2_NEGOTIATE, SMB2_OPLOCK_BREAK, SMB2_QUERY_DIRECTORY, SMB2_QUERY_INFO, SMB2_READ, SMB2_SESSION_SETUP, SMB2_SET_INFO, SMB2_TREE_CONNECT, SMB2_TREE_DISCONNECT, SMB2_WRITE -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for SMB2 response with configuration.ServerMessageBlock2Response(Configuration config, int command) Constructor for SMB2 response with configuration and command. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidUnset received statusfinal voiderror()Set error statusfinal voidSets an exception for this response.final intGets the error status code.Gets the exception associated with this response.Gets the expiration time for this response.intGets the number of credits granted by the server.Gets the next response in the chain.protected voidhaveResponse(byte[] buffer, int start, int len) Called when a response has been received and decoded.booleanChecks whether the asynchronous interim response has been handled.final booleanisError()Checks if the response indicates an error.final booleanChecks if the response has been received.booleanisSigned()Checks whether this SMB2 response packet has been signed.final booleanChecks if signature verification failed.voidPrepares this response for the next request.final voidreceived()Set received statusvoidreset()Resets this message to its initial state.voidsetAsyncHandled(boolean asyncHandled) Sets whether the asynchronous interim response has been handled.voidsetExpiration(Long exp) Sets the expiration time for this response.booleanverifySignature(byte[] buffer, int i, int size) Verifies the signature of this response.Methods inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
addFlags, chain, clearFlags, decode, decode, encode, equals, getAsyncId, getCommand, getConfig, getCredit, getCreditCharge, getDigest, getErrorContextCount, getErrorData, getFlags, getHeaderStart, getLength, getMid, getNext, getNextCommandOffset, getRawPayload, getResponse, getSessionId, getStatus, getTreeId, hashCode, isAsync, isErrorResponseStatus, isRetainPayload, pad8, readBytesWireFormat, readErrorResponse, readHeaderWireFormat, retainPayload, setAsyncId, setCommand, setCredit, setDigest, setExtendedSecurity, setMid, setNext, setRawPayload, setReadSize, setResponse, setSessionId, setTreeId, setUid, size8, size8, toString, writeBytesWireFormat, writeHeaderWireFormatMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codelibs.jcifs.smb.internal.CommonServerMessageBlock
decode, encode, getCommand, getDigest, getMid, getResponse, setCommand, setDigest, setExtendedSecurity, setMid, setResponse, setSessionId, setUidMethods inherited from interface org.codelibs.jcifs.smb.internal.CommonServerMessageBlockResponse
isAsyncMethods inherited from interface org.codelibs.jcifs.smb.util.transport.Message
getRawPayload, isRetainPayload, retainPayload, setRawPayload
-
Constructor Details
-
ServerMessageBlock2Response
Constructor for SMB2 response with configuration and command.- Parameters:
config- the configuration objectcommand- the SMB2 command code
-
ServerMessageBlock2Response
Constructor for SMB2 response with configuration.- Parameters:
config- the configuration object
-
-
Method Details
-
getNextResponse
Gets the next response in the chain.- Specified by:
getNextResponsein interfaceCommonServerMessageBlockResponse- Specified by:
getNextResponsein interfaceResponse- Returns:
- the next response
- See Also:
-
prepare
Prepares this response for the next request.- Specified by:
preparein interfaceCommonServerMessageBlockResponse- Parameters:
next- the next request to prepare for- See Also:
-
reset
public void reset()Resets this message to its initial state.- Specified by:
resetin interfaceCommonServerMessageBlock- Specified by:
resetin interfaceResponse- Overrides:
resetin classServerMessageBlock2- See Also:
-
received
public final void received()Set received status -
exception
Sets an exception for this response. -
error
public final void error()Set error status -
clearReceived
public final void clearReceived()Unset received status- Specified by:
clearReceivedin interfaceResponse- See Also:
-
isReceived
public final boolean isReceived()Checks if the response has been received.- Specified by:
isReceivedin interfaceResponse- Returns:
- whether the response is received
- See Also:
-
isError
public final boolean isError()Checks if the response indicates an error. -
isSigned
public boolean isSigned()Checks whether this SMB2 response packet has been signed.- Returns:
- whether the packet has been signed.
-
getExpiration
Gets the expiration time for this response.- Specified by:
getExpirationin interfaceResponse- Returns:
- the message timeout
- See Also:
-
setExpiration
Sets the expiration time for this response.- Specified by:
setExpirationin interfaceResponse- Parameters:
exp- the message timeout to set- See Also:
-
isAsyncHandled
public boolean isAsyncHandled()Checks whether the asynchronous interim response has been handled.- Returns:
- whether the interim response has been handled
-
setAsyncHandled
public void setAsyncHandled(boolean asyncHandled) Sets whether the asynchronous interim response has been handled.- Parameters:
asyncHandled- the asyncHandled to set
-
getException
Gets the exception associated with this response.- Specified by:
getExceptionin interfaceResponse- Returns:
- an exception linked to an error
- See Also:
-
getErrorCode
public final int getErrorCode()Description copied from interface:ResponseGets the error status code.- Specified by:
getErrorCodein interfaceResponse- Returns:
- error status code
-
isVerifyFailed
public final boolean isVerifyFailed()Description copied from interface:ResponseChecks if signature verification failed.- Specified by:
isVerifyFailedin interfaceResponse- Returns:
- whether signature verification failed
-
getGrantedCredits
public int getGrantedCredits()Gets the number of credits granted by the server.- Specified by:
getGrantedCreditsin interfaceResponse- Returns:
- number of credits granted by the server
- See Also:
-
haveResponse
Called when a response has been received and decoded.- Overrides:
haveResponsein classServerMessageBlock2- Parameters:
buffer- the buffer containing the responsestart- the starting position in the bufferlen- the length of the response- Throws:
SMBProtocolDecodingException- if there is an error decoding the response- See Also:
-
verifySignature
public boolean verifySignature(byte[] buffer, int i, int size) Verifies the signature of this response.- Specified by:
verifySignaturein interfaceResponse- Parameters:
buffer- the buffer containing the signature datai- the starting index in the buffersize- the size of the signature data- Returns:
- whether signature verification is successful
- See Also:
-