FileDocCategorySizeDatePackage
SmbComOpenAndX.javaAPI DocJCIFS 1.3.17 API5961Tue Oct 18 15:26:24 BST 2011jcifs.smb

SmbComOpenAndX

public class SmbComOpenAndX extends AndXServerMessageBlock

Fields Summary
private static final int
FLAGS_RETURN_ADDITIONAL_INFO
private static final int
FLAGS_REQUEST_OPLOCK
private static final int
FLAGS_REQUEST_BATCH_OPLOCK
private static final int
SHARING_COMPATIBILITY
private static final int
SHARING_DENY_READ_WRITE_EXECUTE
private static final int
SHARING_DENY_WRITE
private static final int
SHARING_DENY_READ_EXECUTE
private static final int
SHARING_DENY_NONE
private static final int
DO_NOT_CACHE
private static final int
WRITE_THROUGH
private static final int
OPEN_FN_CREATE
private static final int
OPEN_FN_FAIL_IF_EXISTS
private static final int
OPEN_FN_OPEN
private static final int
OPEN_FN_TRUNC
private static final int
BATCH_LIMIT
int
flags
int
desiredAccess
int
searchAttributes
int
fileAttributes
int
creationTime
int
openFunction
int
allocationSize
Constructors Summary
SmbComOpenAndX(String fileName, int access, int flags, ServerMessageBlock andx)


    // flags is NOT the same as flags member

              
        super( andx );
        this.path = fileName;
        command = SMB_COM_OPEN_ANDX;

        desiredAccess = access & 0x3;
        if( desiredAccess == 0x3 ) {
            desiredAccess = 0x2; /* Mmm, I thought 0x03 was RDWR */
        }
        desiredAccess |= SHARING_DENY_NONE;
        desiredAccess &= ~0x1; // Win98 doesn't like GENERIC_READ ?! -- get Access Denied.

        // searchAttributes
        searchAttributes = ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM;

        // fileAttributes
        fileAttributes = 0;

        // openFunction
        if(( flags & SmbFile.O_TRUNC ) == SmbFile.O_TRUNC ) {
            // truncate the file
            if(( flags & SmbFile.O_CREAT ) == SmbFile.O_CREAT ) {
                // create it if necessary
                openFunction = OPEN_FN_TRUNC | OPEN_FN_CREATE;
            } else {
                openFunction = OPEN_FN_TRUNC;
            }
        } else {
            // don't truncate the file
            if(( flags & SmbFile.O_CREAT ) == SmbFile.O_CREAT ) {
                // create it if necessary
                if(( flags & SmbFile.O_EXCL ) == SmbFile.O_EXCL ) {
                    // fail if already exists
                    openFunction = OPEN_FN_CREATE | OPEN_FN_FAIL_IF_EXISTS;
                } else {
                    openFunction = OPEN_FN_CREATE | OPEN_FN_OPEN;
                }
            } else {
                openFunction = OPEN_FN_OPEN;
            }
        }
    
Methods Summary
intgetBatchLimit(byte command)

        return command == SMB_COM_READ_ANDX ? BATCH_LIMIT : 0;
    
intreadBytesWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
intreadParameterWordsWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
public java.lang.StringtoString()

        return new String( "SmbComOpenAndX[" +
            super.toString() +
            ",flags=0x" + Hexdump.toHexString( flags, 2 ) +
            ",desiredAccess=0x" + Hexdump.toHexString( desiredAccess, 4 ) +
            ",searchAttributes=0x" + Hexdump.toHexString( searchAttributes, 4 ) +
            ",fileAttributes=0x" + Hexdump.toHexString( fileAttributes, 4 ) +
            ",creationTime=" + new Date( creationTime ) +
            ",openFunction=0x" + Hexdump.toHexString( openFunction, 2 ) +
            ",allocationSize=" + allocationSize +
            ",fileName=" + path + "]" );
    
intwriteBytesWireFormat(byte[] dst, int dstIndex)

        int start = dstIndex;

        if( useUnicode ) {
            dst[dstIndex++] = (byte)'\0";
        }
        dstIndex += writeString( path, dst, dstIndex );

        return dstIndex - start;
    
intwriteParameterWordsWireFormat(byte[] dst, int dstIndex)

        int start = dstIndex;

        writeInt2( flags, dst, dstIndex );
        dstIndex += 2;
        writeInt2( desiredAccess, dst, dstIndex );
        dstIndex += 2;
        writeInt2( searchAttributes, dst, dstIndex );
        dstIndex += 2;
        writeInt2( fileAttributes, dst, dstIndex );
        dstIndex += 2;
        creationTime = 0;
        writeInt4( creationTime, dst, dstIndex );
        dstIndex += 4;
        writeInt2( openFunction, dst, dstIndex );
        dstIndex += 2;
        writeInt4( allocationSize, dst, dstIndex );
        dstIndex += 4;
        for( int i = 0; i < 8; i++ ) {
            dst[dstIndex++] = 0x00;
        }

        return dstIndex - start;