Index: pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3553)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3999)
@@ -55,4 +55,5 @@
  */
 
+ 
 #pragma pack(1)
 
@@ -60,5 +61,5 @@
  * RTCP sender report.
  */
-struct pjmedia_rtcp_sr
+typedef struct pjmedia_rtcp_sr
 {
     pj_uint32_t	    ntp_sec;	    /**< NTP time, seconds part.	*/
@@ -67,15 +68,11 @@
     pj_uint32_t	    sender_pcount;  /**< Sender packet cound.		*/
     pj_uint32_t	    sender_bcount;  /**< Sender octet/bytes count.	*/
-};
-
-/**
- * @see pjmedia_rtcp_sr
- */
-typedef struct pjmedia_rtcp_sr pjmedia_rtcp_sr;
+} pjmedia_rtcp_sr;
+
 
 /**
  * RTCP receiver report.
  */
-struct pjmedia_rtcp_rr
+typedef struct pjmedia_rtcp_rr
 {
     pj_uint32_t	    ssrc;	    /**< SSRC identification.		*/
@@ -95,10 +92,5 @@
     pj_uint32_t	    lsr;	    /**< Last SR.			*/
     pj_uint32_t	    dlsr;	    /**< Delay since last SR.		*/
-};
-
-/**
- * @see pjmedia_rtcp_rr
- */
-typedef struct pjmedia_rtcp_rr pjmedia_rtcp_rr;
+} pjmedia_rtcp_rr;
 
 
@@ -106,5 +98,5 @@
  * RTCP common header.
  */
-struct pjmedia_rtcp_common
+typedef struct pjmedia_rtcp_common
 {
 #if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
@@ -121,10 +113,6 @@
     unsigned	    length:16;	/**< packet length          */
     pj_uint32_t	    ssrc;	/**< SSRC identification    */
-};
-
-/**
- * @see pjmedia_rtcp_common
- */
-typedef struct pjmedia_rtcp_common pjmedia_rtcp_common;
+} pjmedia_rtcp_common;
+
 
 /**
@@ -154,17 +142,26 @@
 
 /**
+ * RTCP SDES structure.
+ */
+typedef struct pjmedia_rtcp_sdes
+{
+    pj_str_t	cname;		/**< RTCP SDES type CNAME.	*/
+    pj_str_t	name;		/**< RTCP SDES type NAME.	*/
+    pj_str_t	email;		/**< RTCP SDES type EMAIL.	*/
+    pj_str_t	phone;		/**< RTCP SDES type PHONE.	*/
+    pj_str_t	loc;		/**< RTCP SDES type LOC.	*/
+    pj_str_t	tool;		/**< RTCP SDES type TOOL.	*/
+    pj_str_t	note;		/**< RTCP SDES type NOTE.	*/
+} pjmedia_rtcp_sdes;
+
+
+/**
  * NTP time representation.
  */
-struct pjmedia_rtcp_ntp_rec
+typedef struct pjmedia_rtcp_ntp_rec
 {
     pj_uint32_t	    hi;		/**< High order 32-bit part.	*/
     pj_uint32_t	    lo;		/**< Lo order 32-bit part.	*/
-};
-
-/**
- * @see pjmedia_rtcp_ntp_rec
- */
-typedef struct pjmedia_rtcp_ntp_rec pjmedia_rtcp_ntp_rec;
-
+} pjmedia_rtcp_ntp_rec;
 
 
@@ -172,5 +169,5 @@
  * Unidirectional RTP stream statistics.
  */
-struct pjmedia_rtcp_stream_stat
+typedef struct pjmedia_rtcp_stream_stat
 {
     pj_time_val	    update;	/**< Time of last update.		    */
@@ -191,12 +188,6 @@
 
     pj_math_stat    jitter;	/**< Jitter statistics (in usec)	    */
-};
-
-
-/**
- * @see pjmedia_rtcp_stream_stat
- */
-typedef struct pjmedia_rtcp_stream_stat pjmedia_rtcp_stream_stat;
-
+
+} pjmedia_rtcp_stream_stat;
 
 
@@ -204,5 +195,5 @@
  * Bidirectional RTP stream statistics.
  */
-struct pjmedia_rtcp_stat
+typedef struct pjmedia_rtcp_stat
 {
     pj_time_val		     start; /**< Time when session was created	    */
@@ -227,11 +218,10 @@
 						(in usec).		    */
 #endif
-};
-
-
-/**
- * @see pjmedia_rtcp_stat
- */
-typedef struct pjmedia_rtcp_stat pjmedia_rtcp_stat;
+
+    pjmedia_rtcp_sdes	     peer_sdes;	/**< Peer SDES.			    */
+    char		     peer_sdes_buf_[PJMEDIA_RTCP_RX_SDES_BUF_LEN];
+					/**< Peer SDES buffer.		    */
+
+} pjmedia_rtcp_stat;
 
 
@@ -240,5 +230,5 @@
  * should only be one RTCP session for a bidirectional RTP streams.
  */
-struct pjmedia_rtcp_session
+typedef struct pjmedia_rtcp_session
 {
     char		   *name;	/**< Name identification.	    */
@@ -279,10 +269,5 @@
     pjmedia_rtcp_xr_session xr_session;
 #endif
-};
-
-/**
- * @see pjmedia_rtcp_session
- */
-typedef struct pjmedia_rtcp_session pjmedia_rtcp_session;
+} pjmedia_rtcp_session;
 
 
@@ -440,4 +425,44 @@
 
 /**
+ * Build an RTCP SDES (source description) packet. This packet can be
+ * appended to other RTCP packets, e.g: RTCP RR/SR, to compose a compound
+ * RTCP packet.
+ *
+ * @param session   The RTCP session.
+ * @param buf	    The buffer to receive RTCP SDES packet.
+ * @param length    On input, it will contain the buffer length.
+ *		    On output, it will contain the generated RTCP SDES
+ *		    packet length.
+ * @param sdes	    The source description, see #pjmedia_rtcp_sdes.
+ *
+ * @return	    PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_rtcp_build_rtcp_sdes(
+					    pjmedia_rtcp_session *session, 
+					    void *buf,
+					    pj_size_t *length,
+					    const pjmedia_rtcp_sdes *sdes);
+
+/**
+ * Build an RTCP BYE packet. This packet can be appended to other RTCP
+ * packets, e.g: RTCP RR/SR, to compose a compound RTCP packet.
+ *
+ * @param session   The RTCP session.
+ * @param buf	    The buffer to receive RTCP BYE packet.
+ * @param length    On input, it will contain the buffer length.
+ *		    On output, it will contain the generated RTCP BYE
+ *		    packet length.
+ * @param reason    Optional, the BYE reason.
+ *
+ * @return	    PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_rtcp_build_rtcp_bye(
+					    pjmedia_rtcp_session *session, 
+					    void *buf,
+					    pj_size_t *length,
+					    const pj_str_t *reason);
+
+
+/**
  * Call this function if RTCP XR needs to be enabled/disabled in the 
  * RTCP session.
