|
1 // Copyright (c) 2004-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 : CSIPAuthorizationHeader.cpp |
|
15 // Part of : SIP Codec |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "sipauthorizationheader.h" |
|
22 #include "CSIPAuthorizationHeaderParams.h" |
|
23 #include "sipstrings.h" |
|
24 #include "sipstrconsts.h" |
|
25 #include "_sipcodecdefs.h" |
|
26 |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CSIPAuthorizationHeader::DecodeL |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C CSIPAuthorizationHeader* CSIPAuthorizationHeader::DecodeL( |
|
33 const TDesC8& aValue) |
|
34 { |
|
35 CSIPAuthorizationHeader* header = new(ELeave)CSIPAuthorizationHeader; |
|
36 CleanupStack::PushL(header); |
|
37 header->CSIPAuthorizationHeaderBase::ConstructL(); |
|
38 header->ParseL(aValue); |
|
39 CleanupStack::Pop(header); |
|
40 return header; |
|
41 } |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CSIPAuthorizationHeader::NewL |
|
45 // ---------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C CSIPAuthorizationHeader* CSIPAuthorizationHeader::NewL( |
|
48 RStringF aAuthScheme) |
|
49 { |
|
50 CSIPAuthorizationHeader* self = CSIPAuthorizationHeader::NewLC(aAuthScheme); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ---------------------------------------------------------------------------- |
|
56 // CSIPAuthorizationHeader::NewLC |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C CSIPAuthorizationHeader* CSIPAuthorizationHeader::NewLC( |
|
60 RStringF aAuthScheme) |
|
61 { |
|
62 CSIPAuthorizationHeader* self = new(ELeave)CSIPAuthorizationHeader; |
|
63 CleanupStack::PushL(self); |
|
64 self->CSIPAuthHeaderBase::ConstructL(aAuthScheme); |
|
65 self->ConstructL(); |
|
66 return self; |
|
67 } |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CSIPAuthorizationHeader::NewL |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C CSIPAuthorizationHeader* CSIPAuthorizationHeader::NewL( |
|
74 const CSIPAuthorizationHeaderBase& aHeader) |
|
75 { |
|
76 CSIPAuthorizationHeader* self = CSIPAuthorizationHeader::NewLC(aHeader); |
|
77 CleanupStack::Pop(self); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // ---------------------------------------------------------------------------- |
|
82 // CSIPAuthorizationHeader::NewLC |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C CSIPAuthorizationHeader* |
|
86 CSIPAuthorizationHeader::NewLC (const CSIPAuthorizationHeaderBase& aHeader) |
|
87 { |
|
88 CSIPAuthorizationHeader* self = new(ELeave)CSIPAuthorizationHeader; |
|
89 CleanupStack::PushL(self); |
|
90 self->CSIPAuthorizationHeaderBase::ConstructL(aHeader); |
|
91 return self; |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CSIPAuthorizationHeader::CSIPAuthorizationHeader |
|
96 // ---------------------------------------------------------------------------- |
|
97 // |
|
98 CSIPAuthorizationHeader::CSIPAuthorizationHeader() |
|
99 { |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // CSIPAuthorizationHeader::~CSIPAuthorizationHeader |
|
104 // ---------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C CSIPAuthorizationHeader::~CSIPAuthorizationHeader() |
|
107 { |
|
108 } |
|
109 |
|
110 // ---------------------------------------------------------------------------- |
|
111 // CSIPAuthorizationHeader::ExternalizeSupported |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TBool CSIPAuthorizationHeader::ExternalizeSupported() const |
|
115 { |
|
116 return ETrue; |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // CSIPAuthorizationHeader::CloneL |
|
121 // From CSIPHeaderBase: |
|
122 // ---------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C CSIPHeaderBase* CSIPAuthorizationHeader::CloneL() const |
|
125 { |
|
126 return CSIPAuthorizationHeader::NewL(*this); |
|
127 } |
|
128 |
|
129 // ---------------------------------------------------------------------------- |
|
130 // CSIPAuthorizationHeader::Name |
|
131 // From CSIPHeaderBase: |
|
132 // ---------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C RStringF CSIPAuthorizationHeader::Name() const |
|
135 { |
|
136 return SIPStrings::StringF(SipStrConsts::EAuthorizationHeader); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CSIPAuthorizationHeader::BaseDecodeL |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 RPointerArray<CSIPHeaderBase> |
|
144 CSIPAuthorizationHeader::BaseDecodeL(const TDesC8& aValue) |
|
145 { |
|
146 CSIPAuthorizationHeader* header = DecodeL(aValue); |
|
147 CleanupStack::PushL (header); |
|
148 RPointerArray<CSIPHeaderBase> headers; |
|
149 User::LeaveIfError(headers.Append(header)); |
|
150 CleanupStack::Pop(header); |
|
151 return headers; |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // CSIPAuthorizationHeader::InternalizeValueL |
|
156 // ---------------------------------------------------------------------------- |
|
157 // |
|
158 CSIPHeaderBase* CSIPAuthorizationHeader::InternalizeValueL( |
|
159 RReadStream& aReadStream) |
|
160 { |
|
161 CSIPAuthorizationHeader* self = new(ELeave)CSIPAuthorizationHeader; |
|
162 CleanupStack::PushL(self); |
|
163 self->DoInternalizeValueL(aReadStream); |
|
164 CleanupStack::Pop(self); |
|
165 return self; |
|
166 } |
|
167 |
|
168 // ---------------------------------------------------------------------------- |
|
169 // CSIPAuthorizationHeader::ExternalizeValueL |
|
170 // ---------------------------------------------------------------------------- |
|
171 // |
|
172 void |
|
173 CSIPAuthorizationHeader::ExternalizeValueL(RWriteStream& aWriteStream) const |
|
174 { |
|
175 TPtrC8 authScheme(AuthScheme().DesC()); |
|
176 aWriteStream.WriteUint32L(authScheme.Length()); |
|
177 aWriteStream.WriteL(authScheme); |
|
178 iParams->ExternalizeL(aWriteStream); |
|
179 } |