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