31 #ifndef OPAL_SIP_SIPPRES_H
32 #define OPAL_SIP_SIPPRES_H
38 #if P_EXPAT && OPAL_SIP
41 #include <ptclib/pxml.h>
44 class XCAPClient :
public PHTTPClient
47 struct ElementSelector {
49 const PString & name = PString::Empty(),
50 const PString & position = PString::Empty()
52 , m_position(position)
53 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
57 const PString & attribute,
60 , m_attribute(attribute)
62 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
66 const PString & position,
67 const PString & attribute,
70 , m_position(position)
71 , m_attribute(attribute)
73 { PAssert(!m_name.IsEmpty(), PInvalidParameter); }
75 PString AsString()
const;
83 class NodeSelector :
public std::list<ElementSelector>
89 const ElementSelector & selector
90 ) { push_back(selector); }
92 const ElementSelector & selector1,
93 const ElementSelector & selector2
94 ) { push_back(selector1); push_back(selector2); }
96 const ElementSelector & selector1,
97 const ElementSelector & selector2,
98 const ElementSelector & selector3
99 ) { push_back(selector1); push_back(selector2); push_back(selector3); }
102 const PString & name,
103 const PString & position = PString::Empty()
104 ) { push_back(ElementSelector(name, position)); }
107 const PString & name,
108 const PString & attribute,
109 const PString & value
110 ) { push_back(ElementSelector(name, attribute, value)); }
113 const PString & name,
114 const PString & position,
115 const PString & attribute,
116 const PString & value
117 ) { push_back(ElementSelector(name, position, attribute, value)); }
120 const PString & space,
121 const PString & alias = PString::Empty()
122 ) { PAssert(!space.IsEmpty(), PInvalidParameter); m_namespaces[alias] = space; }
129 std::map<PString, PString> m_namespaces;
137 ) {
return GetXml(BuildURL(), xml); }
146 ) {
return PutXml(BuildURL(), xml); }
153 bool DeleteXml() {
return DeleteDocument(BuildURL()); }
161 ) { m_root = server; }
162 const PURL & GetRoot()
const {
return m_root; }
164 void SetApplicationUniqueID(
167 const PString & GetApplicationUniqueID()
const {
return m_auid; }
169 void SetGlobal() { m_global =
true; }
170 bool IsGlobal()
const {
return m_global; }
172 void SetUserIdentifier(
174 ) { m_global =
false; m_xui = id; }
175 const PString & GetUserIdentifier()
const {
return m_xui; }
179 ) { m_filename = fn; }
180 const PString & GetFilename()
const {
return m_filename; }
183 const NodeSelector & node
185 const NodeSelector & GetNode()
const {
return m_node; }
186 void ClearNode() { m_node.clear(); }
190 ) { m_contentType = type; }
191 const PString & GetContentType()
const {
return m_contentType; }
200 PString m_contentType;
206 SIPWatcherInfoCommand(
bool unsubscribe =
false) : m_unsubscribe(unsubscribe) { }
220 SIP_Presentity(
const SIP_Presentity & other);
223 virtual PObject * Clone()
const {
return new SIP_Presentity(*
this); }
233 static const PCaselessString & PIDFEntityKey();
234 static const PCaselessString & SubProtocolKey();
235 static const PCaselessString & PresenceAgentKey();
236 static const PCaselessString & TransportKey();
237 static const PCaselessString & XcapRootKey();
238 static const PCaselessString & XcapAuthIdKey();
239 static const PCaselessString & XcapPasswordKey();
240 static const PCaselessString & XcapAuthAuidKey();
241 static const PCaselessString & XcapAuthFileKey();
242 static const PCaselessString & XcapBuddyListKey();
248 virtual bool Close();
252 virtual BuddyStatus
GetBuddyEx(BuddyInfo & buddy);
253 virtual BuddyStatus
SetBuddyEx(
const BuddyInfo & buddy);
257 SIPEndPoint & GetEndpoint() {
return *m_endpoint; }
261 void Internal_SubscribeToWatcherInfo(
const SIPWatcherInfoCommand & cmd);
264 unsigned GetExpiryTime()
const;
271 void OnReceivedWatcherStatus(PXMLElement * watcher);
272 void SetPIDFEntity(PURL & entity);
274 void InitRootXcap(XCAPClient & xcap);
277 const PString & entryName = PString::Empty(),
278 const PString & listName = PString::Empty()
282 SubProtocol m_subProtocol;
283 PString m_presenceAgent;
284 PString m_watcherSubscriptionAOR;
285 int m_watcherInfoVersion;
286 PString m_publishedTupleId;
288 typedef std::map<PString, PString> StringMap;
289 StringMap m_watcherAorById;
290 StringMap m_presenceIdByAor;
291 StringMap m_presenceAorById;
292 StringMap m_authorisationIdByAor;
295 void operator=(
const SIP_Presentity &) { }
299 #endif // P_EXPAT && OPAL_SIP
301 #endif // OPAL_SIP_SIPPRES_H