|
1 // Copyright (c) 2005-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 : CSIPEventHeaderParams.cpp |
|
15 // Part of : SIP Codec |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "CSIPEventHeaderParams.h" |
|
23 #include "sipcodecerr.h" |
|
24 #include "SIPSyntaxCheck.h" |
|
25 #include "sipstrings.h" |
|
26 #include "sipstrconsts.h" |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CSIPEventHeaderParams::NewL |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 CSIPEventHeaderParams* CSIPEventHeaderParams::NewL( |
|
33 const CSIPEventHeaderParams& aParams) |
|
34 { |
|
35 CSIPEventHeaderParams* self = CSIPEventHeaderParams::NewLC(aParams); |
|
36 CleanupStack::Pop(self); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // ---------------------------------------------------------------------------- |
|
41 // CSIPEventHeaderParams::NewLC |
|
42 // ---------------------------------------------------------------------------- |
|
43 // |
|
44 CSIPEventHeaderParams* CSIPEventHeaderParams::NewLC( |
|
45 const CSIPEventHeaderParams& aParams) |
|
46 { |
|
47 CSIPEventHeaderParams* self = new(ELeave)CSIPEventHeaderParams; |
|
48 CleanupStack::PushL(self); |
|
49 self->ConstructL(aParams); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // ---------------------------------------------------------------------------- |
|
54 // CSIPEventHeaderParams::CSIPEventHeaderParams |
|
55 // ---------------------------------------------------------------------------- |
|
56 // |
|
57 CSIPEventHeaderParams::CSIPEventHeaderParams() |
|
58 : CSIPParamContainerBase(';') |
|
59 { |
|
60 } |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // CSIPEventHeaderParams::~CSIPEventHeaderParams |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 CSIPEventHeaderParams::~CSIPEventHeaderParams() |
|
67 { |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CSIPEventHeaderParams::operator== |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 TBool CSIPEventHeaderParams::operator==( |
|
75 const CSIPEventHeaderParams& aParams) const |
|
76 { |
|
77 // If a Event-header has a "id" parameter the other one |
|
78 // has to have it too and their values must match. |
|
79 if(this->HasParam(SIPStrings::StringF(SipStrConsts::EId))) |
|
80 { |
|
81 if(!aParams.HasParam(SIPStrings::StringF(SipStrConsts::EId))) |
|
82 { |
|
83 return EFalse; |
|
84 } |
|
85 |
|
86 if(ParamValue(SIPStrings::StringF(SipStrConsts::EId)) != |
|
87 aParams.ParamValue(SIPStrings::StringF(SipStrConsts::EId))) |
|
88 { |
|
89 return EFalse; |
|
90 } |
|
91 return ETrue; |
|
92 } |
|
93 else |
|
94 { |
|
95 return (!aParams.HasParam(SIPStrings::StringF(SipStrConsts::EId))); |
|
96 } |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // CSIPEventHeaderParams::InternalizeL |
|
101 // ---------------------------------------------------------------------------- |
|
102 // |
|
103 CSIPEventHeaderParams* CSIPEventHeaderParams::InternalizeL( |
|
104 RReadStream& aReadStream) |
|
105 { |
|
106 CSIPEventHeaderParams* self = new(ELeave)CSIPEventHeaderParams; |
|
107 CleanupStack::PushL(self); |
|
108 self->DoInternalizeL (aReadStream); |
|
109 CleanupStack::Pop(self); |
|
110 return self; |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CSIPEventHeaderParams::CheckParamL |
|
115 // ---------------------------------------------------------------------------- |
|
116 // |
|
117 void CSIPEventHeaderParams::CheckParamL(CSIPParam& aParam) const |
|
118 { |
|
119 // IdParam |
|
120 if (aParam.Name() == SIPStrings::StringF(SipStrConsts::EId)) |
|
121 { |
|
122 if (!SIPSyntaxCheck::Token(aParam.Value().DesC())) |
|
123 { |
|
124 User::Leave(KErrSipCodecEventHeader); |
|
125 } |
|
126 return; |
|
127 } |
|
128 // generic-param |
|
129 CheckGenericParamL(aParam, KErrSipCodecEventHeader); |
|
130 } |