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.

1131 lines
39 KiB

  1. /**********************************************************************
  2. *
  3. * Copyright (C) Microsoft Corporation, 1999
  4. *
  5. * File name:
  6. *
  7. * msrtp.h
  8. *
  9. * Abstract:
  10. *
  11. * RTP definitions used by applications
  12. *
  13. * Author:
  14. *
  15. * Andres Vega-Garcia (andresvg)
  16. *
  17. * Revision:
  18. *
  19. * 1999/11/19 created
  20. *
  21. **********************************************************************/
  22. #ifndef _msrtp_h_
  23. #define _msrtp_h_
  24. #include <evcode.h>
  25. /**********************************************************************
  26. * Flags passed in IRtpSession::Init()
  27. **********************************************************************/
  28. /* Helper enumeration (do not use): Init flags
  29. *
  30. * WARNING The order here is important, it matches some flags in
  31. * RtpAddr_t so a mapping by shifting is possible */
  32. enum {
  33. RTPINITFG_FIRST, /* Internal only, do not use */
  34. RTPINITFG_AUTO, /* Internal only, do not use */
  35. /* Used to enable QOS, i.e. create QOS enabled sockets */
  36. RTPINITFG_QOS,
  37. /* Used to make the SSRC persistent */
  38. RTPINITFG_PERSISTSSRC,
  39. /* Used to make the sockets persistent */
  40. RTPINITFG_PERSISTSOCKETS,
  41. /* Media class 1 to 7 */
  42. RTPINITFG_CLASS0,
  43. RTPINITFG_CLASS1,
  44. RTPINITFG_CLASS2,
  45. RTPINITFG_DUMMY8,
  46. RTPINITFG_MATCHRADDR, /* Discard packets not comming from the
  47. * remote address */
  48. RTPINITFG_RADDRRESETDEMUX,/* Reset the demux (unmap all outputs)
  49. * when a new remote address is set */
  50. RTPINITFG_LAST /* Internal only, do not use */
  51. };
  52. /* Helper enumeration (do not use): RTP media class */
  53. enum {
  54. RTPCLASS_FIRST, /* Internal only, do not use */
  55. /* Audio traffic */
  56. RTPCLASS_AUDIO,
  57. /* Video traffic */
  58. RTPCLASS_VIDEO,
  59. RTPCLASS_LAST /* Internal only, do not use */
  60. };
  61. /*
  62. * Flags used in IRtpSession::Init()
  63. */
  64. #define RTPINIT_ENABLE_QOS (1 << RTPINITFG_QOS)
  65. #define RTPINIT_PERSIST_SSRC (1 << RTPINITFG_PERSISTSSRC)
  66. #define RTPINIT_PERSIST_SOCKETS (1 << RTPINITFG_PERSISTSOCKETS)
  67. #define RTPINIT_CLASS_AUDIO (RTPCLASS_AUDIO << RTPINITFG_CLASS0)
  68. #define RTPINIT_CLASS_VIDEO (RTPCLASS_VIDEO << RTPINITFG_CLASS0)
  69. #define RTPINIT_CLASS_DEFAULT (RTPCLASS_FIRST << RTPINITFG_CLASS0)
  70. #define RTPINIT_MATCHRADDR (1 << RTPINITFG_MATCHRADDR)
  71. #define RTPINIT_RADDRRESETDEMUX (1 << RTPINITFG_RADDRRESETDEMUX)
  72. /* Mask to validate valid flags in IRtpSession::Init() */
  73. #define RTPINIT_MASK ( (1 << RTPINITFG_AUTO) | \
  74. (1 << RTPINITFG_QOS) | \
  75. (1 << RTPINITFG_PERSISTSSRC) | \
  76. (1 << RTPINITFG_PERSISTSOCKETS)| \
  77. (1 << RTPINITFG_CLASS0) | \
  78. (1 << RTPINITFG_CLASS1) | \
  79. (1 << RTPINITFG_CLASS2) | \
  80. (1 << RTPINITFG_MATCHRADDR) | \
  81. (1 << RTPINITFG_RADDRRESETDEMUX) | \
  82. 0 \
  83. )
  84. /**********************************************************************
  85. * Multicast modes
  86. **********************************************************************/
  87. enum {
  88. RTPMCAST_LOOPBACKMODE_FIRST, /* Internal only, do not use */
  89. /* Disable loopback in Winsock (WS2 will filter ALL packets coming
  90. * from any socket in the same machine, collision detection is
  91. * enabled) */
  92. RTPMCAST_LOOPBACKMODE_NONE,
  93. /* Enable loopback in RTP (Winsock will enable loopback and RTP
  94. * will filter packets with a source address equal to the local
  95. * address, and with the same SSRC, note that in this mode
  96. * collision detection is enabled but is not possible among
  97. * applications runing on the same machine) */
  98. RTPMCAST_LOOPBACKMODE_PARTIAL,
  99. /* Let everything loopback (multicast loopback is enabled in
  100. * Winsock, no filtering is done in RTP, and collision detection
  101. * is disabled) */
  102. RTPMCAST_LOOPBACKMODE_FULL,
  103. RTPMCAST_LOOPBACKMODE_LAST /* Internal only, do not use */
  104. };
  105. #define DEFAULT_MCAST_LOOPBACK RTPMCAST_LOOPBACKMODE_NONE
  106. /**********************************************************************
  107. * TTL defaults
  108. **********************************************************************/
  109. #define DEFAULT_UCAST_TTL 127
  110. #define DEFAULT_MCAST_TTL 4
  111. #define RTPTTL_RTP 0x1
  112. #define RTPTTL_RTCP 0x2
  113. #define RTPTTL_RTPRTCP (RTPTTL_RTP | RTPTTL_RTCP)
  114. /**********************************************************************
  115. *
  116. * Events base
  117. *
  118. **********************************************************************/
  119. /* Helper enumeration (do not use) */
  120. enum {
  121. /* RTP */
  122. RTPEVENTKIND_RTP,
  123. /* Participants */
  124. RTPEVENTKIND_PINFO,
  125. /* QOS */
  126. RTPEVENTKIND_QOS,
  127. /* SDES info */
  128. RTPEVENTKIND_SDES,
  129. RTPEVENTKIND_LAST
  130. };
  131. #define RTPEVNTRANGE 100
  132. #define RTPQOS_ADJUST 3
  133. /* EC_USER defined in evcode.h (0x8000+32=32800) */
  134. #define RTPEVENTBASE (EC_USER+32)
  135. /* Event base for RTP events */
  136. #define RTPRTP_EVENTBASE (RTPEVENTBASE + RTPEVNTRANGE*RTPEVENTKIND_RTP)
  137. /* Event base for participant events */
  138. #define RTPPARINFO_EVENTBASE (RTPEVENTBASE + RTPEVNTRANGE*RTPEVENTKIND_PINFO)
  139. /* Event base for QOS */
  140. #define RTPQOS_EVENTBASE (RTPEVENTBASE + RTPEVNTRANGE*RTPEVENTKIND_QOS + \
  141. RTPQOS_ADJUST)
  142. /* Event base for SDES information */
  143. #define RTPSDES_EVENTBASE (RTPEVENTBASE + RTPEVNTRANGE*RTPEVENTKIND_SDES)
  144. /**********************************************************************
  145. * Kind of mask (used as the dwKind parameter in ModifySessionMask)
  146. **********************************************************************/
  147. /* This enum is used to select the mask on which the ModifySessionMask
  148. * function will modify or query zero, one, or more bits.
  149. *
  150. * E.g. ModifySessionMask(RTPMASK_SDESRECV_EVENTS,
  151. * RTPSDES_MASK_PHONE,
  152. * 0,
  153. * NULL);
  154. *
  155. * This will disable firing an event to the RTP source filter when a
  156. * PHONE SDES item is received, the modified mask will not be returned
  157. * as the pointer passed is NULL
  158. * */
  159. enum {
  160. RTPMASK_FIRST, /* Internal only, do not use */
  161. /* Select the RTP features mask */
  162. RTPMASK_FEATURES_MASK,
  163. /* Select the RTP events mask of events fired to a receiver,
  164. * e.g. an RTP source filter */
  165. RTPMASK_RECV_EVENTS,
  166. /* Select the RTP events mask of events fired to a sender, e.g. an
  167. * RTP render filter */
  168. RTPMASK_SEND_EVENTS,
  169. /* Select the events mask for participants events to be fired to a
  170. * receiver, e.g. an RTP source filter */
  171. RTPMASK_PINFOR_EVENTS,
  172. /* Select the events mask for participants events to be fired to a
  173. * sender, e.g. an RTP render filter */
  174. RTPMASK_PINFOS_EVENTS,
  175. /* Select the events mask of QOS events to be fired to a receiver,
  176. * e.g. an RTP source filter */
  177. RTPMASK_QOSRECV_EVENTS,
  178. /* Select the events mask of QOS events to be fired to a sender,
  179. * e.g. an RTP render filter */
  180. RTPMASK_QOSSEND_EVENTS,
  181. /* Select what SDES items (the items must also be enabled to be
  182. * accepted - RTPMASK_SDES_REMMASK), when received, will fire
  183. * events to a receiver, e.g. an RTP source filter */
  184. RTPMASK_SDESRECV_EVENTS,
  185. /* Select what SDES items (the items must also be enabled to be
  186. * accepted - RTPMASK_SDES_REMMASK), when received, will fire
  187. * events to a sender, e.g. an RTP render filter */
  188. RTPMASK_SDESSEND_EVENTS,
  189. /* Select the SDES items to send (provided they have a default or a
  190. * value has been set) in RTCP reports */
  191. RTPMASK_SDES_LOCMASK,
  192. /* Select the SDES items to accept and store when they are
  193. * received from the remote participants in their RTCP reports,
  194. * regardless if they are senders or receivers or both */
  195. RTPMASK_SDES_REMMASK,
  196. RTPMASK_LAST /* Internal only, do not use */
  197. };
  198. /**********************************************************************
  199. * Features in RTP (masks)
  200. * Will use with RTPMASK_FEATURES_MASK
  201. **********************************************************************/
  202. /* Helper enumeration (do not use) for masks */
  203. enum {
  204. RTPFEAT_FIRST, /* Internal only, do not use */
  205. /* Generate timestamps locally (RTP render only) */
  206. RTPFEAT_GENTIMESTAMP,
  207. /* Receive in same buffer RTP header and payload, don't change the
  208. * RTP header except the SSRC (RTP render only) */
  209. RTPFEAT_PASSHEADER,
  210. /* Enable sending RTCP SR probe packets to do bandwidth estimation
  211. * (queueing latency) */
  212. RTPFEAT_BANDESTIMATION,
  213. RTPFEAT_LAST /* Internal only, do not use */
  214. };
  215. /*
  216. * Masks used to enable/disable the above features (used with
  217. * RTPMASK_FEATURES_MASK)
  218. */
  219. #define RTPFEAT_MASK_GENTIMESTAMP (1 << RTPFEAT_GENTIMESTAMP)
  220. #define RTPFEAT_MASK_PASSHEADER (1 << RTPFEAT_PASSHEADER)
  221. #define RTPFEAT_MASK_BANDESTIMATION (1 << RTPFEAT_BANDESTIMATION)
  222. /**********************************************************************
  223. * RTP information (events, masks)
  224. * Will use with RTPMASK_RECV_EVENTS or RTPMASK_SEND_EVENTS
  225. **********************************************************************/
  226. /* Helper enumeration (do not use) for events and masks */
  227. enum {
  228. RTPRTP_FIRST, /* Internal only, do not use */
  229. /* RTCP RR received */
  230. RTPRTP_RR_RECEIVED,
  231. /* RTCP SR received */
  232. RTPRTP_SR_RECEIVED,
  233. /* Local SSRC is in collision */
  234. RTPRTP_LOCAL_COLLISION,
  235. /* Winsock reception error */
  236. RTPRTP_WS_RECV_ERROR,
  237. /* Winsock send error */
  238. RTPRTP_WS_SEND_ERROR,
  239. /* Network failure */
  240. RTPRTP_WS_NET_FAILURE,
  241. /* Loss rate reported in RTCP RR (loss rate observed in the
  242. * incoming stream that we report to the sender) */
  243. RTPRTP_RECV_LOSSRATE,
  244. /* Loss rate received in RTCP RR (loss rate seen by our peer (and
  245. * reported to us) in our outgoing data stream) */
  246. RTPRTP_SEND_LOSSRATE,
  247. /* Bandwidth estimation reported back to the sender */
  248. RTPRTP_BANDESTIMATION,
  249. /* Decryption failed */
  250. RTPRTP_CRYPT_RECV_ERROR,
  251. /* Encryption failed */
  252. RTPRTP_CRYPT_SEND_ERROR,
  253. RTPRTP_LAST /* Internal only, do not use */
  254. };
  255. /*
  256. * Events generated
  257. */
  258. /* P1:Sender's SSRC, P2:0 */
  259. #define RTPRTP_EVENT_RR_RECEIVED (RTPRTP_EVENTBASE + RTPRTP_RR_RECEIVED)
  260. /* P1:Sender's SSRC, P2:0 */
  261. #define RTPRTP_EVENT_SR_RECEIVED (RTPRTP_EVENTBASE + RTPRTP_SR_RECEIVED)
  262. /* P1:Local SSRC, P2:Old local SSRC */
  263. #define RTPRTP_EVENT_LOCAL_COLLISION (RTPRTP_EVENTBASE + RTPRTP_LOCAL_COLLISION)
  264. /* P1:0=RTP|1=RTCP, P2:WS2 Error */
  265. #define RTPRTP_EVENT_WS_RECV_ERROR (RTPRTP_EVENTBASE + RTPRTP_WS_RECV_ERROR)
  266. /* P1:0=RTP|1=RTCP, P2:WS2 Error */
  267. #define RTPRTP_EVENT_WS_SEND_ERROR (RTPRTP_EVENTBASE + RTPRTP_WS_SEND_ERROR)
  268. /* P1:0=RTP|1=RTCP, P2:WS2 Error */
  269. #define RTPRTP_EVENT_WS_NET_FAILURE (RTPRTP_EVENTBASE + RTPRTP_WS_NET_FAILURE)
  270. /* P1:Sender's SSRC, P2:Loss rate being reported (See NOTE below) */
  271. #define RTPRTP_EVENT_RECV_LOSSRATE (RTPRTP_EVENTBASE + RTPRTP_RECV_LOSSRATE)
  272. /* P1:Reporter's SSRC, P2:Loss rate received in report (See NOTE below) */
  273. #define RTPRTP_EVENT_SEND_LOSSRATE (RTPRTP_EVENTBASE + RTPRTP_SEND_LOSSRATE)
  274. /* NOTE Loss rate passed as (int)(dLossRate * LOSS_RATE_PRECISSION),
  275. * e.g. if you receive a loss rate = L, then the real percentage in a
  276. * 0 - 100 scale would be obtained as L / LOSS_RATE_PRECISSION */
  277. #define LOSS_RATE_PRECISSION 1000
  278. /* P1:Reporter's SSRC, P2:Bandwidth estimation in bps (if the
  279. * estimation is done but the value is undefined, will report the
  280. * value RTP_BANDWIDTH_UNDEFINED. If the estimation is not done at all
  281. * will report the value RTP_BANDWIDTH_NOTESTIMATED. If the estimation
  282. * is getting its initial average will report RTP_BANDWIDTH_NOTREADY)
  283. * */
  284. #define RTPRTP_EVENT_BANDESTIMATION (RTPRTP_EVENTBASE + RTPRTP_BANDESTIMATION)
  285. #define RTP_BANDWIDTH_UNDEFINED ((DWORD)-1)
  286. #define RTP_BANDWIDTH_NOTESTIMATED ((DWORD)-2)
  287. #define RTP_BANDWIDTH_BANDESTNOTREADY ((DWORD)-3)
  288. /* P1:0=RTP|1=RTCP, P2:Error */
  289. #define RTPRTP_EVENT_CRYPT_RECV_ERROR \
  290. (RTPRTP_EVENTBASE + RTPRTP_CRYPT_RECV_ERROR)
  291. /* P1:0=RTP|1=RTCP, P2:Error */
  292. #define RTPRTP_EVENT_CRYPT_SEND_ERROR \
  293. (RTPRTP_EVENTBASE + RTPRTP_CRYPT_SEND_ERROR)
  294. /*
  295. * Masks used to enable/disable the above events (used with
  296. * RTPMASK_RECV_EVENTS or RTPMASK_SEND_EVENTS)
  297. */
  298. #define RTPRTP_MASK_RR_RECEIVED (1 << RTPRTP_RR_RECEIVED)
  299. #define RTPRTP_MASK_SR_RECEIVED (1 << RTPRTP_SR_RECEIVED)
  300. #define RTPRTP_MASK_LOCAL_COLLISION (1 << RTPRTP_LOCAL_COLLISION)
  301. #define RTPRTP_MASK_WS_RECV_ERROR (1 << RTPRTP_WS_RECV_ERROR)
  302. #define RTPRTP_MASK_WS_SEND_ERROR (1 << RTPRTP_WS_SEND_ERROR)
  303. #define RTPRTP_MASK_WS_NET_FAILURE (1 << RTPRTP_WS_NET_FAILURE)
  304. #define RTPRTP_MASK_RECV_LOSSRATE (1 << RTPRTP_RECV_LOSSRATE)
  305. #define RTPRTP_MASK_SEND_LOSSRATE (1 << RTPRTP_SEND_LOSSRATE)
  306. #define RTPRTP_MASK_BANDESTIMATIONSEND (1 << RTPRTP_BANDESTIMATION)
  307. #define RTPRTP_MASK_CRYPT_RECV_ERROR (1 << RTPRTP_CRYPT_RECV_ERROR)
  308. #define RTPRTP_MASK_CRYPT_SEND_ERROR (1 << RTPRTP_CRYPT_SEND_ERROR)
  309. /* RTP prefix
  310. *
  311. * A prefix is used to pass extra information from the source RTP
  312. * filter down stream to the other filters in DShow. There may be as
  313. * many RTP prefixes as needed, each one begins with a
  314. * RtpPrefixCommon_t followed by a structure specific to that prefix.
  315. * A filter not recognizing any prefix will not bother scanning them.
  316. * A filter expecting a prefix should skip those that it doesn't
  317. * undestand. Currently there is only 1 prefix used to pass the offset
  318. * to the payload type and avoid next filters having to compute the
  319. * variable size RTP header (RTPPREFIXID_HDRSIZE)
  320. * */
  321. typedef struct _RtpPrefixCommon_t {
  322. /* Common RtpPrefix */
  323. WORD wPrefixID; /* Prefix ID */
  324. WORD wPrefixLen; /* This header length in bytes */
  325. } RtpPrefixCommon_t;
  326. #define RTPPREFIXID_HDRSIZE 1
  327. /*
  328. * Prefix header for RTP header offset (RTPPREFIXID_HDRSIZE)
  329. *
  330. * The lHdrSize field is the number of bytes from the beginnig of the
  331. * RTP header to the first byte of payload */
  332. typedef struct _RtpPrefixHdr_t {
  333. /* Common RtpPrefix */
  334. WORD wPrefixID; /* Prefix ID */
  335. WORD wPrefixLen; /* This header length in bytes
  336. * (i.e. sizeof(RtpPrefixHdr_t) */
  337. /* Specific prefix HDRSIZE */
  338. long lHdrSize;
  339. } RtpPrefixHdr_t;
  340. /**********************************************************************
  341. * Participants information (state, events, masks)
  342. *
  343. * NOTE: In general, participants generate an event when having state
  344. * transitions, e.g. event RTPPARINFO_EVENT_TALKING is generated when
  345. * participant receives RTP packets and goes to the TALKING state.
  346. * Each event can be enabled or disabled using the mask provided for
  347. * each of them.
  348. * Will use with RTPMASK_PINFOR_EVENTS or RTPMASK_PINFOS_EVENTS
  349. **********************************************************************/
  350. /* Helper enumeration (do not use) for events/states and masks */
  351. enum {
  352. RTPPARINFO_FIRST, /* Internal only, do not use */
  353. /* User was just created (RTP or RTCP packet received) */
  354. RTPPARINFO_CREATED,
  355. /* In the conference but not sending data, i.e. sending RTCP
  356. * packets */
  357. RTPPARINFO_SILENT,
  358. /* Receiving data from this participant (RTP packets) */
  359. RTPPARINFO_TALKING,
  360. /* Was just sending data a while ago */
  361. RTPPARINFO_WAS_TALKING,
  362. /* No RTP/RTCP packets have been received for some time */
  363. RTPPARINFO_STALL,
  364. /* Left the conference (i.e. sent a RTCP BYE packet) */
  365. RTPPARINFO_BYE,
  366. /* Participant context has been deleted */
  367. RTPPARINFO_DEL,
  368. /* Participant was assigned an output (i.e. mapped) */
  369. RTPPARINFO_MAPPED,
  370. /* Participant has released its output (i.e. unmapped) */
  371. RTPPARINFO_UNMAPPED,
  372. /* Participant has generated network quality metrics update */
  373. RTPPARINFO_NETWORKCONDITION,
  374. RTPPARINFO_LAST /* Internal only, do not use */
  375. };
  376. /*
  377. * Events generated
  378. */
  379. /*
  380. * All the events pass the same parameters (except otherwise noted):
  381. * P1:Remote participant's SSRC, P2:0
  382. */
  383. #define RTPPARINFO_EVENT_CREATED (RTPPARINFO_EVENTBASE + RTPPARINFO_CREATED)
  384. #define RTPPARINFO_EVENT_SILENT (RTPPARINFO_EVENTBASE + RTPPARINFO_SILENT)
  385. #define RTPPARINFO_EVENT_TALKING (RTPPARINFO_EVENTBASE + RTPPARINFO_TALKING)
  386. #define RTPPARINFO_EVENT_WAS_TALKING (RTPPARINFO_EVENTBASE + RTPPARINFO_WAS_TALKING)
  387. #define RTPPARINFO_EVENT_STALL (RTPPARINFO_EVENTBASE + RTPPARINFO_STALL)
  388. #define RTPPARINFO_EVENT_BYE (RTPPARINFO_EVENTBASE + RTPPARINFO_BYE)
  389. #define RTPPARINFO_EVENT_DEL (RTPPARINFO_EVENTBASE + RTPPARINFO_DEL)
  390. /* P1:Remote participant's SSRC, P2:IPin pointer */
  391. #define RTPPARINFO_EVENT_MAPPED (RTPPARINFO_EVENTBASE + RTPPARINFO_MAPPED)
  392. /* P1:Remote participant's SSRC, P2:IPin pointer */
  393. #define RTPPARINFO_EVENT_UNMAPPED (RTPPARINFO_EVENTBASE + RTPPARINFO_UNMAPPED)
  394. /*
  395. NOTE: This event is different from all the others in the sense that
  396. two actions are needed in order to be generated, first, the network
  397. metrics computation needs to be enabled (SetNetMetricsState) in one
  398. or more participants (SSRCs), and second this event needs to be
  399. enabled
  400. P1:Remote participant's SSRC, P2:Network condition encoded as follows:
  401. 3 2 1
  402. 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  403. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  404. | loss rate | jitter | RTT | network metric|
  405. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  406. network metric - encoded as a 0 - 100 quality, where 0 is very bad,
  407. and 100 is very good.
  408. RTT - Encoded as 10's of milliseconds.
  409. jitter - Encoded as milliseconds.
  410. loss rate - encoded as a 1/256 units */
  411. #define RTPPARINFO_EVENT_NETWORKCONDITION \
  412. (RTPPARINFO_EVENTBASE + RTPPARINFO_NETWORKCONDITION)
  413. /* Use these macros to extract each metric encoded in P2 with event
  414. * RTPPARINFO_EVENT_NETWORKCONDITION.
  415. *
  416. * network metric is returned as a DWORD 0 - 100 value, RTT is
  417. * returned as a double in secods, jitter is returned as double in
  418. * seconds, and loss rate is returned as a double in percentage [0 -
  419. * 100] */
  420. #define RTPNET_GET_dwGLOBALMETRIC(_p2) ((DWORD) ((_p2) & 0xff))
  421. #define RTPNET_GET_dRTT(_p2) ((double) (((_p2) >> 8) & 0xff) / 100)
  422. #define RTPNET_GET_dJITTER(_p2) ((double) (((_p2) >> 16) & 0xff) / 1000)
  423. #define RTPNET_GET_dLOSSRATE(_p2) ((double) (((_p2)>>24)&0xff)*100.0/256)
  424. /*
  425. * Masks used to enable/disable the above events (used with
  426. * RTPMASK_PINFOR_EVENTS or RTPMASK_PINFOS_EVENTS)
  427. */
  428. #define RTPPARINFO_MASK_CREATED (1 << RTPPARINFO_CREATED)
  429. #define RTPPARINFO_MASK_SILENT (1 << RTPPARINFO_SILENT)
  430. #define RTPPARINFO_MASK_TALKING (1 << RTPPARINFO_TALKING)
  431. #define RTPPARINFO_MASK_WAS_TALKING (1 << RTPPARINFO_WAS_TALKING)
  432. #define RTPPARINFO_MASK_STALL (1 << RTPPARINFO_STALL)
  433. #define RTPPARINFO_MASK_BYE (1 << RTPPARINFO_BYE)
  434. #define RTPPARINFO_MASK_DEL (1 << RTPPARINFO_DEL)
  435. #define RTPPARINFO_MASK_MAPPED (1 << RTPPARINFO_MAPPED)
  436. #define RTPPARINFO_MASK_UNMAPPED (1 << RTPPARINFO_UNMAPPED)
  437. #define RTPPARINFO_MASK_NETWORKCONDITION (1 << RTPPARINFO_NETWORKCONDITION)
  438. /* Helper enumeration (do not use) for the modifiable items in
  439. * participants */
  440. enum {
  441. RTPPARITEM_FIRST, /* Internal only, do not use */
  442. RTPPARITEM_STATE, /* qury: e.g TALKING, SILENT, etc. */
  443. RTPPARITEM_MUTE, /* set/query: muted or not muted */
  444. RTPPARITEM_NETEVENT, /* enable/disable/query: genarting events
  445. * when network conditions change */
  446. RTPPARITEM_LAST /* Internal only, do not use */
  447. };
  448. /* Indexes for the items in RtpNetInfo.dItems, used for RTT, Jitter
  449. * and loss rate
  450. *
  451. * WARNING
  452. *
  453. * The following enumeration and the min/max bounds
  454. * (e.g. NETQ_RTT_MAX) defined in struct.h and rtcpdec.c and used by
  455. * RtpComputNetworkMetrics() must be kept in sync */
  456. enum {
  457. NETQ_RTT_IDX, /* Average RTT in seconds */
  458. NETQ_JITTER_IDX, /* Average Jitters in seconds */
  459. NETQ_LOSSRATE_IDX, /* Average Loss rate is a percentage */
  460. NETQ_LAST_IDX /* Internal (do not use) */
  461. };
  462. typedef struct _RtpNetInfo_t {
  463. /* Network quality */
  464. double dAvg[NETQ_LAST_IDX]; /* Keep averages */
  465. double dHowGood[NETQ_LAST_IDX]; /* Keep a 0-100 metric */
  466. /* Compound network metric as seen by this user, uses the above
  467. * parameters to come up with a network quality metric between 0
  468. * and 100, 0 is too bad, and 100 is the best */
  469. DWORD dwNetMetrics; /* 0 - 100 scale */
  470. union {
  471. double dMetricAge;/* Elapsed time since last update (secs) */
  472. double dLastUpdate;/* Last time metrics were updated */
  473. };
  474. } RtpNetInfo_t;
  475. /**********************************************************************
  476. * QOS (events, masks)
  477. *
  478. * NOTE Each QOS event can be enabled or disabled, using the mask
  479. * provided for each of them.
  480. * Will use with RTPMASK_QOSSEND_EVENTS or RTPMASK_QOSSEND_EVENTS
  481. **********************************************************************/
  482. /* Helper enumeration (do not use) for events and masks */
  483. enum {
  484. RTPQOS_FIRST, /* Internal only, do not use */
  485. /* no QoS support is available */
  486. RTPQOS_NOQOS,
  487. /* at least one Reserve has arrived */
  488. RTPQOS_RECEIVERS,
  489. /* at least one Path has arrived */
  490. RTPQOS_SENDERS,
  491. /* there are no senders */
  492. RTPQOS_NO_SENDERS,
  493. /* there are no receivers */
  494. RTPQOS_NO_RECEIVERS,
  495. /* Reserve has been confirmed */
  496. RTPQOS_REQUEST_CONFIRMED,
  497. /* error due to lack of resources */
  498. RTPQOS_ADMISSION_FAILURE,
  499. /* rejected for administrative reasons - bad credentials */
  500. RTPQOS_POLICY_FAILURE,
  501. /* unknown or conflicting style */
  502. RTPQOS_BAD_STYLE,
  503. /* problem with some part of the filterspec or providerspecific
  504. * buffer in general */
  505. RTPQOS_BAD_OBJECT,
  506. /* problem with some part of the flowspec */
  507. RTPQOS_TRAFFIC_CTRL_ERROR,
  508. /* general error */
  509. RTPQOS_GENERIC_ERROR,
  510. /* invalid service type in flowspec */
  511. RTPQOS_ESERVICETYPE,
  512. /* invalid flowspec */
  513. RTPQOS_EFLOWSPEC,
  514. /* invalid provider specific buffer */
  515. RTPQOS_EPROVSPECBUF,
  516. /* invalid filter style */
  517. RTPQOS_EFILTERSTYLE,
  518. /* invalid filter type */
  519. RTPQOS_EFILTERTYPE,
  520. /* incorrect number of filters */
  521. RTPQOS_EFILTERCOUNT,
  522. /* invalid object length */
  523. RTPQOS_EOBJLENGTH,
  524. /* incorrect number of flows */
  525. RTPQOS_EFLOWCOUNT,
  526. /* unknown object in provider specific buffer */
  527. RTPQOS_EUNKOWNPSOBJ,
  528. /* invalid policy object in provider specific buffer */
  529. RTPQOS_EPOLICYOBJ,
  530. /* invalid flow descriptor in the list */
  531. RTPQOS_EFLOWDESC,
  532. /* inconsistent flow spec in provider specific buffer */
  533. RTPQOS_EPSFLOWSPEC,
  534. /* invalid filter spec in provider specific buffer */
  535. RTPQOS_EPSFILTERSPEC,
  536. /* invalid shape discard mode object in provider specific buffer */
  537. RTPQOS_ESDMODEOBJ,
  538. /* invalid shaping rate object in provider specific buffer */
  539. RTPQOS_ESHAPERATEOBJ,
  540. /* reserved policy element in provider specific buffer */
  541. RTPQOS_RESERVED_PETYPE,
  542. /* sender is not allowed to send */
  543. RTPQOS_NOT_ALLOWEDTOSEND,
  544. /* sender is allowed to send */
  545. RTPQOS_ALLOWEDTOSEND,
  546. RTPQOS_LAST /* Internal only, do not use */
  547. };
  548. /*
  549. * Events generated
  550. */
  551. /* All the events pass the same parameters:
  552. * P1:0, P2:0
  553. */
  554. #define RTPQOS_EVENT_NOQOS (RTPQOS_EVENTBASE + RTPQOS_NOQOS)
  555. #define RTPQOS_EVENT_RECEIVERS (RTPQOS_EVENTBASE + RTPQOS_RECEIVERS)
  556. #define RTPQOS_EVENT_SENDERS (RTPQOS_EVENTBASE + RTPQOS_SENDERS)
  557. #define RTPQOS_EVENT_NO_SENDERS (RTPQOS_EVENTBASE + RTPQOS_NO_SENDERS)
  558. #define RTPQOS_EVENT_NO_RECEIVERS (RTPQOS_EVENTBASE + RTPQOS_NO_RECEIVERS)
  559. #define RTPQOS_EVENT_REQUEST_CONFIRMED (RTPQOS_EVENTBASE + RTPQOS_REQUEST_CONFIRMED)
  560. #define RTPQOS_EVENT_ADMISSION_FAILURE (RTPQOS_EVENTBASE + RTPQOS_ADMISSION_FAILURE)
  561. #define RTPQOS_EVENT_POLICY_FAILURE (RTPQOS_EVENTBASE + RTPQOS_POLICY_FAILURE)
  562. #define RTPQOS_EVENT_BAD_STYLE (RTPQOS_EVENTBASE + RTPQOS_BAD_STYLE)
  563. #define RTPQOS_EVENT_BAD_OBJECT (RTPQOS_EVENTBASE + RTPQOS_BAD_OBJECT)
  564. #define RTPQOS_EVENT_TRAFFIC_CTRL_ERROR (RTPQOS_EVENTBASE + RTPQOS_TRAFFIC_CTRL_ERROR)
  565. #define RTPQOS_EVENT_GENERIC_ERROR (RTPQOS_EVENTBASE + RTPQOS_GENERIC_ERROR)
  566. #define RTPQOS_EVENT_ESERVICETYPE (RTPQOS_EVENTBASE + RTPQOS_ESERVICETYPE)
  567. #define RTPQOS_EVENT_EFLOWSPEC (RTPQOS_EVENTBASE + RTPQOS_EFLOWSPEC)
  568. #define RTPQOS_EVENT_EPROVSPECBUF (RTPQOS_EVENTBASE + RTPQOS_EPROVSPECBUF)
  569. #define RTPQOS_EVENT_EFILTERSTYLE (RTPQOS_EVENTBASE + RTPQOS_EFILTERSTYLE)
  570. #define RTPQOS_EVENT_EFILTERTYPE (RTPQOS_EVENTBASE + RTPQOS_EFILTERTYPE)
  571. #define RTPQOS_EVENT_EFILTERCOUNT (RTPQOS_EVENTBASE + RTPQOS_EFILTERCOUNT)
  572. #define RTPQOS_EVENT_EOBJLENGTH (RTPQOS_EVENTBASE + RTPQOS_EOBJLENGTH)
  573. #define RTPQOS_EVENT_EFLOWCOUNT (RTPQOS_EVENTBASE + RTPQOS_EFLOWCOUNT)
  574. #define RTPQOS_EVENT_EUNKOWNPSOBJ (RTPQOS_EVENTBASE + RTPQOS_EUNKOWNPSOBJ)
  575. #define RTPQOS_EVENT_EPOLICYOBJ (RTPQOS_EVENTBASE + RTPQOS_EPOLICYOBJ)
  576. #define RTPQOS_EVENT_EFLOWDESC (RTPQOS_EVENTBASE + RTPQOS_EFLOWDESC)
  577. #define RTPQOS_EVENT_EPSFLOWSPEC (RTPQOS_EVENTBASE + RTPQOS_EPSFLOWSPEC)
  578. #define RTPQOS_EVENT_EPSFILTERSPEC (RTPQOS_EVENTBASE + RTPQOS_EPSFILTERSPEC)
  579. #define RTPQOS_EVENT_ESDMODEOBJ (RTPQOS_EVENTBASE + RTPQOS_ESDMODEOBJ)
  580. #define RTPQOS_EVENT_ESHAPERATEOBJ (RTPQOS_EVENTBASE + RTPQOS_ESHAPERATEOBJ)
  581. #define RTPQOS_EVENT_RESERVED_PETYPE (RTPQOS_EVENTBASE + RTPQOS_RESERVED_PETYPE)
  582. #define RTPQOS_EVENT_NOT_ALLOWEDTOSEND (RTPQOS_EVENTBASE + RTPQOS_NOT_ALLOWEDTOSEND)
  583. #define RTPQOS_EVENT_ALLOWEDTOSEND (RTPQOS_EVENTBASE + RTPQOS_ALLOWEDTOSEND)
  584. /*
  585. * Masks used to enable/disable the above events (used with
  586. * RTPMASK_QOSRECV_EVENTS or RTPMASK_QOSSEND_EVENTS)
  587. */
  588. #define RTPQOS_MASK_NOQOS (1 << RTPQOS_NOQOS)
  589. #define RTPQOS_MASK_RECEIVERS (1 << RTPQOS_RECEIVERS)
  590. #define RTPQOS_MASK_SENDERS (1 << RTPQOS_SENDERS)
  591. #define RTPQOS_MASK_NO_SENDERS (1 << RTPQOS_NO_SENDERS)
  592. #define RTPQOS_MASK_NO_RECEIVERS (1 << RTPQOS_NO_RECEIVERS)
  593. #define RTPQOS_MASK_REQUEST_CONFIRMED (1 << RTPQOS_REQUEST_CONFIRMED)
  594. #define RTPQOS_MASK_ADMISSION_FAILURE (1 << RTPQOS_ADMISSION_FAILURE)
  595. #define RTPQOS_MASK_POLICY_FAILURE (1 << RTPQOS_POLICY_FAILURE)
  596. #define RTPQOS_MASK_BAD_STYLE (1 << RTPQOS_BAD_STYLE)
  597. #define RTPQOS_MASK_BAD_OBJECT (1 << RTPQOS_BAD_OBJECT)
  598. #define RTPQOS_MASK_TRAFFIC_CTRL_ERROR (1 << RTPQOS_TRAFFIC_CTRL_ERROR)
  599. #define RTPQOS_MASK_GENERIC_ERROR (1 << RTPQOS_GENERIC_ERROR)
  600. #define RTPQOS_MASK_ESERVICETYPE (1 << RTPQOS_ESERVICETYPE)
  601. #define RTPQOS_MASK_EFLOWSPEC (1 << RTPQOS_EFLOWSPEC)
  602. #define RTPQOS_MASK_EPROVSPECBUF (1 << RTPQOS_EPROVSPECBUF)
  603. #define RTPQOS_MASK_EFILTERSTYLE (1 << RTPQOS_EFILTERSTYLE)
  604. #define RTPQOS_MASK_EFILTERTYPE (1 << RTPQOS_EFILTERTYPE)
  605. #define RTPQOS_MASK_EFILTERCOUNT (1 << RTPQOS_EFILTERCOUNT)
  606. #define RTPQOS_MASK_EOBJLENGTH (1 << RTPQOS_EOBJLENGTH)
  607. #define RTPQOS_MASK_EFLOWCOUNT (1 << RTPQOS_EFLOWCOUNT)
  608. #define RTPQOS_MASK_EUNKOWNPSOBJ (1 << RTPQOS_EUNKOWNPSOBJ)
  609. #define RTPQOS_MASK_EPOLICYOBJ (1 << RTPQOS_EPOLICYOBJ)
  610. #define RTPQOS_MASK_EFLOWDESC (1 << RTPQOS_EFLOWDESC)
  611. #define RTPQOS_MASK_EPSFLOWSPEC (1 << RTPQOS_EPSFLOWSPEC)
  612. #define RTPQOS_MASK_EPSFILTERSPEC (1 << RTPQOS_EPSFILTERSPEC)
  613. #define RTPQOS_MASK_ESDMODEOBJ (1 << RTPQOS_ESDMODEOBJ)
  614. #define RTPQOS_MASK_ESHAPERATEOBJ (1 << RTPQOS_ESHAPERATEOBJ)
  615. #define RTPQOS_MASK_RESERVED_PETYPE (1 << RTPQOS_RESERVED_PETYPE)
  616. #define RTPQOS_MASK_NOT_ALLOWEDTOSEND (1 << RTPQOS_NOT_ALLOWEDTOSEND)
  617. #define RTPQOS_MASK_ALLOWEDTOSEND (1 << RTPQOS_ALLOWEDTOSEND)
  618. /* QOS template names */
  619. #define RTPQOSNAME_G711 L"G711"
  620. #define RTPQOSNAME_G723_1 L"G723.1"
  621. #define RTPQOSNAME_GSM6_10 L"GSM6.10"
  622. #define RTPQOSNAME_DVI4_8 L"DVI4_8"
  623. #define RTPQOSNAME_DVI4_16 L"DVI4_16"
  624. #define RTPQOSNAME_SIREN L"SIREN"
  625. #define RTPQOSNAME_G722_1 L"G722.1"
  626. #define RTPQOSNAME_MSAUDIO L"MSAUDIO"
  627. #define RTPQOSNAME_H263QCIF L"H263QCIF"
  628. #define RTPQOSNAME_H263CIF L"H263CIF"
  629. #define RTPQOSNAME_H261QCIF L"H261QCIF"
  630. #define RTPQOSNAME_H261CIF L"H261CIF"
  631. /* RTP reservation styles */
  632. enum {
  633. /* Use default style, i.e. FF for unicast, WF for multicast */
  634. RTPQOS_STYLE_DEFAULT,
  635. /* Wildcard-Filter (default in multicast) */
  636. RTPQOS_STYLE_WF,
  637. /* Fixed-Filter (default in unicast) */
  638. RTPQOS_STYLE_FF,
  639. /* Shared-Explicit (for multicast, typically for video) */
  640. RTPQOS_STYLE_SE,
  641. RTPQOS_STYLE_LAST
  642. };
  643. /* Used to derive a flow spec. This information is obtained from the
  644. * codecs and passed to RTP to generate a QOS flow spec that closelly
  645. * describes the codecs generating/receiving traffic */
  646. typedef struct _RtpQosSpec_t {
  647. DWORD dwAvgRate; /* bits/s */
  648. DWORD dwPeakRate; /* bits/s */
  649. DWORD dwMinPacketSize; /* bytes */
  650. DWORD dwMaxPacketSize; /* bytes */
  651. DWORD dwMaxBurst; /* number of packets */
  652. DWORD dwResvStyle; /* maps to FF, WF, or SE */
  653. } RtpQosSpec_t;
  654. /* Helper enumeration (do not use) */
  655. enum {
  656. RTPQOS_QOSLIST_FIRST, /* Internal only, do not use */
  657. /* Enable Add/Delete */
  658. RTPQOS_QOSLIST_ENABLE,
  659. /* If Enabled, select Add */
  660. RTPQOS_QOSLIST_ADD,
  661. /* Flush */
  662. RTPQOS_QOSLIST_FLUSH,
  663. RTPQOS_QOSLIST_LAST /* Internal only, do not use */
  664. };
  665. /* Values for parameter dwOperation in ModifyQosList().
  666. * They can be OR'ed */
  667. #define RTPQOS_ADD_SSRC ((1<<RTPQOS_QOSLIST_ENABLE) | (1<<RTPQOS_QOSLIST_ADD))
  668. #define RTPQOS_DEL_SSRC (1 << RTPQOS_QOSLIST_ENABLE)
  669. #define RTPQOS_FLUSH (1 << RTPQOS_QOSLIST_FLUSH)
  670. /* Allowed to send mode */
  671. /* Passed as parameters dwQosSendMode in SetQosByName or
  672. * SetQosParameters functions */
  673. enum {
  674. RTPQOSSENDMODE_FIRST, /* Internal only, do not use */
  675. /* Don't ask for permission to send */
  676. RTPQOSSENDMODE_UNRESTRICTED,
  677. /* Ask permission to send, if denied, keep sending at a reduced
  678. * rate */
  679. RTPQOSSENDMODE_REDUCED_RATE,
  680. /* Ask permission to send, if denied, DON'T SEND at all */
  681. RTPQOSSENDMODE_DONT_SEND,
  682. /* Ask permission to send, send at normal rate no matter what, the
  683. * application is supposed to stop passing data to RTP or to pass
  684. * the very minimum (this is the mode that should be used) */
  685. RTPQOSSENDMODE_ASK_BUT_SEND,
  686. RTPQOSSENDMODE_LAST /* Internal only, do not use */
  687. };
  688. /* Maximum number of UNICODE chars to set in the QOS policy locator
  689. * and app ID */
  690. #define MAX_QOS_APPID 128
  691. #define MAX_QOS_APPGUID 128
  692. #define MAX_QOS_POLICY 128
  693. /**********************************************************************
  694. * SDES local/remote information (events, masks)
  695. * Will use with RTPMASK_SDESRECV_EVENTS or RTPMASK_SDESSEND_EVENTS or
  696. * RTPMASK_SDES_LOCMASK or RTPMASK_SDES_REMMASK
  697. **********************************************************************/
  698. /* Helper enumeration (do not use) for events and masks */
  699. enum {
  700. RTPSDES_FIRST, /* Internal only, do not use */
  701. /* RTCP SDES CNAME Canonical name */
  702. RTPSDES_CNAME,
  703. /* RTCP SDES NAME User name*/
  704. RTPSDES_NAME,
  705. /* RTCP SDES EMAIL User's e-mail */
  706. RTPSDES_EMAIL,
  707. /* RTCP SDES PHONE User's phone number */
  708. RTPSDES_PHONE,
  709. /* RTCP SDES LOC User's location */
  710. RTPSDES_LOC,
  711. /* RTCP SDES TOOL Tools (application) used */
  712. RTPSDES_TOOL,
  713. /* RTCP SDES NOTE Note about the user/site */
  714. RTPSDES_NOTE,
  715. /* RTCP SDES PRIV Private information */
  716. RTPSDES_PRIV,
  717. /* RTCP SDES ANY Any of the above */
  718. RTPSDES_ANY,
  719. RTPSDES_LAST /* Internal only, do not use */
  720. };
  721. #define RTPSDES_END RTPSDES_FIRST
  722. /*
  723. * Events generated when the specific SDES field is received for the
  724. * first time (used with RTPMASK_SDES_EVENTS)
  725. */
  726. /* All the events pass the same parameters:
  727. * P1:Remote participant's SSRC, P2:The event index (as in the above
  728. * enumeration.
  729. * Note that the event index goes from RTPSDES_CNAME to RTPSDES_PRIV
  730. */
  731. #define RTPSDES_EVENT_CNAME (RTPSDES_EVENTBASE + RTPSDES_CNAME)
  732. #define RTPSDES_EVENT_NAME (RTPSDES_EVENTBASE + RTPSDES_NAME)
  733. #define RTPSDES_EVENT_EMAIL (RTPSDES_EVENTBASE + RTPSDES_EMAIL)
  734. #define RTPSDES_EVENT_PHONE (RTPSDES_EVENTBASE + RTPSDES_PHONE)
  735. #define RTPSDES_EVENT_LOC (RTPSDES_EVENTBASE + RTPSDES_LOC)
  736. #define RTPSDES_EVENT_TOOL (RTPSDES_EVENTBASE + RTPSDES_TOOL)
  737. #define RTPSDES_EVENT_NOTE (RTPSDES_EVENTBASE + RTPSDES_NOTE)
  738. #define RTPSDES_EVENT_PRIV (RTPSDES_EVENTBASE + RTPSDES_PRIV)
  739. #define RTPSDES_EVENT_ANY (RTPSDES_EVENTBASE + RTPSDES_ANY)
  740. /*
  741. * Masks used to enable/disable the above events (used with
  742. * RTPMASK_SDESRECV_EVENTS and RTPMASK_SDESSEND_EVENTS)
  743. */
  744. #define RTPSDES_MASK_CNAME (1 << RTPSDES_CNAME)
  745. #define RTPSDES_MASK_NAME (1 << RTPSDES_NAME)
  746. #define RTPSDES_MASK_EMAIL (1 << RTPSDES_EMAIL)
  747. #define RTPSDES_MASK_PHONE (1 << RTPSDES_PHONE)
  748. #define RTPSDES_MASK_LOC (1 << RTPSDES_LOC)
  749. #define RTPSDES_MASK_TOOL (1 << RTPSDES_TOOL)
  750. #define RTPSDES_MASK_NOTE (1 << RTPSDES_NOTE)
  751. #define RTPSDES_MASK_PRIV (1 << RTPSDES_PRIV)
  752. #define RTPSDES_MASK_ANY (1 << RTPSDES_ANY)
  753. /*
  754. * Masks used to enable/disable sending each SDES field (used with
  755. * RTPMASK_SDES_LOCMASK)
  756. */
  757. #define RTPSDES_LOCMASK_CNAME (1 << RTPSDES_CNAME)
  758. #define RTPSDES_LOCMASK_NAME (1 << RTPSDES_NAME)
  759. #define RTPSDES_LOCMASK_EMAIL (1 << RTPSDES_EMAIL)
  760. #define RTPSDES_LOCMASK_PHONE (1 << RTPSDES_PHONE)
  761. #define RTPSDES_LOCMASK_LOC (1 << RTPSDES_LOC)
  762. #define RTPSDES_LOCMASK_TOOL (1 << RTPSDES_TOOL)
  763. #define RTPSDES_LOCMASK_NOTE (1 << RTPSDES_NOTE)
  764. #define RTPSDES_LOCMASK_PRIV (1 << RTPSDES_PRIV)
  765. /*
  766. * Masks used to enable/disable keeping each SDES field from the
  767. * remote participants (used with RTPMASK_SDES_REMMASK)
  768. */
  769. #define RTPSDES_REMMASK_CNAME (1 << RTPSDES_CNAME)
  770. #define RTPSDES_REMMASK_NAME (1 << RTPSDES_NAME)
  771. #define RTPSDES_REMMASK_EMAIL (1 << RTPSDES_EMAIL)
  772. #define RTPSDES_REMMASK_PHONE (1 << RTPSDES_PHONE)
  773. #define RTPSDES_REMMASK_LOC (1 << RTPSDES_LOC)
  774. #define RTPSDES_REMMASK_TOOL (1 << RTPSDES_TOOL)
  775. #define RTPSDES_REMMASK_NOTE (1 << RTPSDES_NOTE)
  776. #define RTPSDES_REMMASK_PRIV (1 << RTPSDES_PRIV)
  777. /**********************************************************************
  778. * RTP encryption
  779. **********************************************************************/
  780. /* RTP encryption modes */
  781. enum {
  782. RTPCRYPTMODE_FIRST, /* Internal only, do not use */
  783. /* Encrypt/Decrypt RTP payload only */
  784. RTPCRYPTMODE_PAYLOAD,
  785. /* Encrypt/Decrypt RTP packets only */
  786. RTPCRYPTMODE_RTP,
  787. /* Encrypt/Decrypt RTP and RTCP packets */
  788. RTPCRYPTMODE_ALL,
  789. RTPCRYPTMODE_LAST /* Internal only, do not use */
  790. };
  791. /* Helper enumeration (do not use) for mode flags */
  792. enum {
  793. RTPCRYPTFG_FIRST = 16, /* Internal only, do not use */
  794. /* Use the same key for RECV, SEND, and RTCP */
  795. RTPCRYPTFG_SAMEKEY,
  796. RTPCRYPTFG_LAST, /* Internal only, do not use */
  797. };
  798. /*
  799. * Flags to modify mode
  800. */
  801. #define RTPCRYPT_SAMEKEY (1 << RTPCRYPTFG_SAMEKEY)
  802. /* Max pass phrase in bytes (after it is converted from UNICODE to
  803. * UTF-8), the resulting data is stored in an array this size big */
  804. #define RTPCRYPT_PASSPHRASEBUFFSIZE 256
  805. /*
  806. * The following hashing and data encryption algorithms work on
  807. * Windows2000 out of the box, other algorithms may work with other
  808. * providers
  809. * */
  810. /*
  811. * Hashing algorithms to use in SetEncryptionKey, default hash
  812. * algorithm is RTPCRYPT_HASH_MD5 */
  813. #define RTPCRYPT_HASH_MD2 L"MD2"
  814. #define RTPCRYPT_HASH_MD4 L"MD4"
  815. #define RTPCRYPT_HASH_MD5 L"MD5"
  816. #define RTPCRYPT_HASH_SHA L"SHA"
  817. #define RTPCRYPT_HASH_SHA1 L"SHA1"
  818. /*
  819. * Encryption algorithms to use in SetEncryptionKey, default data
  820. * encryption algorithm is RTPCRYPT_DATA_DES */
  821. #define RTPCRYPT_DATA_DES L"DES"
  822. #define RTPCRYPT_DATA_3DES L"3DES"
  823. #define RTPCRYPT_DATA_RC2 L"RC2"
  824. #define RTPCRYPT_DATA_RC4 L"RC4"
  825. /* NOTE
  826. *
  827. * The stack will be able to recognize the following algorithms, if
  828. * supported:
  829. *
  830. * L"MD2"
  831. * L"MD4"
  832. * L"MD5"
  833. * L"SHA"
  834. * L"SHA1"
  835. * L"MAC"
  836. * L"RSA_SIGN"
  837. * L"DSS_SIGN"
  838. * L"RSA_KEYX"
  839. * L"DES"
  840. * L"3DES_112"
  841. * L"3DES"
  842. * L"DESX"
  843. * L"RC2"
  844. * L"RC4"
  845. * L"SEAL"
  846. * L"DH_SF"
  847. * L"DH_EPHEM"
  848. * L"AGREEDKEY_ANY"
  849. * L"KEA_KEYX"
  850. * L"HUGHES_MD5"
  851. * L"SKIPJACK"
  852. * L"TEK"
  853. * L"CYLINK_MEK"
  854. * L"SSL3_SHAMD5"
  855. * L"SSL3_MASTER"
  856. * L"SCHANNEL_MASTER_HASH"
  857. * L"SCHANNEL_MAC_KEY"
  858. * L"SCHANNEL_ENC_KEY"
  859. * L"PCT1_MASTER"
  860. * L"SSL2_MASTER"
  861. * L"TLS1_MASTER"
  862. * L"RC5"
  863. * L"HMAC"
  864. * L"TLS1PRF"
  865. * */
  866. /**********************************************************************
  867. * RTP Demux
  868. **********************************************************************/
  869. /* Demux modes */
  870. enum {
  871. RTPDMXMODE_FIRST, /* Internal only, do not use */
  872. /* Manual mapping */
  873. RTPDMXMODE_MANUAL,
  874. /* Automatically map and unmap */
  875. RTPDMXMODE_AUTO,
  876. /* Automatically map, manual unmap */
  877. RTPDMXMODE_AUTO_MANUAL,
  878. RTPDMXMODE_LAST /* Internal only, do not use */
  879. };
  880. /* State used in SetMappingState */
  881. #define RTPDMX_PINMAPPED TRUE
  882. #define RTPDMX_PINUNMAPPED FALSE
  883. /* Maximum number of payload type mappings */
  884. #define MAX_MEDIATYPE_MAPPINGS 10
  885. /**********************************************************************
  886. * DTMF (RFC2833)
  887. **********************************************************************/
  888. /* Events sent */
  889. enum {
  890. RTPDTMF_FIRST = 0, /* Internal only, do not use */
  891. RTPDTMF_0 = 0, /* 0 */
  892. RTPDTMF_1, /* 1 */
  893. RTPDTMF_2, /* 2 */
  894. RTPDTMF_3, /* 3 */
  895. RTPDTMF_4, /* 4 */
  896. RTPDTMF_5, /* 5 */
  897. RTPDTMF_6, /* 6 */
  898. RTPDTMF_7, /* 7 */
  899. RTPDTMF_8, /* 8 */
  900. RTPDTMF_9, /* 9 */
  901. RTPDTMF_STAR, /* 10 */
  902. RTPDTMF_POUND, /* 11 */
  903. RTPDTMF_A, /* 12 */
  904. RTPDTMF_B, /* 13 */
  905. RTPDTMF_C, /* 14 */
  906. RTPDTMF_D, /* 15 */
  907. RTPDTMF_FLASH, /* 16 */
  908. RTPDTMF_LAST /* Internal only, do not use */
  909. };
  910. #endif /* _msrtp_h_ */