sipxtacklib  Version 3.3
SipSubscriptionMgr.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007-2008 SIPez LLC All rights reserved.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2008 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 // Author: Dan Petrie (dpetrie AT SIPez DOT com)
14 
15 #ifndef _SipSubscriptionMgr_h_
16 #define _SipSubscriptionMgr_h_
17 
18 // SYSTEM INCLUDES
19 
20 // APPLICATION INCLUDES
21 
22 #include <os/OsDefs.h>
23 #include <os/OsMsgQ.h>
24 #include <os/OsMutex.h>
25 #include <utl/UtlDefs.h>
26 #include <utl/UtlHashMap.h>
27 #include <utl/UtlHashBag.h>
28 #include <net/SipDialogMgr.h>
29 
30 // DEFINES
31 // MACROS
32 // EXTERNAL FUNCTIONS
33 // EXTERNAL VARIABLES
34 // CONSTANTS
35 // STRUCTS
36 // FORWARD DECLARATIONS
37 class SipMessage;
38 class UtlString;
39 class SipDialogMgr;
40 
41 // TYPEDEFS
42 
44 
49 {
50 /* //////////////////////////// PUBLIC //////////////////////////////////// */
51 public:
52 
53 
54 
55 /* ============================ CREATORS ================================== */
56 
59 
61  virtual
63 
64 /* ============================ MANIPULATORS ============================== */
65 
67  virtual UtlBoolean updateDialogInfo(const SipMessage& subscribeRequest,
68  const UtlString& resourceId,
69  const UtlString& eventTypeKey,
70  OsMsgQ* subscriptionTimeoutQueue,
71  UtlString& subscribeDialogHandle,
72  UtlBoolean& isNew,
73  UtlBoolean& isExpired,
74  SipMessage& subscribeResponse);
75 
77  virtual UtlBoolean getNotifyDialogInfo(const UtlString& subscribeDialogHandle,
78  SipMessage& notifyRequest);
79 
81 
88  virtual UtlBoolean createNotifiesDialogInfo(const char* resourceId,
89  const char* eventTypeKey,
90  int& numNotifiesCreated,
91  UtlString**& acceptHeaderValuesArray,
92  SipMessage**& notifyArray);
93 
95  virtual void freeNotifies(int numNotifies,
96  UtlString** acceptHeaderValues,
97  SipMessage** notifiesArray);
98 
100 
106  virtual UtlBoolean endSubscription(const UtlString& dialogHandle);
107 
109  int dumpOldSubscriptions(long oldEpochTimeSeconds);
110 
112  int removeOldSubscriptions(long oldEpochTimeSeconds);
113 
115  void setMaxExpiration(int expiresSeconds);
116 
117 /* ============================ ACCESSORS ================================= */
118 
119 
121 
127 
129  int getStateCount();
130 
131 /* ============================ INQUIRY =================================== */
132 
134  virtual UtlBoolean dialogExists(UtlString& dialogHandle);
135 
137  virtual UtlBoolean isExpired(UtlString& dialogHandle);
138 
139 /* //////////////////////////// PROTECTED ///////////////////////////////// */
140 protected:
141 
142 /* //////////////////////////// PRIVATE /////////////////////////////////// */
143 private:
145  SipSubscriptionMgr(const SipSubscriptionMgr& rSipSubscriptionMgr);
146 
148  SipSubscriptionMgr& operator=(const SipSubscriptionMgr& rhs);
149 
151  void lock();
152 
154  void unlock();
155 
156  int mEstablishedDialogCount;
157  OsMutex mSubscriptionMgrMutex;
158  SipDialogMgr mDialogMgr;
159  int mMinExpiration;
160  int mDefaultExpiration;
161  int mMaxExpiration;
162 
163  // Container for the subscritption states
164  UtlHashMap mSubscriptionStatesByDialogHandle;
165 
166  // Index to subscription states in mSubscriptionStatesByDialogHandle
167  // indexed by the resourceId and eventTypeKey
168  UtlHashBag mSubscriptionStateResourceIndex;
169 };
170 
171 /* ============================ INLINE METHODS ============================ */
172 
173 #endif // _SipSubscriptionMgr_h_
virtual UtlBoolean getNotifyDialogInfo(const UtlString &subscribeDialogHandle, SipMessage &notifyRequest)
Set the subscription dialog information and cseq for the next NOTIFY request.
Definition: SipSubscriptionMgr.cpp:451
virtual UtlBoolean isExpired(UtlString &dialogHandle)
inquire if the dialog has already expired
Definition: SipSubscriptionMgr.cpp:807
SipDialogMgr * getDialogMgr()
Get the dialog manager.
Definition: SipSubscriptionMgr.cpp:775
int removeOldSubscriptions(long oldEpochTimeSeconds)
Remove old subscriptions that expired before given date.
Definition: SipSubscriptionMgr.cpp:711
int getStateCount()
Get count of subscription states/dialogs being managed.
Definition: SipSubscriptionMgr.cpp:780
virtual UtlBoolean dialogExists(UtlString &dialogHandle)
inquire if the dialog exists
Definition: SipSubscriptionMgr.cpp:791
SipSubscriptionMgr()
Default constructor.
Definition: SipSubscriptionMgr.cpp:114
virtual UtlBoolean updateDialogInfo(const SipMessage &subscribeRequest, const UtlString &resourceId, const UtlString &eventTypeKey, OsMsgQ *subscriptionTimeoutQueue, UtlString &subscribeDialogHandle, UtlBoolean &isNew, UtlBoolean &isExpired, SipMessage &subscribeResponse)
Add/Update subscription for the given SUBSCRIBE request.
Definition: SipSubscriptionMgr.cpp:150
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
virtual UtlBoolean endSubscription(const UtlString &dialogHandle)
End the dialog for the subscription indicated, by the dialog handle.
Definition: SipSubscriptionMgr.cpp:605
virtual UtlBoolean createNotifiesDialogInfo(const char *resourceId, const char *eventTypeKey, int &numNotifiesCreated, UtlString **&acceptHeaderValuesArray, SipMessage **&notifyArray)
Construct a NOTIFY request for each subscription/dialog subscribed to the given resourceId and eventT...
Definition: SipSubscriptionMgr.cpp:487
Class for refreshing SIP subscriptions and registrations.
Definition: SipDialogMgr.h:42
Class for maintaining SUBSCRIBE dialog information in subscription server.
Definition: SipSubscriptionMgr.h:48
int dumpOldSubscriptions(long oldEpochTimeSeconds)
Dump to syslog states considered old.
Definition: SipSubscriptionMgr.cpp:660
virtual ~SipSubscriptionMgr()
Destructor.
Definition: SipSubscriptionMgr.cpp:132
void setMaxExpiration(int expiresSeconds)
Set maximum subscription period in seconds.
Definition: SipSubscriptionMgr.cpp:765
virtual void freeNotifies(int numNotifies, UtlString **acceptHeaderValues, SipMessage **notifiesArray)
frees up the notifies created in createNotifiesDialogInfo
Definition: SipSubscriptionMgr.cpp:583

sipXtackLib home page