' ########################################################################################
' Microsoft Windows
' File: wsrm.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
'/*
'** wsrm.h - winsock extension for Reliable Multicast (RMCast) Transport
'**
'** This file contains PGM specific information for use by WinSock2 compatible
'** applications that need Reliable Multicast Transport.
'**
'** Copyright (c) Microsoft Corporation. All rights reserved.
'**
'** Created: Mar 12, 2000
'**
'*/
#IF NOT %DEF(PBX_wsrm_PBI)
#DEFINE PBX_wsrm_PBI
%EQUATE `WSRM_INC = 1
%EQUATE `IPPROTO_RM = 113
%EQUATE `MAX_MCAST_TTL = 255
'//
'// options for setsockopt, getsockopt
'//
%EQUATE `RM_OPTIONSBASE = 1000
'// Set/Query rate (Kb/Sec) + window size (Kb and/or MSec) -- described by RM_SEND_WINDOW below
%EQUATE `RM_RATE_WINDOW_SIZE = %RM_OPTIONSBASE + 1
'// Set the size of the next message -- (ULONG)
%EQUATE `RM_SET_MESSAGE_BOUNDARY = %RM_OPTIONSBASE + 2
'// flush the entire data (window) right now -- not implemented
%EQUATE `RM_FLUSHCACHE = %RM_OPTIONSBASE + 3
'// Set or Query the window advance method on the sender -- methods enumerated in eWINDOW_ADVANCE_METHOD
%EQUATE `RM_SENDER_WINDOW_ADVANCE_METHOD = %RM_OPTIONSBASE + 4
'// get sender statistics
%EQUATE `RM_SENDER_STATISTICS = %RM_OPTIONSBASE + 5
'// allow a late-joiner to NAK any packet upto the lowest sequence Id
%EQUATE `RM_LATEJOIN = %RM_OPTIONSBASE + 6
'// set IP multicast outgoing interface
%EQUATE `RM_SET_SEND_IF = %RM_OPTIONSBASE + 7
'// add IP multicast incoming interface
%EQUATE `RM_ADD_RECEIVE_IF = %RM_OPTIONSBASE + 8
'// delete IP multicast incoming interface
%EQUATE `RM_DEL_RECEIVE_IF = %RM_OPTIONSBASE + 9
'// Set/Query the Window's Advance rate (has to be less that MAX_WINDOW_INCREMENT_PERCENTAGE)
%EQUATE `RM_SEND_WINDOW_ADV_RATE = %RM_OPTIONSBASE + 10
'// Instruct to use parity-based forward error correction schemes
%EQUATE `RM_USE_FEC = %RM_OPTIONSBASE + 11
'// Set the Ttl of the MCast packets -- (ULONG)
%EQUATE `RM_SET_MCAST_TTL = %RM_OPTIONSBASE + 12
'// get receiver statistics
%EQUATE `RM_RECEIVER_STATISTICS = %RM_OPTIONSBASE + 13
'// get receiver statistics
%EQUATE `RM_HIGH_SPEED_INTRANET_OPT = %RM_OPTIONSBASE + 14
'//==============================================================
'//
'// Definitions
'//
%EQUATE `SENDER_DEFAULT_RATE_KBITS_PER_SEC = 56 ' // 56 Kbits/Sec
%EQUATE `SENDER_DEFAULT_WINDOW_SIZE_BYTES = 10 *1000*1000 ' // 10 Megs
%EQUATE `SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = 15 ' // 15%
%EQUATE `MAX_WINDOW_INCREMENT_PERCENTAGE = 25 ' // 25%
%EQUATE `SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = 0 ' // 0%
%EQUATE `SENDER_MAX_LATE_JOINER_PERCENTAGE = 75 ' // 75%
%EQUATE `BITS_PER_BYTE = 8
%EQUATE `LOG2_BITS_PER_BYTE = 3
' enum eWINDOW_ADVANCE_METHOD
%EQUATE `E_WINDOW_ADVANCE_BY_TIME = 1 ' // Default mode
%EQUATE `E_WINDOW_USE_AS_DATA_CACHE = 2
'//==============================================================
'//
'// Structures
'//
' // Size = 12 bytes
TYPE RM_SEND_WINDOW DWORD
 RateKbitsPerSec AS DWORD ' ULONG // Send rate
 WindowSizeInMSecs AS DWORD ' ULONG
 WindowSizeInBytes AS DWORD ' ULONG
