Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #include "RTPParticipantInfo.h"
00024 #include "reports.h"
00025
00026
00027 Register_Class(RTPParticipantInfo);
00028
00029
00030 RTPParticipantInfo::RTPParticipantInfo(uint32 ssrc) : cObject()
00031 {
00032 _sdesChunk = new SDESChunk("SDESChunk", ssrc);
00033
00034
00035
00036
00037
00038 _silentIntervals = 3;
00039 _address = IPAddress::UNSPECIFIED_ADDRESS;
00040 _rtpPort = PORT_UNDEF;
00041 _rtcpPort = PORT_UNDEF;
00042 }
00043
00044
00045 RTPParticipantInfo::RTPParticipantInfo(const RTPParticipantInfo& participantInfo) : cObject()
00046 {
00047 operator=(participantInfo);
00048 }
00049
00050
00051 RTPParticipantInfo::~RTPParticipantInfo()
00052 {
00053 delete _sdesChunk;
00054 }
00055
00056
00057 RTPParticipantInfo& RTPParticipantInfo::operator=(const RTPParticipantInfo& participantInfo)
00058 {
00059 cObject::operator=(participantInfo);
00060 _sdesChunk = new SDESChunk(*(participantInfo._sdesChunk));
00061 _address = participantInfo._address;
00062 _rtpPort = participantInfo._rtpPort;
00063 _rtcpPort = participantInfo._rtcpPort;
00064 return *this;
00065 }
00066
00067
00068 RTPParticipantInfo *RTPParticipantInfo::dup() const
00069 {
00070 return new RTPParticipantInfo(*this);
00071 }
00072
00073
00074 void RTPParticipantInfo::processRTPPacket(RTPPacket *packet, int id, simtime_t arrivalTime)
00075 {
00076 _silentIntervals = 0;
00077 delete packet;
00078 }
00079
00080
00081 void RTPParticipantInfo::processSenderReport(SenderReport *report, simtime_t arrivalTime)
00082 {
00083
00084 delete report;
00085 }
00086
00087
00088 void RTPParticipantInfo::processReceptionReport(ReceptionReport *report, simtime_t arrivalTime)
00089 {
00090
00091 delete report;
00092 }
00093
00094
00095 void RTPParticipantInfo::processSDESChunk(SDESChunk *sdesChunk, simtime_t arrivalTime)
00096 {
00097 for (int i = 0; i < sdesChunk->size(); i++) {
00098 if (sdesChunk->exist(i)) {
00099 SDESItem *sdesItem = (SDESItem *)(sdesChunk->remove(i));
00100 addSDESItem(sdesItem);
00101 }
00102 }
00103 delete sdesChunk;
00104 }
00105
00106
00107 SDESChunk *RTPParticipantInfo::getSDESChunk()
00108 {
00109 return new SDESChunk(*_sdesChunk);
00110 }
00111
00112
00113 void RTPParticipantInfo::addSDESItem(SDESItem *sdesItem)
00114 {
00115 _sdesChunk->addSDESItem(sdesItem);
00116 }
00117
00118
00119 bool RTPParticipantInfo::isSender()
00120 {
00121 return (_silentIntervals <= 1);
00122 }
00123
00124
00125 ReceptionReport *RTPParticipantInfo::receptionReport(simtime_t now)
00126 {
00127 return NULL;
00128 }
00129
00130
00131 SenderReport *RTPParticipantInfo::senderReport(simtime_t now)
00132 {
00133 return NULL;
00134 }
00135
00136
00137 void RTPParticipantInfo::nextInterval(simtime_t now)
00138 {
00139 _silentIntervals++;
00140 }
00141
00142
00143 bool RTPParticipantInfo::toBeDeleted(simtime_t now)
00144 {
00145 return false;
00146 }
00147
00148
00149 uint32 RTPParticipantInfo::getSSRC()
00150 {
00151 return _sdesChunk->getSSRC();
00152 }
00153
00154
00155 void RTPParticipantInfo::setSSRC(uint32 ssrc)
00156 {
00157 _sdesChunk->setSSRC(ssrc);
00158 }
00159
00160
00161 void RTPParticipantInfo::addSDESItem(SDESItem::SDES_ITEM_TYPE type, const char *content)
00162 {
00163 _sdesChunk->addSDESItem(new SDESItem(type, content));
00164 }
00165
00166
00167 IPAddress RTPParticipantInfo::getAddress()
00168 {
00169 return _address;
00170 }
00171
00172
00173 void RTPParticipantInfo::setAddress(IPAddress address)
00174 {
00175 _address = address;
00176 }
00177
00178
00179 int RTPParticipantInfo::getRTPPort()
00180 {
00181 return _rtpPort;
00182 }
00183
00184
00185 void RTPParticipantInfo::setRTPPort(int rtpPort)
00186 {
00187 _rtpPort = rtpPort;
00188 }
00189
00190
00191 int RTPParticipantInfo::getRTCPPort()
00192 {
00193 return _rtcpPort;
00194 }
00195
00196
00197 void RTPParticipantInfo::setRTCPPort(int rtcpPort)
00198 {
00199 _rtcpPort = rtcpPort;
00200 }
00201
00202
00203 char *RTPParticipantInfo::ssrcToName(uint32 ssrc)
00204 {
00205 char name[9];
00206 sprintf(name, "%08x", ssrc);
00207 return opp_strdup(name);
00208 }
00209
00210
00211 void RTPParticipantInfo::dump() const
00212 {
00213 std::cout <<" adress= "<< _address
00214 <<" rtpPort= "<< _rtpPort
00215 <<" rtcpPort= "<< _rtcpPort
00216 << endl;
00217 }