jwawsrm.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. // $Id: JwaWsrm.pas,v 1.6 2005/09/03 14:27:49 marquardt Exp $
  39. unit JwaWsrm;
  40. {$WEAKPACKAGEUNIT}
  41. {$HPPEMIT ''}
  42. {$HPPEMIT '#include "wsrm.h"'}
  43. {$HPPEMIT ''}
  44. {$I jediapilib.inc}
  45. interface
  46. uses
  47. JwaWindows;
  48. (*
  49. ** wsrm.h - winsock extension for Reliable Multicast (RMCast) Transport
  50. **
  51. ** This file contains PGM specific information for use by WinSock2 compatible
  52. ** applications that need Reliable Multicast Transport.
  53. **
  54. ** Copyright (c) Microsoft Corporation. All rights reserved.
  55. **
  56. ** Created: Mar 12, 2000
  57. **
  58. *)
  59. const
  60. IPPROTO_RM = 113;
  61. {$EXTERNALSYM IPPROTO_RM}
  62. MAX_MCAST_TTL = 255;
  63. {$EXTERNALSYM MAX_MCAST_TTL}
  64. //
  65. // options for setsockopt, getsockopt
  66. //
  67. RM_OPTIONSBASE = 1000;
  68. {$EXTERNALSYM RM_OPTIONSBASE}
  69. // Set/Query rate (Kb/Sec) + window size (Kb and/or MSec) -- described by RM_SEND_WINDOW below
  70. RM_RATE_WINDOW_SIZE = RM_OPTIONSBASE + 1;
  71. {$EXTERNALSYM RM_RATE_WINDOW_SIZE}
  72. // Set the size of the next message -- (ULONG)
  73. RM_SET_MESSAGE_BOUNDARY = RM_OPTIONSBASE + 2;
  74. {$EXTERNALSYM RM_SET_MESSAGE_BOUNDARY}
  75. // flush the entire data (window) right now -- not implemented
  76. RM_FLUSHCACHE = RM_OPTIONSBASE + 3;
  77. {$EXTERNALSYM RM_FLUSHCACHE}
  78. // Set or Query the window advance method on the sender -- methods enumerated in eWINDOW_ADVANCE_METHOD
  79. RM_SENDER_WINDOW_ADVANCE_METHOD = RM_OPTIONSBASE + 4;
  80. {$EXTERNALSYM RM_SENDER_WINDOW_ADVANCE_METHOD}
  81. // get sender statistics
  82. RM_SENDER_STATISTICS = RM_OPTIONSBASE + 5;
  83. {$EXTERNALSYM RM_SENDER_STATISTICS}
  84. // allow a late-joiner to NAK any packet upto the lowest sequence Id
  85. RM_LATEJOIN = RM_OPTIONSBASE + 6;
  86. {$EXTERNALSYM RM_LATEJOIN}
  87. // set IP multicast outgoing interface
  88. RM_SET_SEND_IF = RM_OPTIONSBASE + 7;
  89. {$EXTERNALSYM RM_SET_SEND_IF}
  90. // add IP multicast incoming interface
  91. RM_ADD_RECEIVE_IF = RM_OPTIONSBASE + 8;
  92. {$EXTERNALSYM RM_ADD_RECEIVE_IF}
  93. // delete IP multicast incoming interface
  94. RM_DEL_RECEIVE_IF = RM_OPTIONSBASE + 9;
  95. {$EXTERNALSYM RM_DEL_RECEIVE_IF}
  96. // Set/Query the Window's Advance rate (has to be less that MAX_WINDOW_INCREMENT_PERCENTAGE)
  97. RM_SEND_WINDOW_ADV_RATE = RM_OPTIONSBASE + 10;
  98. {$EXTERNALSYM RM_SEND_WINDOW_ADV_RATE}
  99. // Instruct to use parity-based forward error correction schemes
  100. RM_USE_FEC = RM_OPTIONSBASE + 11;
  101. {$EXTERNALSYM RM_USE_FEC}
  102. // Set the Ttl of the MCast packets -- (ULONG)
  103. RM_SET_MCAST_TTL = RM_OPTIONSBASE + 12;
  104. {$EXTERNALSYM RM_SET_MCAST_TTL}
  105. // get receiver statistics
  106. RM_RECEIVER_STATISTICS = RM_OPTIONSBASE + 13;
  107. {$EXTERNALSYM RM_RECEIVER_STATISTICS}
  108. // get receiver statistics
  109. RM_HIGH_SPEED_INTRANET_OPT = RM_OPTIONSBASE + 14;
  110. {$EXTERNALSYM RM_HIGH_SPEED_INTRANET_OPT}
  111. //==============================================================
  112. //
  113. // Definitions
  114. //
  115. const
  116. SENDER_DEFAULT_RATE_KBITS_PER_SEC = 56; // 56 Kbits/Sec
  117. {$EXTERNALSYM SENDER_DEFAULT_RATE_KBITS_PER_SEC}
  118. SENDER_DEFAULT_WINDOW_SIZE_BYTES = 10 * 1000 * 1000; // 10 Megs
  119. {$EXTERNALSYM SENDER_DEFAULT_WINDOW_SIZE_BYTES}
  120. SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = 15; // 15%
  121. {$EXTERNALSYM SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE}
  122. MAX_WINDOW_INCREMENT_PERCENTAGE = 25; // 25%
  123. {$EXTERNALSYM MAX_WINDOW_INCREMENT_PERCENTAGE}
  124. SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = 0; // 0%
  125. {$EXTERNALSYM SENDER_DEFAULT_LATE_JOINER_PERCENTAGE}
  126. SENDER_MAX_LATE_JOINER_PERCENTAGE = 75; // 75%
  127. {$EXTERNALSYM SENDER_MAX_LATE_JOINER_PERCENTAGE}
  128. BITS_PER_BYTE = 8;
  129. {$EXTERNALSYM BITS_PER_BYTE}
  130. LOG2_BITS_PER_BYTE = 3;
  131. {$EXTERNALSYM LOG2_BITS_PER_BYTE}
  132. type
  133. eWINDOW_ADVANCE_METHOD = (E_WINDOW_ADVANCE_BY_TIME = 1, E_WINDOW_USE_AS_DATA_CACHE);
  134. {$EXTERNALSYM eWINDOW_ADVANCE_METHOD}
  135. //==============================================================
  136. //
  137. // Structures
  138. //
  139. type
  140. _RM_SEND_WINDOW = record
  141. RateKbitsPerSec: ULONG; // Send rate
  142. WindowSizeInMSecs: ULONG;
  143. WindowSizeInBytes: ULONG;
  144. end;
  145. {$EXTERNALSYM _RM_SEND_WINDOW}
  146. RM_SEND_WINDOW = _RM_SEND_WINDOW;
  147. {$EXTERNALSYM RM_SEND_WINDOW}
  148. TRmSendWindow = RM_SEND_WINDOW;
  149. _RM_SENDER_STATS = record
  150. DataBytesSent: ULONGLONG; // # client data bytes sent out so far
  151. TotalBytesSent: ULONGLONG; // SPM, OData and RData bytes
  152. NaksReceived: ULONGLONG; // # NAKs received so far
  153. NaksReceivedTooLate: ULONGLONG; // # NAKs recvd after window advanced
  154. NumOutstandingNaks: ULONGLONG; // # NAKs yet to be responded to
  155. NumNaksAfterRData: ULONGLONG; // # NAKs yet to be responded to
  156. RepairPacketsSent: ULONGLONG; // # Repairs (RDATA) sent so far
  157. BufferSpaceAvailable: ULONGLONG; // # partial messages dropped
  158. TrailingEdgeSeqId: ULONGLONG; // smallest (oldest) Sequence Id in the window
  159. LeadingEdgeSeqId: ULONGLONG; // largest (newest) Sequence Id in the window
  160. RateKBitsPerSecOverall: ULONGLONG; // Internally calculated send-rate from the beginning
  161. RateKBitsPerSecLast: ULONGLONG; // Send-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
  162. TotalODataPacketsSent: ULONGLONG; // # ODATA packets sent so far
  163. end;
  164. {$EXTERNALSYM _RM_SENDER_STATS}
  165. RM_SENDER_STATS = _RM_SENDER_STATS;
  166. {$EXTERNALSYM RM_SENDER_STATS}
  167. TRmSenderStats = RM_SENDER_STATS;
  168. _RM_RECEIVER_STATS = record
  169. NumODataPacketsReceived: ULONGLONG;// # OData sequences received
  170. NumRDataPacketsReceived: ULONGLONG;// # RData sequences received
  171. NumDuplicateDataPackets: ULONGLONG;// # RData sequences received
  172. DataBytesReceived: ULONGLONG; // # client data bytes received out so far
  173. TotalBytesReceived: ULONGLONG; // SPM, OData and RData bytes
  174. RateKBitsPerSecOverall: ULONGLONG; // Internally calculated Receive-rate from the beginning
  175. RateKBitsPerSecLast: ULONGLONG; // Receive-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
  176. TrailingEdgeSeqId: ULONGLONG; // smallest (oldest) Sequence Id in the window
  177. LeadingEdgeSeqId: ULONGLONG; // largest (newest) Sequence Id in the window
  178. AverageSequencesInWindow: ULONGLONG;
  179. MinSequencesInWindow: ULONGLONG;
  180. MaxSequencesInWindow: ULONGLONG;
  181. FirstNakSequenceNumber: ULONGLONG; // # First Outstanding Nak
  182. NumPendingNaks: ULONGLONG; // # Sequences waiting for Ncfs
  183. NumOutstandingNaks: ULONGLONG; // # Sequences for which Ncfs have been received, but no data
  184. NumDataPacketsBuffered: ULONGLONG; // # Data packets currently buffered by transport
  185. TotalSelectiveNaksSent: ULONGLONG; // # Selective NAKs sent so far
  186. TotalParityNaksSent: ULONGLONG; // # Parity NAKs sent so far
  187. end;
  188. {$EXTERNALSYM _RM_RECEIVER_STATS}
  189. RM_RECEIVER_STATS = _RM_RECEIVER_STATS;
  190. {$EXTERNALSYM RM_RECEIVER_STATS}
  191. TRmReceiverStats = RM_RECEIVER_STATS;
  192. _RM_FEC_INFO = record
  193. FECBlockSize: USHORT;
  194. FECProActivePackets: USHORT;
  195. FECGroupSize: UCHAR;
  196. fFECOnDemandParityEnabled: BOOLEAN;
  197. end;
  198. {$EXTERNALSYM _RM_FEC_INFO}
  199. RM_FEC_INFO = _RM_FEC_INFO;
  200. {$EXTERNALSYM RM_FEC_INFO}
  201. TRmFecInfo = RM_FEC_INFO;
  202. implementation
  203. end.