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

MNRTPevent.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_EVENT_H 00025 #define MNRTP_EVENT_H 00026 00027 #include "MNRTPutildefs.h" 00028 00029 class MNRTPevent; 00030 00031 typedef MNRTPevent* MNRTPeventptr; 00032 00033 class MNRTPevent 00034 { 00035 private: 00036 MNRTPeventptr StreamEventPtr; 00037 virtual void StreamEvent(stream_event_t /*event*/, int /*fd*/) {} 00038 00039 MNRTPeventptr StreamErrorPtr; 00040 virtual void StreamError(int /*error*/, int /*fd*/) {} 00041 00042 MNRTPeventptr StreamGetFnamePtr; 00043 virtual char* StreamGetFname() {return NULL;} 00044 00045 MNRTPeventptr StreamGetUDPPtr; 00046 virtual int StreamGetUDP() {return 0;} 00047 00048 MNRTPeventptr StreamGetUDPtargetPtr; 00049 virtual char* StreamGetUDPtarget(int /*port*/) {return NULL;} 00050 00051 public: 00052 MNRTPevent() 00053 { 00054 StreamEventPtr = NULL; 00055 StreamErrorPtr = NULL; 00056 StreamGetFnamePtr = NULL; 00057 StreamGetUDPPtr = NULL; 00058 StreamGetUDPtargetPtr = NULL; 00059 } 00060 00061 virtual ~MNRTPevent() { } 00062 00063 /* Event */ 00064 inline void StreamEventCall(stream_event_t event, int fd) 00065 { 00066 if (StreamEventPtr !=NULL) StreamEventPtr->StreamEvent(event, fd); 00067 } 00068 00069 inline void register_StreamEvent(MNRTPeventptr p) 00070 { 00071 StreamEventPtr = p; 00072 } 00073 00074 /* Error */ 00075 inline void StreamErrorCall(int error, int fd) 00076 { 00077 if (StreamErrorPtr != NULL) StreamErrorPtr->StreamError(error, fd); 00078 } 00079 inline void register_StreamError(MNRTPeventptr p) 00080 { 00081 StreamErrorPtr = p; 00082 } 00083 00084 /* File Name */ 00085 inline char* StreamGetFnameCall() 00086 { 00087 if (StreamGetFnamePtr != NULL) 00088 return StreamGetFnamePtr->StreamGetFname(); 00089 else 00090 return NULL; 00091 } 00092 inline void register_StreamGetFname(MNRTPeventptr p) 00093 { 00094 StreamGetFnamePtr = p; 00095 } 00096 00097 /* UDP port */ 00098 inline int StreamGetUDPCall() 00099 { 00100 if (StreamGetUDPPtr != NULL) 00101 return StreamGetUDPPtr->StreamGetUDP(); 00102 else 00103 return 0; 00104 } 00105 inline void register_StreamGetUDP(MNRTPeventptr p) 00106 { 00107 StreamGetUDPPtr = p; 00108 } 00109 00110 inline char* StreamGetUDPtargetCall(int port) 00111 { 00112 if (StreamGetUDPtargetPtr != NULL) 00113 return StreamGetUDPtargetPtr->StreamGetUDPtarget(port); 00114 else 00115 return NULL; 00116 } 00117 inline void register_StreamGetUDPtarget(MNRTPeventptr p) 00118 { 00119 StreamGetUDPtargetPtr = p; 00120 } 00121 00122 }; 00123 00124 #endif /* MNRTP_EVENT_H */ 00125

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