END TYPE
' // Size = 104 bytes
TYPE RM_SENDER_STATS QWORD
 DataBytesSent AS QUAD ' ULONGULONG // # client data bytes sent out so far
 TotalBytesSent AS QUAD ' ULONGULONG // SPM, OData and RData bytes
 NaksReceived AS QUAD ' ULONGULONG // # NAKs received so far
 NaksReceivedTooLate AS QUAD ' ULONGULONG // # NAKs recvd after window advanced
 NumOutstandingNaks AS QUAD ' ULONGULONG // # NAKs yet to be responded to
 NumNaksAfterRData AS QUAD ' ULONGULONG // # NAKs yet to be responded to
 RepairPacketsSent AS QUAD ' ULONGULONG // # Repairs (RDATA) sent so far
 BufferSpaceAvailable AS QUAD ' ULONGULONG // # partial messages dropped
 TrailingEdgeSeqId AS QUAD ' ULONGULONG // smallest (oldest) Sequence Id in the window
 LeadingEdgeSeqId AS QUAD ' ULONGULONG // largest (newest) Sequence Id in the window
 RateKBitsPerSecOverall AS QUAD ' ULONGULONG // Internally calculated send-rate from the beginning
 RateKBitsPerSecLast AS QUAD ' ULONGULONG // Send-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
 TotalODataPacketsSent AS QUAD ' ULONGULONG // # ODATA packets sent so far
END TYPE
' // Size = 144 bytes
TYPE RM_RECEIVER_STATS QWORD
 NumODataPacketsReceived AS QUAD ' ULONGULONG // # OData sequences received
 NumRDataPacketsReceived AS QUAD ' ULONGULONG // # RData sequences received
 NumDuplicateDataPackets AS QUAD ' ULONGULONG // # RData sequences received
 DataBytesReceived AS QUAD ' ULONGULONG // # client data bytes received out so far
 TotalBytesReceived AS QUAD ' ULONGULONG // SPM, OData and RData bytes
 RateKBitsPerSecOverall AS QUAD ' ULONGULONG // Internally calculated Receive-rate from the beginning
 RateKBitsPerSecLast AS QUAD ' ULONGULONG // Receive-rate calculated every INTERNAL_RATE_CALCULATION_FREQUENCY
 TrailingEdgeSeqId AS QUAD ' ULONGULONG // smallest (oldest) Sequence Id in the window
 LeadingEdgeSeqId AS QUAD ' ULONGULONG // largest (newest) Sequence Id in the window
 AverageSequencesInWindow AS QUAD ' ULONGULONG
 MinSequencesInWindow AS QUAD ' ULONGULONG
 MaxSequencesInWindow AS QUAD ' ULONGULONG
 FirstNakSequenceNumber AS QUAD ' ULONGULONG // # First Outstanding Nak
 NumPendingNaks AS QUAD ' ULONGULONG // # Sequences waiting for Ncfs
 NumOutstandingNaks AS QUAD ' ULONGULONG // # Sequences for which Ncfs have been received, but no data
 NumDataPacketsBuffered AS QUAD ' ULONGULONG // # Data packets currently buffered by transport
 TotalSelectiveNaksSent AS QUAD ' ULONGULONG // # Selective NAKs sent so far
 TotalParityNaksSent AS QUAD ' ULONGULONG // # Parity NAKs sent so far
END TYPE
' // Size = 6 bytes
TYPE RM_FEC_INFO BYTE
 FECBlockSize AS WORD ' USHORT
 FECProActivePackets AS WORD ' USHORT
 FECGroupSize AS BYTE ' UCHAR
 fFECOnDemandParityEnabled AS BYTE ' BOOLEAN
END TYPE
#ENDIF
