27 #ifndef OPAL_SIP_SIPPRES_H
28 #define OPAL_SIP_SIPPRES_H
37 #include <ptclib/pxml.h>
39 #include <ptlib/notifier_ext.h>
42 class XCAPClient :
public PHTTPClient
45 struct ElementSelector {
47 const PString & name = PString::Empty(),
48 const PString & position = PString::Empty()
50 , m_position(position)
51 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
55 const PString & attribute,
58 , m_attribute(attribute)
60 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
64 const PString & position,
65 const PString & attribute,
68 , m_position(position)
69 , m_attribute(attribute)
71 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
73 PString AsString()
const;
81 class NodeSelector :
public std::list<ElementSelector>
87 const ElementSelector & selector
88 ) { push_back(selector); }
90 const ElementSelector & selector1,
91 const ElementSelector & selector2
92 ) { push_back(selector1); push_back(selector2); }
94 const ElementSelector & selector1,
95 const ElementSelector & selector2,
96 const ElementSelector & selector3
97 ) { push_back(selector1); push_back(selector2); push_back(selector3); }
100 const PString & name,
101 const PString & position = PString::Empty()
102 ) { push_back(ElementSelector(name, position)); }
105 const PString & name,
106 const PString & attribute,
107 const PString & value
108 ) { push_back(ElementSelector(name, attribute, value)); }
111 const PString & name,
112 const PString & position,
113 const PString & attribute,
114 const PString & value
115 ) { push_back(ElementSelector(name, position, attribute, value)); }
118 const PString & space,
119 const PString & alias = PString::Empty()
120 ) { PAssert(!space.IsEmpty(), PInvalidParameter); m_namespaces[alias] = space; }
127 std::map<PString, PString> m_namespaces;
135 ) {
return GetXml(BuildURL(), xml); }
144 ) {
return PutXml(BuildURL(), xml); }
151 bool DeleteXml() {
return DeleteDocument(BuildURL()); }
159 ) { m_root = server; }
160 const PURL & GetRoot()
const {
return m_root; }
162 void SetApplicationUniqueID(
165 const PString & GetApplicationUniqueID()
const {
return m_auid; }
167 void SetGlobal() { m_global =
true; }
168 bool IsGlobal()
const {
return m_global; }
170 void SetUserIdentifier(
172 ) { m_global =
false; m_xui = id; }
173 const PString & GetUserIdentifier()
const {
return m_xui; }
177 ) { m_filename = fn; }
178 const PString & GetFilename()
const {
return m_filename; }
181 const NodeSelector & node
183 const NodeSelector & GetNode()
const {
return m_node; }
184 void ClearNode() { m_node.clear(); }
188 ) { m_contentType = type; }
189 const PString & GetContentType()
const {
return m_contentType; }
198 PString m_contentType;
202 class SIPWatcherInfoCommand :
public OpalPresentityCommand {
204 SIPWatcherInfoCommand(
bool unsubscribe =
false) : m_unsubscribe(unsubscribe) { }
212 class SIP_Presentity :
public OpalPresentityWithCommandThread,
public PValidatedNotifierTarget
214 PCLASSINFO(SIP_Presentity, OpalPresentityWithCommandThread);
218 SIP_Presentity(
const SIP_Presentity & other);
221 virtual PObject * Clone()
const {
return new SIP_Presentity(*
this); }
231 static const PCaselessString & PIDFEntityKey();
232 static const PCaselessString & SubProtocolKey();
233 static const PCaselessString & PresenceAgentKey();
234 static const PCaselessString & TransportKey();
235 static const PCaselessString & XcapRootKey();
236 static const PCaselessString & XcapAuthIdKey();
237 static const PCaselessString & XcapPasswordKey();
238 static const PCaselessString & XcapAuthAuidKey();
239 static const PCaselessString & XcapAuthFileKey();
240 static const PCaselessString & XcapBuddyListKey();
242 virtual PStringArray GetAttributeNames()
const;
243 virtual PStringArray GetAttributeTypes()
const;
246 virtual bool Close();
247 virtual BuddyStatus GetBuddyListEx(BuddyList & buddies);
248 virtual BuddyStatus SetBuddyListEx(
const BuddyList & buddies);
249 virtual BuddyStatus DeleteBuddyListEx();
250 virtual BuddyStatus GetBuddyEx(BuddyInfo & buddy);
251 virtual BuddyStatus SetBuddyEx(
const BuddyInfo & buddy);
252 virtual BuddyStatus DeleteBuddyEx(
const PURL & presentity);
253 virtual BuddyStatus SubscribeBuddyListEx(PINDEX & successful,
bool subscribe =
true);
255 SIPEndPoint & GetEndpoint() {
return *m_endpoint; }
257 void Internal_SendLocalPresence(
const OpalSetLocalPresenceCommand & cmd);
258 void Internal_SubscribeToPresence(
const OpalSubscribeToPresenceCommand & cmd);
259 void Internal_SubscribeToWatcherInfo(
const SIPWatcherInfoCommand & cmd);
260 void Internal_AuthorisationRequest(
const OpalAuthorisationRequestCommand & cmd);
262 unsigned GetExpiryTime()
const;
269 void OnReceivedWatcherStatus(PXMLElement * watcher);
270 void SetPIDFEntity(PURL & entity);
271 bool ChangeAuthNode(XCAPClient & xcap,
const OpalAuthorisationRequestCommand & cmd);
272 void InitRootXcap(XCAPClient & xcap);
275 const PString & entryName = PString::Empty(),
276 const PString & listName = PString::Empty()
280 SubProtocol m_subProtocol;
281 SIPURL m_presenceAgentURL;
282 PURL m_defaultRootURL;
283 PString m_watcherSubscriptionAOR;
284 int m_watcherInfoVersion;
285 PString m_publishedTupleId;
287 typedef std::map<PString, PString> StringMap;
288 StringMap m_watcherAorById;
289 StringMap m_presenceIdByAor;
290 StringMap m_presenceAorById;
291 StringMap m_authorisationIdByAor;
294 void operator=(
const SIP_Presentity &) { }
298 #endif // OPAL_SIP_PRESENCE
300 #endif // OPAL_SIP_SIPPRES_H
Definition: sippdu.h:1349
Definition: handlers.h:205
Definition: sippdu.h:1360