OPAL  Version 3.14.3
h460p.h
Go to the documentation of this file.
1 /*
2  * h460p.h
3  *
4  * H460 Presence class.
5  *
6  * h323plus library
7  *
8  * Copyright (c) 2008 ISVO (Asia) Pte. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.1 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Alternatively, the contents of this file may be used under the terms
16  * of the General Public License (the "GNU License"), in which case the
17  * provisions of GNU License are applicable instead of those
18  * above. If you wish to allow use of your version of this file only
19  * under the terms of the GNU License and not to allow others to use
20  * your version of this file under the MPL, indicate your decision by
21  * deleting the provisions above and replace them with the notice and
22  * other provisions required by the GNU License. If you do not delete
23  * the provisions above, a recipient may use your version of this file
24  * under either the MPL or the GNU License."
25  *
26  * Software distributed under the License is distributed on an "AS IS"
27  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
28  * the License for the specific language governing rights and limitations
29  * under the License.
30  *
31  *
32  * The Initial Developer of the Original Code is ISVO (Asia) Pte. Ltd.
33  *
34  * Contributor(s): Many thanks to Simon Horne.
35  *
36  * $Revision: 29536 $
37  * $Author: rjongbloed $
38  * $Date: 2013-04-19 18:55:15 +1000 (Fri, 19 Apr 2013) $
39  */
40 
41 #ifndef OPAL_H460_H460P_H
42 #define OPAL_H460_H460P_H
43 
44 #include <opal_config.h>
45 
46 #if OPAL_H460
47 
48 #include <h460/h460pres.h>
49 
50 // Derive you implementation from H323PresenceHandler.
51 
56 class H323PresenceHandler : public PObject
57 {
58  PCLASSINFO(H323PresenceHandler, PObject);
59 
60 public:
61  bool ReceivedPDU(const H225_EndpointIdentifier * id,const PASN_OctetString & pdu);
62 
63  enum MsgType {
73  };
74 
75 // Callbacks
76  virtual void OnNotification(MsgType /*tag*/,
77  const H225_EndpointIdentifier * /*id*/,
78  const H460P_PresenceNotification & /*notify*/) {}
79  virtual void OnSubscription(MsgType /*tag*/,
80  const H225_EndpointIdentifier * /*id*/,
81  const H460P_PresenceSubscription & /*subscription*/) {}
82  virtual void OnInstructions(MsgType /*tag*/,
83  const H225_EndpointIdentifier * /*id*/,
84  const H460P_ArrayOf_PresenceInstruction & /*instruction*/) {}
85  virtual void OnIdentifiers(MsgType /*tag*/,
86  const H460P_ArrayOf_PresenceIdentifier & /*identifier*/) {}
87 
88 // Build Messages
90  const H323PresenceNotifications & notify,
91  const H323PresenceInstructions & inst);
93  const H323PresenceInstructions & inst);
95  const H323PresenceSubscriptions & subs);
97  const H323PresenceNotifications & notify);
99  const H323PresenceSubscriptions & subs);
101  const H323PresenceSubscriptions & subs);
103  const H323PresenceIdentifiers & id);
105  const H323PresenceIdentifiers & id);
107  const H323PresenceNotifications & notify);
108 };
109 
110 
112 {
113 
114 public:
115 
116  enum States {
125  };
126 
127  static PString GetStateString(unsigned state);
128 
129  void SetPresenceState(States state, const PString & display = PString());
130  void SetGenericState(const PString & state);
131  void GetPresenceState(States & state, PString & display);
132 
133  void AddSubscriber(const OpalGloballyUniqueID & guid);
135  void RemoveSubscribers();
136  void AddAlias(const PString & alias);
137  PString GetAlias();
138 
139 
140 };
141 
143 {
144 
145  public:
146  void Add(const H323PresenceNotification & notify);
147 };
148 
150 {
151 
152 public:
154 
155  // Sending Gatekeeper
156  void SetSubscriptionDetails(const PString & subscribe, const PStringList & aliases);
157  void GetSubscriberDetails(PStringList & aliases);
158  PString GetSubscribed();
159 
160  void SetGatekeeperRAS(const H323TransportAddress & address);
162 
163  // Receiving Gatekeeper/Endpoint
164  void MakeDecision(bool approve);
165  bool IsDecisionMade();
166  int IsApproved(); // -1 not decided; 0 - not approved; 1 - approved;
167  void SetTimeToLive(int t);
168  int GetTimeToLive();
169 
170  void SetSubscription(const OpalGloballyUniqueID & guid);
172 
173 protected:
174  void SetApproved(bool success);
175 
176 };
177 
179 {
180  public:
181  void Add(const H323PresenceSubscription & sub);
182 };
183 
185 {
186 
187  public:
188  enum Instruction {
193  };
194 
195  static PString GetInstructionString(unsigned instruct);
196 
197  H323PresenceInstruction(Instruction instruct, const PString & alias);
199  PString GetAlias();
200 };
201 
203 {
204  public:
205  void Add(const H323PresenceInstruction & instruct);
206  H323PresenceInstruction & operator[](PINDEX i) const;
207 };
208 
210 {
211 
212  public:
213  void Add(const OpalGloballyUniqueID & guid);
215 };
216 
217 #endif
218 
219 #endif // OPAL_H460_H460P_H
220