Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.8 KiB

  1. /* Framer.h
  2. *
  3. * Copyright (c) 1994-1995 by DataBeam Corporation, Lexington, KY
  4. *
  5. * Abstract:
  6. * This is the packet frame base class. This class defines the behavior
  7. * for other packet framers that inherit from this class. Some packet
  8. * framing definitions can be found in RFC1006 and Q.922
  9. *
  10. * Caveats:
  11. *
  12. * Authors:
  13. * James W. Lawwill
  14. */
  15. #ifndef _PACKET_FRAME_H_
  16. #define _PACKET_FRAME_H_
  17. typedef enum
  18. {
  19. PACKET_FRAME_NO_ERROR,
  20. PACKET_FRAME_DEST_BUFFER_TOO_SMALL,
  21. PACKET_FRAME_PACKET_DECODED,
  22. PACKET_FRAME_ILLEGAL_FLAG_FOUND,
  23. PACKET_FRAME_FATAL_ERROR
  24. }
  25. PacketFrameError;
  26. class PacketFrame
  27. {
  28. public:
  29. virtual PacketFrameError PacketEncode (
  30. PUChar source_address,
  31. UShort source_length,
  32. PUChar dest_address,
  33. UShort dest_length,
  34. DBBoolean prepend_flag,
  35. DBBoolean append_flag,
  36. PUShort packet_size) = 0;
  37. virtual PacketFrameError PacketDecode (
  38. PUChar source_address,
  39. UShort source_length,
  40. PUChar dest_address,
  41. UShort dest_length,
  42. PUShort bytes_accepted,
  43. PUShort packet_size,
  44. DBBoolean continue_packet) = 0;
  45. virtual Void GetOverhead (
  46. UShort original_packet_size,
  47. PUShort max_packet_size) = 0;
  48. };
  49. typedef PacketFrame * PPacketFrame;
  50. #endif
  51. /*
  52. * PacketFrameError PacketFrame::PacketEncode (
  53. * PUChar source_address,
  54. * UShort source_length,
  55. * PUChar dest_address,
  56. * UShort dest_length,
  57. * DBBoolean packet_start,
  58. * DBBoolean packet_end,
  59. * PUShort packet_size) = 0;
  60. *
  61. * Functional Description
  62. * This function receives takes the source data and encodes it.
  63. *
  64. * Formal Parameters
  65. * source_address - (i) Address of source buffer
  66. * source_length - (i) Length of source buffer
  67. * dest_address - (i) Address of destination buffer.
  68. * dest_length - (i) Length of destination buffer.
  69. * packet_start - (i) This is the beginning of a packet.
  70. * packet_end - (i) This is the end of a packet.
  71. * packet_size - (o) Size of packet after encoding
  72. *
  73. * Return Value
  74. * PACKET_FRAME_NO_ERROR - No error
  75. * PACKET_FRAME_FATAL_ERROR - Fatal error during encode
  76. * PACKET_FRAME_DEST_BUFFER_TOO_SMALL - Self-explanatory
  77. *
  78. * Side Effects
  79. * None
  80. *
  81. * Caveats
  82. * None
  83. */
  84. /*
  85. * PacketFrameError PacketFrame::PacketDecode (
  86. * PUChar source_address,
  87. * UShort source_length,
  88. * PUChar dest_address,
  89. * UShort dest_length,
  90. * PUShort bytes_accepted,
  91. * PUShort packet_size,
  92. * DBBoolean continue_packet) = 0;
  93. *
  94. * Functional Description
  95. * This function takes the stream data passed in and decodes it into a
  96. * packet
  97. *
  98. * Formal Parameters
  99. * source_address - (i) Address of source buffer. If this parm is
  100. * NULL, continue using the current address.
  101. * source_length - (i) Length of source buffer
  102. * dest_address - (i) Address of destination buffer. If this address
  103. * is NULL, continue using current buffer.
  104. * dest_length - (i) Length of destination buffer.
  105. * bytes_accepted - (o) Number of bytes processed before return
  106. * packet_size - (o) Size of packet after decoding
  107. * continue_packet - (i) Restart decoding
  108. *
  109. * Return Value
  110. * PACKET_FRAME_NO_ERROR - No error
  111. * PACKET_FRAME_FATAL_ERROR - Fatal error during encode
  112. * PACKET_FRAME_DEST_BUFFER_TOO_SMALL - Self-explanatory
  113. * PACKET_FRAME_PACKET_DECODED - Self-explanatory
  114. *
  115. * Side Effects
  116. * None
  117. *
  118. * Caveats
  119. * None
  120. *
  121. */
  122. /*
  123. * Void PacketFrame::GetOverhead (
  124. * UShort original_packet_size,
  125. * PUShort max_packet_size) = 0;
  126. *
  127. * Functional Description
  128. * This returns the new maximum packet size
  129. *
  130. * Formal Parameters
  131. * original_packet_size - (i)
  132. * max_packet_size - (o) new maximum packet size
  133. *
  134. * Return Value
  135. * PACKET_FRAME_NO_ERROR - No error
  136. *
  137. * Side Effects
  138. * None
  139. *
  140. * Caveats
  141. * None
  142. *
  143. */