SmbComReadAndXResponse.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // This code is derived from jcifs smb client library <jcifs at samba dot org>
  2. // Ported by J. Arturo <webmaster at komodosoft dot net>
  3. //
  4. // This library is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public
  6. // License as published by the Free Software Foundation; either
  7. // version 2.1 of the License, or (at your option) any later version.
  8. //
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. // Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public
  15. // License along with this library; if not, write to the Free Software
  16. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. namespace SharpCifs.Smb
  18. {
  19. internal class SmbComReadAndXResponse : AndXServerMessageBlock
  20. {
  21. internal byte[] B;
  22. internal int Off;
  23. internal int DataCompactionMode;
  24. internal int DataLength;
  25. internal int DataOffset;
  26. public SmbComReadAndXResponse()
  27. {
  28. }
  29. internal SmbComReadAndXResponse(byte[] b, int off)
  30. {
  31. this.B = b;
  32. this.Off = off;
  33. }
  34. internal virtual void SetParam(byte[] b, int off)
  35. {
  36. this.B = b;
  37. this.Off = off;
  38. }
  39. internal override int WriteParameterWordsWireFormat(byte[] dst, int dstIndex)
  40. {
  41. return 0;
  42. }
  43. internal override int WriteBytesWireFormat(byte[] dst, int dstIndex)
  44. {
  45. return 0;
  46. }
  47. internal override int ReadParameterWordsWireFormat(byte[] buffer, int bufferIndex
  48. )
  49. {
  50. int start = bufferIndex;
  51. bufferIndex += 2;
  52. // reserved
  53. DataCompactionMode = ReadInt2(buffer, bufferIndex);
  54. bufferIndex += 4;
  55. // 2 reserved
  56. DataLength = ReadInt2(buffer, bufferIndex);
  57. bufferIndex += 2;
  58. DataOffset = ReadInt2(buffer, bufferIndex);
  59. bufferIndex += 12;
  60. // 10 reserved
  61. return bufferIndex - start;
  62. }
  63. internal override int ReadBytesWireFormat(byte[] buffer, int bufferIndex)
  64. {
  65. // handled special in SmbTransport.doRecv()
  66. return 0;
  67. }
  68. public override string ToString()
  69. {
  70. return "SmbComReadAndXResponse[" + base.ToString() + ",dataCompactionMode="
  71. + DataCompactionMode + ",dataLength=" + DataLength + ",dataOffset=" + DataOffset
  72. + "]";
  73. }
  74. }
  75. }