Source code of Windows XP (NT5)
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.

420 lines
14 KiB

  1. /*---------------------------------------------------------------------------
  2. * File : RRCMDATA.H
  3. *
  4. * RRCM data structures information.
  5. *
  6. * INTEL Corporation Proprietary Information
  7. * This listing is supplied under the terms of a license agreement with
  8. * Intel Corporation and may not be copied nor disclosed except in
  9. * accordance with the terms of that agreement.
  10. * Copyright (c) 1995 Intel Corporation.
  11. *--------------------------------------------------------------------------*/
  12. #ifndef __RRCMDATA_H_
  13. #define __RRCMDATA_H_
  14. // force 8 byte structure packing
  15. #include <pshpack8.h>
  16. #define MAX_DWORD 4294967295
  17. #define HASH_MODULO 255
  18. #define FILENAME_LENGTH 128
  19. #define RTCP_FEEDBACK_LIST 0
  20. // RTP/RTCP collision data
  21. typedef struct _rtp_collision
  22. {
  23. char collideAddr[MAX_ADDR_LEN];
  24. int addrLen;
  25. DWORD dwCollideTime;
  26. DWORD dwCurRecvRTCPrptNumber;
  27. DWORD SSRC;
  28. } RTP_COLLISION, *PRTP_COLLISION;
  29. // RTCP Session Information data structure
  30. typedef struct _RTCP_SESSION
  31. {
  32. LINK_LIST RTCPList; // Next/prev RTCP session ptrs
  33. // Synchronization elements
  34. CRITICAL_SECTION critSect; // Critical section
  35. HANDLE hExitEvent; // Exit RTCP event handle
  36. #ifdef ENABLE_ISDM2
  37. // ISDM2 Handle
  38. KEY_HANDLE hSessKey; // Key to this sessions ISDM info
  39. #endif
  40. // List of SSRC(s) on the transmit list, i.e., our own transmit SSRC's
  41. // and list of SSRC(s) received
  42. HEAD_TAIL RcvSSRCList; // Rcv SSRC list head/tail ptrs
  43. HEAD_TAIL XmtSSRCList; // Xmt SSRC list head/tail ptrs
  44. // List of Rcv/Xmt data structure. The data resides in a heap
  45. // in order to avoid page fault
  46. HEAD_TAIL RTCPrcvBfrList; // Rcv buffers head/tail ptrs
  47. HANDLE hHeapRcvBfrList; // Heap handle to Rcv bfrs list
  48. // Rcv/Xmt buffers have their own heap
  49. HANDLE hHeapRcvBfr; // Heap handle to Rcv Bfrs mem.
  50. WSABUF XmtBfr; // RTCP send buffer descriptor
  51. // Application provided list of buffers where RRCM will copy the raw
  52. // RTCP buffers
  53. HEAD_TAIL appRtcpBfrList; // Head/tail ptrs for app bfr list
  54. DWORD dwInitNumFreeRcvBfr; // Number of Free Rcv Buffers
  55. DWORD dwRcvBfrSize; // Receive Buffer size
  56. DWORD dwXmtBfrSize; // Transmit Buffer size
  57. DWORD dwSessionStatus; // Entry status:
  58. char toBfr[MAX_ADDR_LEN]; // Destination address
  59. int toLen; // Size of lpTo
  60. int avgRTCPpktSizeRcvd; // Average RTCP pckt size
  61. DWORD dwNumStreamPerSes; // Num of streams per Session
  62. DWORD dwCurNumSSRCperSes; // Num of SSRC per Session
  63. #ifdef MONITOR_STATS
  64. DWORD dwHiNumSSRCperSes; // High Num of SSRC per Session
  65. #endif
  66. // Receive information (shared by all streams of this session)
  67. HANDLE hShutdownDone; // Shutdown procedure done
  68. int dwNumRcvIoPending; // Number of receive I/O pending
  69. // Notification callback of RRCM events if desired by the application
  70. VOID (*pRRCMcallback)(RRCM_EVENT_T, DWORD_PTR, DWORD_PTR, DWORD_PTR);
  71. // User information on callback
  72. DWORD_PTR dwCallbackUserInfo;
  73. // RTP Loop/Collision information
  74. RTP_COLLISION collInfo[NUM_COLLISION_ENTRIES];
  75. } RTCP_SESSION, *PRTCP_SESSION;
  76. // RTCP Xmt information
  77. typedef struct _XMIT_INFO
  78. {
  79. DWORD dwNumPcktSent; // Number of packet sent
  80. DWORD dwNumBytesSent; // Number of bytes sent
  81. DWORD dwNTPmsw; // NTP most significant word
  82. DWORD dwNTPlsw; // NTP least significant word
  83. DWORD dwRTPts; // RTP timestamp
  84. DWORD dwCurXmtSeqNum; // Current Xmt sequence number
  85. DWORD dwPrvXmtSeqNum; // Previous Xmt sequence number
  86. DWORD dwRtcpStreamMinBW; // Minimal session's bandwidth
  87. #ifdef DYNAMIC_RTCP_BW
  88. DWORD dwCalculatedXmtBW; // Session's calculated bandwidth
  89. DWORD dwLastTimeBwCalculated; // Last time BW was calculated
  90. DWORD dwLastTimeNumBytesSent; // Last time number of bytes send
  91. DWORD dwLastTimeNumPcktSent; // Last time number of bytes send
  92. #endif
  93. DWORD dwLastSR; // Last sender report (RTP format)
  94. DWORD dwLastSRLocalTime; // Last sender report local time
  95. DWORD dwLastSendRTPSystemTime; // Last RTP packet send time
  96. DWORD dwLastSendRTPTimeStamp; // RTP timestamp of the last packet
  97. } XMIT_INFO, *PXMIT_INFO;
  98. // RTCP receive information
  99. typedef struct _RECV_INFO
  100. {
  101. DWORD dwNumPcktRcvd; // Number of packet received
  102. DWORD dwPrvNumPcktRcvd; // Previous number of pckt rcvd
  103. DWORD dwExpectedPrior; // Number previously expected
  104. DWORD dwNumBytesRcvd; // Number of bytes rcvd
  105. DWORD dwBaseRcvSeqNum; // Initial sequence number rcvd
  106. DWORD dwBadSeqNum; // Potential new valid seq num
  107. DWORD dwProbation; // # consec pkts for validation
  108. RTP_SEQ_NUM XtendedSeqNum; // Xtnded highest seq. num rcvd
  109. DWORD dwPropagationTime; // Last packet's transmit time
  110. DWORD interJitter; // Interarrival jitter
  111. #ifdef DYNAMIC_RTCP_BW
  112. DWORD dwCalculatedRcvBW; // Session's calculated bandwidth
  113. DWORD dwLastTimeBwCalculated; // Last time BW was calculated
  114. DWORD dwLastTimeNumBytesRcvd; // Last time number of bytes rcvd
  115. DWORD dwLastTimeNumPcktRcvd; // Last time number of bytes rcvd
  116. #endif
  117. } RECV_INFO, *PRECV_INFO;
  118. // RRCM statistics table entry data structure
  119. typedef struct _SSRC_ENTRY
  120. {
  121. LINK_LIST SSRCList; // Next/prev SSRC entry
  122. CRITICAL_SECTION critSect; // Critical section synch.
  123. PRTCP_SESSION pRTCPses; // Point to the parent session
  124. DWORD SSRC; // Source SSRC
  125. DWORD PayLoadType; // payload associated with this SSRC
  126. DWORD dwSSRCStatus; // Entry status
  127. #define NETWK_ADDR_UPDATED 0x80000000 // Network Address already done
  128. #define SEQ_NUM_UPDATED 0x40000000 // XMT Sequence already done
  129. #define THIRD_PARTY_COLLISION 0x20000000 // Third party collsion detected
  130. #define CLOSE_RTCP_SOCKET 0x10000000 // RTCP will close the RTCP socket
  131. #define RTCP_XMT_USER_CTRL 0x08000000 // User's has RTCP timeout control
  132. // SSRC Transmit information
  133. // If on our transmit list, this is our SSRC information, and if on our
  134. // receive list, this is a SR feedback information.
  135. XMIT_INFO xmtInfo;
  136. // SSRC Receive information
  137. // If on our transmit list, this is undefined information, and if on our
  138. // receive list, this is the SSRC's receive information, ie, this SSRC
  139. // is an active sender somewhere on the network. This information is
  140. // maintained by RTP, and used by RTCP to generate RR.
  141. RECV_INFO rcvInfo;
  142. // Feedback information received about ourselve if we're an active source
  143. RTCP_FEEDBACK rrFeedback; // Feedback information
  144. DWORD dwLastReportRcvdTime; // Time of last report received
  145. DWORD dwNextReportSendTime; // Next scheduled report time (ms)
  146. #ifdef _DEBUG
  147. DWORD dwPrvTime; // Elapsed time between report
  148. #endif
  149. // SSRC SDES information
  150. SDES_DATA cnameInfo; // CNAME information
  151. SDES_DATA nameInfo; // NAME information
  152. SDES_DATA emailInfo; // EMAIL address information
  153. SDES_DATA phoneInfo; // PHONE number information
  154. SDES_DATA locInfo; // LOCation (users) information
  155. SDES_DATA toolInfo; // TOOL name information
  156. SDES_DATA txtInfo; // TEXT (NOTE) information
  157. SDES_DATA privInfo; // PRIVate information
  158. // SSRC network address information
  159. int fromLen; // From address length
  160. char from[MAX_ADDR_LEN]; // From address
  161. // !!! Not implemented (entries will grow exponentionally) !!!
  162. // List of SSRCs in RR received by this SSRC. It might be useful for a
  163. // sender or a controller to know how other active sources are received
  164. // by others.
  165. // The drawback is that the number of entries will grow exponentially
  166. // with the number of participants.
  167. // Currently not implemented.
  168. #if RTCP_FEEDBACK_LIST
  169. HEAD_TAIL rrFeedbackList; // Head/Tail of feedback list
  170. #endif
  171. #ifdef ENABLE_ISDM2
  172. DWORD hISDM; // ISDM session handle
  173. #endif
  174. // All variables below should be in an additional linked list one layer
  175. // up this one, under the RTCP session link list.
  176. // They have been moved here when we added multiple streams per session
  177. // !!! NOTE !!!: There is only 1 transmit thread per stream. It's ID is
  178. // found in this data structure which is on the Xmt list.
  179. SOCKET RTPsd; // RTP socket descriptor
  180. SOCKET RTCPsd; // RTCP socket descriptor
  181. HANDLE hXmtThread; // RTCP session thread handle
  182. DWORD dwXmtThreadID; // RTCP session thread ID
  183. HANDLE hExitXmtEvent; // Xmt thread Exit event -
  184. // Used to terminate a session
  185. // among multiple stream on the
  186. // same session
  187. DWORD dwNumRptSent; // Number of RTCP report sent
  188. DWORD dwNumRptRcvd; // Number of RTCP report rcvd
  189. DWORD dwNumXmtIoPending; // Number of transmit I/O pending
  190. DWORD dwStreamClock; // Sampling frequency
  191. DWORD dwUserXmtTimeoutCtrl; // User's xmt timer control
  192. // 0x0 -> RRCM control
  193. // 0xFFFF -> No RTCP send
  194. // value -> timer value
  195. // All the above variables should move in the intermediate layer for
  196. // multiple stream per session support
  197. } SSRC_ENTRY, *PSSRC_ENTRY;
  198. // RTP process data structure
  199. typedef struct _RTP_SESSION
  200. {
  201. LINK_LIST RTPList; // Next/Prev RTP session
  202. CRITICAL_SECTION critSect; // Critical section
  203. PRTCP_SESSION pRTCPSession; // Pointer to my RTCP side
  204. } RTP_SESSION, *PRTP_SESSION;
  205. #if 0
  206. // RTP Ordered buffer structure
  207. typedef struct _RTP_BFR_LIST
  208. {
  209. LINK_LIST RTPBufferLink; // Next/prev
  210. LPWSAOVERLAPPED_COMPLETION_ROUTINE
  211. pfnCompletionNotification; // Pointer to Rcv notif. func
  212. WSAEVENT hEvent; // WSAOverlapped handle
  213. LPWSABUF pBuffer; // Pointer to WSABuffers
  214. PRTP_SESSION pSession; // This session's ID
  215. DWORD dwBufferCount; // Number of bufs in LPWSABUF
  216. DWORD dwFlags; // WSARecv flags
  217. LPVOID pFrom; // Pointer to source address
  218. LPINT pFromlen; // Pointer to source address
  219. SOCKET RTPsocket; // Socket descriptor
  220. } RTP_BFR_LIST, *PRTP_BFR_LIST;
  221. // RTP Ordered buffer structure
  222. typedef struct _RTP_HASH_LIST
  223. {
  224. LINK_LIST RTPHashLink; // Next/prev
  225. PRTP_SESSION pSession; // This session's ID
  226. SOCKET RTPsocket; // Socket descriptor
  227. } RTP_HASH_LIST, *PRTP_HASH_LIST;
  228. #endif
  229. // RTP registry initialization
  230. typedef struct _RRCM_REGISTRY
  231. {
  232. DWORD NumSessions; // RTP/RTCP sessions
  233. DWORD NumFreeSSRC; // Initial number of free SSRCs
  234. DWORD NumRTCPPostedBfr; // Number of RTCP recv bfr posted
  235. DWORD RTCPrcvBfrSize; // RTCP rcv bfr size
  236. // Dynamically loaded DLL & Send/Recv function name
  237. CHAR WSdll[FILENAME_LENGTH];
  238. } RRCM_REGISTRY, *PRRCM_REGISTRY;
  239. // RTP Context Sensitive structure
  240. typedef struct _RTP_CONTEXT
  241. {
  242. HEAD_TAIL pRTPSession; // Head/tail of RTP session(s)
  243. CRITICAL_SECTION critSect;
  244. HINSTANCE hInst; // DLL instance
  245. RRCM_REGISTRY registry; // Registry initialization
  246. } RTP_CONTEXT, *PRTP_CONTEXT;
  247. // RTCP Context Sensitive structure
  248. typedef struct _RTCP_CONTEXT
  249. {
  250. HEAD_TAIL RTCPSession; // RTCP sessions head/tail ptrs
  251. HANDLE hHeapRTCPSes; // Heap handle to RTCP sessions
  252. CRITICAL_SECTION critSect; // Critical section synch.
  253. HEAD_TAIL RRCMFreeStat; // RRCM entries head/tail ptrs
  254. HANDLE hHeapRRCMStat; // Heap handle to RRCM stats
  255. DWORD dwInitNumFreeRRCMStat; // Number of Free SSRC entries
  256. DWORD dwRtcpThreadID; // RTCP thread ID
  257. HANDLE hRtcpThread; // RTCP thread hdle
  258. HANDLE hTerminateRtcpEvent; // RTCP terminate thread event hdl
  259. HANDLE hRtcpRptRequestEvent; // RTCP report request event
  260. #ifdef MONITOR_STATS
  261. DWORD dwRTCPSesCurNum; // Num of RTCP Session
  262. DWORD dwRTCPSesHiNum; // High num RTCP per Session
  263. DWORD dwRRCMStatFreeLoNum; // Low num of RRCM free Stat
  264. DWORD dwRRCMStatFreeCurNum; // Cur num of RRCM Free Stat
  265. DWORD dwRRCMStatFreeHiNum; // High num of RRCM Free Stat
  266. DWORD dwCurNumRTCPThread; // Current num of RTCP thread
  267. DWORD dwHiNumRTCPThread; // High number of RTCP thread
  268. DWORD dwNumRTCPhdrErr; // Num of RTCP pckt header err.
  269. DWORD dwNumRTCPlenErr; // Num of RTCP pckt length err.
  270. #endif
  271. } RTCP_CONTEXT, *PRTCP_CONTEXT;
  272. // RTCP Free Buffers List
  273. typedef struct _RTCP_BFR_LIST
  274. {
  275. LINK_LIST bfrList; // Next/prev buffer in list
  276. WSAOVERLAPPED overlapped; // Overlapped I/O structure
  277. WSABUF bfr; // WSABuffers
  278. DWORD dwBufferCount; // Number of bufs in WSABUF
  279. DWORD dwNumBytesXfr; // Number of bytes rcv/xmt
  280. DWORD dwFlags; // Flags
  281. char addr[MAX_ADDR_LEN]; // Network Address
  282. int addrLen; // Address length
  283. PSSRC_ENTRY pSSRC; // Pointer to SSRC entry address
  284. } RTCP_BFR_LIST, *PRTCP_BFR_LIST;
  285. // Dynamically loaded functions
  286. typedef struct _RRCM_WS
  287. {
  288. HINSTANCE hWSdll;
  289. LPFN_WSASENDTO sendTo;
  290. LPFN_WSARECVFROM recvFrom;
  291. LPFN_WSANTOHL ntohl;
  292. LPFN_WSANTOHS ntohs;
  293. LPFN_WSAHTONL htonl;
  294. LPFN_WSAHTONS htons;
  295. LPFN_GETSOCKNAME getsockname;
  296. LPFN_GETHOSTNAME gethostname;
  297. LPFN_GETHOSTBYNAME gethostbyname;
  298. LPFN_CLOSESOCKET closesocket;
  299. LPFN_WSASOCKET WSASocket;
  300. LPFN_BIND bind;
  301. LPFN_WSAENUMPROTOCOLS WSAEnumProtocols;
  302. LPFN_WSAJOINLEAF WSAJoinLeaf;
  303. LPFN_WSAIOCTL WSAIoctl;
  304. LPFN_SETSOCKOPT setsockopt;
  305. WSAPROTOCOL_INFO RTPProtInfo; // used to open RTP sockets
  306. } RRCM_WS, *PRRCM_WS;
  307. extern RRCM_WS RRCMws;
  308. #define WS2Enabled (RRCMws.hWSdll != NULL)
  309. #define WSQOSEnabled (RRCMws.RTPProtInfo.dwServiceFlags1 & XP1_QOS_SUPPORTED)
  310. #ifdef ENABLE_ISDM2
  311. // ISDM support
  312. typedef struct _ISDM2
  313. {
  314. CRITICAL_SECTION critSect; // Critical section synch.
  315. ISDM2API ISDMEntry; // DLL entry point
  316. HINSTANCE hISDMdll;
  317. DWORD hIsdmSession; // ISDM Session's handle
  318. } ISDM2, *PISDM2;
  319. #endif // #ifdef ENABLE_ISDM2
  320. // restore structure packing
  321. #include <poppack.h>
  322. #endif // __RRCMDATA_H_
  323.