1 19 20 package com.knowgate.jcifs.smb; 21 22 import java.io.InputStream ; 23 import java.io.IOException ; 24 import com.knowgate.misc.Gadgets; 25 import com.knowgate.debug.DebugFile; 26 27 class NetServerEnum2Response extends SmbComTransactionResponse { 28 29 class ServerInfo1 implements FileEntry { 30 String name; 31 int versionMajor; 32 int versionMinor; 33 int type; 34 String commentOrMasterBrowser; 35 36 public String getName() { 37 return name; 38 } 39 public int getType() { 40 return (type & 0x80000000) != 0 ? SmbFile.TYPE_WORKGROUP : SmbFile.TYPE_SERVER; 41 } 42 public int getAttributes() { 43 return SmbFile.ATTR_READONLY | SmbFile.ATTR_DIRECTORY; 44 } 45 public long createTime() { 46 return 0L; 47 } 48 public long lastModified() { 49 return 0L; 50 } 51 public long length() { 52 return 0L; 53 } 54 55 public String toString() { 56 return new String ( "ServerInfo1[" + 57 "name=" + name + 58 ",versionMajor=" + versionMajor + 59 ",versionMinor=" + versionMinor + 60 ",type=0x" + Gadgets.toHexString( type, 8 ) + 61 ",commentOrMasterBrowser=" + commentOrMasterBrowser + "]" ); 62 } 63 } 64 65 private int converter, totalAvailableEntries; 66 67 String lastName; 68 69 NetServerEnum2Response() { 70 } 71 72 int writeSetupWireFormat( byte[] dst, int dstIndex ) { 73 return 0; 74 } 75 int writeParametersWireFormat( byte[] dst, int dstIndex ) { 76 return 0; 77 } 78 int writeDataWireFormat( byte[] dst, int dstIndex ) { 79 return 0; 80 } 81 int readSetupWireFormat( byte[] buffer, int bufferIndex, int len ) { 82 return 0; 83 } 84 int readParametersWireFormat( byte[] buffer, int bufferIndex, int len ) { 85 int start = bufferIndex; 86 87 status = readInt2( buffer, bufferIndex ); 88 bufferIndex += 2; 89 converter = readInt2( buffer, bufferIndex ); 90 bufferIndex += 2; 91 numEntries = readInt2( buffer, bufferIndex ); 92 bufferIndex += 2; 93 totalAvailableEntries = readInt2( buffer, bufferIndex ); 94 bufferIndex += 2; 95 96 return bufferIndex - start; 97 } 98 int readDataWireFormat( byte[] buffer, int bufferIndex, int len ) { 99 int start = bufferIndex; 100 ServerInfo1 e = null; 101 102 results = new ServerInfo1[numEntries]; 103 for( int i = 0; i < numEntries; i++ ) { 104 results[i] = e = new ServerInfo1(); 105 e.name = readString( buffer, bufferIndex, 16, false ); 106 bufferIndex += 16; 107 e.versionMajor = (int)( buffer[bufferIndex++] & 0xFF ); 108 e.versionMinor = (int)( buffer[bufferIndex++] & 0xFF ); 109 e.type = readInt4( buffer, bufferIndex ); 110 bufferIndex += 4; 111 int off = readInt4( buffer, bufferIndex ); 112 bufferIndex += 4; 113 off = ( off & 0xFFFF ) - converter; 114 off = start + off; 115 e.commentOrMasterBrowser = readString( buffer, off, 48, false ); 116 117 } 118 lastName = numEntries == 0 ? null : e.name; 119 120 return bufferIndex - start; 121 } 122 public String toString() { 123 return new String ( "NetServerEnum2Response[" + 124 super.toString() + 125 ",status=" + status + 126 ",converter=" + converter + 127 ",entriesReturned=" + numEntries + 128 ",totalAvailableEntries=" + totalAvailableEntries + 129 ",lastName=" + lastName + "]" ); 130 } 131 } 132 | Popular Tags |