/usr/include/sipxtapi/mp/MpArrayBuf.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 | //
// Copyright (C) 2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2006 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
//////////////////////////////////////////////////////////////////////////////
#ifndef _INCLUDED_MPARRAYBUF_H // [
#define _INCLUDED_MPARRAYBUF_H
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "mp/MpBuf.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
/// Stores data right after the header.
/**
* This class adds two features to MpBuf - pointer to data, located right after
* the MpArrayBuf object, and its size. Size of the data may be set by user to
* any acceptable value. See setDataSize() for more details about data size
* setting.
*/
struct MpArrayBuf : public MpBuf
{
friend class MpArrayBufPtr;
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Set current data size
bool setDataSize( int size ///< new data size
);
/**<
* New data size could not be greater then allocated space (provided by
* getMaxDataSize()).
* @return <b>false</b> if size is greater then allocated space.
* In this case size is set to maximum possible).
* @return <b>true</b> is returned in either case.
*/
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Get pointer to the buffer data with intent to write/change it.
char *getDataWritePtr() {return mpData;}
/// Get read only pointer to the buffer data.
const char *getDataPtr() const {return mpData;}
/// Get size of #MpArrayBuf without data (in bytes).
static int getHeaderSize() {
static MpArrayBuf* foo = NULL;
return (unsigned long)(&(foo->mpData[0])) - (unsigned long)(foo);
}
/// Get maximum allowed payload size (in bytes).
unsigned getMaxDataSize() const
{return mpPool->getBlockSize()-getHeaderSize();}
/// Get current data size.
unsigned getDataSize() const {return mDataSize;}
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
unsigned mDataSize; ///< Size of the following data (in bytes).
char mpData[1]; ///< Pointer to the data, following this header.
/// This is called in place of constructor.
void init();
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Disable copy (and other) constructor.
MpArrayBuf(const MpBuf &);
/**<
* This struct will be initialized by init() member.
*/
/// Disable assignment operator.
MpArrayBuf &operator=(const MpBuf &);
/**<
* Buffers may be copied. But do we need this?
*/
};
/// Smart pointer to MpArrayBuf.
/**
* You should only use this smart pointer, not #MpArrayBuf* itself.
* The goal of this smart pointer is to care about reference counter and
* buffer deallocation.
*/
class MpArrayBufPtr : public MpBufPtr {
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Default constructor - construct invalid pointer.
MPBUF_DEFAULT_CONSTRUCTOR(MpArrayBuf)
/// This constructor owns MpBuf object.
MPBUF_FROM_BASE_CONSTRUCTOR(MpArrayBuf, MP_BUF_ARRAY, MpBuf)
/// Copy object from base type with type check.
MPBUF_TYPECHECKED_COPY(MpArrayBuf, MP_BUF_ARRAY, MpBuf)
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Return pointer to MpArrayBuf.
MPBUF_MEMBER_ACCESS_OPERATOR(MpArrayBuf)
/// Return readonly pointer to MpArrayBuf.
MPBUF_CONST_MEMBER_ACCESS_OPERATOR(MpArrayBuf)
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
};
#endif // _INCLUDED_MPARRAYBUF_H ]
|