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

MNRTPcallback.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 MNRTP_CALLBACK_H 00025 #define MNRTP_CALLBACK_H 00026 00027 #include "MNRTPdefs.h" 00028 #include "../sh/SHReport.h" 00029 #include "MNRTPPacket.h" 00030 #include "MNValid.h" 00031 #include <stdio.h> 00032 00033 class MNRTPcallback; 00034 class MNRTCPPacket; 00035 00036 00037 typedef MNRTPcallback* MNRTPcallback_p; 00038 00039 /**********************************************************************/ 00040 /* MNRTP_RTPreader_callback */ 00041 /**********************************************************************/ 00042 00043 class MNRTP_RTPreader_callback 00044 { 00045 public: 00046 virtual void RTPreader_cb( MNRTPPacketPtr packet ) = 0; 00047 }; 00048 00049 /**********************************************************************/ 00050 /* MNRTP_RTCPreader_callback */ 00051 /**********************************************************************/ 00052 00053 class MNRTP_RTCPreader_callback 00054 { 00055 public: 00056 virtual void RTCPreader_cb( u_int32 ssrc, 00057 char* data, 00058 int len, 00059 int subtype, 00060 char* name ); 00061 virtual void RTCPreader_cb( SH::RPtr<MNRTCPPacket> packet ); 00062 00063 }; 00064 00065 /**********************************************************************/ 00066 /* MNRTP_RTCPbye_callback */ 00067 /**********************************************************************/ 00068 00069 class MNRTP_RTCPbye_callback 00070 { 00071 public: 00072 virtual void RTCPbye_cb( u_int32 ssrc, 00073 text_item_t* bye_text) = 0; 00074 }; 00075 00076 /**********************************************************************/ 00077 /* MNRTP_Collision_callback */ 00078 /**********************************************************************/ 00079 00080 class MNRTP_Collision_callback 00081 { 00082 public: 00083 virtual void RTPcollission_cb( struct sockaddr_in *dest ) = 0; 00084 }; 00085 00086 /**********************************************************************/ 00087 /* MNRTP_CollisionApp_callback */ 00088 /**********************************************************************/ 00089 00090 class MNRTP_CollisionApp_callback 00091 { 00092 public: 00093 virtual void RTPcollission_app_cb( u_int32 old_ssrc, 00094 u_int32 new_ssrc ) = 0; 00095 }; 00096 00097 00098 /**********************************************************************/ 00099 /* MNRTPcallback */ 00100 /**********************************************************************/ 00101 00102 class MNRTPcallback 00103 { 00104 DECLARE_VALID 00105 private: 00106 MNRTP_Collision_callback* RTPcoll; 00107 MNRTP_CollisionApp_callback* RTPcollapp; 00108 MNRTP_RTPreader_callback* RTPreadercoll; 00109 MNRTP_RTCPreader_callback* RTCPreadercoll; 00110 MNRTP_RTCPbye_callback* RTCPbyecoll; 00111 00112 public: 00113 MNRTPcallback() 00114 { 00115 RTPcoll = NULL; 00116 RTPreadercoll = NULL; 00117 RTCPreadercoll = NULL; 00118 RTCPbyecoll = NULL; 00119 RTPcollapp = NULL; 00120 MAKE_VALID 00121 } 00122 00123 virtual ~MNRTPcallback() 00124 { 00125 CHECK_VALID 00126 MAKE_INVALID 00127 } 00128 00129 /*------------------------------------------------------------ 00130 * The registration functions first. 00131 */ 00132 00133 void register_RTPcollission_cb( MNRTP_Collision_callback* p ); 00134 void register_RTPcollission_app_cb( MNRTP_CollisionApp_callback* p ); 00135 void register_RTPreader_cb(MNRTP_RTPreader_callback* p); 00136 void register_RTCPreader_cb(MNRTP_RTCPreader_callback* p); 00137 void register_RTCPbye_cb(MNRTP_RTCPbye_callback* p); 00138 00139 /*------------------------------------------------------------ 00140 * The functions that do the calling next. 00141 */ 00142 00143 /* RTP collission */ 00144 void RTPcollission( struct sockaddr_in *dest ) 00145 { 00146 CHECK_VALID 00147 if (RTPcoll !=NULL) RTPcoll->RTPcollission_cb(dest); 00148 } 00149 00150 /* RTP collission application callback */ 00151 void RTPcollission_app_call( u_int32 os, u_int32 ns ) 00152 { 00153 CHECK_VALID 00154 if (RTPcollapp != NULL) RTPcollapp->RTPcollission_app_cb(os, ns); 00155 } 00156 00161 void RTPreader_call( MNRTPPacketPtr packet ); 00162 00167 void RTCPreader_call( SH::RPtr<MNRTCPPacket> packet ); 00168 00169 void RTCPreader_call( u_int32 ssrc, 00170 char* data, 00171 int len, 00172 int subtype, 00173 char* name ) 00174 { 00175 CHECK_VALID 00176 if (RTCPreadercoll !=NULL) 00177 { 00178 RTCPreadercoll->RTCPreader_cb(ssrc, data, len, subtype, name); 00179 } 00180 } 00181 00182 void RTCPbye_call(u_int32 ssrc, text_item_t *bye_text) 00183 { 00184 CHECK_VALID 00185 if (RTCPbyecoll != NULL) RTCPbyecoll->RTCPbye_cb(ssrc, bye_text); 00186 } 00187 00188 }; // class MNRTPcallback() 00189 00190 #endif 00191

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