|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "natfwunsafbindingresponse.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CNATFWUNSAFBindingResponse::NewL |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CNATFWUNSAFBindingResponse* |
|
28 CNATFWUNSAFBindingResponse::NewL( |
|
29 const TNATFWUNSAFTransactionID& aTransactionID) |
|
30 { |
|
31 CNATFWUNSAFBindingResponse* self = CNATFWUNSAFBindingResponse::NewLC( |
|
32 aTransactionID); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CNATFWUNSAFBindingResponse::NewLC |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CNATFWUNSAFBindingResponse* |
|
42 CNATFWUNSAFBindingResponse::NewLC( |
|
43 const TNATFWUNSAFTransactionID& aTransactionID) |
|
44 { |
|
45 CNATFWUNSAFBindingResponse* self = |
|
46 new (ELeave) CNATFWUNSAFBindingResponse(aTransactionID); |
|
47 CleanupStack::PushL(self); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CNATFWUNSAFBindingResponse::CreateL |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CNATFWUNSAFMessage* |
|
56 CNATFWUNSAFBindingResponse::CreateL( |
|
57 const TNATFWUNSAFTransactionID& aTransactionID) |
|
58 { |
|
59 return NewL(aTransactionID); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CNATFWUNSAFBindingResponse::CNATFWUNSAFBindingResponse |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CNATFWUNSAFBindingResponse::CNATFWUNSAFBindingResponse( |
|
67 const TNATFWUNSAFTransactionID& aTransactionID) : |
|
68 CNATFWUNSAFMessage(aTransactionID) |
|
69 { |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CNATFWUNSAFBindingResponse::~CNATFWUNSAFBindingResponse |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 CNATFWUNSAFBindingResponse::~CNATFWUNSAFBindingResponse() |
|
77 { |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CNATFWUNSAFBindingResponse::Type |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CNATFWUNSAFMessage::TType CNATFWUNSAFBindingResponse::Type() const |
|
85 { |
|
86 return CNATFWUNSAFMessage::EBindingResponse; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CNATFWUNSAFBindingResponse::Validate |
|
91 // If the Binding Request had XOR-ONLY, server must not put the MAPPED-ADDRESS |
|
92 // in the Binding Response, but must put the XOR-MAPPED-ADDRESS. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 TBool CNATFWUNSAFBindingResponse::Validate() const |
|
96 { |
|
97 return HasAttribute(CNATFWUNSAFAttribute::EMappedAddress) || |
|
98 HasAttribute(CNATFWUNSAFAttribute::EXorMappedAddress); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CNATFWUNSAFBindingResponse::IsAllowed |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TBool CNATFWUNSAFBindingResponse::IsAllowed(TUint16 aAttributeType) const |
|
106 { |
|
107 return (aAttributeType == CNATFWUNSAFAttribute::EMappedAddress || |
|
108 aAttributeType == CNATFWUNSAFAttribute::ESourceAddress || |
|
109 aAttributeType == CNATFWUNSAFAttribute::EChangedAddress || |
|
110 aAttributeType == CNATFWUNSAFAttribute::EMessageIntegrity || |
|
111 aAttributeType == CNATFWUNSAFAttribute::EReflectedFrom || |
|
112 aAttributeType == CNATFWUNSAFAttribute::EXorMappedAddress || |
|
113 aAttributeType == CNATFWUNSAFAttribute::EServer || |
|
114 aAttributeType == CNATFWUNSAFAttribute::EFingerprint); |
|
115 } |