sipxtacklib  Version 3.3
SipPublishServer.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _SipPublishServer_h_
12 #define _SipPublishServer_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include <os/OsServerTask.h>
18 #include <os/OsDefs.h>
19 #include <os/OsRWMutex.h>
20 #include <utl/UtlString.h>
21 #include <utl/UtlHashMap.h>
22 #include <net/SipUserAgent.h>
23 
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // FORWARD DECLARATIONS
33 class SipUserAgent;
35 class OsMsg;
36 class SipMessage;
37 
38 
39 // TYPEDEFS
40 
41 
43 
75 class SipPublishServer : public OsServerTask
76 {
77 /* //////////////////////////// PUBLIC //////////////////////////////////// */
78 public:
79 
80 
81 /* ============================ CREATORS ================================== */
82 
85  const char* eventType);
86 
88  SipPublishServer(SipUserAgent& defaultUserAgent,
89  SipPublishServerEventStateMgr& defaultEventStateMgr,
90  SipPublishServerEventStateCompositor& defaultCompositor);
91 
92 
94  virtual
96 
97 
98 /* ============================ MANIPULATORS ============================== */
99 
101  UtlBoolean enableEventType(const char* eventType,
102  SipUserAgent* userAgent = NULL,
103  SipPublishServerEventStateMgr* eventStateMgr = NULL,
104  SipPublishServerEventStateCompositor* compositor = NULL);
105 
107  UtlBoolean disableEventType(const char* eventType,
108  SipUserAgent*& userAgent,
109  SipPublishServerEventStateMgr*& eventStateMgr,
111 
113  UtlBoolean handleMessage(OsMsg &eventMessage);
114 
115 /* ============================ ACCESSORS ================================= */
116 
118 
126  getEventStateCompositor(const UtlString& eventType);
127 
129 
137  SipPublishServerEventStateMgr* getEventStateMgr(const UtlString& eventType);
138 
139 /* ============================ INQUIRY =================================== */
140 
141 
142 /* //////////////////////////// PROTECTED ///////////////////////////////// */
143 protected:
144 
145 
146 /* //////////////////////////// PRIVATE /////////////////////////////////// */
147 private:
149  SipPublishServer(const SipPublishServer& rSipPublishServer);
150 
152  SipPublishServer& operator=(const SipPublishServer& rhs);
153 
155  UtlBoolean handlePublish(const SipMessage& publishRequest);
156 
158  void lockForWrite();
159 
161  void unlockForWrite();
162 
164  void lockForRead();
165 
167  void unlockForRead();
168 
169  SipUserAgent* mpDefaultUserAgent;
170  SipPublishServerEventStateMgr* mpDefaultEventStateMgr;
171  SipPublishServerEventStateCompositor* mpDefaultCompositor;
172  UtlHashMap mEventDefinitions;
173  OsRWMutex mPublishServerMutex;
174 };
175 
176 /* ============================ INLINE METHODS ============================ */
177 
178 #endif // _SipPublishServer_h_
Transaction and Transport manager for SIP stack.
Definition: SipUserAgent.h:157
UtlBoolean handleMessage(OsMsg &eventMessage)
Handler for PUBLISH requests and timers.
Definition: SipPublishServer.cpp:208
Class for specializing the handling of SIP Events in SipPublishServer.
Definition: SipPublishServerEventStateCompositor.h:44
SipPublishServerEventStateCompositor * getEventStateCompositor(const UtlString &eventType)
Get the event state compositor for the given eventType.
Definition: SipPublishServer.cpp:241
SipPublishServerEventStateMgr * getEventStateMgr(const UtlString &eventType)
Get the event state manager for the given event type.
Definition: SipPublishServer.cpp:261
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
UtlBoolean enableEventType(const char *eventType, SipUserAgent *userAgent=NULL, SipPublishServerEventStateMgr *eventStateMgr=NULL, SipPublishServerEventStateCompositor *compositor=NULL)
Tell the publish server to support given event type.
Definition: SipPublishServer.cpp:129
SipPublishServer(SipUserAgent &defaultUserAgent, SipPublishServerEventStateMgr &defaultEventStateMgr, SipPublishServerEventStateCompositor &defaultCompositor)
Default SipPublishServer constructor.
Definition: SipPublishServer.cpp:91
virtual ~SipPublishServer()
Destructor.
Definition: SipPublishServer.cpp:110
static SipPublishServer * buildBasicServer(SipUserAgent &userAgent, const char *eventType)
Helper utility to build a basic server with default behavior.
Definition: SipPublishServer.cpp:66
Top level class for accepting and processing PUBLISH requests.
Definition: SipPublishServer.h:75
Class for maintaining PUBLISH event state information in publish server.
Definition: SipPublishServerEventStateMgr.h:42
UtlBoolean disableEventType(const char *eventType, SipUserAgent *&userAgent, SipPublishServerEventStateMgr *&eventStateMgr, SipPublishServerEventStateCompositor *&compositor)
Tell the publish server to stop supporting given event type.
Definition: SipPublishServer.cpp:168

sipXtackLib home page