KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > smb > SmbComTreeConnectAndXResponse


1 /* jcifs smb client library in Java
2  * Copyright (C) 2000 "Michael B. Allen" <jcifs at samba dot org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * 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 jcifs.smb;
20
21 import java.io.UnsupportedEncodingException JavaDoc;
22
23 class SmbComTreeConnectAndXResponse extends AndXServerMessageBlock {
24
25     private static final int SMB_SUPPORT_SEARCH_BITS = 0x0001;
26     private static final int SMB_SHARE_IS_IN_DFS = 0x0002;
27
28     boolean supportSearchBits, shareIsInDfs;
29     String JavaDoc service, nativeFileSystem = "";
30
31     SmbComTreeConnectAndXResponse( ServerMessageBlock andx ) {
32         super( andx );
33     }
34
35     int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
36         return 0;
37     }
38     int writeBytesWireFormat( byte[] dst, int dstIndex ) {
39         return 0;
40     }
41     int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
42         supportSearchBits = ( buffer[bufferIndex] & SMB_SUPPORT_SEARCH_BITS ) == SMB_SUPPORT_SEARCH_BITS;
43         shareIsInDfs = ( buffer[bufferIndex] & SMB_SHARE_IS_IN_DFS ) == SMB_SHARE_IS_IN_DFS;
44         return 2;
45     }
46     int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
47         int start = bufferIndex;
48
49         int len = readStringLength( buffer, bufferIndex, 32 );
50         try {
51             service = new String JavaDoc( buffer, bufferIndex, len, "ASCII" );
52         } catch( UnsupportedEncodingException JavaDoc uee ) {
53             return 0;
54         }
55         bufferIndex += len + 1;
56         // win98 observed not returning nativeFileSystem
57
if( byteCount > bufferIndex - start ) {
58             nativeFileSystem = readString( buffer, bufferIndex );
59             bufferIndex += stringWireLength( nativeFileSystem, bufferIndex );
60         }
61
62         return bufferIndex - start;
63     }
64     public String JavaDoc toString() {
65         String JavaDoc result = new String JavaDoc( "SmbComTreeConnectAndXResponse[" +
66             super.toString() +
67             ",supportSearchBits=" + supportSearchBits +
68             ",shareIsInDfs=" + shareIsInDfs +
69             ",service=" + service +
70             ",nativeFileSystem=" + nativeFileSystem + "]" );
71         return result;
72     }
73 }
74
75
Popular Tags