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