|
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 <es_sock.h> |
|
22 #include "natfwunsafusecandidateattribute.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CNATFWUNSAFUseCandidateAttribute::NewL |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 EXPORT_C CNATFWUNSAFUseCandidateAttribute* |
|
29 CNATFWUNSAFUseCandidateAttribute::NewL() |
|
30 { |
|
31 CNATFWUNSAFUseCandidateAttribute* self = |
|
32 CNATFWUNSAFUseCandidateAttribute::NewLC(); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CNATFWUNSAFUseCandidateAttribute::NewLC |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CNATFWUNSAFUseCandidateAttribute* |
|
42 CNATFWUNSAFUseCandidateAttribute::NewLC() |
|
43 { |
|
44 CNATFWUNSAFUseCandidateAttribute* self = |
|
45 new (ELeave) CNATFWUNSAFUseCandidateAttribute(); |
|
46 CleanupStack::PushL(self); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CNATFWUNSAFUseCandidateAttribute::DecodeAttributeL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CNATFWUNSAFAttribute* |
|
55 CNATFWUNSAFUseCandidateAttribute::DecodeAttributeL(const TDesC8& aByteStream) |
|
56 { |
|
57 TUint16 valueLength = ParseLengthL(aByteStream); |
|
58 |
|
59 //Stream has to have no data (length=0) |
|
60 __ASSERT_ALWAYS(valueLength == EAttributeValueSize, |
|
61 User::Leave(KErrCorrupt)); |
|
62 __ASSERT_ALWAYS(aByteStream.Length() >= EValueOffset + valueLength, |
|
63 User::Leave(KErrArgument)); |
|
64 return NewL(); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CNATFWUNSAFUseCandidateAttribute::CNATFWUNSAFUseCandidateAttribute |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CNATFWUNSAFUseCandidateAttribute::CNATFWUNSAFUseCandidateAttribute() : |
|
72 CNATFWUNSAFAttribute() |
|
73 { |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CNATFWUNSAFUseCandidateAttribute::~CNATFWUNSAFUseCandidateAttribute |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 CNATFWUNSAFUseCandidateAttribute::~CNATFWUNSAFUseCandidateAttribute() |
|
81 { |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CNATFWUNSAFUseCandidateAttribute::Type |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CNATFWUNSAFAttribute::TType CNATFWUNSAFUseCandidateAttribute::Type() const |
|
89 { |
|
90 return EUseCandidate; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CNATFWUNSAFUseCandidateAttribute::EncodeValueL |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 HBufC8* CNATFWUNSAFUseCandidateAttribute::EncodeValueL() const |
|
98 { |
|
99 //An empty buffer is returned since this attribute contains no data. |
|
100 return HBufC8::NewL(EAttributeValueSize); |
|
101 } |