This file is indexed.

/usr/include/sipxtapi/ptapi/PtProvider.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
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
//
// 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 _PtProvider_h_
#define _PtProvider_h_

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsDefs.h"
#include "os/OsBSem.h"
#include "os/OsProtectEventMgr.h"
#include "ptapi/PtDefs.h"
#include "tao/TaoDefs.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class PtAddress;
class PtCall;
class PtProviderListener;
class PtTerminal;
class TaoClientTask;
class TaoServerTask;
class TaoReference;
class TaoObjectMap;
class CpCallManager;

//:A PtProvider represents the software entity that interfaces with an
//:instance of the "Pingtel Server" to monitor and control a group of
//:Pingtel phones.
//
// <H3>Obtaining access to a Provider (Pingtel Server)</H3>
// A PtProvider object is created and returned by the static
// PtProvider::getProvider() method.  This method sets up any needed
// communication paths between the application and the provider.
//
// <H3>Listeners and Events</H3>
// Each time a state change occurs on a provider, the application is notified
// via an event. These events are reported via PtProviderListener objects.
// Applications instantiate objects which are derived from the
// PtProviderListener class and use the PtProvider.addProviderListener()
// method to begin the delivery of events. Nearly all provider
// events reported via a PtProviderListener are instances of either the
// PtProviderEvent class or its descendants.  The only exceptions are the
// PROVIDER_ADDRESS_ADDED and PROVIDER_ADDRESS_REMOVED events (which are
// instances of the PtAddressEvent class) and the PROVIDER_TERMINAL_ADDED
// and PROVIDER_TERMINAL_REMOVED events (which are instances of the
// PtTerminalEvent class).<br>
// <br>
// Applications may query the reported event object for
// the specific state change via the PtEvent.getId() method. When the
// provider changes state, a PtProviderEvent is reported via the
// PtProviderListener with one of the following event IDs:
// PROVIDER_IN_SERVICE, PROVIDER_OUT_OF_SERVICE, or PROVIDER_SHUTDOWN.  A
// PtProviderEvent with an event ID of PROVIDER_EVENT_TRANSMISSION_ENDED is
// delivered to all PtProviderListeners when the provider becomes
// unobservable and is the final event delivered to the listener.
//
// <H3>Call Objects and Providers</H3>
// The PtProvider maintains knowledge of the calls currently associated with
// it. Applications may obtain an array of these calls via the
// PtProvider.getCalls() method. A PtProvider may have calls associated with
// it that were created before it came into existence. The provider maintains
// references to all calls until they move into the PtCall::INVALID state.<br>
// <br>
// Applications may create new calls using the PtProvider.createCall() method.
// A new call is returned in the PtCall::IDLE state. Applications may then
// use this idle call to place new phone calls. Once created, this new
// call object is returned via the PtProvider.getCalls() method.
//
// <H3>The Provider's domain</H3>
// The term "provider's domain" refers to the collection of PtAddress and
// PtTerminal objects which are local to the provider, and typically, can be
// controlled by the provider.
//
// <H3>Address and Terminal Objects</H3>
// A PtAddress object represents what we commonly think of as a "telephone
// number." For calls to IP telephony endpoints, the "telephone number" may
// actually be a URL or IP address identifying the endpoint.  Regardless, it
// represents a logical endpoint of a phone call.  A PtTerminal
// represents a physical endpoint connected to the telephone or IP network.
// An example of a terminal is a telephone that uses the Pingtel Telephony API.
// PtAddresses and PtTerminals are in a many-to-many relationship. A
// PtAddress may be associated with multiple PtTerminals, and PtTerminals
// may be associated with multiple PtAddresses. See the specifications for
// the PtAddress and PtTerminal classes for more information.<br>
// <br>
// Unlike PtCall objects, applications may not create PtTerminal or PtAddress
// objects. The PtProvider begins with knowledge of certain PtTerminal and
// PtAddress objects within its local domain. This list is quasi-static,
// changing only as logical and physical endpoints are added and removed in
// the phone system. The currently known addresses and terminals in the
// provider's domain are reported by the PtProvider.getAddresses() and
// PtProvider.getTerminals() methods, respectively.<br>
// <br>
// PtAddress and PtTerminal objects may also be created sometime during the
// operation of the PtProvider when the PtProvider learns of addresses and
// terminals that are outside of its domain.  For example, if the PtProvider's
// domain is a PBX, the PtProvider will know about all PtAddresses and
// PtTerminals in the PBX.  Any PtAddresses and PtTerminals it subsequently
// learns about that are outside the PBX are referred to as remote. These
// remote address and terminal objects are not reported by the
// PtProvider.getTerminals() and PtProvider.getAddresses() methods.

