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.DCEWriteable; 21 22 25 public class WorkstationInfo implements DCEWriteable 26 { 27 28 30 public static final int InfoLevel100 = 100; 31 32 34 private int m_infoLevel; 35 36 38 private int m_platformId; 39 private String m_name; 40 private String m_domain; 41 private int m_verMajor; 42 private int m_verMinor; 43 44 private String m_userName; 45 private String m_logonDomain; 46 private String m_otherDomain; 47 48 51 public WorkstationInfo() 52 { 53 } 54 55 60 public WorkstationInfo(int lev) 61 { 62 m_infoLevel = lev; 63 } 64 65 70 public final int getInformationLevel() 71 { 72 return m_infoLevel; 73 } 74 75 80 public final String getWorkstationName() 81 { 82 return m_name; 83 } 84 85 90 public final String getDomain() 91 { 92 return m_domain; 93 } 94 95 100 public final int getPlatformId() 101 { 102 return m_platformId; 103 } 104 105 110 public final int getMajorVersion() 111 { 112 return m_verMajor; 113 } 114 115 120 public final int getMinorVersion() 121 { 122 return m_verMinor; 123 } 124 125 130 public final String getUserName() 131 { 132 return m_userName; 133 } 134 135 140 public String getLogonDomain() 141 { 142 return m_logonDomain; 143 } 144 145 150 public String getOtherDomains() 151 { 152 return m_otherDomain; 153 } 154 155 160 public void setLogonDomain(String logdom) 161 { 162 m_logonDomain = logdom; 163 } 164 165 170 public void setOtherDomains(String othdom) 171 { 172 m_otherDomain = othdom; 173 } 174 175 180 public final void setWorkstationName(String name) 181 { 182 m_name = name; 183 } 184 185 190 public final void setDomain(String domain) 191 { 192 m_domain = domain; 193 } 194 195 200 public final void setInformationLevel(int lev) 201 { 202 m_infoLevel = lev; 203 } 204 205 210 public final void setPlatformId(int id) 211 { 212 m_platformId = id; 213 } 214 215 221 public final void setVersion(int verMajor, int verMinor) 222 { 223 m_verMajor = verMajor; 224 m_verMinor = verMinor; 225 } 226 227 232 public final void setUserName(String user) 233 { 234 m_userName = user; 235 } 236 237 240 protected final void clearStrings() 241 { 242 243 245 m_userName = null; 246 m_domain = null; 247 m_logonDomain = null; 248 m_otherDomain = null; 249 } 250 251 257 public void writeObject(DCEBuffer buf, DCEBuffer strBuf) 258 { 259 260 262 buf.putInt(getInformationLevel()); 263 buf.putPointer(true); 264 265 267 switch (getInformationLevel()) 268 { 269 270 272 case InfoLevel100: 273 buf.putInt(getPlatformId()); 274 buf.putPointer(true); 275 buf.putPointer(true); 276 buf.putInt(getMajorVersion()); 277 buf.putInt(getMinorVersion()); 278 279 strBuf.putString(getWorkstationName(), DCEBuffer.ALIGN_INT, true); 280 strBuf.putString(getDomain() != null ? getDomain() : "", DCEBuffer.ALIGN_INT, true); 281 break; 282 283 285 case 101: 286 break; 287 288 290 case 102: 291 break; 292 } 293 } 294 295 300 public String toString() 301 { 302 StringBuffer str = new StringBuffer (); 303 str.append("["); 304 305 str.append(getWorkstationName()); 306 str.append(":Domain="); 307 str.append(getDomain()); 308 str.append(":User="); 309 str.append(getUserName()); 310 str.append(":Id="); 311 str.append(getPlatformId()); 312 313 str.append(":v"); 314 str.append(getMajorVersion()); 315 str.append("."); 316 str.append(getMinorVersion()); 317 318 320 if (getLogonDomain() != null) 321 { 322 str.append(":Logon="); 323 str.append(getLogonDomain()); 324 } 325 326 if (getOtherDomains() != null) 327 { 328 str.append(":Other="); 329 str.append(getOtherDomains()); 330 } 331 332 334 str.append("]"); 335 return str.toString(); 336 } 337 } 338 | Popular Tags |