OPAL  Version 3.18.8
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 
37 #ifndef OPAL_H460_H460P_H
38 #define OPAL_H460_H460P_H
39 
40 #include <opal_config.h>
41 
42 #if OPAL_H460
43 
44 #include <h460/h460pres.h>
45 
46 // Derive you implementation from H323PresenceHandler.
47 
52 class H323PresenceHandler : public PObject
53 {
54  PCLASSINFO(H323PresenceHandler, PObject);
55 
56 public:
57  bool ReceivedPDU(const H225_EndpointIdentifier * id,const PASN_OctetString & pdu);
58 
59  enum MsgType {
69  };
70 
71 // Callbacks
72  virtual void OnNotification(MsgType /*tag*/,
73  const H225_EndpointIdentifier * /*id*/,
74  const H460P_PresenceNotification & /*notify*/) {}
75  virtual void OnSubscription(MsgType /*tag*/,
76  const H225_EndpointIdentifier * /*id*/,
77  const H460P_PresenceSubscription & /*subscription*/) {}
78  virtual void OnInstructions(MsgType /*tag*/,
79  const H225_EndpointIdentifier * /*id*/,
80  const H460P_ArrayOf_PresenceInstruction & /*instruction*/) {}
81  virtual void OnIdentifiers(MsgType /*tag*/,
82  const H460P_ArrayOf_PresenceIdentifier & /*identifier*/) {}
83 
84 // Build Messages
86  const H323PresenceNotifications & notify,
87  const H323PresenceInstructions & inst);
89  const H323PresenceInstructions & inst);
91  const H323PresenceSubscriptions & subs);
93  const H323PresenceNotifications & notify);
95  const H323PresenceSubscriptions & subs);
97  const H323PresenceSubscriptions & subs);
99  const H323PresenceIdentifiers & id);
101  const H323PresenceIdentifiers & id);
103  const H323PresenceNotifications & notify);
104 };
105 
106 
108 {
109 
110 public:
111 
112  enum States {
121  };
122 
123  static PString GetStateString(unsigned state);
124 
125  void SetPresenceState(States state, const PString & display = PString());
126  void SetGenericState(const PString & state);
127  void GetPresenceState(States & state, PString & display);
128 
129  void AddSubscriber(const OpalGloballyUniqueID & guid);
131  void RemoveSubscribers();
132  void AddAlias(const PString & alias);
133  PString GetAlias();
134 
135 
136 };
137 
139 {
140 
141  public:
142  void Add(const H323PresenceNotification & notify);
143 };
144 
146 {
147 
148 public:
150 
151  // Sending Gatekeeper
152  void SetSubscriptionDetails(const PString & subscribe, const PStringList & aliases);
153  void GetSubscriberDetails(PStringList & aliases);
154  PString GetSubscribed();
155 
156  void SetGatekeeperRAS(const H323TransportAddress & address);
158 
159  // Receiving Gatekeeper/Endpoint
160  void MakeDecision(bool approve);
161  bool IsDecisionMade();
162  int IsApproved(); // -1 not decided; 0 - not approved; 1 - approved;
163  void SetTimeToLive(int t);
164  int GetTimeToLive();
165 
166  void SetSubscription(const OpalGloballyUniqueID & guid);
168 
169 protected:
170  void SetApproved(bool success);
171 
172 };
173 
175 {
176  public:
177  void Add(const H323PresenceSubscription & sub);
178 };
179 
181 {
182 
183  public:
184  enum Instruction {
189  };
190 
191  static PString GetInstructionString(unsigned instruct);
192 
193  H323PresenceInstruction(Instruction instruct, const PString & alias);
195  PString GetAlias();
196 };
197 
199 {
200  public:
201  void Add(const H323PresenceInstruction & instruct);
202  H323PresenceInstruction & operator[](PINDEX i) const;
203 };
204 
206 {
207 
208  public:
209  void Add(const OpalGloballyUniqueID & guid);
211 };
212 
213 #endif
214 
215 #endif // OPAL_H460_H460P_H
216 
virtual void OnNotification(MsgType, const H225_EndpointIdentifier *, const H460P_PresenceNotification &)
Definition: h460p.h:72
void Add(const H323PresenceNotification &notify)
OpalGloballyUniqueID GetSubscription()
Definition: h460p.h:205
H460P_PresenceAlert & BuildAlert(H460P_PresenceMessage &msg, const H323PresenceNotifications &notify)
MsgType
Definition: h460p.h:59
void SetSubscriptionDetails(const PString &subscribe, const PStringList &aliases)
Instruction
Definition: h460p.h:184
void SetGenericState(const PString &state)
Definition: h460pres.h:685
void MakeDecision(bool approve)
Definition: h460pres.h:124
Definition: h460pres.h:368
static PString GetInstructionString(unsigned instruct)
Definition: h460p.h:117
Definition: h460p.h:65
Definition: h460p.h:187
virtual void OnSubscription(MsgType, const H225_EndpointIdentifier *, const H460P_PresenceSubscription &)
Definition: h460p.h:75
Definition: h460p.h:198
Definition: h460pres.h:210
Instruction GetInstruction()
Definition: h460p.h:66
Definition: h460pres.h:562
void Add(const H323PresenceInstruction &instruct)
Definition: h460p.h:180
H460P_PresenceInstruct & BuildInstruct(H460P_PresenceMessage &msg, const H323PresenceInstructions &inst)
Definition: h460p.h:138
H460P_PresenceRequest & BuildRequest(H460P_PresenceMessage &msg, const H323PresenceSubscriptions &subs)
void AddAlias(const PString &alias)
Definition: h460p.h:188
void GetPresenceState(States &state, PString &display)
Definition: h460p.h:67
Definition: h460pres.h:250
H323TransportAddress GetGatekeeperRAS()
Definition: h460pres.h:537
Definition: h460p.h:107
OpalGloballyUniqueID GetIdentifier(PINDEX i)
Definition: h460p.h:63
Definition: h460p.h:174
Definition: h460p.h:52
States
Definition: h460p.h:112
OpalGloballyUniqueID GetSubscriber(PINDEX i)
bool ReceivedPDU(const H225_EndpointIdentifier *id, const PASN_OctetString &pdu)
H460P_PresenceRemove & BuildRemove(H460P_PresenceMessage &msg, const H323PresenceIdentifiers &id)
Definition: h460p.h:68
Definition: h460p.h:60
void Add(const H323PresenceSubscription &sub)
H323PresenceInstruction & operator[](PINDEX i) const
static PString GetStateString(unsigned state)
Definition: h460pres.h:398
virtual void OnIdentifiers(MsgType, const H460P_ArrayOf_PresenceIdentifier &)
Definition: h460p.h:81
Definition: h460pres.h:473
void GetSubscriberDetails(PStringList &aliases)
H460P_PresenceAuthorize & BuildAuthorize(H460P_PresenceMessage &msg, const H323PresenceSubscriptions &subs)
Definition: h460pres.h:505
void SetSubscription(const OpalGloballyUniqueID &guid)
void AddSubscriber(const OpalGloballyUniqueID &guid)
Definition: h460pres.h:448
Definition: h460p.h:115
virtual void OnInstructions(MsgType, const H225_EndpointIdentifier *, const H460P_ArrayOf_PresenceInstruction &)
Definition: h460p.h:78
void SetPresenceState(States state, const PString &display=PString())
Definition: h460pres.h:310
Definition: h460pres.h:38
Definition: h460pres.h:612
H460P_PresenceNotify & BuildNotify(H460P_PresenceMessage &msg, const H323PresenceNotifications &notify)
Definition: h460p.h:62
Definition: h460p.h:145
H460P_PresenceAlive & BuildAlive(H460P_PresenceMessage &msg, const H323PresenceIdentifiers &id)
Definition: h460pres.h:587
void Add(const OpalGloballyUniqueID &guid)
Definition: h460p.h:64
#define OpalGloballyUniqueID
Definition: guid.h:38
H460P_PresenceResponse & BuildResponse(H460P_PresenceMessage &msg, const H323PresenceSubscriptions &subs)
void SetApproved(bool success)
Definition: h460pres.h:230
Definition: transaddr.h:62
void SetGatekeeperRAS(const H323TransportAddress &address)
H460P_PresenceStatus & BuildStatus(H460P_PresenceMessage &msg, const H323PresenceNotifications &notify, const H323PresenceInstructions &inst)
Definition: h460p.h:61
Definition: h460p.h:113
H323PresenceInstruction(Instruction instruct, const PString &alias)
Definition: h460pres.h:423