1 |
#if !defined(RESIP_RegEventClient_hxx) |
2 |
#define RESIP_RegEventClient_hxx |
3 |
|
4 |
#include "resip/dum/SubscriptionHandler.hxx" |
5 |
#include "resip/dum/RegistrationHandler.hxx" |
6 |
#include "resip/dum/Handles.hxx" |
7 |
#include "resip/dum/DialogUsageManager.hxx" |
8 |
#include "resip/dum/DumThread.hxx" |
9 |
#include "resip/stack/SipStack.hxx" |
10 |
#include "resip/stack/StackThread.hxx" |
11 |
#include "rutil/SharedPtr.hxx" |
12 |
|
13 |
namespace resip |
14 |
{ |
15 |
class NameAddr; |
16 |
class SipMessage; |
17 |
class Security; |
18 |
class MasterProfile; |
19 |
} |
20 |
|
21 |
class RegEventClient : public resip::ClientSubscriptionHandler, |
22 |
public resip::ClientRegistrationHandler |
23 |
{ |
24 |
public: |
25 |
RegEventClient(resip::SharedPtr<resip::MasterProfile> profile); |
26 |
virtual ~RegEventClient(); |
27 |
|
28 |
void run(); |
29 |
|
30 |
void watchAor(const resip::Uri& aor); |
31 |
//void unwatchAor(const resip::Uri& aor); |
32 |
|
33 |
virtual void onRegEvent(const resip::Data& aor, const resip::Data& reg)=0; |
34 |
virtual void onRegEventError(const resip::Data& aor, const resip::Data& reg)=0; |
35 |
|
36 |
protected: |
37 |
virtual void onUpdatePending(resip::ClientSubscriptionHandle, |
38 |
const resip::SipMessage& notify, |
39 |
bool outOfOrder); |
40 |
virtual void onUpdateActive(resip::ClientSubscriptionHandle, |
41 |
const resip::SipMessage& notify, |
42 |
bool outOfOrder); |
43 |
virtual void onUpdateExtension(resip::ClientSubscriptionHandle, |
44 |
const resip::SipMessage& notify, |
45 |
bool outOfOrder); |
46 |
virtual int onRequestRetry(resip::ClientSubscriptionHandle, |
47 |
int retrySeconds, |
48 |
const resip::SipMessage& notify); |
49 |
virtual void onTerminated(resip::ClientSubscriptionHandle, |
50 |
const resip::SipMessage* msg); |
51 |
virtual void onNewSubscription(resip::ClientSubscriptionHandle, |
52 |
const resip::SipMessage& notify); |
53 |
|
54 |
|
55 |
virtual void onSuccess(resip::ClientRegistrationHandle, |
56 |
const resip::SipMessage& response) |
57 |
{ |
58 |
} |
59 |
|
60 |
virtual void onRemoved(resip::ClientRegistrationHandle, |
61 |
const resip::SipMessage& response) |
62 |
{ |
63 |
} |
64 |
|
65 |
virtual int onRequestRetry(resip::ClientRegistrationHandle, |
66 |
int retrySeconds, |
67 |
const resip::SipMessage& response) |
68 |
{ |
69 |
return -1; |
70 |
} |
71 |
|
72 |
virtual void onFailure(resip::ClientRegistrationHandle, |
73 |
const resip::SipMessage& response) |
74 |
{ |
75 |
} |
76 |
|
77 |
|
78 |
protected: |
79 |
resip::Security* mSecurity; |
80 |
resip::SipStack mStack; |
81 |
resip::StackThread mStackThread; |
82 |
resip::DialogUsageManager mDum; |
83 |
resip::DumThread mDumThread; |
84 |
|
85 |
resip::SharedPtr<resip::MasterProfile> mProfile; |
86 |
friend class AddAor; |
87 |
}; |
88 |
|
89 |
class AddAor : public resip::DumCommand |
90 |
{ |
91 |
public: |
92 |
AddAor(RegEventClient& client, const resip::Uri& aor); |
93 |
virtual void executeCommand(); |
94 |
|
95 |
virtual resip::Message* clone() const; |
96 |
#ifdef RESIP_USE_STL_STREAMS |
97 |
virtual std::ostream& encode(std::ostream&) const; |
98 |
virtual std::ostream& encodeBrief(std::ostream&) const; |
99 |
#else |
100 |
virtual resip::ResipFastOStream& encode(resip::ResipFastOStream&) const; |
101 |
virtual resip::ResipFastOStream& encodeBrief(resip::ResipFastOStream&) const; |
102 |
#endif |
103 |
|
104 |
private: |
105 |
RegEventClient& mClient; |
106 |
const resip::Uri mAor; |
107 |
}; |
108 |
|
109 |
#endif |