001: /* jcifs smb client library in Java
002: * Copyright (C) 2000 "Michael B. Allen" <jcifs at samba dot org>
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package com.knowgate.jcifs.smb;
020:
021: import java.util.Date;
022: import java.io.IOException;
023: import java.io.InputStream;
024:
025: import com.knowgate.misc.Gadgets;
026:
027: class SmbComNTCreateAndXResponse extends AndXServerMessageBlock {
028:
029: static final int EXCLUSIVE_OPLOCK_GRANTED = 1;
030: static final int BATCH_OPLOCK_GRANTED = 2;
031: static final int LEVEL_II_OPLOCK_GRANTED = 3;
032:
033: byte oplockLevel;
034: int fid, createAction, extFileAttributes, fileType, deviceState;
035: long creationTime, lastAccessTime, lastWriteTime, changeTime,
036: allocationSize, endOfFile;
037: boolean directory;
038:
039: SmbComNTCreateAndXResponse() {
040: }
041:
042: int writeParameterWordsWireFormat(byte[] dst, int dstIndex) {
043: return 0;
044: }
045:
046: int writeBytesWireFormat(byte[] dst, int dstIndex) {
047: return 0;
048: }
049:
050: int readParameterWordsWireFormat(byte[] buffer, int bufferIndex) {
051: int start = bufferIndex;
052:
053: oplockLevel = buffer[bufferIndex++];
054: fid = readInt2(buffer, bufferIndex);
055: bufferIndex += 2;
056: createAction = readInt4(buffer, bufferIndex);
057: bufferIndex += 4;
058: creationTime = readTime(buffer, bufferIndex);
059: bufferIndex += 8;
060: lastAccessTime = readTime(buffer, bufferIndex);
061: bufferIndex += 8;
062: lastWriteTime = readTime(buffer, bufferIndex);
063: bufferIndex += 8;
064: changeTime = readTime(buffer, bufferIndex);
065: bufferIndex += 8;
066: extFileAttributes = readInt4(buffer, bufferIndex);
067: bufferIndex += 4;
068: allocationSize = readInt8(buffer, bufferIndex);
069: bufferIndex += 8;
070: endOfFile = readInt8(buffer, bufferIndex);
071: bufferIndex += 8;
072: fileType = readInt2(buffer, bufferIndex);
073: bufferIndex += 2;
074: deviceState = readInt2(buffer, bufferIndex);
075: bufferIndex += 2;
076: directory = (buffer[bufferIndex++] & 0xFF) > 0;
077:
078: return bufferIndex - start;
079: }
080:
081: int readBytesWireFormat(byte[] buffer, int bufferIndex) {
082: return 0;
083: }
084:
085: int readBytesDirectWireFormat(InputStream in, int byteCount,
086: byte[] buffer, int bufferIndex) throws IOException {
087: return 0;
088: }
089:
090: public String toString() {
091: return new String("SmbComNTCreateAndXResponse["
092: + super .toString() + ",oplockLevel=" + oplockLevel
093: + ",fid=" + fid + ",createAction=0x"
094: + Gadgets.toHexString(createAction, 4)
095: + ",creationTime=" + new Date(creationTime)
096: + ",lastAccessTime=" + new Date(lastAccessTime)
097: + ",lastWriteTime=" + new Date(lastWriteTime)
098: + ",changeTime=" + new Date(changeTime)
099: + ",extFileAttributes=0x"
100: + Gadgets.toHexString(extFileAttributes, 4)
101: + ",allocationSize=" + allocationSize + ",endOfFile="
102: + endOfFile + ",fileType=" + fileType + ",deviceState="
103: + deviceState + ",directory=" + directory + "]");
104: }
105: }
|