SmbComReadAndXResponse.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. int start = bufferIndex;
  50. bufferIndex += 2;
  51. // reserved
  52. DataCompactionMode = ReadInt2(buffer, bufferIndex);
  53. bufferIndex += 4;
  54. // 2 reserved
  55. DataLength = ReadInt2(buffer, bufferIndex);
  56. bufferIndex += 2;
  57. DataOffset = ReadInt2(buffer, bufferIndex);
  58. bufferIndex += 12;
  59. // 10 reserved
  60. return bufferIndex - start;
  61. }
  62. internal override int ReadBytesWireFormat(byte[] buffer, int bufferIndex)
  63. {
  64. // handled special in SmbTransport.doRecv()
  65. return 0;
  66. }
  67. public override string ToString()
  68. {
  69. return "SmbComReadAndXResponse["
  70. + base.ToString()
  71. + ",dataCompactionMode=" + DataCompactionMode
  72. + ",dataLength=" + DataLength
  73. + ",dataOffset=" + DataOffset + "]";
  74. }
  75. }
  76. }