Main Page   Compound List   File List   Compound Members   File Members  

rtp.h

Go to the documentation of this file.
00001 /*
00002 * rtp.h  --  RTP header file
00003 * RTP draft: November 1994 version
00004 *
00005 * $Id: rtp.h,v 1.1.1.1 2002/11/09 12:40:48 johnwalker Exp $
00006 */
00007 
00008 #define RTP_SEQ_MOD (1<<16)
00009 #define RTP_TS_MOD  (0xffffffff)
00010 /*
00011 * Current type value.
00012 */
00013 #define RTP_VERSION 2
00014 
00015 #define RTP_MAX_SDES 256   /* maximum text length for SDES */
00016 
00017 typedef enum {
00018   RTCP_SR   = 200,
00019   RTCP_RR   = 201,
00020   RTCP_SDES = 202,
00021   RTCP_BYE  = 203,
00022   RTCP_APP  = 204
00023 } rtcp_type_t;
00024 
00025 typedef enum {
00026   RTCP_SDES_END    =  0,
00027   RTCP_SDES_CNAME  =  1,
00028   RTCP_SDES_NAME   =  2,
00029   RTCP_SDES_EMAIL  =  3,
00030   RTCP_SDES_PHONE  =  4,
00031   RTCP_SDES_LOC    =  5,
00032   RTCP_SDES_TOOL   =  6,
00033   RTCP_SDES_NOTE   =  7,
00034   RTCP_SDES_PRIV   =  8, 
00035   RTCP_SDES_IMG    =  9,
00036   RTCP_SDES_DOOR   = 10,
00037   RTCP_SDES_SOURCE = 11
00038 } rtcp_sdes_type_t;
00039 
00040 typedef struct {
00041   unsigned int version:2;  /* protocol version */
00042   unsigned int p:1;        /* padding flag */
00043   unsigned int x:1;        /* header extension flag */
00044   unsigned int cc:4;       /* CSRC count */
00045   unsigned int m:1;        /* marker bit */
00046   unsigned int pt:7;       /* payload type */
00047   u_int16 seq;             /* sequence number */
00048   u_int32 ts;              /* timestamp */
00049   u_int32 ssrc;            /* synchronization source */
00050   u_int32 csrc[1];         /* optional CSRC list */
00051 } rtp_hdr_t;
00052 
00053 typedef struct {
00054   unsigned int version:2;  /* protocol version */
00055   unsigned int p:1;        /* padding flag */
00056   unsigned int count:5;    /* varies by payload type */
00057   unsigned int pt:8;       /* payload type */
00058   u_int16 length;          /* packet length in words, without this word */
00059 } rtcp_common_t;
00060 
00061 /* reception report */
00062 typedef struct {
00063   u_int32 ssrc;            /* data source being reported */
00064   unsigned int fraction:8; /* fraction lost since last SR/RR */
00065   int lost:24;             /* cumulative number of packets lost (signed!) */
00066   u_int32 last_seq;        /* extended last sequence number received */
00067   u_int32 jitter;          /* interarrival jitter */
00068   u_int32 lsr;             /* last SR packet from this source */
00069   u_int32 dlsr;            /* delay since last SR packet */
00070 } rtcp_rr_t;
00071 
00072 typedef struct {
00073   u_int8 type;             /* type of SDES item (rtcp_sdes_type_t) */
00074   u_int8 length;           /* length of SDES item (in octets) */
00075   char data[1];            /* text, not zero-terminated */
00076 } rtcp_sdes_item_t;
00077 
00078 /* one RTCP packet */
00079 typedef struct {
00080   rtcp_common_t common;    /* common header */
00081   union {
00082     /* sender report (SR) */
00083     struct {
00084       u_int32 ssrc;        /* source this RTCP packet refers to */
00085       u_int32 ntp_sec;     /* NTP timestamp */
00086       u_int32 ntp_frac;
00087       u_int32 rtp_ts;      /* RTP timestamp */
00088       u_int32 psent;       /* packets sent */
00089       u_int32 osent;       /* octets sent */ 
00090       /* variable-length list */
00091       rtcp_rr_t rr[1];
00092     } sr;
00093 
00094     /* reception report (RR) */
00095     struct {
00096       u_int32 ssrc;        /* source this generating this report */
00097       /* variable-length list */
00098       rtcp_rr_t rr[1];
00099     } rr;
00100 
00101     /* BYE */
00102     struct {
00103       u_int32 src[1];      /* list of sources */
00104       /* can't express trailing text */
00105     } bye;
00106 
00107     /* source description (SDES) */
00108     struct rtcp_sdes_t {
00109       u_int32 src;              /* first SSRC/CSRC */
00110       rtcp_sdes_item_t item[1]; /* list of SDES items */
00111     } sdes;
00112   } r;
00113 } rtcp_t;

Generated on Tue Feb 10 08:44:18 2004 for Speak-FreelyforUnix by doxygen1.2.18