|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : CSIPProxyAuthorizationHeader.cpp |
|
15 // Part of : SIP Codec |
|
16 // Version : SIP/6.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "sipproxyauthorizationheader.h" |
|
22 #include "CSIPAuthorizationHeaderParams.h" |
|
23 #include "sipcodecerr.h" |
|
24 #include "SIPSyntaxCheck.h" |
|
25 #include "sipstrings.h" |
|
26 #include "sipstrconsts.h" |
|
27 #include "_sipcodecdefs.h" |
|
28 |
|
29 // ---------------------------------------------------------------------------- |
|
30 // CSIPProxyAuthorizationHeader::DecodeL |
|
31 // ---------------------------------------------------------------------------- |
|
32 // |
|
33 EXPORT_C CSIPProxyAuthorizationHeader* CSIPProxyAuthorizationHeader::DecodeL( |
|
34 const TDesC8& aValue) |
|
35 { |
|
36 CSIPProxyAuthorizationHeader* header = |
|
37 new(ELeave)CSIPProxyAuthorizationHeader; |
|
38 CleanupStack::PushL(header); |
|
39 header->CSIPAuthorizationHeaderBase::ConstructL(); |
|
40 header->ParseL(aValue); |
|
41 CleanupStack::Pop(header); |
|
42 return header; |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // CSIPProxyAuthorizationHeader::NewL |
|
47 // ---------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CSIPProxyAuthorizationHeader* CSIPProxyAuthorizationHeader::NewL( |
|
50 RStringF aAuthScheme) |
|
51 { |
|
52 CSIPProxyAuthorizationHeader* self = |
|
53 CSIPProxyAuthorizationHeader::NewLC(aAuthScheme); |
|
54 CleanupStack::Pop(self); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 // CSIPProxyAuthorizationHeader::NewLC |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C CSIPProxyAuthorizationHeader* CSIPProxyAuthorizationHeader::NewLC( |
|
63 RStringF aAuthScheme) |
|
64 { |
|
65 CSIPProxyAuthorizationHeader* self = |
|
66 new(ELeave)CSIPProxyAuthorizationHeader; |
|
67 CleanupStack::PushL(self); |
|
68 self->CSIPAuthHeaderBase::ConstructL(aAuthScheme); |
|
69 self->ConstructL(); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // ---------------------------------------------------------------------------- |
|
74 // CSIPProxyAuthorizationHeader::NewL |
|
75 // ---------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C CSIPProxyAuthorizationHeader* CSIPProxyAuthorizationHeader::NewL( |
|
78 const CSIPAuthorizationHeaderBase& aHeader) |
|
79 { |
|
80 CSIPProxyAuthorizationHeader* self = |
|
81 CSIPProxyAuthorizationHeader::NewLC(aHeader); |
|
82 CleanupStack::Pop(self); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CSIPProxyAuthorizationHeader::NewLC |
|
88 // ---------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C CSIPProxyAuthorizationHeader* CSIPProxyAuthorizationHeader::NewLC( |
|
91 const CSIPAuthorizationHeaderBase& aHeader) |
|
92 { |
|
93 CSIPProxyAuthorizationHeader* self = |
|
94 new(ELeave)CSIPProxyAuthorizationHeader; |
|
95 CleanupStack::PushL(self); |
|
96 self->CSIPAuthorizationHeaderBase::ConstructL(aHeader); |
|
97 return self; |
|
98 } |
|
99 |
|
100 // ---------------------------------------------------------------------------- |
|
101 // CSIPProxyAuthorizationHeader::CSIPProxyAuthorizationHeader |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 CSIPProxyAuthorizationHeader::CSIPProxyAuthorizationHeader() |
|
105 { |
|
106 } |
|
107 |
|
108 // ---------------------------------------------------------------------------- |
|
109 // CSIPProxyAuthorizationHeader::~CSIPProxyAuthorizationHeader |
|
110 // ---------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C CSIPProxyAuthorizationHeader::~CSIPProxyAuthorizationHeader() |
|
113 { |
|
114 } |
|
115 |
|
116 // ---------------------------------------------------------------------------- |
|
117 // CSIPProxyAuthorizationHeader::ExternalizeSupported |
|
118 // ---------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C TBool CSIPProxyAuthorizationHeader::ExternalizeSupported() const |
|
121 { |
|
122 return ETrue; |
|
123 } |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // CSIPProxyAuthorizationHeader::CloneL |
|
127 // From CSIPHeaderBase: |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C CSIPHeaderBase* CSIPProxyAuthorizationHeader::CloneL() const |
|
131 { |
|
132 return CSIPProxyAuthorizationHeader::NewL(*this); |
|
133 } |
|
134 |
|
135 // ---------------------------------------------------------------------------- |
|
136 // CSIPProxyAuthorizationHeader::Name |
|
137 // From CSIPHeaderBase: |
|
138 // ---------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C RStringF CSIPProxyAuthorizationHeader::Name() const |
|
141 { |
|
142 return SIPStrings::StringF(SipStrConsts::EProxyAuthorizationHeader); |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSIPProxyAuthorizationHeader::BaseDecodeL |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 RPointerArray<CSIPHeaderBase> |
|
150 CSIPProxyAuthorizationHeader::BaseDecodeL(const TDesC8& aValue) |
|
151 { |
|
152 CSIPProxyAuthorizationHeader* header = DecodeL(aValue); |
|
153 CleanupStack::PushL (header); |
|
154 RPointerArray<CSIPHeaderBase> headers; |
|
155 User::LeaveIfError(headers.Append(header)); |
|
156 CleanupStack::Pop(header); |
|
157 return headers; |
|
158 } |
|
159 |
|
160 // ---------------------------------------------------------------------------- |
|
161 // CSIPProxyAuthorizationHeader::InternalizeValueL |
|
162 // ---------------------------------------------------------------------------- |
|
163 // |
|
164 CSIPHeaderBase* CSIPProxyAuthorizationHeader::InternalizeValueL( |
|
165 RReadStream& aReadStream) |
|
166 { |
|
167 CSIPProxyAuthorizationHeader* self = |
|
168 new(ELeave)CSIPProxyAuthorizationHeader; |
|
169 CleanupStack::PushL(self); |
|
170 self->DoInternalizeValueL(aReadStream); |
|
171 CleanupStack::Pop(self); |
|
172 return self; |
|
173 } |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CSIPProxyAuthorizationHeader::ExternalizeValueL |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 void |
|
180 CSIPProxyAuthorizationHeader::ExternalizeValueL(RWriteStream& aWriteStream) const |
|
181 { |
|
182 TPtrC8 authScheme(AuthScheme().DesC()); |
|
183 aWriteStream.WriteUint32L(authScheme.Length()); |
|
184 aWriteStream.WriteL(authScheme); |
|
185 iParams->ExternalizeL(aWriteStream); |
|
186 } |