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.

488 lines
18 KiB

  1. #ifndef __tapirtp_h__
  2. #define __tapirtp_h__
  3. #include <objbase.h>
  4. #include "msrtp.h"
  5. /*
  6. * WARNING
  7. *
  8. * All the NETWORK/HOST sensitive parameters (e.g. port numbers, IP
  9. * addresses, SSRCs) are expected/returned in NETWORK order
  10. * */
  11. /*
  12. * NOTE
  13. *
  14. * Most constants are defined in file msrtp.h,
  15. * e.g. RTPMCAST_LOOPBACKMODE_NONE, RTPSDES_CNAME, etc. msrtp.h (in
  16. * the same directory as this file) has all the options and a short
  17. * explanation
  18. * */
  19. /* {5467edec-0cca-11d3-96e0-00104bc7b3a8} */
  20. DEFINE_GUID(CLSID_MSRTPSourceFilter,
  21. 0x5467edec, 0x0cca, 0x11d3, 0x96, 0xe0, 0x00, 0x10, 0x4b, 0xc7, 0xb3, 0xa8);
  22. struct DECLSPEC_UUID("5467edec-0cca-11d3-96e0-00104bc7b3a8") MSRTPSourceFilter;
  23. /* {323cdf3c-0cca-11d3-96e0-00104bc7b3a8} */
  24. DEFINE_GUID(CLSID_MSRTPRenderFilter,
  25. 0x323cdf3c, 0x0cca, 0x11d3, 0x96, 0xe0, 0x00, 0x10, 0x4b, 0xc7, 0xb3, 0xa8);
  26. struct DECLSPEC_UUID("323cdf3c-0cca-11d3-96e0-00104bc7b3a8") MSRTPRenderFilter;
  27. /**********************************************************************
  28. * IRtpSession (Exposed by RTP Source and Render filters)
  29. **********************************************************************/
  30. struct DECLSPEC_UUID("f07f3070-0cca-11d3-96e0-00104bc7b3a8") DECLSPEC_NOVTABLE
  31. IRtpSession : public IUnknown
  32. {
  33. /* Compact form */
  34. STDMETHOD(Control)(
  35. DWORD dwControl,
  36. DWORD_PTR dwPar1,
  37. DWORD_PTR dwPar2
  38. ) PURE;
  39. STDMETHOD(GetLastError)(
  40. DWORD *pdwError
  41. ) PURE;
  42. /* Separate methods */
  43. /***************************
  44. * Initialization
  45. ***************************/
  46. /* Init is the first method to call after an RTP source or render
  47. * filter is created, using a cookie allows the same RTP session
  48. * to be shared by a source and a render. The first call will have
  49. * the coockie initialized to NULL, the next call will use the
  50. * returned cookie to lookup the same RTP session. dwFlags can be
  51. * RTPINIT_QOS to create QOS enabled sockets, you can find out the
  52. * complete list of flags that can be used in file msrtp.h */
  53. STDMETHOD(Init)(
  54. HANDLE *phCookie,
  55. DWORD dwFlags
  56. ) PURE;
  57. /* Deinit is a method used to take the filter back to a state on
  58. * which a new Init() can and must be done if the filter is to be
  59. * started again, also note that just after Init(), a filter needs
  60. * to be configured, that holds also when you use Deinit() taking
  61. * the filter to its initial state */
  62. STDMETHOD(Deinit)(
  63. void
  64. ) PURE;
  65. /***************************
  66. * IP adress and ports
  67. ***************************/
  68. /* Get the local and remote ports */
  69. STDMETHOD(GetPorts)(
  70. WORD *pwRtpLocalPort,
  71. WORD *pwRtpRemotePort,
  72. WORD *pwRtcpLocalPort,
  73. WORD *pwRtcpRemotePort
  74. ) PURE;
  75. /* Set the local and remote ports */
  76. STDMETHOD(SetPorts)(
  77. WORD wRtpLocalPort,
  78. WORD wRtpRemotePort,
  79. WORD wRtcpLocalPort,
  80. WORD wRtcpRemotePort
  81. ) PURE;
  82. /* Set the local and remote IP address */
  83. STDMETHOD(SetAddress)(
  84. DWORD dwLocalAddr,
  85. DWORD dwRemoteAddr
  86. ) PURE;
  87. /* Obtain the local and remote IP addresses */
  88. STDMETHOD(GetAddress)(
  89. DWORD *pdwLocalAddr,
  90. DWORD *pdwRemoteAddr
  91. ) PURE;
  92. /* The dwFlags parameter is used to determine if the scope is set
  93. * for RTP (0x1), RTCP (0x2), or both (0x3) */
  94. STDMETHOD(SetScope)(
  95. DWORD dwTTL,
  96. DWORD dwFlags
  97. ) PURE;
  98. /* Set the multicast loopback mode
  99. * (e.g. RTPMCAST_LOOPBACKMODE_NONE,
  100. * RTPMCAST_LOOPBACKMODE_PARTIAL, etc) */
  101. STDMETHOD(SetMcastLoopback)(
  102. int iMcastLoopbackMode,
  103. DWORD dwFlags /* Not used, pass 0 */
  104. ) PURE;
  105. /***************************
  106. * Miscelaneous
  107. ***************************/
  108. /* Modify the mask specified by dwKind (e.g. RTPMASK_RECV_EVENTS,
  109. * RTPMASK_SDES_LOCMASK).
  110. *
  111. * dwMask is the mask of bits to be set or reset depending on
  112. * dwValue (reset if 0, set otherwise).
  113. *
  114. * pdwModifiedMask will return the resulting mask if the pointer
  115. * is not NULL. You can just query the current mask value by
  116. * passing dwMask=0 */
  117. STDMETHOD(ModifySessionMask)(
  118. DWORD dwKind,
  119. DWORD dwMask,
  120. DWORD dwValue,
  121. DWORD *pdwModifiedMask
  122. ) PURE;
  123. /* Set the bandwidth limits. A value of -1 will make the parameter
  124. * to be left unchanged.
  125. *
  126. * All the parameters are in bits/sec */
  127. STDMETHOD(SetBandwidth)(
  128. DWORD dwInboundBw,
  129. DWORD dwOutboundBw,
  130. DWORD dwReceiversRtcpBw,
  131. DWORD dwSendersRtcpBw
  132. ) PURE;
  133. /***************************
  134. * Participants
  135. ***************************/
  136. /* pdwSSRC points to an array of DWORDs where to copy the SSRCs,
  137. * pdwNumber contains the maximum entries to copy, and returns the
  138. * actual number of SSRCs copied. If pdwSSRC is NULL, pdwNumber
  139. * will return the current number of SSRCs (i.e. the current
  140. * number of participants) */
  141. STDMETHOD(EnumParticipants)(
  142. DWORD *pdwSSRC,
  143. DWORD *pdwNumber
  144. ) PURE;
  145. /* Get the participant state. dwSSRC specifies the
  146. * participant. pdwState will return the current participant's
  147. * state (e.g. RTPPARINFO_TALKING, RTPPARINFO_SILENT). */
  148. STDMETHOD(GetParticipantState)(
  149. DWORD dwSSRC,
  150. DWORD *pdwState
  151. ) PURE;
  152. /* Get the participant's mute state. dwSSRC specifies the
  153. * participant. pbMuted will return the participant's mute state
  154. * */
  155. STDMETHOD(GetMuteState)(
  156. DWORD dwSSRC,
  157. BOOL *pbMuted
  158. ) PURE;
  159. /* Set the participant's mute state. dwSSRC specifies the
  160. * participant. bMuted specifies the new state. Note that mute is
  161. * used to refer to the permission or not to pass packets received
  162. * up to the application, and it applies equally to audio or video
  163. * */
  164. STDMETHOD(SetMuteState)(
  165. DWORD dwSSRC,
  166. BOOL bMuted
  167. ) PURE;
  168. /* Query the network metrics computation state for the specific SSRC */
  169. STDMETHOD(GetNetMetricsState)(
  170. DWORD dwSSRC,
  171. BOOL *pbState
  172. ) PURE;
  173. /* Enable or disable the computation of networks metrics, this is
  174. * mandatory in order of the corresponding event to be fired if
  175. * enabled. This is done for the specific SSRC or the first one
  176. * found if SSRC=-1, if SSRC=0, then the network metrics
  177. * computation will be performed for any and all the SSRCs */
  178. STDMETHOD(SetNetMetricsState)(
  179. DWORD dwSSRC,
  180. BOOL bState
  181. ) PURE;
  182. /* Retrieves network information, if the network metric
  183. * computation is enabled for the specific SSRC, all the fields in
  184. * the structure will be meaningful, if not, only the average
  185. * values will contain valid data */
  186. STDMETHOD(GetNetworkInfo)(
  187. DWORD dwSSRC,
  188. RtpNetInfo_t *pRtpNetInfo
  189. ) PURE;
  190. /***************************
  191. * SDES
  192. ***************************/
  193. /* Set the local SDES information for item dwSdesItem (e.g
  194. * RTPSDES_CNAME, RTPSDES_EMAIL), psSdesData contains the UNICODE
  195. * NULL terminated string to be assigned to the item */
  196. STDMETHOD(SetSdesInfo)(
  197. DWORD dwSdesItem,
  198. WCHAR *psSdesData
  199. ) PURE;
  200. /* Get a local SDES item if dwSSRC=0, otherwise gets the SDES item
  201. * from the participant whose SSRC was specified.
  202. *
  203. * dwSdesItem is the item to get (e.g. RTPSDES_CNAME,
  204. * RTPSDES_EMAIL), psSdesData is the memory place where the item's
  205. * value will be copied, pdwSdesDataLen contains the initial size
  206. * in UNICODE chars, and returns the actual UNICODE chars copied
  207. * (including the NULL terminating char, if any), dwSSRC specify
  208. * which participant to retrieve the information from. If the SDES
  209. * item is not available, dwSdesDataLen is set to 0 and the call
  210. * doesn't fail */
  211. STDMETHOD(GetSdesInfo)(
  212. DWORD dwSdesItem,
  213. WCHAR *psSdesData,
  214. DWORD *pdwSdesDataLen,
  215. DWORD dwSSRC
  216. ) PURE;
  217. /***************************
  218. * QOS
  219. ***************************/
  220. /* Select a QOS template (flowspec) by passing its name in
  221. * psQosName, dwResvStyle specifies the RSVP style (e.g
  222. * RTPQOS_STYLE_WF, RTPQOS_STYLE_FF), dwMaxParticipants specifies
  223. * the max number of participants (1 for unicast, N for
  224. * multicast), this number is used to scale up the
  225. * flowspec. dwQosSendMode specifies the send mode (has to do with
  226. * allowed/not allowed to send) (e.g. RTPQOSSENDMODE_UNRESTRICTED,
  227. * RTPQOSSENDMODE_RESTRICTED1). dwFrameSize is the frame size (in
  228. * ms), used to derive several flowspec parameters, if this value
  229. * is not available, 0 can be set
  230. * */
  231. STDMETHOD(SetQosByName)(
  232. WCHAR *psQosName,
  233. DWORD dwResvStyle,
  234. DWORD dwMaxParticipants,
  235. DWORD dwQosSendMode,
  236. DWORD dwFrameSize
  237. ) PURE;
  238. /* Not yet implemented, will have same functionality as
  239. * SetQosByName, except that instead of passing a name to use a
  240. * predefined flowspec, the caller will pass enough information in
  241. * the RtpQosSpec structure to obtain the customized flowspec to
  242. * use */
  243. STDMETHOD(SetQosParameters)(
  244. RtpQosSpec_t *pRtpQosSpec,
  245. DWORD dwMaxParticipants,
  246. DWORD dwQosSendMode
  247. ) PURE;
  248. /* If AppName is specified, replaces the default AppName, as well
  249. * as the APP field in the policy used, with the new UNICODE
  250. * string, if not, sets the binary image name as the default. If
  251. * psAppGUID is specified, it will be prepended to the default
  252. * policy locator as "GUID=string_passed,". If psPolicyLocator is
  253. * specified, append a comma and this whole string to the default
  254. * policy locator, if not, just sets the default
  255. * */
  256. STDMETHOD(SetQosAppId)(
  257. WCHAR *psAppName,
  258. WCHAR *psAppGUID,
  259. WCHAR *psPolicyLocator
  260. ) PURE;
  261. /* Adds/removes a single SSRC to/from the shared explicit list of
  262. * participants who receive reservation (i.e. it is used when the
  263. * ResvStyle=RTPQOS_STYLE_SE). */
  264. STDMETHOD(SetQosState)(
  265. DWORD dwSSRC,
  266. BOOL bEnable
  267. ) PURE;
  268. /* Adds/removes a number of SSRCs to/from the shared explicit list
  269. * of participants who receive reservation (i.e. it is used when
  270. * the ResvStyle=RTPQOS_STYLE_SE). dwNumber is the number of SSRCs
  271. * to add/remove, and returns the actual number of SSRCs
  272. * added/removed */
  273. STDMETHOD(ModifyQosList)(
  274. DWORD *pdwSSRC,
  275. DWORD *pdwNumber,
  276. DWORD dwOperation
  277. ) PURE;
  278. /***************************
  279. * Cryptography
  280. ***************************/
  281. /* iMode defines what is going to be encrypted/decrypted,
  282. * e.g. RTPCRYPTMODE_PAYLOAD to encrypt/decrypt only RTP
  283. * payload. dwFlag can be RTPCRYPT_SAMEKEY to indicate that (if
  284. * applicable) the key used for RTCP is the same used for RTP */
  285. STDMETHOD(SetEncryptionMode)(
  286. int iMode,
  287. DWORD dwFlags
  288. ) PURE;
  289. /* Specifies the information needed to derive an
  290. * encryption/decryption key. PassPhrase is the (random) text used
  291. * to generate a key. HashAlg specifies the algorithm to use to
  292. * hash the pass phrase and generate a key. DataAlg is the
  293. * algorithm used to encrypt/decrypt the data. Default hash
  294. * algorithm is RTPCRYPT_MD5, default data algorithm is
  295. * RTPCRYPT_DES. If encryption is to be used, the PassPhrase is a
  296. * mandatory parameter to set. bRtcp specifies if the parameters
  297. * are for RTCP or RTP, if the SAMEKEY flag was used when setting
  298. * the mode, this parameter is ignored */
  299. STDMETHOD(SetEncryptionKey)(
  300. WCHAR *psPassPhrase,
  301. WCHAR *psHashAlg,
  302. WCHAR *psDataAlg,
  303. BOOL bRtcp
  304. ) PURE;
  305. };
  306. /**********************************************************************
  307. * IRtpMediaControl (Exposed by RTP Source and Render filters)
  308. **********************************************************************/
  309. struct DECLSPEC_UUID("825db25c-cbbd-4212-b10f-2e1b2ff024e7") DECLSPEC_NOVTABLE
  310. IRtpMediaControl : public IUnknown
  311. {
  312. /* Establishes the mapping between a payload type, its sampling
  313. * frequency and its DShow media type (e.g. for H.261
  314. * {31,90000,MEDIASUBTYPE_RTP_Payload_H261} ) */
  315. STDMETHOD(SetFormatMapping)(
  316. IN DWORD dwRTPPayLoadType,
  317. IN DWORD dwFrequency,
  318. IN AM_MEDIA_TYPE *pMediaType
  319. ) PURE;
  320. /* Empties the format mapping table */
  321. STDMETHOD(FlushFormatMappings)(
  322. void
  323. ) PURE;
  324. };
  325. /**********************************************************************
  326. * IRtpDemux (Exposed only by RTP Source filter)
  327. **********************************************************************/
  328. struct DECLSPEC_UUID("1308f00a-fc1a-4d08-af3c-10a62ae70bde") DECLSPEC_NOVTABLE
  329. IRtpDemux : public IUnknown
  330. {
  331. /* Add a single pin, may return its position */
  332. STDMETHOD(AddPin)(
  333. IN int iOutMode,
  334. OUT int *piPos
  335. ) PURE;
  336. /* Set the number of pins, can only be >= than current number of
  337. * pins */
  338. STDMETHOD(SetPinCount)(
  339. IN int iCount,
  340. IN int iOutMode
  341. ) PURE;
  342. /* Set the pin mode (e.g. RTPDMXMODE_AUTO or RTPDMXMODE_MANUAL),
  343. * if iPos >= 0 use it, otherwise use pIPin */
  344. STDMETHOD(SetPinMode)(
  345. IN int iPos,
  346. IN IPin *pIPin,
  347. IN int iOutMode
  348. ) PURE;
  349. /* Map/unmap pin i to/from user with SSRC, if iPos >= 0 use it,
  350. * otherwise use pIPin, when unmapping, only the pin or the SSRC
  351. * is required */
  352. STDMETHOD(SetMappingState)(
  353. IN int iPos,
  354. IN IPin *pIPin,
  355. IN DWORD dwSSRC,
  356. IN BOOL bMapped
  357. ) PURE;
  358. /* Find the Pin assigned (if any) to the SSRC, return either
  359. * position or pin or both */
  360. STDMETHOD(FindPin)(
  361. IN DWORD dwSSRC,
  362. OUT int *piPos,
  363. OUT IPin **ppIPin
  364. ) PURE;
  365. /* Find the SSRC mapped to the Pin, if iPos >= 0 use it, otherwise
  366. * use pIPin */
  367. STDMETHOD(FindSSRC)(
  368. IN int iPos,
  369. IN IPin *pIPin,
  370. OUT DWORD *pdwSSRC
  371. ) PURE;
  372. };
  373. /**********************************************************************
  374. * IRtpDtmf (Exposed only by RTP Render filter)
  375. **********************************************************************/
  376. struct DECLSPEC_UUID("554438d8-a4bd-428a-aabd-1cff350eece6") DECLSPEC_NOVTABLE
  377. IRtpDtmf : public IUnknown
  378. {
  379. /***************************
  380. * DTMF (RFC2833)
  381. ***************************/
  382. /* Configures DTMF parameters */
  383. STDMETHOD(SetDtmfParameters)(
  384. DWORD dwPT_Dtmf /* Payload type for DTMF events */
  385. ) PURE;
  386. /* Directs an RTP render filter to send a packet formatted
  387. * according to rfc2833 containing the specified event, specified
  388. * volume level, duration in milliseconds, and the END flag,
  389. * following the rules in section 3.6 for events sent in multiple
  390. * packets. Parameter dwId changes from one digit to the next one.
  391. *
  392. * NOTE the duration is given in milliseconds, then it is
  393. * converted to RTP timestamp units which are represented using 16
  394. * bits, the maximum value is hence dependent on the sampling
  395. * frequency, but for 8KHz the valid values would be 0 to 8191 ms
  396. * */
  397. STDMETHOD(SendDtmfEvent)(
  398. DWORD dwId,
  399. /* As per RFC2833 */
  400. DWORD dwEvent, /* 0 - 16 */
  401. DWORD dwVolume, /* 0 - 63 */
  402. DWORD dwDuration, /* See note above */
  403. BOOL bEnd /* 0 - 1 */
  404. ) PURE;
  405. };
  406. /**********************************************************************
  407. * IRtpRedundancy (Exposed by RTP Source and Render filters)
  408. **********************************************************************/
  409. struct DECLSPEC_UUID("f3a9dcfe-1513-46ce-a1cb-0fcabe70ff44") DECLSPEC_NOVTABLE
  410. IRtpRedundancy : public IUnknown
  411. {
  412. /***************************
  413. * RTP redundancy (RFC2918)
  414. ***************************/
  415. /* Configures redundancy. For a receiver only parameter dwPT_Red
  416. * is used (the other are ignored) and may be set to -1 to ignore
  417. * it if it was already set or to assign the default. For a
  418. * sender, parameters dwPT_Red, dwInitialRedDistance, and
  419. * dwMaxRedDistance can be set to -1 to ignore the parameter if it
  420. * was already set or to assign the default value */
  421. STDMETHOD(SetRedParameters)(
  422. DWORD dwPT_Red, /* Payload type for redundant packets */
  423. DWORD dwInitialRedDistance,/* Initial red distance */
  424. DWORD dwMaxRedDistance /* default used when passing -1*/
  425. ) PURE;
  426. };
  427. #endif // __tapirtp_h__