Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNRTCPPacket.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MN_RTCP_PACKET_H 00025 #define MN_RTCP_PACKET_H 00026 00027 #include <config.h> 00028 00029 #include <assert.h> 00030 00031 #include "sh/SHData.h" 00032 #include "MNArrayList.h" 00033 #include "MNRTPNetTypes.h" 00034 #include "MNRTPdefs.h" 00035 #include "MNRTPtime.h" 00036 #include "var_type.h" 00037 #include "sh/SHReport.h" 00038 00039 /*********************************************************************** 00040 * MNRTCPPacket 00041 ***********************************************************************/ 00042 00043 class MNRTCPPacket : public SH::Report 00044 { 00046 unsigned int version:2; 00047 00049 unsigned int p:1; 00050 00052 unsigned int count:5; // this is the subtype!!!! 00053 00055 unsigned int pt:8; 00056 00058 u_int16 length; 00059 00060 private: 00062 MNRTCPPacket( const MNRTCPPacket& orig ); 00064 MNRTCPPacket& operator=( const MNRTCPPacket& orig ); 00065 00066 protected: 00072 MNRTCPPacket( ) 00073 { } 00074 00075 public: 00076 MNRTCPPacket( unsigned int pt_ ); 00077 00078 virtual ~MNRTCPPacket(); 00079 00080 virtual bool isA( SH::Report::ID id ) const; 00081 static SH::Report::ID Id; 00082 00083 void init( unsigned int pt_ ); 00084 00085 u_int8 getCount( ) const; 00086 void setCount( u_int8 cnt ); 00087 void setLength( unsigned int len ); 00088 inline unsigned int getLength() const { return length; }; 00089 inline unsigned int getType() const { return pt; }; 00090 00091 virtual void write_to_buffer( u_int8* buffer, size_t len ) const; 00092 virtual void dump( ostream& ostr ) const; 00093 }; 00094 00095 /*********************************************************************** 00096 * MNRTCPPacket_SR 00097 ***********************************************************************/ 00098 00099 class MNRTCPPacket_SR 00100 : public MNRTCPPacket 00101 { 00102 friend class MNRTCP; 00103 friend class MNRTCPPacket; 00104 00106 u_int32 _ssrc; 00107 00109 u_int32 _ntp_sec; 00111 u_int32 _ntp_frac; 00112 00114 u_int32 _rtp_ts; 00115 00117 u_int32 _psent; 00118 00120 u_int32 _osent; 00121 00122 private: 00124 MNRTCPPacket_SR( const MNRTCPPacket_SR& orig ); 00126 MNRTCPPacket_SR& operator=( const MNRTCPPacket_SR& orig ); 00127 00128 protected: 00132 MNRTCPPacket_SR( ) 00133 { } 00134 00135 public: 00136 MNRTCPPacket_SR( u_int16 count, 00137 u_int32 ssrc, 00138 const ntp64& now, 00139 u_int32 rtp_timestamp, 00140 u_int32 packets_sent, 00141 u_int32 octets_sent ); 00142 00143 void init( u_int16 count, 00144 u_int32 ssrc, 00145 const ntp64& now, 00146 u_int32 rtp_timestamp, 00147 u_int32 packets_sent, 00148 u_int32 octets_sent ); 00149 00150 virtual bool isA( SH::Report::ID id ) const; 00151 static SH::Report::ID Id; 00152 00153 virtual void write_to_buffer( u_int8* buffer, size_t len ) const; 00154 virtual void dump( ostream& ostr ) const; 00155 00156 u_int32 getNTPUpper() { return _ntp_sec;} 00157 u_int32 getNTPLower() { return _ntp_frac;} 00158 u_int32 getRTPTimestamp() {return _rtp_ts;} 00159 }; 00160 00161 /*********************************************************************** 00162 * MNRTCPPacket_RR 00163 ***********************************************************************/ 00164 00165 class MNRTCPPacket_RR 00166 : public MNRTCPPacket 00167 { 00168 friend class MNRTCP; 00169 friend class MNRTCPPacket; 00170 00172 u_int32 _ssrc; 00173 unsigned int fraction; 00174 int lost; 00175 u_int32 last_seq; 00176 u_int32 jitter; 00177 u_int32 lsr; 00178 u_int32 dlsr; 00179 00180 private: 00182 MNRTCPPacket_RR( const MNRTCPPacket_RR& orig ); 00184 MNRTCPPacket_RR& operator=( const MNRTCPPacket_RR& orig ); 00185 00186 protected: 00190 MNRTCPPacket_RR( ) 00191 { } 00192 00193 public: 00194 MNRTCPPacket_RR( u_int16 count, 00195 u_int32 ssrc ); 00196 MNRTCPPacket_RR( rtcp_rr_t report ); 00197 00198 void init( u_int16 count, 00199 u_int32 ssrc ); 00200 00201 virtual bool isA( SH::Report::ID id ) const; 00202 static SH::Report::ID Id; 00203 00204 virtual void write_to_buffer( u_int8* buffer, size_t len ) const; 00205 virtual void dump( ostream& ostr ) const; 00206 }; 00207 00208 /*********************************************************************** 00209 * MNRTCPPacket_APP 00210 ***********************************************************************/ 00211 00212 class MNRTCPPacket_APP 00213 : public MNRTCPPacket 00214 { 00215 friend class MNRTCP; 00216 friend class MNRTCPPacket; 00217 00218 u_int32 _ssrc; 00219 char _name[4]; 00220 u_int32*_payload; 00221 00222 private: 00224 MNRTCPPacket_APP( const MNRTCPPacket_APP& orig ); 00226 MNRTCPPacket_APP& operator=( const MNRTCPPacket_APP& orig ); 00227 00228 protected: 00232 MNRTCPPacket_APP ( ) 00233 { } 00234 00235 public: 00236 MNRTCPPacket_APP( u_int8 subtype, 00237 u_int16 nb_byte_pl, 00238 u_int32 ssrc, 00239 const char* name, 00240 u_int32* pl ); 00241 00251 void init ( u_int8 subtype, 00252 u_int16 nb_byte_pl, 00253 u_int32 ssrc, 00254 const char* name, 00255 u_int32* pl ); 00256 00257 virtual bool isA( SH::Report::ID id ) const; 00258 static SH::Report::ID Id; 00259 00260 virtual ~MNRTCPPacket_APP( ); 00261 00262 virtual void write_to_buffer( u_int8* buffer, size_t len ) const; 00263 u_int32 getSSrc() { return _ssrc; }; 00264 char* getName() { return _name; }; 00265 u_int32* getPayload() {return _payload;}; 00266 00267 virtual void dump( ostream& ostr ) const; 00268 }; 00269 00270 /*********************************************************************** 00271 * MNRTCPPacket_SDES 00272 ***********************************************************************/ 00273 00274 class MNRTCPPacket_SDES 00275 : public MNRTCPPacket 00276 { 00277 friend class MNRTCP; 00278 friend class MNRTCPPacket; 00279 00280 u_int32 _src; 00281 00282 private: 00284 MNRTCPPacket_SDES( const MNRTCPPacket_SDES& orig ); 00286 MNRTCPPacket_SDES& operator=( const MNRTCPPacket_SDES& orig ); 00287 00288 protected: 00292 MNRTCPPacket_SDES( ) 00293 { } 00294 00295 public: 00296 MNRTCPPacket_SDES( u_int16 sdes_length, 00297 u_int32 ssrc ); 00298 00299 void init( u_int16 sdes_length, 00300 u_int32 ssrc ); 00301 00302 virtual bool isA( SH::Report::ID id ) const; 00303 static SH::Report::ID Id; 00304 00305 virtual void write_to_buffer( u_int8* buffer, size_t len ) const; 00306 virtual void dump( ostream& ostr ) const; 00307 }; 00308 00309 ostream& operator<<( ostream& ostr, const MNRTCPPacket& sr ); 00310 00311 #endif /* MN_RTCP_PACKET_H */ 00312

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8