00001
00002
00003
00004
#include <sys/types.h>
00005
00006
00007
00008
00009
00010 typedef unsigned char u_int8;
00011 typedef unsigned short u_int16;
00012 typedef unsigned int u_int32;
00013 typedef short int16;
00014
00015
00016
00017
00018 #define RTP_VERSION 2
00019
00020 #define RTP_SEQ_MOD (1<<16)
00021 #define RTP_MAX_SDES 255
00022
00023 typedef enum {
00024
RTCP_SR = 200,
00025
RTCP_RR = 201,
00026
RTCP_SDES = 202,
00027
RTCP_BYE = 203,
00028
RTCP_APP = 204
00029 }
rtcp_type_t;
00030
00031 typedef enum {
00032
RTCP_SDES_END = 0,
00033
RTCP_SDES_CNAME = 1,
00034
RTCP_SDES_NAME = 2,
00035
RTCP_SDES_EMAIL = 3,
00036
RTCP_SDES_PHONE = 4,
00037
RTCP_SDES_LOC = 5,
00038
RTCP_SDES_TOOL = 6,
00039
RTCP_SDES_NOTE = 7,
00040
RTCP_SDES_PRIV = 8
00041 }
rtcp_sdes_type_t;
00042
00043
00044
00045
00046 typedef struct {
00047 unsigned int version:2;
00048 unsigned int p:1;
00049 unsigned int x:1;
00050 unsigned int cc:4;
00051 unsigned int m:1;
00052 unsigned int pt:7;
00053 unsigned int seq:16;
00054 u_int32 ts;
00055 u_int32 ssrc;
00056
00057 }
rtp_hdr_t;
00058
00059
00060
00061
00062 typedef struct {
00063 unsigned int version:2;
00064 unsigned int p:1;
00065 unsigned int count:5;
00066 unsigned int pt:8;
00067 u_int16 length;
00068 }
rtcp_common_t;
00069
00070
00071
00072
00073 #define RTCP_VALID_MASK (0xc000 | 0x2000 | 0xfe)
00074 #define RTCP_VALID_VALUE ((RTP_VERSION << 14) | RTCP_SR)
00075
00076
00077
00078
00079 typedef struct {
00080 u_int32 ssrc;
00081 unsigned int fraction:8;
00082 int lost:24;
00083 u_int32 last_seq;
00084 u_int32 jitter;
00085 u_int32 lsr;
00086 u_int32 dlsr;
00087 }
rtcp_rr_t;
00088
00089
00090
00091
00092 typedef struct {
00093 u_int8 type;
00094 u_int8 length;
00095 char data[1];
00096 }
rtcp_sdes_item_t;
00097
00098
00099
00100
00101 typedef struct {
00102 rtcp_common_t common;
00103
union {
00104
00105
struct {
00106
u_int32 ssrc;
00107 u_int32 ntp_sec;
00108 u_int32 ntp_frac;
00109 u_int32 rtp_ts;
00110 u_int32 psent;
00111 u_int32 osent;
00112
rtcp_rr_t rr[1];
00113 } sr;
00114
00115
00116
struct {
00117 u_int32 ssrc;
00118 rtcp_rr_t rr[1];
00119 } rr;
00120
00121
00122
struct rtcp_sdes {
00123
u_int32 src;
00124 rtcp_sdes_item_t item[1];
00125 } sdes;
00126
00127
00128
struct {
00129 u_int32 src[1];
00130
00131 } bye;
00132 } r;
00133 }
rtcp_t;
00134
00135 typedef struct rtcp_sdes
rtcp_sdes_t;
00136
00137
00138
00139
00140 typedef struct {
00141 u_int16 max_seq;
00142 u_int32 cycles;
00143 u_int32 base_seq;
00144 u_int32 bad_seq;
00145 u_int32 probation;
00146 u_int32 received;
00147 u_int32 expected_prior;
00148 u_int32 received_prior;
00149 u_int32 transit;
00150 u_int32 jitter;
00151
00152 }
source;