reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
UserAuthInfo.cxx
Go to the documentation of this file.
1
2#include "rutil/ResipAssert.h"
3
5#include "rutil/Data.hxx"
6#include "rutil/Logger.hxx"
7
8using namespace resip;
9using namespace std;
10
11constexpr const char* ServerErrorStatusText = "Server Error.";
12
13#define RESIPROCATE_SUBSYSTEM Subsystem::DUM
14
16 const Data& realm,
17 InfoMode mode,
18 const Data& transactionId):
19 DumFeatureMessage(transactionId),
20 mMode(mode),
21 mUser(user),
22 mRealm(realm),
23 mErrorCode(503),
24 mErrorStatusText(ServerErrorStatusText)
25{
26}
27
29 const Data& realm,
30 const Data& a1,
31 const Data& transactionId):
32 DumFeatureMessage(transactionId),
33 mMode(RetrievedA1),
34 mUser(user),
35 mRealm(realm),
36 mA1(a1),
37 mErrorCode(503),
38 mErrorStatusText(ServerErrorStatusText)
39{
40}
41
43 const resip::Data& realm,
44 const resip::Data& transactionId,
45 resip::TransactionUser* transactionUser):
46 DumFeatureMessage(transactionId),
47 mMode(RetrievedA1),
48 mUser(user),
49 mRealm(realm),
50 mErrorCode(503),
51 mErrorStatusText(ServerErrorStatusText)
52{
53 mTu = transactionUser;
54}
55
59
62{
63 return mMode;
64}
65
66const Data&
68{
69 return mA1;
70}
71
72const Data&
74{
75 return mRealm;
76}
77
78const Data&
80{
81 return mUser;
82}
83
84const void UserAuthInfo::getErrorInfo(int32_t& errorCode, resip::Data& errorStatusText) const
85{
86 errorCode = mErrorCode;
87 errorStatusText = mErrorStatusText;
88}
89
90void
91UserAuthInfo::setMode(InfoMode mode, int32_t errorCode /* = 0 */, const resip::Data & statusText /* = resip::Data::Empty */)
92{
93 mMode = mode;
94
95 if (mode == InfoMode::Error)
96 {
97 if (errorCode > 0 && !statusText.empty())
98 {
99 mErrorCode = errorCode;
100 mErrorStatusText = statusText;
101 }
102 }
103}
104
105void
107{
108 mA1 = a1;
109}
110
113{
114 resip_assert(false); return NULL;
115}
116
118UserAuthInfo::encode(EncodeStream& strm) const
119{
120 strm << "UserAuthInfo " << mUser << " @ " << mRealm << " A1=" << mA1;
121 return strm;
122}
123
125UserAuthInfo::encodeBrief(EncodeStream& strm) const
126{
127 return encode(strm);
128}
129
131resip::operator<<(EncodeStream& strm, const UserAuthInfo& msg)
132{
133 return msg.encode(strm);
134}
135
136
137/* ====================================================================
138 * The Vovida Software License, Version 1.0
139 *
140 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
141 *
142 * Redistribution and use in source and binary forms, with or without
143 * modification, are permitted provided that the following conditions
144 * are met:
145 *
146 * 1. Redistributions of source code must retain the above copyright
147 * notice, this list of conditions and the following disclaimer.
148 *
149 * 2. Redistributions in binary form must reproduce the above copyright
150 * notice, this list of conditions and the following disclaimer in
151 * the documentation and/or other materials provided with the
152 * distribution.
153 *
154 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
155 * and "Vovida Open Communication Application Library (VOCAL)" must
156 * not be used to endorse or promote products derived from this
157 * software without prior written permission. For written
158 * permission, please contact vocal@vovida.org.
159 *
160 * 4. Products derived from this software may not be called "VOCAL", nor
161 * may "VOCAL" appear in their name, without prior written
162 * permission of Vovida Networks, Inc.
163 *
164 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
165 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
166 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
167 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
168 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
169 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
170 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
171 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
172 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
173 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
174 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
175 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
176 * DAMAGE.
177 *
178 * ====================================================================
179 *
180 * This software consists of voluntary contributions made by Vovida
181 * Networks, Inc. and many individuals on behalf of Vovida Networks,
182 * Inc. For more information on Vovida Networks, Inc., please see
183 * <http://www.vovida.org/>.
184 *
185 */
#define resip_assert(x)
This file needs to work for both C and C++ code.
constexpr const char * ServerErrorStatusText
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! – what is the intent of ApplicationMessage, especially as used in
The base-class used for message-passing.
Definition Message.hxx:21
TransactionUser * mTu
Definition Message.hxx:50
The base-class for an RFC 3261 Transaction User.
const void getErrorInfo(int32_t &errorCode, resip::Data &errorStatusText) const
void setMode(InfoMode mode, int32_t errorCode=0, const resip::Data &statusText=resip::Data::Empty)
virtual resip::Message * clone() const
virtual EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
const resip::Data & getUser() const
const resip::Data & getRealm() const
void setA1(const resip::Data &a1)
virtual EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
UserAuthInfo(const resip::Data &user, const resip::Data &realm, InfoMode mode, const resip::Data &transactionId)
InfoMode getMode() const
const resip::Data & getA1() const
dcm! – add UnusedChecking(_enum) below;
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
signed int int32_t
Definition stdint.h:82