reSIProcate/DialogUsageManager  9694
UserAuthInfo.cxx
Go to the documentation of this file.
00001 
00002 #include <cassert>
00003 
00004 #include "resip/dum/UserAuthInfo.hxx"
00005 #include "rutil/Data.hxx"
00006 #include "rutil/Logger.hxx"
00007 
00008 using namespace resip;
00009 using namespace std;
00010 
00011 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
00012 
00013 UserAuthInfo::UserAuthInfo(const Data& user,
00014                            const Data& realm,
00015                            InfoMode mode,
00016                            const Data& transactionId):
00017    DumFeatureMessage(transactionId),
00018    mMode(mode),
00019    mUser(user),
00020    mRealm(realm)
00021 {
00022 }
00023 
00024 UserAuthInfo::UserAuthInfo(const Data& user, 
00025                            const Data& realm, 
00026                            const Data& a1, 
00027                            const Data& transactionId):
00028    DumFeatureMessage(transactionId),
00029    mMode(RetrievedA1),
00030    mUser(user),
00031    mRealm(realm),
00032    mA1(a1)
00033 {
00034 }
00035 
00036 UserAuthInfo::UserAuthInfo( const resip::Data& user,
00037                             const resip::Data& realm,
00038                             const resip::Data& transactionId,
00039                             resip::TransactionUser* transactionUser):
00040    DumFeatureMessage(transactionId),
00041    mMode(RetrievedA1),
00042    mUser(user),
00043    mRealm(realm)
00044 {
00045    mTu = transactionUser;
00046 }
00047 
00048 UserAuthInfo::~UserAuthInfo()
00049 {
00050 }
00051 
00052 UserAuthInfo::InfoMode
00053 UserAuthInfo::getMode() const
00054 {
00055    return mMode;
00056 }
00057 
00058 const Data&
00059 UserAuthInfo::getA1() const
00060 {
00061    return mA1;
00062 }
00063 
00064 const Data& 
00065 UserAuthInfo::getRealm() const
00066 {
00067    return mRealm;
00068 }
00069 
00070 const Data&
00071 UserAuthInfo::getUser() const
00072 {
00073    return mUser;
00074 }
00075 
00076 void 
00077 UserAuthInfo::setMode(InfoMode mode)
00078 {
00079    mMode = mode;
00080 }
00081       
00082 void 
00083 UserAuthInfo::setA1(const resip::Data& a1)
00084 {
00085    mA1 = a1;
00086 }
00087 
00088 Data 
00089 UserAuthInfo::brief() const
00090 {  
00091    Data buffer;
00092    DataStream strm(buffer);
00093    strm << "UserAuthInfo " << mUser << " @ " << mRealm << " A1=" << mA1;
00094    strm.flush();
00095    return buffer;
00096 }
00097 
00098 resip::Message* 
00099 UserAuthInfo::clone() const
00100 {
00101    assert(false); return NULL;
00102 }
00103 
00104 EncodeStream& 
00105 UserAuthInfo::encode(EncodeStream& strm) const
00106 {
00107    strm << brief();
00108    return strm;
00109 }
00110 
00111 EncodeStream&
00112 UserAuthInfo::encodeBrief(EncodeStream& strm) const
00113 {
00114    return encode(strm);
00115 }
00116 
00117 EncodeStream& 
00118 resip::operator<<(EncodeStream& strm, const UserAuthInfo& msg)
00119 {
00120    return msg.encode(strm);
00121 }
00122 
00123 
00124 /* ====================================================================
00125  * The Vovida Software License, Version 1.0 
00126  * 
00127  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00128  * 
00129  * Redistribution and use in source and binary forms, with or without
00130  * modification, are permitted provided that the following conditions
00131  * are met:
00132  * 
00133  * 1. Redistributions of source code must retain the above copyright
00134  *    notice, this list of conditions and the following disclaimer.
00135  * 
00136  * 2. Redistributions in binary form must reproduce the above copyright
00137  *    notice, this list of conditions and the following disclaimer in
00138  *    the documentation and/or other materials provided with the
00139  *    distribution.
00140  * 
00141  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00142  *    and "Vovida Open Communication Application Library (VOCAL)" must
00143  *    not be used to endorse or promote products derived from this
00144  *    software without prior written permission. For written
00145  *    permission, please contact vocal@vovida.org.
00146  *
00147  * 4. Products derived from this software may not be called "VOCAL", nor
00148  *    may "VOCAL" appear in their name, without prior written
00149  *    permission of Vovida Networks, Inc.
00150  * 
00151  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00152  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00153  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00154  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00155  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00156  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00157  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00158  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00159  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00160  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00161  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00162  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00163  * DAMAGE.
00164  * 
00165  * ====================================================================
00166  * 
00167  * This software consists of voluntary contributions made by Vovida
00168  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00169  * Inc.  For more information on Vovida Networks, Inc., please see
00170  * <http://www.vovida.org/>.
00171  *
00172  */