This file is indexed.

/usr/include/sipxtapi/utl/UtlContainer.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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


#ifndef _UtlContainer_h_
#define _UtlContainer_h_

// SYSTEM INCLUDES
#include <stdlib.h> 

// APPLICATION INCLUDES
#include "utl/UtlDefs.h"
#include "utl/UtlLink.h"
#include "utl/UtlContainable.h"
#include "utl/UtlIterator.h"
#include "os/OsBSem.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS

/**
 * UtlContainer defines an abstract container designed to hold UtlContainable 
 * derived objects.
 */
class UtlContainer : public UtlContainable
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

    static const UtlContainableType TYPE ;    /** < Class type used for runtime checking */ 

/* ============================ CREATORS ================================== */
   
    /**
     * Default Constructor
     */
    UtlContainer();

    /**
     * Destructor
     */
    virtual ~UtlContainer(); 

/* ============================ MANIPULATORS ============================== */

    /**
     * Inserts the designated containable object into the list
     * 
     * @return the object if successful, otherwise null
     */
    virtual UtlContainable* insert(UtlContainable* obj) = 0 ;

    /**
     * Removes the designated objects from the list and frees the object 
     * by calling delete.
     */ 
    virtual UtlBoolean destroy(UtlContainable*) = 0 ;    

    /**
     * Removes all elements from the container and deletes each one.
     */
    virtual void destroyAll() = 0 ;

    /**
     * Removes the designated object by reference
     * (as opposed to searching for an equality match).  
     *
     * @return the object if successful, otherwise null
     */
    virtual UtlContainable* removeReference(const UtlContainable* object) = 0;

    /**
     * Removes all elements from the container without freeing the objects.
     */
    virtual void removeAll() = 0 ;

/* ============================ ACCESSORS ================================= */

    /**
     * Find the designated value within the container
     */
    virtual UtlContainable* find(const UtlContainable*) const = 0 ;   


    /**
     * Calculate a unique hash code for this object.  If the equals
     * operator returns true for another object, then both of those
     * objects must return the same hashcode.
     */
    virtual unsigned hash() const;

    /**
     * Get the ContainableType for a UtlContainable derived class.
     */
    virtual UtlContainableType getContainableType() const;