class PtProvider
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

   enum ProviderState
   {
      IN_SERVICE,
      OUT_OF_SERVICE,
      SHUTDOWN
   };
   //!enumcode: IN_SERVICE - the provider is currently available for use
   //!enumcode: OUT_OF_SERVICE - the provider is currently not available for use
   //!enumcode: SHUTDOWN - the provider is permanently no longer available for use

/* ============================ CREATORS ================================== */

   static PtStatus getProvider(const char* login, const char* password,
                               const char* server, const char* options,
                                                           CpCallManager* pCallMgr, PtProvider*& rpProvider);

 //  static int getProvider(const char* login, const char* password,
   //                            const char* server, const char* options,
     //                          PtProvider& rProvider);
     //:If successful, sets <i>rpProvider</i> to point to a PtProvider object.
     //!param: (in) login - user identifier (used for authentication)
     //!param: (in) password - password (used for authentication)
     //!param: (in) server - Pingtel server expressed as "host:port"
     //!param: (in) options - (not presently used)
     //!param: (in) pCallManager - Pointer to the call manager
     //!param: (out) rProvider - set to refer to a PtProvider object

     //!retcode: PT_SUCCESS - rProvider reference to a PtProvider object
     //!retcode: PT_PROVIDER_UNAVAILABLE - the Pingtel server did not respond
     //!retcode: PT_HOST_NOT_FOUND - Invalid host or port for server
     //!retcode: PT_AUTH_FAILED - Invalid login name or password

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

   virtual PtStatus addProviderListener(PtProviderListener& rListener);
     //:Adds a listener to the provider.
     //!param: (in) rListener - the listener to add to this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_EXISTS - <i>rListener</i> is already registered
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus createCall(PtCall& rCall);
     //:If successful, sets <i>rpCall</i> to refer to a new PtCall object.
     // The new PtCall object will be in the PtCall::IDLE state and have no
     // connections.
     //!param: (out) rCall - reference to the newly created call
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_RESOURCE_UNAVAILABLE - insufficient resources
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus removeProviderListener(PtProviderListener& rListener);
     //:Removes the specified listener from the provider.
     //!param: (in) rListener - the listener to remove from this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_NOT_FOUND - <i>rListener</i> not registered
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus shutdown(void);
     //:Instructs the provider to shut itself down and perform all necessary
     //:cleanup.
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

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

   virtual PtStatus getAddress(const char* phoneURL, PtAddress& rAddress);
     //:Sets <i>rpAddress</i> to refer to the PtAddress corresponding to the
     //:specified phone number or NULL if there is no corresponding address.
     //!param: (in) phoneURL - a URL representing the phone number to look up
     //!param: (out) rAddress - reference to the address object corresponding to phoneURL
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_INVALID_ARGUMENT - <i>phoneURL</i> was not recognized
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

