This file is indexed.

/usr/include/openh323/h460/h460p.h is in libh323plus-dev 1.24.0~dfsg2-1.3.

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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
/*
 * h460p.h
 *
 * H460 Presence class.
 *
 * h323plus library
 *
 * Copyright (c) 2008 ISVO (Asia) Pte. Ltd.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Alternatively, the contents of this file may be used under the terms
 * of the General Public License (the  "GNU License"), in which case the
 * provisions of GNU License are applicable instead of those
 * above. If you wish to allow use of your version of this file only
 * under the terms of the GNU License and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting the provisions above and replace them with the notice and
 * other provisions required by the GNU License. If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GNU License."
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 *
 * The Initial Developer of the Original Code is ISVO (Asia) Pte. Ltd.
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: h460p.h,v $
 * Revision 1.9  2010/05/26 13:07:51  willamowius
 * SOlaris 10 compile fix
 *
 * Revision 1.8  2010/02/24 03:00:00  shorne
 * Added generic data support to presence feature
 *
 * Revision 1.7  2010/01/20 04:23:08  shorne
 * Add ability to advertise supported H.460 features in presence
 *
 * Revision 1.6  2009/12/21 01:15:09  shorne
 * Further Presence Development
 *
 * Revision 1.5  2009/12/08 08:25:47  willamowius
 * gcc fixes for presence
 *
 * Revision 1.4  2009/12/08 04:05:14  shorne
 * Major update of presence system
 *
 * Revision 1.3  2009/11/17 11:01:28  shorne
 * Presence Support Update
 *
 * Revision 1.2  2008/02/21 00:04:33  shorne
 * fix variable naming issue on linux compile
 *
 * Revision 1.1  2008/01/29 04:38:12  shorne
 * completed Initial implementation
 *
 *
 *
 */


#pragma once

#include "openh323buildopts.h"

#ifdef H323_H460

#include <ptlib.h>
#include <h460/h460pres.h>
#include <guid.h>
#include <transports.h>
#include <list>
#include <map>

class H323PresenceNotification : public H460P_PresenceNotification
{

public:

	enum States {
      e_hidden,
      e_available,
      e_online,
      e_offline,
      e_onCall,
      e_voiceMail,
      e_notAvailable,
	  e_away,
	  e_generic
	};

	static PString GetStateString(unsigned state);

    void SetPresenceState(States state, const PString & display = PString());
    void SetGenericState(const PString & state);
	void GetPresenceState(States & state, PString & display) const;

	void AddSupportedFeature(int id);
	void AddSupportedFeature(const H460P_PresenceFeature & id);
	void AddEndpointLocale(const H460P_PresenceGeoLocation & loc);
	void AddGenericData(const H225_ArrayOf_GenericData & data);

	void AddSubscriber(const OpalGloballyUniqueID & guid);
	OpalGloballyUniqueID GetSubscriber(PINDEX i);
	void RemoveSubscribers();
    void AddAlias(const PString & alias);
	PString GetAlias() const;

};

class H323PresenceNotifications : public H460P_PresenceNotify  
{

  public:
    void Add(const H323PresenceNotification & notify);
	H323PresenceNotification & operator[](PINDEX i) const;

	void SetAlias(const PString & alias);
	void GetAlias(PString & alias);

	void SetAliasList(const PStringList & alias);
	void GetAliasList(PStringList & alias) const;

	void SetSize(PINDEX newSize);
	PINDEX GetSize() const;

 private:
	PStringList m_aliasList;
};

class H323PresenceSubscription : public H460P_PresenceSubscription
{

public:
	H323PresenceSubscription();
	H323PresenceSubscription(const OpalGloballyUniqueID & guid);

 // Sending Gatekeeper
	void SetSubscriptionDetails(const PString & subscribe, const PStringList & aliases);
	void SetSubscriptionDetails(const H225_AliasAddress & subscribe, const H225_AliasAddress & subscriber);
	void GetSubscriberDetails(PStringList & aliases) const;
	PString GetSubscribed();

	void SetGatekeeperRAS(const H323TransportAddress & address);
	H323TransportAddress GetGatekeeperRAS();

 // Receiving Gatekeeper/Endpoint
	void MakeDecision(bool approve);
	bool IsDecisionMade();
	int IsApproved(); // -1 not decided; 0 - not approved; 1 - approved;
	void SetTimeToLive(int t);
	int GetTimeToLive();

	void SetSubscription(const OpalGloballyUniqueID & guid);
    OpalGloballyUniqueID GetSubscription() const;

	void SetApproved(bool success);
	void AddGenericData(const H225_ArrayOf_GenericData & data);
    
};

class H323PresenceSubscriptions : public H460P_PresenceAuthorize
{
   public:
	void Add(const H323PresenceSubscription & sub);
	H323PresenceSubscription & operator[](PINDEX i) const;

