|
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 : CSIPSubscriptionStateHeaderParams.cpp |
|
15 // Part of : SIP Codec |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "CSIPSubscriptionStateHeaderParams.h" |
|
22 #include "sipcodecerr.h" |
|
23 #include "SIPSyntaxCheck.h" |
|
24 #include "sipstrings.h" |
|
25 #include "sipstrconsts.h" |
|
26 |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CSIPSubscriptionStateHeaderParams::NewL |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 CSIPSubscriptionStateHeaderParams* CSIPSubscriptionStateHeaderParams::NewL( |
|
33 const CSIPSubscriptionStateHeaderParams& aParams) |
|
34 { |
|
35 CSIPSubscriptionStateHeaderParams* self = |
|
36 CSIPSubscriptionStateHeaderParams::NewLC(aParams); |
|
37 CleanupStack::Pop(self); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // ---------------------------------------------------------------------------- |
|
42 // CSIPSubscriptionStateHeaderParams::NewLC |
|
43 // ---------------------------------------------------------------------------- |
|
44 // |
|
45 CSIPSubscriptionStateHeaderParams* CSIPSubscriptionStateHeaderParams::NewLC( |
|
46 const CSIPSubscriptionStateHeaderParams& aParams) |
|
47 { |
|
48 CSIPSubscriptionStateHeaderParams* self = |
|
49 new(ELeave)CSIPSubscriptionStateHeaderParams; |
|
50 CleanupStack::PushL(self); |
|
51 self->ConstructL(aParams); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ---------------------------------------------------------------------------- |
|
56 // CSIPSubscriptionStateHeaderParams::CSIPSubscriptionStateHeaderParams |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 CSIPSubscriptionStateHeaderParams::CSIPSubscriptionStateHeaderParams() |
|
60 : CSIPParamContainerBase(';') |
|
61 { |
|
62 } |
|
63 |
|
64 // ---------------------------------------------------------------------------- |
|
65 // CSIPSubscriptionStateHeaderParams::~CSIPSubscriptionStateHeaderParams |
|
66 // ---------------------------------------------------------------------------- |
|
67 // |
|
68 CSIPSubscriptionStateHeaderParams::~CSIPSubscriptionStateHeaderParams() |
|
69 { |
|
70 } |
|
71 |
|
72 // ---------------------------------------------------------------------------- |
|
73 // CSIPSubscriptionStateHeaderParams::InternalizeL |
|
74 // ---------------------------------------------------------------------------- |
|
75 // |
|
76 CSIPSubscriptionStateHeaderParams* |
|
77 CSIPSubscriptionStateHeaderParams::InternalizeL(RReadStream& aReadStream) |
|
78 { |
|
79 CSIPSubscriptionStateHeaderParams* self = |
|
80 new(ELeave)CSIPSubscriptionStateHeaderParams; |
|
81 CleanupStack::PushL(self); |
|
82 self->DoInternalizeL (aReadStream); |
|
83 CleanupStack::Pop(self); |
|
84 return self; |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------------------------------- |
|
88 // CSIPSubscriptionStateHeaderParams::CheckParamL |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 void CSIPSubscriptionStateHeaderParams::CheckParamL(CSIPParam& aParam) const |
|
92 { |
|
93 RStringF name = aParam.Name(); |
|
94 TPtrC8 value = aParam.Value().DesC(); |
|
95 // ReasonParam |
|
96 if (name == SIPStrings::StringF(SipStrConsts::EReason)) |
|
97 { |
|
98 if (!SIPSyntaxCheck::Token(value)) |
|
99 { |
|
100 User::Leave(KErrSipCodecSubscriptionStateHeader); |
|
101 } |
|
102 return; |
|
103 } |
|
104 // expires |
|
105 if (name == SIPStrings::StringF(SipStrConsts::EExpires)) |
|
106 { |
|
107 if (!SIPSyntaxCheck::UInt(value)) |
|
108 { |
|
109 User::Leave(KErrSipCodecSubscriptionStateHeader); |
|
110 } |
|
111 return; |
|
112 } |
|
113 // retry-after |
|
114 if (name == SIPStrings::StringF(SipStrConsts::ERetryAfter)) |
|
115 { |
|
116 if (!SIPSyntaxCheck::UInt(value)) |
|
117 { |
|
118 User::Leave(KErrSipCodecSubscriptionStateHeader); |
|
119 } |
|
120 return; |
|
121 } |
|
122 // generic-param |
|
123 CheckGenericParamL(aParam, KErrSipCodecSubscriptionStateHeader); |
|
124 } |