//   PtStatus getAddresses(PtAddress& arAddresses[], int size, int& nItems);
      virtual PtStatus getAddresses(PtAddress arAddresses[], int size, int& nItems);
          //: TRICKY: array of reference are illegal, avoid using reference here.
     //:Returns an array of references to PtAddress objects that are known to
     //:the provider and within its domain.
     // The caller provides an array that can hold up to <i>size</i>
     // PtAddress references.  This method will fill in the <i>addresses</i>
     // array with up to <i>size</i> references.  The actual number of references
     // filled in is passed back via the <i>nItems</i> argument.
     //!param: (out) arAddresses - the array of PtAddress references
     //!param: (in) size - the number of elements in the <i>addresses</i> array
     //!param: (out) nItems - the number of items assigned
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_MORE_DATA - there are more than <i>size</i> addresses
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   //PtStatus getCalls(PtCall& arCalls[], int size, int& nItems);
   virtual PtStatus getCalls(PtCall arCalls[], int size, int& nItems);
   //:WARNING: array of reference are illegal try to avoid it.
     //:Returns an array of references to PtCall objects that are known to the
     //:provider.
     // The caller provides an array that can hold up to <i>size</i>
     // PtCall references.  This method will fill in the <i>calls</i> array with
     // up to <i>size</i> references.  The actual number of references filled in
     // is passed back via the <i>nItems</i> argument.
     //!param: (out) arCalls - the array of PtCall pointers
     //!param: (in) size - the number of elements in the <i>calls</i> array
     //!param: (out) nItems - the number of items assigned
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_MORE_DATA - there are more than <i>size</i> calls
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

  virtual PtStatus getProviderListeners(PtProviderListener* listeners[],
                                int size, int& nItems);
     //:Returns an array of pointers to PtProviderListener objects that have
     //:been registered with this provider.
     // The caller provides an array that can hold up to <i>size</i>
     // PtProviderListener pointers.  This method will fill in the
     // <i>listeners</i> array with up to <i>size</i> pointers.  The actual
     // number of pointers filled in is passed back via the <i>nItems</i>
     // argument.
     //!param: (out) listeners - the array of PtProviderListener pointers
     //!param: (in) size - the number of elements in the <i>pListeners</i> array
     //!param: (out) nItems - the number of items assigned
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_MORE_DATA - there are more than <i>size</i> listeners
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual int getState(void);
     //:Returns the current state of the provider, either IN_SERVICE,
     //:OUT_OF_SERVICE or SHUTDOWN.
     //!retcode: IN_SERVICE - the provider is available for use
     //!retcode: OUT_OF_SERVICE - the provider is temporarily unavailable
     //!retcode: SHUTDOWN - the provider is permanently unavailable

   virtual PtStatus getTerminal(const char* name, PtTerminal& rTerminal);
     //:Assigns to <i>rTerminal</i> the PtTerminal corresponding to the
     //:specified name.
     //!param: (in) name - the name to look up (typically the phone extension)
     //!param: (out) rpTerminal - the terminal object for name
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_INVALID_ARGUMENT - name was not recognized
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available
// PtStatus getTerminals(PtTerminals& arTerms[], int size, int& nItems);
   virtual PtStatus getTerminals(PtTerminal arTerms[], int size, int& nItems);
   //:WARNING: avoid using array of reference.
     //:Returns an array of references to PtTerminal objects that are known to
     //:the provider and within its domain.
     // The caller provides an array that can hold up to <i>size</i>
     // PtTerminal references.  This method will fill in the <i>terms</i> array
     // with up to <i>size</i> references.  The actual number of references
     // filled in is passed back via the <i>nItems</i> argument.
     //!param: (out) arTerms - the array of PtTerminal references
     //!param: (in) size - the number of elements in the <i>terms</i> array
     //!param: (out) nItems - the number of items assigned
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_MORE_DATA - there are more than <i>size</i> terminals
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus numAddresses(int& count);
     //:Returns the number of addresses currently known to this provider and
     //:within its domain.
     //!param: (out) count - the number of addresses known to this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus numCalls(int& count);
     //:Returns the number of calls currently known to this provider.
     //!param: (out) count - the number of calls known to this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus numProviderListeners(int& count);
     //:Returns the number of PtProviderListeners currently registered with
     //:this provider.
     //!param: (out) count - the number of listeners known to this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

   virtual PtStatus numTerminals(int& count);
     //:Returns the number of terminals currently known to this provider and
     //:within its domain.
     //!param: (out) count - the number of terminals known to this provider
     //!retcode: PT_SUCCESS - success
     //!retcode: PT_PROVIDER_UNAVAILABLE - the provider is not available

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

friend class PtTerminal;

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
    static OsBSem           semInit ;
      //: Binary Semaphore used to guard initialiation and tear down
    static PtProvider* spInstance;       // pointer to the single instance of
        static TaoClientTask            *mpClient;

        static TaoReference             *mpTransactionCnt;

        static TaoObjectMap             *mpCalls;
        static TaoReference             *mpCallCnt;

        static TaoObjectMap             *mpAddresses;
        static TaoReference             *mpAddressCnt;

        static unsigned int             mRef;


        UtlString                       mLogin;
        UtlString                       mPass;

        ProviderState           mState;

        OsTime          mTimeOut;

        void initialize();

        PtStatus createProvider(const char* login, const char* password,
                        const char* server, const char* options,
         CpCallManager* pCallMgr = NULL);

        PtProvider(const char* login, const char* password,
                        const char* server, const char* options,
                        CpCallManager* pCallMgr = NULL);

        PtProvider(const PtProvider& rPtProvider);
         //:Copy constructor (not implemented for this class)

        PtProvider& operator=(const PtProvider& rhs);
         //:Assignment operator (not implemented for this class)

        PtProvider(UtlString& rLogin, UtlString& rPass);

        PtProvider();
     //:Default constructor

   virtual
   ~PtProvider();
     //:Destructor

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
        OsProtectEventMgr *mpEventMgr;
        static UtlBoolean mbInvalidIP;
                                                                        //  the Pinger class
        static OsBSem  sLock;            // semaphore used to ensure that there
                                                                        //  is only one instance of this class

        static UtlBoolean isLocal(const char* host);



};

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

#endif  // _PtProvider_h_