NBNSService.java 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package de.tudarmstadt.informatik.hostage.protocol.smbutils;
  2. /**
  3. * NetBios Name Service services.
  4. * @author Wulf Pfeiffer.
  5. */
  6. public class NBNSService {
  7. public static final int SERVER = 0;
  8. public static final int MESSENGER = 1;
  9. public static final int WORKSTATION = 2;
  10. public static final int BROWSER_ELECTION = 3;
  11. public static final int LOCAL_MASTER_BROWSER = 4;
  12. public static final int BROWSER = 5;
  13. /**
  14. * Returns the proper bytes that are used in the wrapping of netbios names for the NBNSService.
  15. * @param service NBNSService.
  16. * @return bytes.
  17. */
  18. public static byte[] getServiceBytes(int service) {
  19. switch (service) {
  20. case NBNSService.SERVER:
  21. return new byte[]{0x43, 0x41};
  22. case NBNSService.MESSENGER:
  23. return new byte[]{0x41, 0x44};
  24. case NBNSService.WORKSTATION:
  25. return new byte[]{0x41, 0x41};
  26. case NBNSService.BROWSER_ELECTION:
  27. return new byte[]{0x42, 0x4f};
  28. case NBNSService.LOCAL_MASTER_BROWSER:
  29. return new byte[]{0x42, 0x4e};
  30. default:
  31. return new byte[]{0x43, 0x41};
  32. }
  33. }
  34. }