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.

134 lines
3.6 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 enum {
  29. RTCP_SDES_END,
  30. RTCP_SDES_CNAME,
  31. RTCP_SDES_NAME,
  32. RTCP_SDES_EMAIL,
  33. RTCP_SDES_PHONE,
  34. RTCP_SDES_LOC,
  35. RTCP_SDES_TOOL,
  36. RTCP_SDES_TXT,
  37. RTCP_SDES_PRIV
  38. } RTCP_SDES_TYPE_T;
  39. typedef struct {
  40. // !!! WARNING !!!
  41. // The following word doesn't need to be swapped for NtoH()
  42. WORD cc:4; /* CSRC count */
  43. WORD x:1; /* header extension flag */
  44. WORD p:1; /* padding flag */
  45. WORD type:2; /* version type 1/2 */
  46. WORD pt:7; /* payload type */
  47. WORD m:1; /* marker bit */
  48. WORD seq; /* sequence number */
  49. DWORD ts; /* timestamp */
  50. DWORD ssrc; /* synchronization source */
  51. DWORD csrc[1]; /* optional CSRC list */
  52. } RTP_HDR_T;
  53. typedef struct {
  54. // !!! WARNING !!!
  55. // The following word doesn't need to be swapped for NtoH()
  56. WORD count:5; /* varies by payload type */
  57. WORD p:1; /* padding flag */
  58. WORD type:2; /* protocol version */
  59. WORD pt:8; /* payload type */
  60. WORD length; /* packet length in words, without this word */
  61. } RTCP_COMMON_T;
  62. /* reception report */
  63. typedef struct {
  64. DWORD ssrc; /* data source being reported */
  65. DWORD received; /* cumulative number of packets received */
  66. DWORD expected; /* cumulative number of packets expected */
  67. DWORD jitter; /* interarrival jitter */
  68. DWORD lsr; /* last SR packet from this source */
  69. DWORD dlsr; /* delay since last SR packet */
  70. } RTCP_RR_T;
  71. typedef struct {
  72. BYTE sdesType; /* type of SDES item (rtcp_sdes_type_t) */
  73. BYTE sdesLength; /* length of SDES item (in octets) */
  74. char sdesData[1]; /* text, not zero-terminated */
  75. } RTCP_SDES_ITEM_T;
  76. typedef struct {
  77. DWORD ssrc; /* source this RTCP packet refers to */
  78. DWORD ntp_sec; /* NTP timestamp */
  79. DWORD ntp_frac;
  80. DWORD rtp_ts; /* RTP timestamp */
  81. DWORD psent; /* packets sent */
  82. DWORD osent; /* octets sent */
  83. RTCP_RR_T rr[1]; /* variable-length list */
  84. } SENDER_RPT;
  85. typedef struct {
  86. DWORD ssrc; /* source this generating this report */
  87. RTCP_RR_T rr[1]; /* variable-length list */
  88. } RECEIVER_RPT;
  89. typedef struct {
  90. DWORD src[1]; /* list of sources */
  91. /* can't express trailing text */
  92. } BYE_PCKT;
  93. typedef struct {
  94. DWORD src; /* first SSRC/CSRC */
  95. RTCP_SDES_ITEM_T item[1]; /* list of SDES items */
  96. } RTCP_SDES_T;
  97. /* one RTCP packet */
  98. typedef struct {
  99. RTCP_COMMON_T common; /* common header */
  100. union
  101. {
  102. SENDER_RPT sr; /* sender report (SR) */
  103. RECEIVER_RPT rr; /* reception report (RR) */
  104. BYE_PCKT bye; /* BYE */
  105. RTCP_SDES_T sdes; /* source description (SDES) */
  106. } r;
  107. } RTCP_T;
  108. typedef DWORD MEMBER_T;
  109. #endif /* ifndef _RTP_H_ */