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.

128 lines
3.8 KiB

  1. /*-------------------------------------------------------------------------
  2. * Filename: RTP.H
  3. *
  4. * RTP related data structures.
  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 _RTP_H_
  13. #define _RTP_H_
  14. #define RTP_HDR_MIN_LEN 12
  15. #define RTP_SEQ_MOD (1<<16)
  16. #define RTP_TS_MOD (0xffffffff)
  17. #define RTP_TYPE 2 /* Current version */
  18. #define RTP_MAX_SDES 256 /* maximum text length for SDES */
  19. #define RTCP_SIZE_GAIN (1./16.)
  20. #define NTWRK_HDR_SIZE 28
  21. typedef enum {
  22. RTCP_SR = 200,
  23. RTCP_RR = 201,
  24. RTCP_SDES = 202,
  25. RTCP_BYE = 203,
  26. RTCP_APP = 204
  27. } RTCP_TYPE_T;
  28. typedef struct {
  29. // !!! WARNING !!!
  30. // The following word doesn't need to be swapped for NtoH()
  31. WORD cc:4; /* CSRC count */
  32. WORD x:1; /* header extension flag */
  33. WORD p:1; /* padding flag */
  34. WORD type:2; /* version type 1/2 */
  35. WORD pt:7; /* payload type */
  36. WORD m:1; /* marker bit */
  37. WORD seq; /* sequence number */
  38. DWORD ts; /* timestamp */
  39. DWORD ssrc; /* synchronization source */
  40. DWORD csrc[1]; /* optional CSRC list */
  41. } RTP_HDR_T;
  42. // macros to get various RTP header fields
  43. #define RTP_TIMESTAMP(p) (((RTP_HDR_T *)p)->ts)
  44. #define RTP_SEQNUM(p) (((RTP_HDR_T *)p)->seq)
  45. #define RTP_MARKBIT(p) (((RTP_HDR_T *)p)->m)
  46. #define RTP_SSRC(p) (((RTP_HDR_T *)p)->ssrc)
  47. typedef struct {
  48. // !!! WARNING !!!
  49. // The following word doesn't need to be swapped for NtoH()
  50. WORD count:5; /* varies by payload type */
  51. WORD p:1; /* padding flag */
  52. WORD type:2; /* protocol version */
  53. WORD pt:8; /* payload type */
  54. WORD length; /* packet length in words, without this word */
  55. } RTCP_COMMON_T;
  56. /* reception report */
  57. typedef struct {
  58. DWORD ssrc; /* data source being reported */
  59. DWORD received; /* cumulative number of packets received */
  60. DWORD expected; /* cumulative number of packets expected */
  61. DWORD jitter; /* interarrival jitter */
  62. DWORD lsr; /* last SR packet from this source */
  63. DWORD dlsr; /* delay since last SR packet */
  64. } RTCP_RR_T;
  65. typedef struct {
  66. BYTE dwSdesType; /* type of SDES item (rtcp_sdes_type_t) */
  67. BYTE dwSdesLength; /* length of SDES item (in octets) */
  68. char sdesData[1]; /* text, not zero-terminated */
  69. } RTCP_SDES_ITEM_T;
  70. typedef struct {
  71. DWORD ssrc; /* source this RTCP packet refers to */
  72. DWORD ntp_sec; /* NTP timestamp */
  73. DWORD ntp_frac;
  74. DWORD rtp_ts; /* RTP timestamp */
  75. DWORD psent; /* packets sent */
  76. DWORD osent; /* octets sent */
  77. RTCP_RR_T rr[1]; /* variable-length list */
  78. } SENDER_RPT;
  79. typedef struct {
  80. DWORD ssrc; /* source this generating this report */
  81. RTCP_RR_T rr[1]; /* variable-length list */
  82. } RECEIVER_RPT;
  83. typedef struct {
  84. DWORD src[1]; /* list of sources */
  85. /* can't express trailing text */
  86. } BYE_PCKT;
  87. typedef struct {
  88. DWORD src; /* first SSRC/CSRC */
  89. RTCP_SDES_ITEM_T item[1]; /* list of SDES items */
  90. } RTCP_SDES_T;
  91. /* one RTCP packet */
  92. typedef struct {
  93. RTCP_COMMON_T common; /* common header */
  94. union
  95. {
  96. SENDER_RPT sr; /* sender report (SR) */
  97. RECEIVER_RPT rr; /* reception report (RR) */
  98. BYE_PCKT bye; /* BYE */
  99. RTCP_SDES_T sdes; /* source description (SDES) */
  100. } r;
  101. } RTCP_T;
  102. typedef DWORD MEMBER_T;
  103. #endif /* ifndef _RTP_H_ */