01: /* jcifs smb client library in Java
02: * Copyright (C) 2000 "Michael B. Allen" <jcifs at samba dot org>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.knowgate.jcifs.smb;
20:
21: import java.io.IOException;
22: import java.io.InputStream;
23: import java.io.UnsupportedEncodingException;
24:
25: class SmbComTreeConnectAndXResponse extends AndXServerMessageBlock {
26:
27: private static final int SMB_SUPPORT_SEARCH_BITS = 0x0001;
28: private static final int SMB_SHARE_IS_IN_DFS = 0x0002;
29:
30: boolean supportSearchBits, shareIsInDfs;
31: String service, nativeFileSystem = "";
32:
33: SmbComTreeConnectAndXResponse(ServerMessageBlock andx) {
34: super (andx);
35: }
36:
37: int writeParameterWordsWireFormat(byte[] dst, int dstIndex) {
38: return 0;
39: }
40:
41: int writeBytesWireFormat(byte[] dst, int dstIndex) {
42: return 0;
43: }
44:
45: int readParameterWordsWireFormat(byte[] buffer, int bufferIndex) {
46: supportSearchBits = (buffer[bufferIndex] & SMB_SUPPORT_SEARCH_BITS) == SMB_SUPPORT_SEARCH_BITS;
47: shareIsInDfs = (buffer[bufferIndex] & SMB_SHARE_IS_IN_DFS) == SMB_SHARE_IS_IN_DFS;
48: return 2;
49: }
50:
51: int readBytesWireFormat(byte[] buffer, int bufferIndex) {
52: int start = bufferIndex;
53:
54: int len = readStringLength(buffer, bufferIndex, 32);
55: try {
56: service = new String(buffer, bufferIndex, len, "ASCII");
57: } catch (UnsupportedEncodingException uee) {
58: return 0;
59: }
60: bufferIndex += len + 1;
61: // win98 observed not returning nativeFileSystem
62: if (byteCount > bufferIndex - start) {
63: nativeFileSystem = readString(buffer, bufferIndex);
64: bufferIndex += stringWireLength(nativeFileSystem,
65: bufferIndex);
66: }
67:
68: return bufferIndex - start;
69: }
70:
71: int readBytesDirectWireFormat(InputStream in, int byteCount,
72: byte[] buffer, int bufferIndex) throws IOException {
73: return 0;
74: }
75:
76: public String toString() {
77: String result = new String("SmbComTreeConnectAndXResponse["
78: + super .toString() + ",supportSearchBits="
79: + supportSearchBits + ",shareIsInDfs=" + shareIsInDfs
80: + ",service=" + service + ",nativeFileSystem="
81: + nativeFileSystem + "]");
82: return result;
83: }
84: }
|