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.

116 lines
3.0 KiB

  1. /*
  2. RTP.H
  3. RTP structures and prototypes
  4. */
  5. #ifndef _RTP_H_
  6. #define _RTP_H_
  7. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  8. #define RTP_VERSION 2
  9. /* Defined in rrcm_dll.h
  10. typedef enum {
  11. RTCP_SDES_END = 0,
  12. RTCP_SDES_CNAME = 1,
  13. RTCP_SDES_NAME = 2,
  14. RTCP_SDES_EMAIL = 3,
  15. RTCP_SDES_PHONE = 4,
  16. RTCP_SDES_LOC = 5,
  17. RTCP_SDES_TOOL = 6,
  18. RTCP_SDES_NOTE = 7,
  19. RTCP_SDES_PRIV = 8,
  20. RTCP_SDES_IMG = 9,
  21. RTCP_SDES_DOOR = 10,
  22. RTCP_SDES_SOURCE = 11
  23. } SDES_TYPE;
  24. */
  25. typedef enum {
  26. RTCP_TYPE_SR = 200, // sender report
  27. RTCP_TYPE_RR = 201, // receiver report
  28. RTCP_TYPE_SDES = 202, // source description
  29. RTCP_TYPE_BYE = 203, // end of session
  30. RTCP_TYPE_APP = 204 // app. specific
  31. } RTCP_TYPE;
  32. typedef unsigned __int64 NTP_TS;
  33. typedef struct {
  34. // !!! WARNING !!!
  35. // The following word doesn't need to be swapped for NtoH()
  36. unsigned short cc:4; /* CSRC count */
  37. unsigned short x:1; /* header extension flag */
  38. unsigned short p:1; /* padding flag */
  39. unsigned short version:2; /* protocol version */
  40. unsigned short payload:7; /* payload type */
  41. unsigned short m:1; /* marker bit */
  42. WORD seq; /* sequence number */
  43. DWORD ts; /* timestamp */
  44. DWORD ssrc; /* synchronization source */
  45. //DWORD csrc[1]; /* optional CSRC list */
  46. } RTP_HDR;
  47. // common part of RTCP header
  48. typedef struct {
  49. unsigned short version:2; /* protocol version */
  50. unsigned short p:1; /* padding flag */
  51. unsigned short count:5; /* varies by payload type */
  52. unsigned short rtcpType:8; /* payload type */
  53. WORD length; /* packet length in dwords, without this hdr */
  54. } RTCP_HDR;
  55. /* reception report */
  56. typedef struct {
  57. DWORD ssrc; /* data source being reported */
  58. BYTE fracLost; /* fraction lost since last SR/RR */
  59. BYTE lostHi; /* cumulative number of packets lost (signed!) */
  60. WORD lostLo;
  61. DWORD lastSeq; /* extended last sequence number received */
  62. DWORD jitter; /* interarrival jitter */
  63. DWORD lastSR; /* last SR packet from this source */
  64. DWORD delayLastSR; /* delay since last SR packet */
  65. } RTCP_RR;
  66. /* sender report (SR) */
  67. typedef struct {
  68. DWORD ssrc; /* source this RTCP packet refers to */
  69. DWORD ntpHi; /* NTP timestamp - seconds */
  70. DWORD ntpLo; /* mantissa */
  71. DWORD timestamp; /* RTP timestamp */
  72. DWORD packetsSent; /* packets sent */
  73. DWORD bytesSent; /* octets sent */
  74. /* variable-length list */
  75. //RTCP_RR rr[1];
  76. } RTCP_SR;
  77. /* BYE */
  78. typedef struct {
  79. DWORD src[1]; /* list of sources */
  80. /* can't express trailing text */
  81. } RTCP_BYE;
  82. typedef struct {
  83. BYTE type; /* type of SDES item (rtcp_sdes_type_t) */
  84. BYTE length; /* length of SDES item (in octets) */
  85. char data[1]; /* text, not zero-terminated */
  86. } RTCP_SDES_ITEM;
  87. /* source description (SDES) */
  88. typedef struct {
  89. DWORD src; /* first SSRC/CSRC */
  90. RTCP_SDES_ITEM item[1]; /* list of SDES items */
  91. } RTCP_SDES;
  92. #define INVALID_RTP_SEQ_NUMBER 0xffffffff
  93. #include <poppack.h> /* End byte packing */
  94. #endif // _RTP_H_