/* ============================ INQUIRY =================================== */

    /**
     * Determine if the container is empty.
     */
    virtual UtlBoolean isEmpty() const = 0 ;

    /**
     * Determine if the container includes the designated objects.
     */
    virtual UtlBoolean contains(const UtlContainable *)  const = 0 ;

    /**
     * Determine the number of elements within the container.
     */     
    virtual size_t entries() const = 0 ;


    /**
     * Compare the this object to another like-objects.  Results for 
     * designating a non-like object are undefined.
     *
     * @returns 0 if equal, < 0 if less then and >0 if greater.
     */
    virtual int compareTo(const UtlContainable* otherObject) const;    

    /// Lock the linkage between containers and iterators
    static void acquireIteratorConnectionLock();
    /**<
     * This must be called by any code that will take both the
     * mContainerRefLock in an iterator and the mContainerLock in a
     * container.  It can be released as soon as both those locks are
     * acquired, and should be, since most operations on any iterator
     * will need to take it briefly.
     */

    /// Unlock the linkage between containers and iterators
    static void releaseIteratorConnectionLock();

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
    friend class UtlIterator;
    friend class UtlInit;

    /// Add an iterator to the list to be notified of changes to this container.
    void addIterator(UtlIterator* newIterator ///< to be notified of container changes
                     ) const; // this const is a lie, but not a detectable one...
    /**<
     * <strong>
     * The caller must be holding this->mContainerLock and newIterator->mContainerRefLock
     * </strong>
     *
     * This also sets the mpMyContainer pointer in newIterator.
     */

    /// Called from iterator destructor to prevent further notices.
    void removeIterator(UtlIterator* existingIterator ///< iterator to remove from notice list
                        ) const;
    /**<
     * <strong>
     *   The caller must be holding both this->mContainerLock and 
     *   existingIterator->mContainerRefLock; see also acquireIteratorConnectionLock. 
     * </strong>
     *
     * Remove the existingIterator from the list to be called for
     * changes to this UtlContainer.
     */
    
    /// Call the invalidate method on all iterators
    void invalidateIterators();
    /**<
     * This is for use in subclasses that have other state that must
     * be cleaned up.
     *
     * :NOTE: the caller must be holding the iterator list lock;
     *  see iteratorListLock
     */

    /// Must be taken when making any change to container state
    mutable OsBSem mContainerLock;


    /**
     * mpIterator list is the list of existing UtlIterator objects
     *   constructed using this UtlContainer
     *
     * This is used to invoke methods on each UtlIterator when changes are made to the UtlContainer
     *   ->remove when an element is about to be removed from the UtlContainer,
     *   ->invalidate when this UtlContainer is being deleted
     * see sIteratorConnectionLock
     */
    UtlChain mIteratorList; 

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
    /// This lock prevent container/iterator deadlocks
    static OsBSem* spIteratorConnectionLock;
    /**<
     * UtlContainer/UtlIterator locking strategy
     *
     * The mpMyContainer pointer in a UtlIterator is protected by
     * the UtlIterator::mContainerRefLock.  That lock must be held to
     * write mpMyContainer, and while an iterator method is accessing
     * its container, *mpMyContainer.
     *
     * All other member variables of any UtlContainer, and all other
     * member variables of any UtlIterator are protected by the
     * UtlContainer::mContainerLock.
     *
     * A UtlIterator must always take both, because it has to lock the
     * mpMyContainer value to find its UtlContainer, and then lock the
     * mContainerLock before looking at the  UtlContainer state.
     *
     * A UtlContainer can usually take just the mContainerLock, but
     * when it is adding or removing a UtlIterator, it must lock the iterator's
     * mContainerRefLock as well so that it can change the mpMyContainer value.
     *
     * To prevent deadlocks, the sIteratorConnectionLock must be taken
     * before either lock when both are going to be needed.  It can
     * (and should) be released as soon as both locks are taken.  It does
     * not need to be held through the entire operation - once both
     * individual locks are taken, everything is safe and there can be no
     * deadlock.  Since holding it will block any operation on any UtlIterator,
     * it should be released as early as possible.
     *
     * Thus, the common sequences of operations are:
     *
     * Iterator operations:
     *
     *   UtlContainer::acquireIteratorConnectionLock();
     *   OsLock take(mContainerRefLock);
     *
     *   UtlList* myList = static_cast<UtlList*>(mpMyContainer);
     *   OsLock take(myList->mContainerLock);
     *   UtlContainer::releaseIteratorConnectionLock(); // as soon as both locks are taken
     *
     *   // ... whatever the method does ...
     *
     * Container operations (that does not affect mpMyContainer in any iterator):
     *
     *   {
     *      OsLock take (mContainerLock);
     *
     *      ... whatever the method does ...
     *   }
     *
     * Container destructor (must take sIteratorConnectionLock to disconnect iterators):
     *
     *   UtlContainer::acquireIteratorConnectionLock();
     *   OsLock take(mContainerRefLock);
     *  
     *   UtlList* myList = static_cast<UtlList*>(mpMyContainer);
     *   OsLock take(myList->mContainerLock);
     *   UtlContainer::releaseIteratorConnectionLock(); // as soon as both locks are taken
     *  
     *   myList->removeIterator(this);
     *   mpMyContainer = NULL;
     */

    /**
     * There is no copy constructor
     */
    UtlContainer(const UtlContainer& copy );

    /**
     * There is no assignment operator
     */
    UtlContainer& operator=(const UtlContainer& copy );

} ;

/* ============================ INLINE METHODS ============================ */

#endif    // _UtlContainer_h_