	void SetAlias(const PString & alias);
	void GetAlias(PString & alias);

	void SetSize(PINDEX newSize);
	PINDEX GetSize() const;
};

class H323PresenceInstruction  :  public H460P_PresenceInstruction
{

 public:
	enum Instruction {
	  e_subscribe,
      e_unsubscribe,
      e_block,
      e_unblock,
	  e_pending
	};

	static PString GetInstructionString(unsigned instruct);
 
    H323PresenceInstruction(Instruction instruct, const PString & alias);
	Instruction GetInstruction();
	PString GetAlias() const;
};

class H323PresenceInstructions  : public H460P_PresenceInstruct
{
  public:
	void Add(const H323PresenceInstruction & instruct);
	H323PresenceInstruction & operator[](PINDEX i) const;

	void SetAlias(const PString & alias);
	void GetAlias(PString & alias);

	void SetSize(PINDEX newSize);
	PINDEX GetSize() const;
};

class H323PresenceIdentifiers   : public H460P_ArrayOf_PresenceIdentifier
{

  public:
	void Add(const OpalGloballyUniqueID & guid, PBoolean todelete = false);
	OpalGloballyUniqueID GetIdentifier(PINDEX i);
};

struct H323PresenceRecord
{
	H225_EndpointIdentifier m_identifer;
	H225_AliasAddress		m_locAlias;
	H225_AliasAddress		m_subAlias;
	time_t					m_timeStamp;
	unsigned				m_ttl;
};

struct H323PresenceID
{
	PBoolean								m_isSubscriber;
	H225_AliasAddress						m_subscriber;
	H225_AliasAddress						m_Alias;
	H323PresenceInstruction::Instruction	m_Status;
	PBoolean								m_Active;
	PTime									m_Updated;
};

struct H323PresenceEndpoint
{
	H323PresenceSubscriptions	m_Authorize;
    H323PresenceInstructions	m_Instruction;
    H323PresenceNotifications	m_Notify;
	H323PresenceIdentifiers		m_Identifiers;
};

#define H323PresenceStore		std::map<H225_AliasAddress,H323PresenceEndpoint>
#define H323PresenceGkStore		std::map<H225_TransportAddress,H323PresenceEndpoint>

template<class Msg>
struct Order {
  bool operator()(Msg s1, Msg s2) const
  {
    return s1.Compare(s2) < 0;
  }
};

// Indicia
#define H323PresenceInd			std::map<H225_AliasAddress,list<H460P_PresencePDU>,Order<H225_AliasAddress> >


// Gatekeeper functions
#define H323PresenceAlias		std::map<H225_AliasAddress,H225_EndpointIdentifier,Order<H225_AliasAddress> >
#define H323PresenceLocal		std::map<H225_EndpointIdentifier, H323PresenceInd,Order<H225_EndpointIdentifier> >

#define H323PresenceExternal	std::map<H225_AliasAddress,H225_TransportAddress,Order<H225_AliasAddress> >
#define H323PresenceRemote		std::map<H225_TransportAddress, H323PresenceInd>
#define H323PresenceLRQRelay	std::map<H460P_PresenceIdentifier,H225_TransportAddress,Order<H460P_PresenceIdentifier> >

#define H323PresenceIds			std::map<H460P_PresenceIdentifier,H323PresenceID,Order<H460P_PresenceIdentifier> >
#define H323PresencePending		std::map<H225_AliasAddress,H460P_PresenceIdentifier, Order<H225_AliasAddress> >
#define H323PresenceIdMap		std::map<H225_AliasAddress,H323PresencePending, Order<H225_AliasAddress> >


// Derive you implementation from H323PresenceHandler.

class H323PresenceHandler  : public PObject
{
    PCLASSINFO(H323PresenceHandler, PObject);

public:
	bool ReceivedPDU(const PASN_OctetString & pdu, H225_TransportAddress * ip = NULL);

    enum MsgType {
		e_Status,
		e_Instruct,
		e_Authorize,
		e_Notify,
		e_Request,
		e_Response,
		e_Alive,
		e_Remove,
		e_Alert
    };

	enum InstType {
		e_subscribe,
		e_unsubscribe,
		e_block,
		e_unblock,
		e_pending
	};

	class localeInfo {
		public:
			localeInfo();
			bool BuildLocalePDU(H460P_PresenceGeoLocation & pdu);

			PString		m_locale;
			PString		m_region;
			PString		m_country;
			PString		m_countryCode;
			PString		m_latitude;
			PString		m_longitude;
			PString		m_elevation;
	};

	PBoolean BuildPresenceElement(unsigned msgtag,					///< RAS Message ID
							PASN_OctetString & pdu					///< Encoded PresenceElement
							);

	PBoolean BuildPresenceElement(unsigned msgtag,					///< Presence Message ID
							const H225_EndpointIdentifier & ep,		///< Endpoint Identifier
							PASN_OctetString & pdu					///< Presence Message elements
							);

