/usr/include/sipxtapi/mp/MpDataBuf.h is in libsipxtapi-dev 3.3.0~test17-2.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 | //
// Copyright (C) 2006-2012 SIPez LLC. All rights reserved.
//
// $$
//////////////////////////////////////////////////////////////////////////////
#ifndef _INCLUDED_MPDATABUF_H // [
#define _INCLUDED_MPDATABUF_H
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "mp/MpBuf.h"
#include "mp/MpArrayBuf.h"
// DEFINES
// MACROS
/// This constructor owns MpBuf object.
#define MPBUFDATA_FROM_BASE_CONSTRUCTOR(classname, buffer_type, base_classname) \
classname##Ptr( MpBuf *buffer \
, MpBufPool *pHeaderPool=classname::smpDefaultPool) \
: base_classname##Ptr(buffer, pHeaderPool) \
{ \
if (mpBuffer != NULL) { \
MPBUF_FROM_BASE_CONSTRUCTOR_INIT(classname, buffer_type) \
} \
};
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
/// Stores data in the external buffer.
/**
* This struct could be used if you want to store data separate from header. This
* approach may be useful when you need to share data between several headers.
* For example, you may want to pass raw audio data to RTP packet without copying.
*
* @warning Data pointer is set in the MpDataBufPtr constructor.
*/
struct MpDataBuf : public MpBuf
{
friend class MpDataBufPtr;
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/// Default pool for MpDataBuf objects.
static MpBufPool *smpDefaultPool;
/* ============================ CREATORS ================================== */
///@name Creators
//@{
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Set new payload data.
void setData(const MpArrayBufPtr &pData)
{ mpData = pData; };
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Return pointer to payload data.
char *getDataWritePtr();
/// Return pointer to payload data.
const char *getDataPtr() const;
/// Get payload data.
MpArrayBufPtr getData() const {return mpData;};
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
MpArrayBufPtr mpData; ///< Payload data.
/// This is called in place of constructor.
void init();
/// Destructor for MpDataBuf.
static void sDestroy(MpBuf *pBuffer);
/// @brief Function that initialize buffer after cloning. It makes clone
/// of mpData.
static void sInitClone(MpBuf *pBuffer);
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Disable copy (and other) constructor.
MpDataBuf(const MpBuf &);
/**<
* This struct will be initialized by init() member.
*/
/// Disable assignment operator.
MpDataBuf &operator=(const MpBuf &);
/**<
* Buffers may be copied. But do we need this?
*/
};
/// Smart pointer to MpDataBuf.
/**
* You should only use this smart pointer, not #MpDataBuf* itself.
* The goal of this smart pointer is to care about reference counter and
* buffer deallocation.
*/
class MpDataBufPtr : public MpBufPtr {
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Default constructor - construct invalid pointer.
MPBUF_DEFAULT_CONSTRUCTOR(MpDataBuf)
/// This constructor owns MpBuf object.
MpDataBufPtr(MpBuf *pDataBuffer, MpBufPool *pHeaderPool=MpDataBuf::smpDefaultPool)
: MpBufPtr(pHeaderPool->getBuffer())
{
if (mpBuffer != NULL) {
MPBUF_FROM_BASE_CONSTRUCTOR_INIT(MpDataBuf, MP_BUF_DATA)
// Set data pointer
pBuffer->setData(MpArrayBufPtr(pDataBuffer));
}
};
/// Construct object from base type with type check.
MPBUF_TYPECHECKED_COPY(MpDataBuf, MP_BUF_DATA, MpBuf)
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
void setFlowGraph(MpFlowGraphBase* flowgraph)
{
if(mpBuffer != NULL)
{
mpBuffer->setFlowGraph(flowgraph);
((MpDataBuf*)mpBuffer)->mpData.setFlowGraph(flowgraph);
}
};
/// Return pointer to MpDataBuf.
MPBUF_MEMBER_ACCESS_OPERATOR(MpDataBuf)
/// Return readonly pointer to MpDataBuf.
MPBUF_CONST_MEMBER_ACCESS_OPERATOR(MpDataBuf)
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
};
#endif // _INCLUDED_MPDATABUF_H ]
|