Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00022 #include "RTPInterfacePacket.h"
00023
00024 Register_Class(RTPInterfacePacket);
00025
00026
00027 RTPInterfacePacket::RTPInterfacePacket(const char *name) : cPacket(name)
00028 {
00029 _type = RTP_IFP_UNDEF;
00030 _commonName = NULL;
00031 _profileName = NULL;
00032 _bandwidth = 0;
00033 _destinationAddress = IPAddress::UNSPECIFIED_ADDRESS;
00034 _port = PORT_UNDEF;
00035 _ssrc = 0;
00036 _payloadType = 0;
00037 _fileName = NULL;
00038 }
00039
00040
00041 RTPInterfacePacket::RTPInterfacePacket(const RTPInterfacePacket& rifp) : cPacket()
00042 {
00043 setName(rifp.getName());
00044 operator=(rifp);
00045 }
00046
00047
00048 RTPInterfacePacket::~RTPInterfacePacket()
00049 {
00050 if (opp_strcmp(_commonName, ""))
00051 delete _commonName;
00052 if (opp_strcmp(_profileName, ""))
00053 delete _profileName;
00054 if (opp_strcmp(_fileName, ""))
00055 delete _fileName;
00056 }
00057
00058
00059 RTPInterfacePacket& RTPInterfacePacket::operator=(const RTPInterfacePacket& rifp)
00060 {
00061 cPacket::operator=(rifp);
00062 _type = rifp._type;
00063 _commonName = opp_strdup(rifp._commonName);
00064 _profileName = opp_strdup(rifp._profileName);
00065 _bandwidth = rifp._bandwidth;
00066 _destinationAddress = rifp._destinationAddress;
00067 _port = rifp._port;
00068 _ssrc = rifp._ssrc;
00069 _payloadType = rifp._payloadType;
00070 _fileName = opp_strdup(rifp._fileName);
00071 return *this;
00072 }
00073
00074
00075 RTPInterfacePacket *RTPInterfacePacket::dup() const
00076 {
00077 return new RTPInterfacePacket(*this);
00078 }
00079
00080
00081 std::string RTPInterfacePacket::info()
00082 {
00083 std::stringstream out;
00084 out << "RTPInterfacePacket: type=" << _type;
00085 return out.str();
00086 }
00087
00088
00089 void RTPInterfacePacket::dump(std::ostream& os)
00090 {
00091 os << "RTPInterfacePacket:" << endl;
00092 os << " type = " << _type << endl;
00093 os << " commonName = " << _commonName << endl;
00094 os << " profileName = " << _profileName << endl;
00095 os << " bandwidth = " << _bandwidth << endl;
00096 os << " destinationAddress = " << _destinationAddress << endl;
00097 os << " port = " << _port << endl;
00098 os << " ssrc = " << _ssrc << endl;
00099 os << " payloadType = " << _payloadType << endl;
00100 os << " fileName = " << _fileName << endl;
00101 }
00102
00103
00104 void RTPInterfacePacket::enterSession(const char *commonName, const char *profileName, int bandwidth, IPAddress destinationAddress, int port)
00105 {
00106 _type = RTP_IFP_ENTER_SESSION;
00107 _commonName = commonName;
00108 _profileName = profileName;
00109 _bandwidth = bandwidth;
00110 _destinationAddress = destinationAddress;
00111 _port = port;
00112 }
00113
00114
00115 void RTPInterfacePacket::sessionEntered(uint32 ssrc)
00116 {
00117 _type = RTP_IFP_SESSION_ENTERED;
00118 _ssrc = ssrc;
00119 }
00120
00121
00122 void RTPInterfacePacket::createSenderModule(uint32 ssrc, int payloadType, const char *fileName)
00123 {
00124 _type = RTP_IFP_CREATE_SENDER_MODULE;
00125 _ssrc = ssrc;
00126 _payloadType =payloadType;
00127 _fileName = fileName;
00128 }
00129
00130
00131 void RTPInterfacePacket::senderModuleCreated(uint32 ssrc)
00132 {
00133 _type = RTP_IFP_SENDER_MODULE_CREATED;
00134 _ssrc = ssrc;
00135 }
00136
00137
00138 void RTPInterfacePacket::deleteSenderModule(uint32 ssrc)
00139 {
00140 _type = RTP_IFP_DELETE_SENDER_MODULE;
00141 _ssrc = ssrc;
00142 }
00143
00144
00145 void RTPInterfacePacket::senderModuleDeleted(uint32 ssrc)
00146 {
00147 _type = RTP_IFP_SENDER_MODULE_DELETED;
00148 _ssrc = ssrc;
00149 }
00150
00151
00152 void RTPInterfacePacket::senderModuleControl(uint32 ssrc, RTPSenderControlMessage *msg)
00153 {
00154 _type = RTP_IFP_SENDER_CONTROL;
00155 _ssrc = ssrc;
00156 encapsulate(msg);
00157 }
00158
00159
00160 void RTPInterfacePacket::senderModuleStatus(uint32 ssrc, RTPSenderStatusMessage *msg)
00161 {
00162 _type = RTP_IFP_SENDER_STATUS;
00163 _ssrc = ssrc;
00164 encapsulate(msg);
00165 }
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 void RTPInterfacePacket::leaveSession()
00207 {
00208 _type = RTP_IFP_LEAVE_SESSION;
00209 }
00210
00211
00212 void RTPInterfacePacket::sessionLeft()
00213 {
00214 _type = RTP_IFP_SESSION_LEFT;
00215 }
00216
00217
00218 RTPInterfacePacket::RTP_IFP_TYPE RTPInterfacePacket::getType()
00219 {
00220 return _type;
00221 }
00222
00223
00224 const char *RTPInterfacePacket::getCommonName()
00225 {
00226 return opp_strdup(_commonName);
00227 }
00228
00229
00230 const char *RTPInterfacePacket::getProfileName()
00231 {
00232 return opp_strdup(_profileName);
00233 }
00234
00235
00236 uint32 RTPInterfacePacket::getSSRC()
00237 {
00238 return _ssrc;
00239 }
00240
00241
00242 int RTPInterfacePacket::getPayloadType()
00243 {
00244 return _payloadType;
00245 }
00246
00247
00248 const char *RTPInterfacePacket::getFileName()
00249 {
00250 return opp_strdup(_fileName);
00251 }
00252
00253
00254 int RTPInterfacePacket::getBandwidth()
00255 {
00256 return _bandwidth;
00257 }
00258
00259
00260 IPAddress RTPInterfacePacket::getDestinationAddress()
00261 {
00262 return _destinationAddress;
00263 }
00264
00265
00266 int RTPInterfacePacket::getPort()
00267 {
00268 return _port;
00269 }