|
1 /* |
|
2 * Copyright (c) 2004 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 #include "nsmldmauthinfo.h" |
|
20 #include "nsmlsosserverdefs.h" |
|
21 |
|
22 // --------------------------------------------------------- |
|
23 // CNSmlDMAuthInfo::CNSmlDMAuthInfo() |
|
24 // Constructor |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CNSmlDMAuthInfo::CNSmlDMAuthInfo() |
|
28 { |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------- |
|
32 // CNSmlDMAuthInfo::CNSmlDMAuthInfo() |
|
33 // Destructor |
|
34 // --------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C CNSmlDMAuthInfo::~CNSmlDMAuthInfo() |
|
37 { |
|
38 |
|
39 if ( iServerNonce ) |
|
40 { |
|
41 delete iServerNonce; |
|
42 } |
|
43 |
|
44 if ( iClientNonce ) |
|
45 { |
|
46 delete iClientNonce; |
|
47 } |
|
48 |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------- |
|
52 // TInt CNSmlDMAuthInfo::DataSize() |
|
53 // Returns the size of data |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 TInt CNSmlDMAuthInfo::DataSize() const |
|
57 { |
|
58 TInt size(0); |
|
59 |
|
60 size += KSizeofTInt32; // Server nonce length |
|
61 size += iServerNonce->Length()+1; |
|
62 size += KSizeofTInt32; // Client nonce length |
|
63 size += iClientNonce->Length()+1; |
|
64 size += KSizeofTInt32; // Auth required |
|
65 |
|
66 return size; |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // void CNSmlDMAuthInfo::InternalizeL( RReadStream& aStream ) |
|
71 // From base class. Reads data from given stream. |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 void CNSmlDMAuthInfo::InternalizeL( RReadStream& aStream ) |
|
75 { |
|
76 TInt length(0); |
|
77 |
|
78 length = aStream.ReadInt32L(); |
|
79 iServerNonce = HBufC8::NewL( aStream, length ); |
|
80 |
|
81 length = aStream.ReadInt32L(); |
|
82 iClientNonce = HBufC8::NewL( aStream, length ); |
|
83 |
|
84 iAuthPref = aStream.ReadInt32L(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // void CNSmlDMAuthInfo::ExternalizeL( RWriteStream& aStream ) const |
|
89 // From base class. Writes data to given stream. |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 void CNSmlDMAuthInfo::ExternalizeL( RWriteStream& aStream ) const |
|
93 { |
|
94 aStream.WriteInt32L( iServerNonce->Size() ); |
|
95 aStream << *iServerNonce; |
|
96 |
|
97 aStream.WriteInt32L( iClientNonce->Size() ); |
|
98 aStream << *iClientNonce; |
|
99 |
|
100 aStream.WriteInt32L( iAuthPref ); |
|
101 aStream.CommitL(); |
|
102 } |
|
103 |