	PBoolean BuildPresenceElement(unsigned msgtag,					///< Presence Message ID
							const H225_TransportAddress & ip,		///< Transport Address
							PASN_OctetString & pdu					///< Presence Message elements
							);

	PBoolean BuildPresenceMessage(unsigned id,						///< Presence Message ID
							H323PresenceStore & store,				///< Presence Store Information
							H460P_ArrayOf_PresenceMessage & element	///< Presence Message elements
							);

	PBoolean BuildPresenceMessage(unsigned id,						///< Presence Message ID 
							const H225_EndpointIdentifier & ep, 	///< Endpoint Identifier
							H460P_ArrayOf_PresenceMessage & msgs	///< Presence Message elements
							);

	PBoolean BuildPresenceMessage(unsigned id,						///< Presence Message ID 
							const H225_TransportAddress & ip, 		///< Transport Address
							H460P_ArrayOf_PresenceMessage & msgs	///< Presence Message elements
							);

	virtual H323PresenceStore & GetPresenceStoreLocked(unsigned msgtag =0);
	virtual void PresenceStoreUnLock(unsigned msgtag = 0);

  // Events Endpoints
	virtual void OnNotification(MsgType /*tag*/,
								const H460P_PresenceNotification & /*notify*/,
								const H225_AliasAddress & /*addr*/
								) {}

	virtual void OnSubscription(MsgType /*tag*/,
								const H460P_PresenceSubscription & /*subscription*/,
								const H225_AliasAddress & /*addr*/
								) {}

	virtual void OnInstructions(MsgType /*tag*/,
								const H460P_ArrayOf_PresenceInstruction & /*instruction*/,
								const H225_AliasAddress & /*addr*/
								) {}

  // Events Gatekeepers
	virtual void OnNotification(MsgType /*tag*/,
								const H460P_PresenceNotification & /*notify*/,
								const H225_TransportAddress & /*ip*/
								) {}

	virtual void OnSubscription(MsgType /*tag*/,
								const H460P_PresenceSubscription & /*subscription*/,
								const H225_TransportAddress & /*ip*/
								) {}

	virtual void OnIdentifiers(MsgType /*tag*/, 
								const H460P_PresenceIdentifier & /*identifier*/,
								const H225_TransportAddress & /*ip*/
								) {}


  // Build Endpoint Callbacks
	virtual PBoolean BuildSubscription(const H225_EndpointIdentifier & /*ep*/,
								H323PresenceStore & /*subscription*/
								) { return false; }

	virtual PBoolean BuildNotification(const H225_EndpointIdentifier & /*ep*/,
								H323PresenceStore & /*notify*/
								) { return false; }

	virtual PBoolean BuildInstructions(const H225_EndpointIdentifier & /*ep*/,
								H323PresenceStore & /*instruction*/
								) { return false; }

  // Build Gatekeeper Callbacks
	virtual PBoolean BuildSubscription(bool /*request*/,
								const H225_TransportAddress & /*ip*/,
								H323PresenceGkStore & /*subscription*/
								) { return false; }

	virtual PBoolean BuildNotification(
								const H225_TransportAddress & /*ip*/,
								H323PresenceGkStore & /*notify*/
								) { return false; }

	virtual PBoolean BuildIdentifiers(bool /*alive*/,
								const H225_TransportAddress & /*ip*/,
								H323PresenceGkStore & /*identifiers*/
								) { return false; }

protected:
// Build Messages
     H460P_PresenceStatus & BuildStatus(H460P_PresenceMessage & msg, 
									const H323PresenceNotifications & notify,
									const H323PresenceInstructions & inst);
     H460P_PresenceInstruct & BuildInstruct(H460P_PresenceMessage & msg, 
									const H323PresenceInstructions & inst);
     H460P_PresenceAuthorize & BuildAuthorize(H460P_PresenceMessage & msg, 
									const H323PresenceSubscriptions & subs);
     H460P_PresenceNotify & BuildNotify(H460P_PresenceMessage & msg, 
									const H323PresenceNotifications & notify);
     H460P_PresenceRequest & BuildRequest(H460P_PresenceMessage & msg, 
									const H323PresenceSubscriptions & subs);
     H460P_PresenceResponse & BuildResponse(H460P_PresenceMessage & msg, 
									const H323PresenceSubscriptions & subs);
     H460P_PresenceAlive & BuildAlive(H460P_PresenceMessage & msg, 
									const H323PresenceIdentifiers & id);
     H460P_PresenceRemove & BuildRemove(H460P_PresenceMessage & msg, 
									const H323PresenceIdentifiers & id);
     H460P_PresenceAlert & BuildAlert(H460P_PresenceMessage & msg, 
									const H323PresenceNotifications & notify);

private:
	 H323PresenceStore m_presenceStore;
	 PMutex storeMutex;
};


#endif