RequestGetDfsReferral.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Copyright (C) 2014 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-DFSC] REQ_GET_DFS_REFERRAL
  15. /// </summary>
  16. public class RequestGetDfsReferral
  17. {
  18. public ushort MaxReferralLevel;
  19. public string RequestFileName; // Unicode
  20. public RequestGetDfsReferral()
  21. {
  22. }
  23. public RequestGetDfsReferral(byte[] buffer)
  24. {
  25. MaxReferralLevel = LittleEndianConverter.ToUInt16(buffer, 0);
  26. RequestFileName = ByteReader.ReadNullTerminatedUTF16String(buffer, 2);
  27. }
  28. public byte[] GetBytes()
  29. {
  30. int length = 2 + RequestFileName.Length * 2 + 2;
  31. byte[] buffer = new byte[length];
  32. LittleEndianWriter.WriteUInt16(buffer, 0, MaxReferralLevel);
  33. ByteWriter.WriteUTF16String(buffer, 2, RequestFileName);
  34. return buffer;
  35. }
  36. }
  37. }