00001 /*************************************************************************** 00002 RTCPPacket.h - description 00003 ------------------- 00004 (C) 2007 Ahmed Ayadi <ahmed.ayadi@sophia.inria.fr> 00005 (C) 2001 Matthias Oppitz <Matthias.Oppitz@gmx.de> 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00031 #ifndef __INET_RTCPPACKET_H 00032 #define __INET_RTCPPACKET_H 00033 00034 #include <iostream> 00035 #include "INETDefs.h" 00036 #include "reports.h" 00037 #include "sdes.h" 00038 00039 00044 class INET_API RTCPPacket : public cPacket 00045 { 00046 public: 00047 00052 enum RTCP_PACKET_TYPE { 00053 RTCP_PT_UNDEF = 0, 00054 RTCP_PT_SR = 200, 00055 RTCP_PT_RR = 201, 00056 RTCP_PT_SDES = 202, 00057 RTCP_PT_BYE = 203 00058 }; 00059 00063 RTCPPacket(const char *name = NULL); 00064 00068 RTCPPacket(const RTCPPacket& rtcpPacket); 00069 00073 virtual ~RTCPPacket(); 00074 00078 RTCPPacket& operator=(const RTCPPacket& rtcpPacket); 00079 00083 virtual RTCPPacket *dup() const; 00084 00088 virtual std::string info(); 00089 00093 virtual void dump(std::ostream& os) const; 00094 00098 virtual int getVersion(); 00099 00104 virtual int getPadding(); 00105 00111 virtual int getCount(); 00112 00116 virtual RTCP_PACKET_TYPE getPacketType(); 00117 00123 virtual int getRtcpLength() const; 00124 00125 00126 protected: 00127 00131 int _version; 00132 00138 int _padding; 00139 00145 int _count; 00146 00150 RTCP_PACKET_TYPE _packetType; 00151 }; 00152 00153 00159 class INET_API RTCPReceiverReportPacket : public RTCPPacket 00160 { 00161 00162 public: 00163 00167 RTCPReceiverReportPacket(const char *name = NULL); 00168 00172 RTCPReceiverReportPacket(const RTCPReceiverReportPacket& rtcpReceiverReportPacket); 00173 00177 virtual ~RTCPReceiverReportPacket(); 00178 00182 RTCPReceiverReportPacket& operator=(const RTCPReceiverReportPacket& rtcpReceiverReportPacket); 00183 00187 virtual RTCPReceiverReportPacket *dup() const; 00188 00192 virtual std::string info(); 00193 00197 virtual void dump(std::ostream& os) const; 00198 00203 virtual uint32 getSSRC(); 00204 00208 virtual void setSSRC(uint32 ssrc); 00209 00213 virtual void addReceptionReport(ReceptionReport *report); 00214 00219 virtual cArray *getReceptionReports(); 00220 00221 protected: 00222 00226 uint32 _ssrc; 00227 00231 cArray *_receptionReports; 00232 00233 }; 00234 00235 00244 class INET_API RTCPSenderReportPacket : public RTCPReceiverReportPacket 00245 { 00246 00247 public: 00248 00252 RTCPSenderReportPacket(const char *name = NULL); 00253 00257 RTCPSenderReportPacket(const RTCPSenderReportPacket& rtcpSenderReportPacket); 00258 00262 virtual ~RTCPSenderReportPacket(); 00263 00267 RTCPSenderReportPacket& operator=(const RTCPSenderReportPacket& rtcpSenderReportPacket); 00268 00272 virtual RTCPSenderReportPacket *dup() const; 00273 00277 virtual std::string info(); 00278 00282 virtual void dump(std::ostream& os) const; 00283 00288 virtual SenderReport *getSenderReport(); 00289 00294 virtual void setSenderReport(SenderReport *senderReport); 00295 00296 protected: 00297 00302 SenderReport *_senderReport; 00303 }; 00304 00305 00311 class INET_API RTCPSDESPacket : public RTCPPacket 00312 { 00313 00314 public: 00318 RTCPSDESPacket(const char *name = NULL); 00319 00323 RTCPSDESPacket(const RTCPSDESPacket& rtcpSDESPacket); 00324 00328 virtual ~RTCPSDESPacket(); 00329 00333 RTCPSDESPacket& operator=(const RTCPSDESPacket& rtcpSDESPacket); 00334 00338 virtual RTCPSDESPacket *dup() const; 00339 00343 virtual std::string info(); 00344 00348 virtual void dump(std::ostream& os) const; 00349 00353 virtual cArray *getSdesChunks(); 00354 00359 virtual void addSDESChunk(SDESChunk *sdesChunk); 00360 00361 protected: 00362 00366 cArray *_sdesChunks; 00367 }; 00368 00369 00377 class INET_API RTCPByePacket : public RTCPPacket 00378 { 00379 00380 public: 00384 RTCPByePacket(const char *name = NULL); 00385 00389 RTCPByePacket(const RTCPByePacket& rtcpByePacket); 00390 00394 virtual ~RTCPByePacket(); 00395 00399 RTCPByePacket& operator=(const RTCPByePacket& rtcpByePacket); 00400 00404 virtual RTCPByePacket *dup() const; 00405 00409 virtual uint32 getSSRC(); 00410 00414 virtual void setSSRC(uint32 ssrc); 00415 00416 protected: 00420 uint32 _ssrc; 00421 }; 00422 00423 00431 class INET_API RTCPCompoundPacket : public cPacket 00432 { 00433 00434 public: 00438 RTCPCompoundPacket(const char *name = NULL); 00439 00443 RTCPCompoundPacket(const RTCPCompoundPacket& rtcpCompoundPacket); 00444 00448 virtual ~RTCPCompoundPacket(); 00449 00453 RTCPCompoundPacket& operator=(const RTCPCompoundPacket& rtcpCompoundPacket); 00454 00458 virtual RTCPCompoundPacket *dup() const; 00459 00463 virtual std::string info(); 00464 00468 virtual void dump(std::ostream& os) const; 00469 00473 virtual void addRTCPPacket(RTCPPacket *rtcpPacket); 00474 00479 virtual cArray *getRtcpPackets(); 00480 00481 protected: 00482 00486 cArray *_rtcpPackets; 00487 00488 }; 00489 #endif 00490 00491