reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ClientRegistration.hxx
Go to the documentation of this file.
1#if !defined(RESIP_CLIENTREGISTRATION_HXX)
2#define RESIP_CLIENTREGISTRATION_HXX
3
8
9namespace resip
10{
11
12class SipMessage;
13class BaseCreator;
14
17{
18 public:
19 //ClientRegistration(DialogUsageManager& dum, DialogSet& dialog,
20 //SipMessage& req);
21 ClientRegistration(DialogUsageManager& dum, DialogSet& dialog, std::shared_ptr<SipMessage> req);
24
27
29
31 void addBinding(const NameAddr& contact);
32
34 void addBinding(const NameAddr& contact, uint32_t registrationTime);
35
37 void removeBinding(const NameAddr& contact);
38
42 void removeAll(bool stopRegisteringWhenDone=false);
43
46 void removeMyBindings(bool stopRegisteringWhenDone=false);
47
50 void requestRefresh(uint32_t expires = 0);
51
53 void stopRegistering();
54
56 const NameAddrs& myContacts() const noexcept;
57
59 const NameAddrs& allContacts() const noexcept;
60
62 uint32_t whenExpires() const;
63
65 void end() override;
66
68 bool isRequestPending() const noexcept { return mState != Registered && mState != RetryAdding && mState != RetryRefreshing; }
69
73 void removeMyBindingsCommand(bool stopRegisteringWhenDone=false);
74 virtual void endCommand();
75
76
77 void dispatch(const SipMessage& msg) override;
78 void dispatch(const DumTimeout& timer) override;
79
80 EncodeStream& dump(EncodeStream& strm) const override;
81
82 static void tagContact(NameAddr& contact, DialogUsageManager& dum, const std::shared_ptr<UserProfile>& userProfile);
83
84 protected:
85 virtual ~ClientRegistration();
86
87 private:
88 typedef enum
89 {
90 Querying,
91 Adding,
92 Refreshing,
93 Registered,
94 Removing,
95 RetryAdding, // Waiting to retry an add
96 RetryRefreshing, // Waiting to retry a refresh
97 None // for queued only
98 } State;
99
100 std::shared_ptr<SipMessage> tryModification(ClientRegistration::State state);
101 void internalRequestRefresh(uint32_t expires = 0); // 0 defaults to using original expires value (to remove use removeXXX() instead)
102 unsigned int checkProfileRetry(const SipMessage& msg);
103 void tagContact(NameAddr& contact) const;
104 unsigned long calculateExpiry(const SipMessage& reg200) const;
105 bool contactIsMine(const NameAddr& contact) const;
106 bool rinstanceIsMine(const Data& rinstance) const;
107 bool searchByUri(const Uri& cUri) const;
108
109 friend class DialogSet;
110 void flowTerminated();
111
112 //SipMessage& mLastRequest;
113 std::shared_ptr<SipMessage> mLastRequest;
114 NameAddrs mMyContacts; // Contacts that this UA is requesting
115 NameAddrs mAllContacts; // All the contacts Registrar knows about
116 unsigned int mTimerSeq; // expected timer seq (all < are stale)
117
118 State mState;
119 bool mEnding;
120 bool mEndWhenDone;
121 bool mUserRefresh;
122 uint32_t mRegistrationTime;
123 uint64_t mExpires;
124 uint64_t mRefreshTime;
125 State mQueuedState;
126 std::shared_ptr<SipMessage> mQueuedRequest;
127
128 NetworkAssociation mNetworkAssociation;
129};
130
131}
132
133#endif
134
135/* ====================================================================
136 * The Vovida Software License, Version 1.0
137 *
138 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
139 *
140 * Redistribution and use in source and binary forms, with or without
141 * modification, are permitted provided that the following conditions
142 * are met:
143 *
144 * 1. Redistributions of source code must retain the above copyright
145 * notice, this list of conditions and the following disclaimer.
146 *
147 * 2. Redistributions in binary form must reproduce the above copyright
148 * notice, this list of conditions and the following disclaimer in
149 * the documentation and/or other materials provided with the
150
151 * distribution.
152 *
153 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
154 * and "Vovida Open Communication Application Library (VOCAL)" must
155 * not be used to endorse or promote products derived from this
156 * software without prior written permission. For written
157 * permission, please contact vocal@vovida.org.
158 *
159 * 4. Products derived from this software may not be called "VOCAL", nor
160 * may "VOCAL" appear in their name, without prior written
161 * permission of Vovida Networks, Inc.
162 *
163 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
164 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
165 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
166 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
167 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
168 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
169 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
170 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
171 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
172 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
173 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
174 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
175 * DAMAGE.
176 *
177 * ====================================================================
178 *
179 * This software consists of voluntary contributions made by Vovida
180 * Networks, Inc. and many individuals on behalf of Vovida Networks,
181 * Inc. For more information on Vovida Networks, Inc., please see
182 * <http://www.vovida.org/>.
183 *
184 */
dcm! – shutdown/deletion API – end?
void removeAll(bool stopRegisteringWhenDone=false)
Removes all bindings associated with the AOR - even those that may have been by a another UA.
EncodeStream & dump(EncodeStream &strm) const override
void addBinding(const NameAddr &contact)
Adds a registration binding, using the registration from the UserProfile.
void removeBinding(const NameAddr &contact)
Removes one particular binding.
const NameAddrs & myContacts() const noexcept
returns a list of contacts added by addBinding
void stopRegistering()
kills the usgage, does not unregister, call removeMyBindings to unregister
ClientRegistrationHandle getHandle()
void removeMyBindingsCommand(bool stopRegisteringWhenDone=false)
Provide asynchronous method access by using command.
ClientRegistration & operator=(const ClientRegistration &)=delete
void requestRefresh(uint32_t expires=0)
Request a manual refresh of the registration.
static void tagContact(NameAddr &contact, DialogUsageManager &dum, const std::shared_ptr< UserProfile > &userProfile)
void removeMyBindings(bool stopRegisteringWhenDone=false)
Removes all bindings added by addBinding.
void end() override
Calls removeMyBindings and ends usage when complete.
void dispatch(const SipMessage &msg) override
bool isRequestPending() const noexcept
Returns true if a REGISTER request is currently pending and we are waiting for the SIP Response.
ClientRegistration(ClientRegistration &&)=delete
const NameAddrs & allContacts() const noexcept
returns a list of all contacts for this AOR - may include those added by other UA's
ClientRegistration & operator=(ClientRegistration &&)=delete
uint32_t whenExpires() const
returns the number of seconds until the registration expires - relative, returns 0 if already expired
ClientRegistration(const ClientRegistration &)=delete
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Represents a SIP message.
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
unsigned int uint32_t
Definition Stun.hxx:34
#define EncodeStream
unsigned int uint32_t
Definition stdint.h:85