jwawsrm.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. {******************************************************************************}
  2. { }
  3. { Interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2003 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { Portions created by Marcel van Brakel are Copyright (C) 2003 }
  9. { Marcel van Brakel. All Rights Reserved. }
  10. { }
  11. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  12. { }
  13. { You may retrieve the latest version of this file at the Project JEDI }
  14. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  15. { }
  16. { The contents of this file are used with permission, subject to the Mozilla }
  17. { Public License Version 1.1 (the "License"); you may not use this file except }
  18. { in compliance with the License. You may obtain a copy of the License at }
  19. { http://www.mozilla.org/MPL/MPL-1.1.html }
  20. { }
  21. { Software distributed under the License is distributed on an "AS IS" basis, }
  22. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  23. { the specific language governing rights and limitations under the License. }
  24. { }
  25. { Alternatively, the contents of this file may be used under the terms of the }
  26. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  27. { provisions of the LGPL License are applicable instead of those above. }
  28. { If you wish to allow use of your version of this file only under the terms }
  29. { of the LGPL License and not to allow others to use your version of this file }
  30. { under the MPL, indicate your decision by deleting the provisions above and }
  31. { replace them with the notice and other provisions required by the LGPL }
  32. { License. If you do not delete the provisions above, a recipient may use }
  33. { your version of this file under either the MPL or the LGPL License. }
  34. { }
  35. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  36. { }
  37. {******************************************************************************}
  38. unit JwaWsrm;
  39. {$WEAKPACKAGEUNIT}
  40. {$HPPEMIT ''}
  41. {$HPPEMIT '#include "wsrm.h"'}
  42. {$HPPEMIT ''}
  43. {$I jediapilib.inc}
  44. interface
  45. uses
  46. JwaWinType;
  47. (*
  48. ** wsrm.h - winsock extension for Reliable Multicast (RMCast) Transport
  49. **
  50. ** This file contains PGM specific information for use by WinSock2 compatible
  51. ** applications that need Reliable Multicast Transport.
  52. **
  53. ** Copyright (c) Microsoft Corporation. All rights reserved.
  54. **
  55. ** Created: Mar 12, 2000
  56. **
  57. *)
  58. const
  59. IPPROTO_RM = 113;
  60. {$EXTERNALSYM IPPROTO_RM}
  61. MAX_MCAST_TTL = 255;
  62. {$EXTERNALSYM MAX_MCAST_TTL}
  63. //
  64. // options for setsockopt, getsockopt
  65. //
  66. RM_OPTIONSBASE = 1000;
  67. {$EXTERNALSYM RM_OPTIONSBASE}
  68. // Set/Query rate (Kb/Sec) + window size (Kb and/or MSec) -- described by RM_SEND_WINDOW below
  69. RM_RATE_WINDOW_SIZE = RM_OPTIONSBASE + 1;
  70. {$EXTERNALSYM RM_RATE_WINDOW_SIZE}
  71. // Set the size of the next message -- (ULONG)
  72. RM_SET_MESSAGE_BOUNDARY = RM_OPTIONSBASE + 2;
  73. {$EXTERNALSYM RM_SET_MESSAGE_BOUNDARY}
  74. // flush the entire data (window) right now -- not implemented
  75. RM_FLUSHCACHE = RM_OPTIONSBASE + 3;
  76. {$EXTERNALSYM RM_FLUSHCACHE}
  77. // Set or Query the window advance method on the sender -- methods enumerated in eWINDOW_ADVANCE_METHOD
  78. RM_SENDER_WINDOW_ADVANCE_METHOD = RM_OPTIONSBASE + 4;
  79. {$EXTERNALSYM RM_SENDER_WINDOW_ADVANCE_METHOD}
  80. // get sender statistics
  81. RM_SENDER_STATISTICS = RM_OPTIONSBASE + 5;
  82. {$EXTERNALSYM RM_SENDER_STATISTICS}
  83. // allow a late-joiner to NAK any packet upto the lowest sequence Id
  84. RM_LATEJOIN = RM_OPTIONSBASE + 6;
  85. {$EXTERNALSYM RM_LATEJOIN}
  86. // set IP multicast outgoing interface
  87. RM_SET_SEND_IF = RM_OPTIONSBASE + 7;
  88. {$EXTERNALSYM RM_SET_SEND_IF}
  89. // add IP multicast incoming interface
  90. RM_ADD_RECEIVE_IF = RM_OPTIONSBASE + 8;
  91. {$EXTERNALSYM RM_ADD_RECEIVE_IF}
  92. // delete IP multicast incoming interface
  93. RM_DEL_RECEIVE_IF = RM_OPTIONSBASE + 9;
  94. {$EXTERNALSYM RM_DEL_RECEIVE_IF}
  95. // Set/Query the Window's Advance rate (has to be less that MAX_WINDOW_INCREMENT_PERCENTAGE)
  96. RM_SEND_WINDOW_ADV_RATE = RM_OPTIONSBASE + 10;
  97. {$EXTERNALSYM RM_SEND_WINDOW_ADV_RATE}
  98. // Instruct to use parity-based forward error correction schemes
  99. RM_USE_FEC = RM_OPTIONSBASE + 11;
  100. {$EXTERNALSYM RM_USE_FEC}
  101. // Set the Ttl of the MCast packets -- (ULONG)
  102. RM_SET_MCAST_TTL = RM_OPTIONSBASE + 12;
  103. {$EXTERNALSYM RM_SET_MCAST_TTL}
  104. // get receiver statistics
  105. RM_RECEIVER_STATISTICS = RM_OPTIONSBASE + 13;
  106. {$EXTERNALSYM RM_RECEIVER_STATISTICS}
  107. // get receiver statistics
  108. RM_HIGH_SPEED_INTRANET_OPT = RM_OPTIONSBASE + 14;
  109. {$EXTERNALSYM RM_HIGH_SPEED_INTRANET_OPT}
  110. //==============================================================
  111. //
  112. // Definitions
  113. //
  114. const
  115. SENDER_DEFAULT_RATE_KBITS_PER_SEC = 56; // 56 Kbits/Sec
  116. {$EXTERNALSYM SENDER_DEFAULT_RATE_KBITS_PER_SEC}
  117. SENDER_DEFAULT_WINDOW_SIZE_BYTES = 10 * 1000 * 1000; // 10 Megs
  118. {$EXTERNALSYM SENDER_DEFAULT_WINDOW_SIZE_BYTES}
  119. SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = 15; // 15%
  120. {$EXTERNALSYM SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE}
  121. MAX_WINDOW_INCREMENT_PERCENTAGE = 25; // 25%
  122. {$EXTERNALSYM MAX_WINDOW_INCREMENT_PERCENTAGE}
  123. SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = 0; // 0%
  124. {$EXTERNALSYM SENDER_DEFAULT_LATE_JOINER_PERCENTAGE}
  125. SENDER_MAX_LATE_JOINER_PERCENTAGE = 75; // 75%
  126. {$EXTERNALSYM SENDER_MAX_LATE_JOINER_PERCENTAGE}
  127. BITS_PER_BYTE = 8;
  128. {$EXTERNALSYM BITS_PER_BYTE}
  129. LOG2_BITS_PER_BYTE = 3;
  130. {$EXTERNALSYM LOG2_BITS_PER_BYTE}
  131. type
  132. eWINDOW_ADVANCE_METHOD = (E_WINDOW_ADVANCE_BY_TIME = 1, E_WINDOW_USE_AS_DATA_CACHE);
  133. {$EXTERNALSYM eWINDOW_ADVANCE_METHOD}
  134. //==============================================================
  135. //
  136. // Structures
  137. //
  138. type
  139. _RM_SEND_WINDOW = record
  140. RateKbitsPerSec: ULONG; // Send rate
  141. WindowSizeInMSecs: ULONG;
  142. WindowSizeInBytes: ULONG;
  143. end;
  144. {$EXTERNALSYM _RM_SEND_WINDOW}
  145. RM_SEND_WINDOW = _RM_SEND_WINDOW;
  146. {$EXTERNALSYM RM_SEND_WINDOW}
  147. TRmSendWindow = RM_SEND_WINDOW;
  148. _RM_SENDER_STATS = record
  149. DataBytesSent: ULONGLONG; // # client data bytes sent out so far
  150. TotalBytesSent: ULONGLONG; // SPM, OData and RData bytes
  151. NaksReceived: ULONGLONG; // # NAKs received so far
  152. NaksReceivedTooLate: ULONGLONG; // # NAKs recvd after window advanced
  153. NumOutstandingNaks: ULONGLONG; // # NAKs yet to be responded to
  154. NumNaksAfterRData: ULONGLONG; // # NAKs yet to be responded to
  155. RepairPacketsSent: ULONGLONG; // # Repairs (RDATA) sent so far
  156. BufferSpaceAvailable: ULONGLONG; // # partial messages dropped
  157. TrailingEdgeSeqId: ULONGLONG; // smallest (oldest) Sequence Id in the window
  158. LeadingEdgeSeqId: ULONGLONG; // largest (newest) Sequence Id in the window
  159. RateKBitsPerSecOverall: ULONGLONG; // Internally calculated send-rate from the beginning
  160. RateKBitsPerSecLast: ULONGLONG; // Send-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
  161. TotalODataPacketsSent: ULONGLONG; // # ODATA packets sent so far
  162. end;
  163. {$EXTERNALSYM _RM_SENDER_STATS}
  164. RM_SENDER_STATS = _RM_SENDER_STATS;
  165. {$EXTERNALSYM RM_SENDER_STATS}
  166. TRmSenderStats = RM_SENDER_STATS;
  167. _RM_RECEIVER_STATS = record
  168. NumODataPacketsReceived: ULONGLONG;// # OData sequences received
  169. NumRDataPacketsReceived: ULONGLONG;// # RData sequences received
  170. NumDuplicateDataPackets: ULONGLONG;// # RData sequences received
  171. DataBytesReceived: ULONGLONG; // # client data bytes received out so far
  172. TotalBytesReceived: ULONGLONG; // SPM, OData and RData bytes
  173. RateKBitsPerSecOverall: ULONGLONG; // Internally calculated Receive-rate from the beginning
  174. RateKBitsPerSecLast: ULONGLONG; // Receive-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
  175. TrailingEdgeSeqId: ULONGLONG; // smallest (oldest) Sequence Id in the window
  176. LeadingEdgeSeqId: ULONGLONG; // largest (newest) Sequence Id in the window
  177. AverageSequencesInWindow: ULONGLONG;
  178. MinSequencesInWindow: ULONGLONG;
  179. MaxSequencesInWindow: ULONGLONG;
  180. FirstNakSequenceNumber: ULONGLONG; // # First Outstanding Nak
  181. NumPendingNaks: ULONGLONG; // # Sequences waiting for Ncfs
  182. NumOutstandingNaks: ULONGLONG; // # Sequences for which Ncfs have been received, but no data
  183. NumDataPacketsBuffered: ULONGLONG; // # Data packets currently buffered by transport
  184. TotalSelectiveNaksSent: ULONGLONG; // # Selective NAKs sent so far
  185. TotalParityNaksSent: ULONGLONG; // # Parity NAKs sent so far
  186. end;
  187. {$EXTERNALSYM _RM_RECEIVER_STATS}
  188. RM_RECEIVER_STATS = _RM_RECEIVER_STATS;
  189. {$EXTERNALSYM RM_RECEIVER_STATS}
  190. TRmReceiverStats = RM_RECEIVER_STATS;
  191. _RM_FEC_INFO = record
  192. FECBlockSize: USHORT;
  193. FECProActivePackets: USHORT;
  194. FECGroupSize: UCHAR;
  195. fFECOnDemandParityEnabled: BOOLEAN;
  196. end;
  197. {$EXTERNALSYM _RM_FEC_INFO}
  198. RM_FEC_INFO = _RM_FEC_INFO;
  199. {$EXTERNALSYM RM_FEC_INFO}
  200. TRmFecInfo = RM_FEC_INFO;
  201. implementation
  202. end.