|
reSIProcate/DialogUsageManager
9694
|
00001 #if !defined(RESIP_USERPROFILE_HXX) 00002 #define RESIP_USERPROFILE_HXX 00003 00004 #include <iosfwd> 00005 #include <set> 00006 #include "resip/stack/Headers.hxx" 00007 #include "resip/stack/MethodTypes.hxx" 00008 #include "resip/stack/Tuple.hxx" 00009 #include "resip/dum/Profile.hxx" 00010 00011 namespace resip 00012 { 00013 00014 class Data; 00015 00016 class UserProfile : public Profile 00017 { 00018 public: 00019 UserProfile(); 00020 UserProfile(SharedPtr<Profile> baseProfile); 00021 virtual ~UserProfile(); 00022 00023 virtual void setDefaultFrom(const NameAddr& from); 00024 virtual NameAddr& getDefaultFrom(); 00025 00026 virtual void setServiceRoute(const NameAddrs& sRoute); 00027 virtual NameAddrs& getServiceRoute(); 00028 00029 virtual void setImsAuthUser(const Data& userName, const Data& host) { mImsAuthUserName = userName; mImsAuthHost = host; } 00030 virtual Data& getImsAuthUserName() { return mImsAuthUserName; } 00031 virtual Data& getImsAuthHost() { return mImsAuthHost; } 00032 00033 // Returns a UserProfile that will return a UserProfile that can be used 00034 // to send requests according to RFC 3323 and RFC 3325 00035 virtual SharedPtr<UserProfile> getAnonymousUserProfile() const; 00036 bool isAnonymous() const; 00037 00038 // !cj! - this GRUU stuff looks very suspect 00039 // !dcm! -- yep, I don't think you can adda gruu..and disabling is weird. 00040 //Anon should be on a per-call level...all of these will prob. go away. 00041 //.dcm. anonymous gruu's will be used by making annon userprofile where 00042 //one is avail. Up to the ap to keep the req'd reg up. 00043 //1 gruu per userprofile for now. 00044 virtual void addGruu(const Data& aor, const NameAddr& contact); 00045 virtual bool hasGruu(const Data& aor) const; 00046 virtual bool hasGruu(const Data& aor, const Data& instance) const; 00047 virtual NameAddr& getGruu(const Data& aor); 00048 virtual NameAddr& getGruu(const Data& aor, const NameAddr& contact); 00049 00050 //should do Supported wrangling--but what if required is desired? Same as 100rel? 00051 virtual bool& gruuEnabled() { return mGruuEnabled; } 00052 virtual bool gruuEnabled() const { return mGruuEnabled; } 00053 00054 virtual bool hasPublicGruu() const { return !mPubGruu.host().empty(); } 00055 virtual const Uri& getPublicGruu() { return mPubGruu; } 00056 virtual void setPublicGruu(const Uri& gruu) { mPubGruu = gruu; } 00057 00058 virtual bool hasTempGruu() const { return !mTempGruu.host().empty(); } 00059 virtual const Uri& getTempGruu() { return mTempGruu; } 00060 virtual void setTempGruu(const Uri& gruu) { mTempGruu = gruu; } 00061 00062 struct DigestCredential 00063 { 00064 DigestCredential(); 00065 DigestCredential(const Data& realm, 00066 const Data& username, 00067 const Data& pwd, 00068 bool isPasswordA1Hash); 00069 DigestCredential(const Data& realm); 00070 00071 Data realm; 00072 Data user; 00073 Data password; 00074 bool isPasswordA1Hash; 00075 00076 bool operator<(const DigestCredential& rhs) const; 00077 }; 00078 00080 virtual void clearDigestCredentials(); 00086 virtual void setDigestCredential( const Data& realm, 00087 const Data& user, 00088 const Data& password, 00089 bool isPasswordA1Hash=false); 00090 virtual const DigestCredential& getDigestCredential( const Data& realm ); 00091 00092 // Enable this to enable RFC5626 support in DUM - adds regId to registrations, and 00093 // ;ob parameter to Path, Route, and Contact headers 00094 // Warning: You MUST set an instanceId, a regId and an outbound proxy if you enable 00095 // clientOutbound support. You MUST also ensure that you add the following Supported 00096 // options: 00097 // profile->addSupportedOptionTag(Token(Symbols::Outbound)); // RFC 5626 - outbound 00098 // profile->addSupportedOptionTag(Token(Symbols::Path)); // RFC 3327 - path 00099 virtual bool& clientOutboundEnabled() { return mClientOutboundEnabled; } 00100 virtual bool clientOutboundEnabled() const { return mClientOutboundEnabled; } 00101 00102 // Outbound (RFC5626) instanceId used in contact headers 00103 virtual bool hasInstanceId(); 00104 virtual void setInstanceId(const Data& id); 00105 virtual const Data& getInstanceId() const; 00106 00107 // Outbound (RFC5626) regId used in registrations 00108 virtual void setRegId(int regId) { mRegId = regId; } 00109 virtual int getRegId() { return mRegId; } 00110 00111 // Returns the current Flow Tuple that is being used for communication on usages 00112 // that use this profile 00113 const Tuple& getClientOutboundFlowTuple() const { return mClientOutboundFlowTuple; } 00114 void clearClientOutboundFlowTuple() { mClientOutboundFlowTuple = Tuple(); } 00115 00116 protected: 00117 virtual UserProfile* clone() const; 00118 00119 private: 00120 NameAddr mDefaultFrom; 00121 Data mInstanceId; 00122 NameAddrs mServiceRoute; 00123 Data mImsAuthUserName; 00124 Data mImsAuthHost; 00125 bool mGruuEnabled; 00126 Uri mPubGruu; 00127 Uri mTempGruu; 00128 const static NameAddr mAnonymous; 00129 00130 int mRegId; 00131 bool mClientOutboundEnabled; 00132 friend class DialogUsageManager; // Give DialogUsageManager, ClientRegistration, and Dialog access to mClientOutboundFlowKey 00133 friend class ClientRegistration; 00134 friend class Dialog; 00135 Tuple mClientOutboundFlowTuple; 00136 00137 typedef std::set<DigestCredential> DigestCredentials; 00138 DigestCredentials mDigestCredentials; 00139 00140 friend EncodeStream& operator<<(EncodeStream&, const UserProfile& profile); 00141 }; 00142 00143 EncodeStream& 00144 operator<<(EncodeStream&, const UserProfile& profile); 00145 00146 EncodeStream& 00147 operator<<(EncodeStream&, const UserProfile::DigestCredential& cred); 00148 00149 } 00150 00151 #endif 00152 00153 /* ==================================================================== 00154 * The Vovida Software License, Version 1.0 00155 * 00156 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00157 * 00158 * Redistribution and use in source and binary forms, with or without 00159 * modification, are permitted provided that the following conditions 00160 * are met: 00161 * 00162 * 1. Redistributions of source code must retain the above copyright 00163 * notice, this list of conditions and the following disclaimer. 00164 * 00165 * 2. Redistributions in binary form must reproduce the above copyright 00166 * notice, this list of conditions and the following disclaimer in 00167 * the documentation and/or other materials provided with the 00168 * distribution. 00169 * 00170 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00171 * and "Vovida Open Communication Application Library (VOCAL)" must 00172 * not be used to endorse or promote products derived from this 00173 * software without prior written permission. For written 00174 * permission, please contact vocal@vovida.org. 00175 * 00176 * 4. Products derived from this software may not be called "VOCAL", nor 00177 * may "VOCAL" appear in their name, without prior written 00178 * permission of Vovida Networks, Inc. 00179 * 00180 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00181 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00182 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00183 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00184 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00185 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00186 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00187 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00188 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00189 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00190 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00191 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00192 * DAMAGE. 00193 * 00194 * ==================================================================== 00195 * 00196 * This software consists of voluntary contributions made by Vovida 00197 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00198 * Inc. For more information on Vovida Networks, Inc., please see 00199 * <http://www.vovida.org/>. 00200 * 00201 */
1.7.5.1