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 2003/02/04 22:30:34 johnwalker Exp $
00006 */
00007 
00008 #ifdef MICROSOFT_COMPILERS_CAN_BE_TRUSTED
00009 #error Microsoft compilers can *never* be trusted,
00010 #error except to invariably do the wrong thing.
00011 typedef unsigned char u_int8;
00012 typedef unsigned short u_int16;
00013 typedef unsigned long u_int32;
00014 #endif
00015 
00016 #define RTP_SEQ_MOD (1<<16)
00017 #define RTP_TS_MOD      (0xffffffff)
00018 /*
00019 * Current type value.
00020 */
00021 #define RTP_VERSION 2
00022 
00023 #define RTP_MAX_SDES 256   /* maximum text length for SDES */
00024 
00025 typedef enum {
00026   RTCP_SR       = 200,
00027   RTCP_RR       = 201,
00028   RTCP_SDES = 202,
00029   RTCP_BYE      = 203,
00030   RTCP_APP      = 204
00031 } rtcp_type_t;
00032 
00033 typedef enum {
00034   RTCP_SDES_END    =  0,
00035   RTCP_SDES_CNAME  =  1,
00036   RTCP_SDES_NAME   =  2,
00037   RTCP_SDES_EMAIL  =  3,
00038   RTCP_SDES_PHONE  =  4,
00039   RTCP_SDES_LOC    =  5,
00040   RTCP_SDES_TOOL   =  6,
00041   RTCP_SDES_NOTE   =  7,
00042   RTCP_SDES_PRIV   =  8, 
00043   RTCP_SDES_IMG    =  9,
00044   RTCP_SDES_DOOR   = 10,
00045   RTCP_SDES_SOURCE = 11
00046 } rtcp_sdes_type_t;
00047 
00048 #ifdef MICROSOFT_COMPILERS_CAN_BE_TRUSTED
00049 
00050 /*      We don't dare use the following structures, which appear
00051         for documentation only, because Microsoft Visual C has
00052         incompatible and downright weird ideas about packing bit
00053         fields and structures.  The packets are actually processed
00054         using hard-coded byte numbers and shifting for the bit
00055         fields to guarantee the compiler can't inject its own
00056         opinions into the process.  */
00057 
00058 typedef struct {
00059   unsigned int version:2;  /* protocol version */
00060   unsigned int p:1;        /* padding flag */
00061   unsigned int x:1;        /* header extension flag */
00062   unsigned int cc:4;       /* CSRC count */
00063   unsigned int m:1;        /* marker bit */
00064   unsigned int pt:7;       /* payload type */
00065   u_int16 seq;                     /* sequence number */
00066   u_int32 ts;                      /* timestamp */
00067   u_int32 ssrc;                    /* synchronization source */
00068   u_int32 csrc[1];                 /* optional CSRC list */
00069 } rtp_hdr_t;
00070 
00071 typedef struct {
00072   unsigned int version:2;  /* protocol version */
00073   unsigned int p:1;        /* padding flag */
00074   unsigned int count:5;    /* varies by payload type */
00075   unsigned int pt:8;       /* payload type */
00076   u_int16 length;                  /* packet length in words, without this word */
00077 } rtcp_common_t;
00078 
00079 /* reception report */
00080 typedef struct {
00081   u_int32 ssrc;                    /* data source being reported */
00082   unsigned long fraction:8; /* fraction lost since last SR/RR */
00083   long lost:24;                    /* cumulative number of packets lost (signed!) */
00084   u_int32 last_seq;        /* extended last sequence number received */
00085   u_int32 jitter;                  /* interarrival jitter */
00086   u_int32 lsr;                     /* last SR packet from this source */
00087   u_int32 dlsr;                    /* delay since last SR packet */
00088 } rtcp_rr_t;
00089 
00090 typedef struct {
00091   u_int8 type;                     /* type of SDES item (rtcp_sdes_type_t) */
00092   u_int8 length;                   /* length of SDES item (in octets) */
00093   char data[1];                    /* text, not zero-terminated */
00094 } rtcp_sdes_item_t;
00095 
00096 /* one RTCP packet */
00097 typedef struct {
00098   rtcp_common_t common;    /* common header */
00099   union {
00100         /* sender report (SR) */
00101         struct {
00102           u_int32 ssrc;            /* source this RTCP packet refers to */
00103           u_int32 ntp_sec;         /* NTP timestamp */
00104           u_int32 ntp_frac;
00105           u_int32 rtp_ts;          /* RTP timestamp */
00106           u_int32 psent;           /* packets sent */
00107           u_int32 osent;           /* octets sent */ 
00108           /* variable-length list */
00109           rtcp_rr_t rr[1];
00110         } sr;
00111 
00112         /* reception report (RR) */
00113         struct {
00114           u_int32 ssrc;            /* source this generating this report */
00115           /* variable-length list */
00116           rtcp_rr_t rr[1];
00117         } rr;
00118 
00119         /* BYE */
00120         struct {
00121           u_int32 src[1];          /* list of sources */
00122       /* can't express trailing text */
00123         } bye;
00124 
00125         /* source description (SDES) */
00126         struct rtcp_sdes_t {
00127           u_int32 src;                          /* first SSRC/CSRC */
00128           rtcp_sdes_item_t item[1]; /* list of SDES items */
00129         } sdes;
00130   } r;
00131 } rtcp_t;
00132 #endif

Generated on Tue Feb 10 08:26:35 2004 for Speak-FreelyforWindows by doxygen1.2.18