ACE.cs 1.1 KB

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
  12. {
  13. /// <summary>
  14. /// [MS-DTYP] ACE (Access Control Entry)
  15. /// </summary>
  16. public abstract class ACE
  17. {
  18. public abstract void WriteBytes(byte[] buffer, ref int offset);
  19. public abstract int Length
  20. {
  21. get;
  22. }
  23. public static ACE GetAce(byte[] buffer, int offset)
  24. {
  25. AceType aceType = (AceType)ByteReader.ReadByte(buffer, offset + 0);
  26. switch (aceType)
  27. {
  28. case AceType.ACCESS_ALLOWED_ACE_TYPE:
  29. return new AccessAllowedACE(buffer, offset);
  30. default:
  31. throw new NotImplementedException();
  32. }
  33. }
  34. }
  35. }