KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > 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 com.knowgate.jcifs.smb;
20
21 import java.io.IOException JavaDoc;
22 import java.io.InputStream JavaDoc;
23 import java.io.UnsupportedEncodingException JavaDoc;
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 JavaDoc service, nativeFileSystem = "";
32
33     SmbComTreeConnectAndXResponse( ServerMessageBlock andx ) {
34         super( andx );
35     }
36
37     int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
38         return 0;
39     }
40     int writeBytesWireFormat( byte[] dst, int dstIndex ) {
41         return 0;
42     }
43     int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
44         supportSearchBits = ( buffer[bufferIndex] & SMB_SUPPORT_SEARCH_BITS ) == SMB_SUPPORT_SEARCH_BITS;
45         shareIsInDfs = ( buffer[bufferIndex] & SMB_SHARE_IS_IN_DFS ) == SMB_SHARE_IS_IN_DFS;
46         return 2;
47     }
48     int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
49         int start = bufferIndex;
50
51         int len = readStringLength( buffer, bufferIndex, 32 );
52         try {
53             service = new String JavaDoc( buffer, bufferIndex, len, "ASCII" );
54         } catch( UnsupportedEncodingException JavaDoc uee ) {
55             return 0;
56         }
57         bufferIndex += len + 1;
58         // win98 observed not returning nativeFileSystem
59
if( byteCount > bufferIndex - start ) {
60             nativeFileSystem = readString( buffer, bufferIndex );
61             bufferIndex += stringWireLength( nativeFileSystem, bufferIndex );
62         }
63
64         return bufferIndex - start;
65     }
66     int readBytesDirectWireFormat( InputStream JavaDoc in, int byteCount,
67                 byte[] buffer, int bufferIndex ) throws IOException JavaDoc {
68         return 0;
69     }
70     public String JavaDoc toString() {
71         String JavaDoc result = new String JavaDoc( "SmbComTreeConnectAndXResponse[" +
72             super.toString() +
73             ",supportSearchBits=" + supportSearchBits +
74             ",shareIsInDfs=" + shareIsInDfs +
75             ",service=" + service +
76             ",nativeFileSystem=" + nativeFileSystem + "]" );
77         return result;
78     }
79 }
80
81
Popular Tags