NameFlags.cs 995 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Utilities;
  11. namespace SMBLibrary.NetBios
  12. {
  13. public enum OwnerNodeType : byte
  14. {
  15. BNode = 0x00,
  16. PNode = 0x01,
  17. MNode = 0x10,
  18. }
  19. public struct NameFlags // ushort
  20. {
  21. public const int Length = 2;
  22. public OwnerNodeType NodeType;
  23. public bool WorkGroup;
  24. public static explicit operator ushort(NameFlags nameFlags)
  25. {
  26. ushort value = (ushort)(((byte)nameFlags.NodeType) << 13);
  27. if (nameFlags.WorkGroup)
  28. {
  29. value |= 0x8000;
  30. }
  31. return value;
  32. }
  33. }
  34. }