java.lang.Object
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2Request<Smb2CreateResponse>
org.codelibs.jcifs.smb.internal.smb2.create.Smb2CreateRequest
- All Implemented Interfaces:
CommonServerMessageBlock,CommonServerMessageBlockRequest,Request<Smb2CreateResponse>,RequestWithPath,Message,Request
public class Smb2CreateRequest
extends ServerMessageBlock2Request<Smb2CreateResponse>
implements RequestWithPath
SMB2 Create request message. This command is used to create or open a file or directory
on the server with specified access rights and sharing options.
- Author:
- mbechler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intComplete this operation immediately with an oplock break if it would break an oplockstatic final intIf file exists, fail.static final intDelete the file when the last handle to it is closedstatic final intFile being created or opened must be a directorystatic final intAny open of this file cannot be exclusivestatic final intDisable compression on the filestatic final intThe client does not understand extended attributesstatic final intFile cannot be cached or buffered at intermediate levelsstatic final intFile being created or opened must not be a directorystatic final intOpen does not cause an opportunistic lock break for the filestatic final intIf file exists, open it.static final intOpen file by its file IDstatic final intThe file is being opened for backup intentstatic final intThe file is being opened solely to query its free spacestatic final intIf file exists, open it.static final intOpen a remote instance of the filestatic final intOpen a reparse point and bypass normal reparse point processingstatic final intThe file is being opened and an oplock is being requested as an atomic operationstatic final intIf file exists, overwrite it.static final intIf file exists, overwrite it.static final intAccess to the file is randomstatic final intReserve an opportunistic lock filter on the openstatic final intAccess to the file is sequential onlystatic final intEnable other opens for delete accessstatic final intEnable other opens for read accessstatic final intEnable other opens for write accessstatic final intIf file exists, supersede it.static final intAll operations on the file are performed synchronously with alertsstatic final intAll operations on the file are performed synchronously without alertsstatic final intWrite operations go directly to persistent storagestatic final intAnonymous impersonation level - client cannot obtain identification information about itselfstatic final intDelegate impersonation level - server can impersonate the client's security context on remote systemsstatic final intIdentification impersonation level - server can obtain the client's identity but cannot impersonatestatic final intImpersonation level - server can impersonate the client's security context on the local systemstatic final byteBatch oplockstatic final byteExclusive oplockstatic final byteLevel II oplockstatic final byteLease-based oplockstatic final byteNo oplockFields 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
ConstructorsConstructorDescriptionSmb2CreateRequest(Configuration config, String name) Constructs an SMB2 create request -
Method Summary
Modifier and TypeMethodDescriptionprotected Smb2CreateResponseCreate the response object for this requestGets the domain name.Gets the full UNC path.getPath()Gets the path to the resource.Gets the server name.booleanChecks if this request should be resolved in DFS.protected intreadBytesWireFormat(byte[] buffer, int bufferIndex) Reads the message body from the wire format.voidsetCreateDisposition(int createDisposition) Set the create disposition specifying what action to take if file exists or doesn't existvoidsetCreateOptions(int createOptions) Set the create options that control file creation behaviorvoidsetDesiredAccess(int desiredAccess) Set the desired access mask for the filevoidsetFileAttributes(int fileAttributes) Set the file attributes for the created filevoidsetFullUNCPath(String domain, String server, String fullName) Sets the full UNC path components.voidsetImpersonationLevel(int impersonationLevel) Set the impersonation level for the create requestvoidSets the path to the resource.voidsetRequestedOplockLevel(byte requestedOplockLevel) Set the requested oplock level for the filevoidsetResolveInDfs(boolean resolve) Sets whether to resolve this request path in DFS.voidsetSecurityFlags(byte securityFlags) Set the security flags for the create requestvoidsetShareAccess(int shareAccess) Set the share access mode for the filevoidsetSmbCreateFlags(long smbCreateFlags) Set the SMB create flagsintsize()Gets the size of this message.toString()protected intwriteBytesWireFormat(byte[] dst, int dstIndex) Writes the message body to the wire format.Methods inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2Request
allowChain, createCancel, encode, getCreditCost, getNext, getOverrideTimeout, getResponse, ignoreDisconnect, initResponse, isCancel, isResponseAsync, setNext, setOverrideTimeout, setRequestCredits, setResponse, setTid, splitMethods inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
addFlags, chain, clearFlags, decode, decode, equals, getAsyncId, getCommand, getConfig, getCredit, getCreditCharge, getDigest, getErrorContextCount, getErrorData, getFlags, getHeaderStart, getLength, getMid, getNextCommandOffset, getRawPayload, getSessionId, getStatus, getTreeId, hashCode, haveResponse, isAsync, isErrorResponseStatus, isRetainPayload, pad8, readErrorResponse, readHeaderWireFormat, reset, retainPayload, setAsyncId, setCommand, setCredit, setDigest, setExtendedSecurity, setMid, setNext, setRawPayload, setReadSize, setSessionId, setTreeId, setUid, size8, size8, 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, reset, setCommand, setDigest, setExtendedSecurity, setMid, setResponse, setSessionId, setUidMethods inherited from interface org.codelibs.jcifs.smb.util.transport.Message
getRawPayload, isRetainPayload, retainPayload, setRawPayload
-
Field Details
-
SMB2_OPLOCK_LEVEL_NONE
public static final byte SMB2_OPLOCK_LEVEL_NONENo oplock- See Also:
-
SMB2_OPLOCK_LEVEL_II
public static final byte SMB2_OPLOCK_LEVEL_IILevel II oplock- See Also:
-
SMB2_OPLOCK_LEVEL_EXCLUSIVE
public static final byte SMB2_OPLOCK_LEVEL_EXCLUSIVEExclusive oplock- See Also:
-
SMB2_OPLOCK_LEVEL_BATCH
public static final byte SMB2_OPLOCK_LEVEL_BATCHBatch oplock- See Also:
-
SMB2_OPLOCK_LEVEL_LEASE
public static final byte SMB2_OPLOCK_LEVEL_LEASELease-based oplock- See Also:
-
SMB2_IMPERSONATION_LEVEL_ANONYMOUS
public static final int SMB2_IMPERSONATION_LEVEL_ANONYMOUSAnonymous impersonation level - client cannot obtain identification information about itself- See Also:
-
SMB2_IMPERSONATION_LEVEL_IDENTIFICATION
public static final int SMB2_IMPERSONATION_LEVEL_IDENTIFICATIONIdentification impersonation level - server can obtain the client's identity but cannot impersonate- See Also:
-
SMB2_IMPERSONATION_LEVEL_IMPERSONATION
public static final int SMB2_IMPERSONATION_LEVEL_IMPERSONATIONImpersonation level - server can impersonate the client's security context on the local system- See Also:
-
SMB2_IMPERSONATION_LEVEL_DELEGATE
public static final int SMB2_IMPERSONATION_LEVEL_DELEGATEDelegate impersonation level - server can impersonate the client's security context on remote systems- See Also:
-
FILE_SHARE_READ
public static final int FILE_SHARE_READEnable other opens for read access- See Also:
-
FILE_SHARE_WRITE
public static final int FILE_SHARE_WRITEEnable other opens for write access- See Also:
-
FILE_SHARE_DELETE
public static final int FILE_SHARE_DELETEEnable other opens for delete access- See Also:
-
FILE_SUPERSEDE
public static final int FILE_SUPERSEDEIf file exists, supersede it. Otherwise create the file- See Also:
-
FILE_OPEN
public static final int FILE_OPENIf file exists, open it. Otherwise fail- See Also:
-
FILE_CREATE
public static final int FILE_CREATEIf file exists, fail. Otherwise create the file- See Also:
-
FILE_OPEN_IF
public static final int FILE_OPEN_IFIf file exists, open it. Otherwise create the file- See Also:
-
FILE_OVERWRITE
public static final int FILE_OVERWRITEIf file exists, overwrite it. Otherwise fail- See Also:
-
FILE_OVERWRITE_IF
public static final int FILE_OVERWRITE_IFIf file exists, overwrite it. Otherwise create the file- See Also:
-
FILE_DIRECTORY_FILE
public static final int FILE_DIRECTORY_FILEFile being created or opened must be a directory- See Also:
-
FILE_WRITE_THROUGH
public static final int FILE_WRITE_THROUGHWrite operations go directly to persistent storage- See Also:
-
FILE_SEQUENTIAL_ONLY
public static final int FILE_SEQUENTIAL_ONLYAccess to the file is sequential only- See Also:
-
FILE_NO_IMTERMEDIATE_BUFFERING
public static final int FILE_NO_IMTERMEDIATE_BUFFERINGFile cannot be cached or buffered at intermediate levels- See Also:
-
FILE_SYNCHRONOUS_IO_ALERT
public static final int FILE_SYNCHRONOUS_IO_ALERTAll operations on the file are performed synchronously with alerts- See Also:
-
FILE_SYNCHRONOUS_IO_NONALERT
public static final int FILE_SYNCHRONOUS_IO_NONALERTAll operations on the file are performed synchronously without alerts- See Also:
-
FILE_NON_DIRECTORY_FILE
public static final int FILE_NON_DIRECTORY_FILEFile being created or opened must not be a directory- See Also:
-
FILE_COMPLETE_IF_OPLOCKED
public static final int FILE_COMPLETE_IF_OPLOCKEDComplete this operation immediately with an oplock break if it would break an oplock- See Also:
-
FILE_NO_EA_KNOWLEDGE
public static final int FILE_NO_EA_KNOWLEDGEThe client does not understand extended attributes- See Also:
-
FILE_OPEN_REMOTE_INSTANCE
public static final int FILE_OPEN_REMOTE_INSTANCEOpen a remote instance of the file- See Also:
-
FILE_RANDOM_ACCESS
public static final int FILE_RANDOM_ACCESSAccess to the file is random- See Also:
-
FILE_DELETE_ON_CLOSE
public static final int FILE_DELETE_ON_CLOSEDelete the file when the last handle to it is closed- See Also:
-
FILE_OPEN_BY_FILE_ID
public static final int FILE_OPEN_BY_FILE_IDOpen file by its file ID- See Also:
-
FILE_OPEN_FOR_BACKUP_INTENT
public static final int FILE_OPEN_FOR_BACKUP_INTENTThe file is being opened for backup intent- See Also:
-
FILE_NO_COMPRESSION
public static final int FILE_NO_COMPRESSIONDisable compression on the file- See Also:
-
FILE_OPEN_REQUIRING_OPLOCK
public static final int FILE_OPEN_REQUIRING_OPLOCKThe file is being opened and an oplock is being requested as an atomic operation- See Also:
-
FILE_DISALLOW_EXCLUSIVE
public static final int FILE_DISALLOW_EXCLUSIVEAny open of this file cannot be exclusive- See Also:
-
FILE_RESERVE_OPFILTER
public static final int FILE_RESERVE_OPFILTERReserve an opportunistic lock filter on the open- See Also:
-
FILE_OPEN_REPARSE_POINT
public static final int FILE_OPEN_REPARSE_POINTOpen a reparse point and bypass normal reparse point processing- See Also:
-
FILE_NOP_RECALL
public static final int FILE_NOP_RECALLOpen does not cause an opportunistic lock break for the file- See Also:
-
FILE_OPEN_FOR_FREE_SPACE_QUERY
public static final int FILE_OPEN_FOR_FREE_SPACE_QUERYThe file is being opened solely to query its free space- See Also:
-
-
Constructor Details
-
Smb2CreateRequest
Constructs an SMB2 create request- Parameters:
config- the client configurationname- uncPath to open, strips a leading \
-
-
Method Details
-
createResponse
protected Smb2CreateResponse createResponse(CIFSContext tc, ServerMessageBlock2Request<Smb2CreateResponse> req) Description copied from class:ServerMessageBlock2RequestCreate the response object for this request- Specified by:
createResponsein classServerMessageBlock2Request<Smb2CreateResponse>- Parameters:
tc- the CIFS contextreq- the request object- Returns:
- the response object
-
getPath
Gets the path to the resource.- Specified by:
getPathin interfaceRequestWithPath- Returns:
- the path to the resource (below share)
- See Also:
-
getFullUNCPath
Gets the full UNC path.- Specified by:
getFullUNCPathin interfaceRequestWithPath- Returns:
- the full UNC path
- See Also:
-
getServer
Gets the server name.- Specified by:
getServerin interfaceRequestWithPath- Returns:
- the server name
- See Also:
-
getDomain
Gets the domain name.- Specified by:
getDomainin interfaceRequestWithPath- Returns:
- the domain name
- See Also:
-
setFullUNCPath
Description copied from interface:RequestWithPathSets the full UNC path components.- Specified by:
setFullUNCPathin interfaceRequestWithPath- Parameters:
fullName- the fullName to setdomain- the domain nameserver- the server name
-
setPath
Sets the path to the resource. Strips a leading \- Specified by:
setPathin interfaceRequestWithPath- Parameters:
path- the path to set- See Also:
-
setResolveInDfs
public void setResolveInDfs(boolean resolve) Sets whether to resolve this request path in DFS.- Specified by:
setResolveInDfsin interfaceRequestWithPath- Parameters:
resolve- true to enable DFS resolution- See Also:
-
isResolveInDfs
public boolean isResolveInDfs()Checks if this request should be resolved in DFS.- Specified by:
isResolveInDfsin interfaceRequestWithPath- Returns:
- whether to resolve the request path in DFS
- See Also:
-
setSecurityFlags
public void setSecurityFlags(byte securityFlags) Set the security flags for the create request- Parameters:
securityFlags- the securityFlags to set
-
setRequestedOplockLevel
public void setRequestedOplockLevel(byte requestedOplockLevel) Set the requested oplock level for the file- Parameters:
requestedOplockLevel- the requestedOplockLevel to set
-
setImpersonationLevel
public void setImpersonationLevel(int impersonationLevel) Set the impersonation level for the create request- Parameters:
impersonationLevel- the impersonationLevel to set
-
setSmbCreateFlags
public void setSmbCreateFlags(long smbCreateFlags) Set the SMB create flags- Parameters:
smbCreateFlags- the smbCreateFlags to set
-
setDesiredAccess
public void setDesiredAccess(int desiredAccess) Set the desired access mask for the file- Parameters:
desiredAccess- the desiredAccess to set
-
setFileAttributes
public void setFileAttributes(int fileAttributes) Set the file attributes for the created file- Parameters:
fileAttributes- the fileAttributes to set
-
setCreateDisposition
public void setCreateDisposition(int createDisposition) Set the create disposition specifying what action to take if file exists or doesn't exist- Parameters:
createDisposition- the createDisposition to set
-
setCreateOptions
public void setCreateOptions(int createOptions) Set the create options that control file creation behavior- Parameters:
createOptions- the createOptions to set
-
size
public int size()Gets the size of this message.- Specified by:
sizein interfaceCommonServerMessageBlockRequest- Returns:
- the size of this message
- See Also:
-
writeBytesWireFormat
protected int writeBytesWireFormat(byte[] dst, int dstIndex) Writes the message body to the wire format.- Specified by:
writeBytesWireFormatin classServerMessageBlock2- Parameters:
dst- the destination bufferdstIndex- the starting position in the buffer- Returns:
- number of bytes written
- See Also:
-
readBytesWireFormat
protected int readBytesWireFormat(byte[] buffer, int bufferIndex) Reads the message body from the wire format.- Specified by:
readBytesWireFormatin classServerMessageBlock2- Parameters:
buffer- the buffer to read frombufferIndex- the starting position in the buffer- Returns:
- number of bytes read
- See Also:
-
toString
- Overrides:
toStringin classServerMessageBlock2
-