reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
UserProfile.hxx
Go to the documentation of this file.
1#if !defined(RESIP_USERPROFILE_HXX)
2#define RESIP_USERPROFILE_HXX
3
4#include <iosfwd>
5#include <set>
10#include "resip/dum/Profile.hxx"
11
12namespace resip
13{
14
15class Data;
16
17class UserProfile : public Profile
18{
19 public:
21 explicit UserProfile(std::shared_ptr<Profile> baseProfile);
22 virtual ~UserProfile();
23
24 virtual void setDefaultFrom(const NameAddr& from);
25 virtual NameAddr& getDefaultFrom() noexcept;
26
27 virtual void setServiceRoute(const NameAddrs& sRoute);
28 virtual NameAddrs& getServiceRoute() noexcept;
29
30 virtual void setImsAuthUser(const Data& userName, const Data& host) { mImsAuthUserName = userName; mImsAuthHost = host; }
31 virtual Data& getImsAuthUserName() noexcept { return mImsAuthUserName; }
32 virtual Data& getImsAuthHost() noexcept { return mImsAuthHost; }
33
34 // Returns a UserProfile that will return a UserProfile that can be used
35 // to send requests according to RFC 3323 and RFC 3325
36 virtual std::shared_ptr<UserProfile> getAnonymousUserProfile() const;
37 bool isAnonymous() const;
38
39 // !cj! - this GRUU stuff looks very suspect
40 // !dcm! -- yep, I don't think you can adda gruu..and disabling is weird.
41 //Anon should be on a per-call level...all of these will prob. go away.
42 //.dcm. anonymous gruu's will be used by making annon userprofile where
43 //one is avail. Up to the ap to keep the req'd reg up.
44 //1 gruu per userprofile for now.
45 virtual void addGruu(const Data& aor, const NameAddr& contact);
46 virtual bool hasGruu(const Data& aor) const;
47 virtual bool hasGruu(const Data& aor, const Data& instance) const;
48 virtual NameAddr& getGruu(const Data& aor);
49 virtual NameAddr& getGruu(const Data& aor, const NameAddr& contact);
50
51 //should do Supported wrangling--but what if required is desired? Same as 100rel?
52 virtual bool& gruuEnabled() noexcept { return mGruuEnabled; }
53 virtual bool gruuEnabled() const noexcept { return mGruuEnabled; }
54
55 virtual bool hasPublicGruu() const { return !mPubGruu.host().empty(); }
56 virtual const Uri& getPublicGruu() const noexcept { return mPubGruu; }
57 virtual void setPublicGruu(const Uri& gruu) { mPubGruu = gruu; }
58
59 virtual bool hasTempGruu() const { return !mTempGruu.host().empty(); }
60 virtual const Uri& getTempGruu() const noexcept { return mTempGruu; }
61 virtual void setTempGruu(const Uri& gruu) { mTempGruu = gruu; }
62
64 {
67 const Data& username,
68 const Data& pwd,
69 bool isPasswordA1Hash);
71
76
77 bool operator<(const DigestCredential& rhs) const;
78 };
79
81 virtual void clearDigestCredentials() noexcept;
94 virtual void setDigestCredential(const Data& realm,
95 const Data& user,
96 const Data& password,
97 bool isPasswordA1Hash=false);
98 virtual const DigestCredential& getDigestCredential( const Data& realm );
99 // DigestCacheUseLimit is used to indicate the maximum number of times a particular Proxy or WWW Authorization
100 // header will be used in requests within a dialogset. When this limit is reached then the
101 // next request in the DiaglogSet will go out without digest credentials. This setting can be used to
102 // work around bugs/limitations in third-party implementations that have difficulty properly dealing with
103 // cached credentials. A setting of 0 (default) will disable the limit and all requests in a Dialogset will
104 // have the same cached Authorization header on them, until they are re-challenged by the far end. A setting of
105 // 1 disables caching entirely and future requests within the dialog set will go out without any authorization
106 // headers.
107 virtual void setDigestCacheUseLimit(unsigned long digestCacheUseLimit) noexcept { mDigestCacheUseLimit = digestCacheUseLimit; }
108 virtual unsigned long getDigestCacheUseLimit() const noexcept { return mDigestCacheUseLimit; }
109
110 // Enable this to enable RFC5626 support in DUM - adds regId to registrations, and
111 // ;ob parameter to Path, Route, and Contact headers
112 // Warning: You MUST set an instanceId, a regId and an outbound proxy if you enable
113 // clientOutbound support. You MUST also ensure that you add the following Supported
114 // options:
115 // profile->addSupportedOptionTag(Token(Symbols::Outbound)); // RFC 5626 - outbound
116 // profile->addSupportedOptionTag(Token(Symbols::Path)); // RFC 3327 - path
117 virtual bool& clientOutboundEnabled() noexcept { return mClientOutboundEnabled; }
118 virtual bool clientOutboundEnabled() const noexcept { return mClientOutboundEnabled; }
119
120 // Outbound (RFC5626) instanceId used in contact headers
121 virtual bool hasInstanceId();
122 virtual void setInstanceId(const Data& id);
123 virtual const Data& getInstanceId() const noexcept;
124
125 // Outbound (RFC5626) regId used in registrations
126 virtual void setRegId(int regId) noexcept { mRegId = regId; }
127 virtual int getRegId() noexcept { return mRegId; }
128
129 // Returns the current Flow Tuple that is being used for communication on usages
130 // that use this profile
131 const Tuple& getClientOutboundFlowTuple() const noexcept { return mClientOutboundFlowTuple; }
132 void clearClientOutboundFlowTuple() { mClientOutboundFlowTuple = Tuple(); }
133 void setClientOutboundFlowTuple(const Tuple& outboundFlowTuple) { mClientOutboundFlowTuple = outboundFlowTuple; } // Only for advanced users
134
135 protected:
136 virtual UserProfile* clone() const;
137
138 private:
139 NameAddr mDefaultFrom;
140 Data mInstanceId;
141 NameAddrs mServiceRoute;
142 Data mImsAuthUserName;
143 Data mImsAuthHost;
144 bool mGruuEnabled;
145 Uri mPubGruu;
146 Uri mTempGruu;
147 const static NameAddr mAnonymous;
148
149 int mRegId;
150 bool mClientOutboundEnabled;
151 friend class DialogUsageManager; // Give DialogUsageManager, ClientRegistration, and Dialog access to mClientOutboundFlowKey
152 friend class ClientRegistration;
153 friend class Dialog;
154 Tuple mClientOutboundFlowTuple;
155
156 typedef std::set<DigestCredential> DigestCredentials;
157 DigestCredentials mDigestCredentials;
158 unsigned long mDigestCacheUseLimit;
159
161};
162
165
168
169}
170
171#endif
172
173/* ====================================================================
174 * The Vovida Software License, Version 1.0
175 *
176 * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com
177 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
178 *
179 * Redistribution and use in source and binary forms, with or without
180 * modification, are permitted provided that the following conditions
181 * are met:
182 *
183 * 1. Redistributions of source code must retain the above copyright
184 * notice, this list of conditions and the following disclaimer.
185 *
186 * 2. Redistributions in binary form must reproduce the above copyright
187 * notice, this list of conditions and the following disclaimer in
188 * the documentation and/or other materials provided with the
189 * distribution.
190 *
191 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
192 * and "Vovida Open Communication Application Library (VOCAL)" must
193 * not be used to endorse or promote products derived from this
194 * software without prior written permission. For written
195 * permission, please contact vocal@vovida.org.
196 *
197 * 4. Products derived from this software may not be called "VOCAL", nor
198 * may "VOCAL" appear in their name, without prior written
199 * permission of Vovida Networks, Inc.
200 *
201 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
202 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
203 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
204 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
205 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
206 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
207 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
208 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
209 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
210 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
211 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
212 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
213 * DAMAGE.
214 *
215 * ====================================================================
216 *
217 * This software consists of voluntary contributions made by Vovida
218 * Networks, Inc. and many individuals on behalf of Vovida Networks,
219 * Inc. For more information on Vovida Networks, Inc., please see
220 * <http://www.vovida.org/>.
221 *
222 */
dcm! – shutdown/deletion API – end?
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
bool empty() const noexcept
Checks whether the Data is empty.
Definition Data.hxx:591
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Represents a network address.
Definition Tuple.hxx:59
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
Data & host()
Definition Uri.hxx:40
virtual NameAddr & getGruu(const Data &aor)
const Tuple & getClientOutboundFlowTuple() const noexcept
virtual NameAddrs & getServiceRoute() noexcept
virtual void setInstanceId(const Data &id)
virtual bool gruuEnabled() const noexcept
virtual void setTempGruu(const Uri &gruu)
virtual bool & gruuEnabled() noexcept
virtual int getRegId() noexcept
virtual bool hasGruu(const Data &aor) const
virtual bool clientOutboundEnabled() const noexcept
virtual void setDigestCredential(const Data &realm, const Data &user, const Data &password, bool isPasswordA1Hash=false)
For the password you may either provide the plain text password (isPasswordA1Hash = false) or the Dig...
virtual const Uri & getTempGruu() const noexcept
virtual bool hasInstanceId()
virtual const Data & getInstanceId() const noexcept
virtual const DigestCredential & getDigestCredential(const Data &realm)
virtual void setPublicGruu(const Uri &gruu)
virtual std::shared_ptr< UserProfile > getAnonymousUserProfile() const
virtual unsigned long getDigestCacheUseLimit() const noexcept
virtual void setRegId(int regId) noexcept
virtual UserProfile * clone() const
virtual void setServiceRoute(const NameAddrs &sRoute)
virtual void clearDigestCredentials() noexcept
The following functions deal with clearing, setting and getting of digest credentals.
virtual const Uri & getPublicGruu() const noexcept
friend EncodeStream & operator<<(EncodeStream &, const UserProfile &profile)
virtual void setImsAuthUser(const Data &userName, const Data &host)
virtual bool hasPublicGruu() const
virtual bool hasTempGruu() const
virtual void setDigestCacheUseLimit(unsigned long digestCacheUseLimit) noexcept
virtual Data & getImsAuthUserName() noexcept
virtual void setDefaultFrom(const NameAddr &from)
void clearClientOutboundFlowTuple()
virtual Data & getImsAuthHost() noexcept
void setClientOutboundFlowTuple(const Tuple &outboundFlowTuple)
virtual NameAddr & getDefaultFrom() noexcept
bool isAnonymous() const
virtual bool & clientOutboundEnabled() noexcept
virtual void addGruu(const Data &aor, const NameAddr &contact)
dcm! – add UnusedChecking(_enum) below;
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
bool operator<(const DigestCredential &rhs) const
void list()
Definition userAdmin.cxx:66