1 17 package org.alfresco.filesys.smb.dcerpc.info; 18 19 import org.alfresco.filesys.smb.dcerpc.DCEBuffer; 20 import org.alfresco.filesys.smb.dcerpc.DCEBufferException; 21 import org.alfresco.filesys.smb.dcerpc.DCEReadable; 22 import org.alfresco.filesys.smb.dcerpc.DCEWriteable; 23 24 27 public class ServerInfo implements DCEWriteable, DCEReadable 28 { 29 30 32 public static final int InfoLevel0 = 0; 33 public static final int InfoLevel1 = 1; 34 public static final int InfoLevel101 = 101; 35 public static final int InfoLevel102 = 102; 36 37 39 public final static int PLATFORM_OS2 = 400; 40 public final static int PLATFORM_NT = 500; 41 42 44 private int m_infoLevel; 45 46 48 private int m_platformId; 49 private String m_name; 50 private int m_verMajor; 51 private int m_verMinor; 52 private int m_srvType; 53 private String m_comment; 54 55 58 public ServerInfo() 59 { 60 } 61 62 67 public ServerInfo(int lev) 68 { 69 m_infoLevel = lev; 70 } 71 72 77 public final int getInformationLevel() 78 { 79 return m_infoLevel; 80 } 81 82 87 public final String getServerName() 88 { 89 return m_name; 90 } 91 92 97 public final String getComment() 98 { 99 return m_comment; 100 } 101 102 107 public final int getPlatformId() 108 { 109 return m_platformId; 110 } 111 112 117 public final int getMajorVersion() 118 { 119 return m_verMajor; 120 } 121 122 127 public final int getMinorVersion() 128 { 129 return m_verMinor; 130 } 131 132 137 public final int getServerType() 138 { 139 return m_srvType; 140 } 141 142 147 public final void setServerName(String name) 148 { 149 m_name = name; 150 } 151 152 157 public final void setComment(String comment) 158 { 159 m_comment = comment; 160 } 161 162 167 public final void setInformationLevel(int lev) 168 { 169 m_infoLevel = lev; 170 } 171 172 177 public final void setPlatformId(int id) 178 { 179 m_platformId = id; 180 } 181 182 187 public final void setServerType(int typ) 188 { 189 m_srvType = typ; 190 } 191 192 198 public final void setVersion(int verMajor, int verMinor) 199 { 200 m_verMajor = verMajor; 201 m_verMinor = verMinor; 202 } 203 204 207 protected final void clearStrings() 208 { 209 210 212 m_name = null; 213 m_comment = null; 214 } 215 216 222 public void readObject(DCEBuffer buf) throws DCEBufferException 223 { 224 225 227 clearStrings(); 228 229 231 m_infoLevel = buf.getInt(); 232 buf.skipPointer(); 233 234 236 switch (getInformationLevel()) 237 { 238 239 241 case InfoLevel0: 242 if (buf.getPointer() != 0) 243 m_name = buf.getString(DCEBuffer.ALIGN_INT); 244 break; 245 246 248 case InfoLevel1: 249 case InfoLevel101: 250 m_platformId = buf.getInt(); 251 buf.skipPointer(); 252 m_verMajor = buf.getInt(); 253 m_verMinor = buf.getInt(); 254 m_srvType = buf.getInt(); 255 buf.skipPointer(); 256 257 m_name = buf.getString(DCEBuffer.ALIGN_INT); 258 m_comment = buf.getString(); 259 break; 260 261 263 case InfoLevel102: 264 break; 265 } 266 } 267 268 274 public void readStrings(DCEBuffer buf) throws DCEBufferException 275 { 276 277 } 279 280 286 public void writeObject(DCEBuffer buf, DCEBuffer strBuf) 287 { 288 289 291 buf.putInt(getInformationLevel()); 292 buf.putPointer(true); 293 294 296 switch (getInformationLevel()) 297 { 298 299 301 case InfoLevel0: 302 buf.putPointer(getServerName() != null); 303 if (getServerName() != null) 304 strBuf.putString(getServerName(), DCEBuffer.ALIGN_INT, true); 305 break; 306 307 309 case InfoLevel1: 310 case InfoLevel101: 311 buf.putInt(getPlatformId()); 312 buf.putPointer(true); 313 buf.putInt(getMajorVersion()); 314 buf.putInt(getMinorVersion()); 315 buf.putInt(getServerType()); 316 buf.putPointer(true); 317 318 strBuf.putString(getServerName(), DCEBuffer.ALIGN_INT, true); 319 strBuf.putString(getComment() != null ? getComment() : "", DCEBuffer.ALIGN_INT, true); 320 break; 321 322 324 case InfoLevel102: 325 break; 326 } 327 } 328 329 334 public String toString() 335 { 336 return ""; 337 } 338 } 339 | Popular Tags |