/usr/include/sipxtapi/mp/MprRtpStartReceiveMsg.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | //
// Copyright (C) 2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MprRtpStartReceiveMsg_h_
#define _MprRtpStartReceiveMsg_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "mp/MpResourceMsg.h"
#include "sdp/SdpCodec.h"
#include "os/OsMsg.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/// Message object used to communicate with the media processing task
class MprRtpStartReceiveMsg : public MpResourceMsg
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor
MprRtpStartReceiveMsg(const UtlString& targetResourceName,
SdpCodec* codecs[],
int numCodecs,
OsSocket& rRtpSocket,
OsSocket& rRtcpSocket)
: MpResourceMsg(MPRM_START_RECEIVE_RTP, targetResourceName)
, mpCodecs(NULL)
, mNumCodecs(0)
, mpRtpSocket(&rRtpSocket)
, mpRtcpSocket(&rRtcpSocket)
{
assert(numCodecs > 0);
if(numCodecs > 0)
{
mpCodecs = new SdpCodec*[numCodecs];
int codecIndex;
for(codecIndex = 0; codecIndex < numCodecs; codecIndex++)
{
if(codecs[codecIndex])
{
mpCodecs[codecIndex] =
new SdpCodec(*(codecs[codecIndex]));
}
// This should never occur:
else
{
assert(codecs[codecIndex] != NULL);
mpCodecs[codecIndex] = NULL;
}
}
mNumCodecs = numCodecs;
}
};
/// Copy constructor
MprRtpStartReceiveMsg(const MprRtpStartReceiveMsg& resourceMsg)
: MpResourceMsg(resourceMsg)
, mpCodecs(NULL)
, mpRtpSocket(resourceMsg.mpRtpSocket)
, mpRtcpSocket(resourceMsg.mpRtcpSocket)
{
assert(resourceMsg.mNumCodecs > 0);
if(resourceMsg.mNumCodecs > 0)
{
// Make a codec array to copy into this message
mpCodecs = new SdpCodec*[resourceMsg.mNumCodecs];
int codecIndex;
for(codecIndex = 0; codecIndex < resourceMsg.mNumCodecs; codecIndex++)
{
if(resourceMsg.mpCodecs[codecIndex])
{
mpCodecs[codecIndex] = new SdpCodec(*(resourceMsg.mpCodecs[codecIndex]));
}
// This should never occur:
else
{
assert(resourceMsg.mpCodecs[codecIndex] != NULL);
mpCodecs[codecIndex] = NULL;
}
}
mNumCodecs = resourceMsg.mNumCodecs;
}
};
/// Create a copy of this msg object (which may be of a derived type)
OsMsg* createCopy(void) const
{
return new MprRtpStartReceiveMsg(*this);
}
/// Destructor
~MprRtpStartReceiveMsg()
{
if(mpCodecs)
{
int codecIndex;
for(codecIndex = 0; codecIndex < mNumCodecs; codecIndex++)
{
if(mpCodecs[codecIndex])
{
delete mpCodecs[codecIndex];
mpCodecs[codecIndex] = NULL;
}
}
delete[] mpCodecs;
mpCodecs = NULL;
}
};
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Assignment operator
MprRtpStartReceiveMsg& operator=(const MprRtpStartReceiveMsg& rhs)
{
if (this == &rhs)
return *this; // handle the assignment to self case
MpResourceMsg::operator=(rhs); // assign fields for parent class
// The target array is bigger free up the spare SdpCodecs
int codecIndex;
for(codecIndex = rhs.mNumCodecs; codecIndex < mNumCodecs; codecIndex++)
{
delete mpCodecs[codecIndex];
mpCodecs[codecIndex] = NULL;
}
// The target array is not big enough, allocate a bigger one
if(mNumCodecs < rhs.mNumCodecs && rhs.mNumCodecs > 0)
{
SdpCodec** tempCodecArray = mpCodecs;
mpCodecs = new SdpCodec*[rhs.mNumCodecs];
// Move the existing codecs to the bigger array to avoid
// allocation of new ones
for(codecIndex = 0; codecIndex < mNumCodecs; codecIndex++)
{
mpCodecs[codecIndex] = tempCodecArray[codecIndex];
tempCodecArray[codecIndex] = NULL;
}
delete[] tempCodecArray;
tempCodecArray = NULL;
}
// Copy the codecs from the source to the target
for(codecIndex = 0; codecIndex < rhs.mNumCodecs; codecIndex++)
{
if(mpCodecs[codecIndex])
{
*(mpCodecs[codecIndex]) = *(rhs.mpCodecs[codecIndex]);
}
else
{
mpCodecs[codecIndex] = new SdpCodec(*(rhs.mpCodecs[codecIndex]));
}
}
mNumCodecs = rhs.mNumCodecs;
mpRtpSocket = rhs.mpRtpSocket;
mpRtcpSocket = rhs.mpRtcpSocket;
return *this;
}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
void getCodecArray(int& codecCount, SdpCodec**& codecs)
{
codecCount = mNumCodecs;
codecs = mpCodecs;
}
OsSocket* getRtpSocket(){return(mpRtpSocket);};
OsSocket* getRtcpSocket(){return(mpRtcpSocket);};
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
SdpCodec** mpCodecs;
int mNumCodecs;
OsSocket* mpRtpSocket;
OsSocket* mpRtcpSocket;
};
/* ============================ INLINE METHODS ============================ */
#endif // _MprRtpStartReceiveMsg_h_
|