00001 /* 00002 00003 This file is a part of JRTPLIB 00004 Copyright (c) 1999-2007 Jori Liesenborgs 00005 00006 Contact: jori.liesenborgs@gmail.com 00007 00008 This library was developed at the "Expertisecentrum Digitale Media" 00009 (http://www.edm.uhasselt.be), a research center of the Hasselt University 00010 (http://www.uhasselt.be). The library is based upon work done for 00011 my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 00012 00013 Permission is hereby granted, free of charge, to any person obtaining a 00014 copy of this software and associated documentation files (the "Software"), 00015 to deal in the Software without restriction, including without limitation 00016 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00017 and/or sell copies of the Software, and to permit persons to whom the 00018 Software is furnished to do so, subject to the following conditions: 00019 00020 The above copyright notice and this permission notice shall be included 00021 in all copies or substantial portions of the Software. 00022 00023 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00024 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00025 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00026 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00027 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00028 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 00029 IN THE SOFTWARE. 00030 00031 */ 00032 00037 #ifndef RTPTRANSMITTER_H 00038 00039 #define RTPTRANSMITTER_H 00040 00041 #include "rtpconfig.h" 00042 #include "rtptypes.h" 00043 #include "rtpmemoryobject.h" 00044 00045 class RTPRawPacket; 00046 class RTPAddress; 00047 class RTPTransmissionParams; 00048 class RTPTime; 00049 class RTPTransmissionInfo; 00050 00057 class RTPTransmitter : public RTPMemoryObject 00058 { 00059 public: 00065 enum TransmissionProtocol 00066 { 00067 IPv4UDPProto, 00068 IPv6UDPProto, 00069 UserDefinedProto 00070 }; 00071 00073 enum ReceiveMode 00074 { 00075 AcceptAll, 00076 AcceptSome, 00077 IgnoreSome 00078 }; 00079 protected: 00081 RTPTransmitter(RTPMemoryManager *mgr) : RTPMemoryObject(mgr) { } 00082 public: 00083 virtual ~RTPTransmitter() { } 00084 00089 virtual int Init(bool threadsafe) = 0; 00090 00099 virtual int Create(size_t maxpacksize,const RTPTransmissionParams *transparams) = 0; 00100 00104 virtual void Destroy() = 0; 00105 00113 virtual RTPTransmissionInfo *GetTransmissionInfo() = 0; 00114 00124 virtual int GetLocalHostName(uint8_t *buffer,size_t *bufferlength) = 0; 00125 00127 virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0; 00128 00131 virtual size_t GetHeaderOverhead() = 0; 00132 00134 virtual int Poll() = 0; 00135 00140 virtual int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0) = 0; 00141 00143 virtual int AbortWait() = 0; 00144 00146 virtual int SendRTPData(const void *data,size_t len) = 0; 00147 00149 virtual int SendRTCPData(const void *data,size_t len) = 0; 00150 00152 virtual int AddDestination(const RTPAddress &addr) = 0; 00153 00155 virtual int DeleteDestination(const RTPAddress &addr) = 0; 00156 00158 virtual void ClearDestinations() = 0; 00159 00161 virtual bool SupportsMulticasting() = 0; 00162 00164 virtual int JoinMulticastGroup(const RTPAddress &addr) = 0; 00165 00167 virtual int LeaveMulticastGroup(const RTPAddress &addr) = 0; 00168 00170 virtual void LeaveAllMulticastGroups() = 0; 00171 00177 virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m) = 0; 00178 00180 virtual int AddToIgnoreList(const RTPAddress &addr) = 0; 00181 00183 virtual int DeleteFromIgnoreList(const RTPAddress &addr)= 0; 00184 00186 virtual void ClearIgnoreList() = 0; 00187 00189 virtual int AddToAcceptList(const RTPAddress &addr) = 0; 00190 00192 virtual int DeleteFromAcceptList(const RTPAddress &addr) = 0; 00193 00195 virtual void ClearAcceptList() = 0; 00196 00198 virtual int SetMaximumPacketSize(size_t s) = 0; 00199 00201 virtual bool NewDataAvailable() = 0; 00202 00205 virtual RTPRawPacket *GetNextPacket() = 0; 00206 #ifdef RTPDEBUG 00207 virtual void Dump() = 0; 00208 #endif // RTPDEBUG 00209 }; 00210 00217 class RTPTransmissionParams 00218 { 00219 protected: 00220 RTPTransmissionParams(RTPTransmitter::TransmissionProtocol p) { protocol = p; } 00221 public: 00222 virtual ~RTPTransmissionParams() { } 00223 00225 RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; } 00226 private: 00227 RTPTransmitter::TransmissionProtocol protocol; 00228 }; 00229 00236 class RTPTransmissionInfo 00237 { 00238 protected: 00239 RTPTransmissionInfo(RTPTransmitter::TransmissionProtocol p) { protocol = p; } 00240 public: 00241 virtual ~RTPTransmissionInfo() { } 00243 RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; } 00244 private: 00245 RTPTransmitter::TransmissionProtocol protocol; 00246 }; 00247 00248 #endif // RTPTRANSMITTER_H 00249