1 17 package org.alfresco.filesys.smb; 18 19 25 26 public final class Dialect 27 { 28 29 31 private static final String [] protList = { 32 "PC NETWORK PROGRAM 1.0", 33 "MICROSOFT NETWORKS 1.03", 34 "MICROSOFT NETWORKS 3.0", 35 "DOS LANMAN1.0", 36 "LANMAN1.0", 37 "DOS LM1.2X002", 38 "LM1.2X002", 39 "DOS LANMAN2.1", 40 "LANMAN2.1", 41 "Samba", 42 "NT LM 0.12", 43 "NT LANMAN 1.0" }; 44 45 47 private static final String [] protType = { 48 "Core", 49 "CorePlus", 50 "DOS LANMAN 1.0", 51 "LANMAN1.0", 52 "DOS LANMAN 2.1", 53 "LM1.2X002", 54 "LANMAN2.1", 55 "NT LM 0.12" }; 56 57 59 public static final int Core = 0; 60 public static final int CorePlus = 1; 61 public static final int DOSLanMan1 = 2; 62 public static final int LanMan1 = 3; 63 public static final int DOSLanMan2 = 4; 64 public static final int LanMan2 = 5; 65 public static final int LanMan2_1 = 6; 66 public static final int NT = 7; 67 public static final int Max = 8; 68 69 public static final int Unknown = -1; 70 71 73 private static final int[] protIdx = { 74 Core, 75 CorePlus, 76 DOSLanMan1, 77 DOSLanMan1, 78 LanMan1, 79 DOSLanMan2, 80 LanMan2, 81 LanMan2_1, 82 LanMan2_1, 83 NT, 84 NT, 85 NT }; 86 87 89 public static final int SMB_PROT_MAXSTRING = protIdx.length; 90 91 93 private static final int[] cmdtable = { 94 Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, Core, LanMan1, LanMan1, 0, 0, 0, 0, 0, LanMan1, LanMan1, LanMan1, LanMan1, 0, LanMan1, 0, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, LanMan1, 0, LanMan1, LanMan2, LanMan2, LanMan2, LanMan1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Core, Core, Core, Core, LanMan1, LanMan1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Core, Core, LanMan1, LanMan1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NT, NT, NT, NT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Core, Core, Core, Core, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1 }; 310 311 317 318 public static String DialectString(int i) 319 { 320 321 323 if (i >= protList.length) 324 return null; 325 return protList[i]; 326 } 327 328 335 public final static boolean DialectSupportsCommand(int dialect, int cmd) 336 { 337 339 if (cmd > cmdtable.length) 340 return false; 341 342 344 if (cmdtable[cmd] <= dialect) 345 return true; 346 return false; 347 } 348 349 355 356 public static int DialectType(int i) 357 { 358 return protIdx[i]; 359 } 360 361 367 public static int DialectType(String diastr) 368 { 369 370 372 int i = 0; 373 374 while (i < protList.length && protList[i].compareTo(diastr) != 0) 375 i++; 376 377 379 if (i < protList.length) 380 return DialectType(i); 381 else 382 return Unknown; 383 } 384 385 391 392 public static String DialectTypeString(int dia) 393 { 394 return protType[dia]; 395 } 396 397 402 403 public static int NumberOfDialects() 404 { 405 return protList.length; 406 } 407 } | Popular Tags |