author | hgs |
Thu, 16 Sep 2010 13:07:04 +0300 | |
changeset 49 | 43351a4f2da3 |
parent 34 | ad1f037f1ac2 |
permissions | -rw-r--r-- |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
34 | 5 |
* under the terms of "Eclipse Public License v1.0" |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
34 | 15 |
* Handle to EAP plugin information |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
/* |
49 | 20 |
* %version: 17 % |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
*/ |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
|
34 | 23 |
// System includes |
24 |
#include <eapqtpluginhandle.h> |
|
25 |
||
26 |
// User includes |
|
26 | 27 |
#include "eapqtpluginhandle_p.h" |
28 |
||
34 | 29 |
/*! |
30 |
* \class EapQtPluginHandle |
|
31 |
* \brief Public implementation of handle to EAP plugin information |
|
32 |
*/ |
|
33 |
||
34 |
// External function prototypes |
|
35 |
||
36 |
// Local constants |
|
37 |
||
26 | 38 |
struct EapQtPluginHandleMapper |
39 |
{ |
|
40 |
EapQtExpandedEapType::Type mType; |
|
41 |
int mUid; |
|
42 |
}; |
|
43 |
||
34 | 44 |
// mapper from EapQtPluginHandle::Plugin to default |
45 |
// EapQtExpandedEapType & protocol plugin implementation UID pair |
|
26 | 46 |
static const EapQtPluginHandleMapper handleMapper[EapQtPluginHandle::PluginLast] = { |
47 |
{EapQtExpandedEapType::TypeUndefined, 0x00000000}, |
|
48 |
{EapQtExpandedEapType::TypeEapAka, 0x102073c2}, |
|
49 |
{EapQtExpandedEapType::TypeEapFast, 0x2000BF12}, |
|
50 |
{EapQtExpandedEapType::TypeEapGtc, 0x101f8e80}, |
|
51 |
{EapQtExpandedEapType::TypeLeap, 0x101f8ea7}, |
|
52 |
{EapQtExpandedEapType::TypeEapMschapv2, 0x101f8e67}, |
|
53 |
{EapQtExpandedEapType::TypePeap, 0x101f8e4e}, |
|
54 |
{EapQtExpandedEapType::TypeEapSim, 0x101f8e4b}, |
|
55 |
{EapQtExpandedEapType::TypeEapTls, 0x101f8e4d}, |
|
56 |
{EapQtExpandedEapType::TypeEapTtls, 0x101f8e4f}, |
|
57 |
{EapQtExpandedEapType::TypePap, 0x2001B2F2}, |
|
58 |
{EapQtExpandedEapType::TypePlainMschapv2, 0x101f8e7b} |
|
59 |
}; |
|
60 |
||
34 | 61 |
// mapper from EapQtExpandedEapType::Type to EapQtPluginHandle::Plugin |
26 | 62 |
static const EapQtPluginHandle::Plugin typeMapper[EapQtExpandedEapType::TypeLast] = { |
63 |
EapQtPluginHandle::PluginUndefined, |
|
64 |
EapQtPluginHandle::PluginEapAka, |
|
65 |
EapQtPluginHandle::PluginEapFast, |
|
66 |
EapQtPluginHandle::PluginEapGtc, |
|
67 |
EapQtPluginHandle::PluginLeap, |
|
68 |
EapQtPluginHandle::PluginEapMschapv2, |
|
69 |
EapQtPluginHandle::PluginPeap, |
|
70 |
EapQtPluginHandle::PluginEapSim, |
|
71 |
EapQtPluginHandle::PluginEapTls, |
|
72 |
EapQtPluginHandle::PluginEapTtls, |
|
34 | 73 |
EapQtPluginHandle::PluginUndefined, /* wps does not have a plugin */ |
26 | 74 |
EapQtPluginHandle::PluginPap, |
75 |
EapQtPluginHandle::PluginPlainMschapv2 |
|
76 |
}; |
|
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
|
34 | 78 |
// ======== LOCAL FUNCTIONS ======== |
27 | 79 |
|
34 | 80 |
// ======== MEMBER FUNCTIONS ======== |
81 |
||
26 | 82 |
EapQtPluginHandle::EapQtPluginHandle() : |
83 |
d_ptr(new EapQtPluginHandlePrivate(handleMapper[PluginUndefined].mType, |
|
84 |
handleMapper[PluginUndefined].mUid)) |
|
85 |
{ |
|
86 |
} |
|
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
|
34 | 88 |
EapQtPluginHandle::EapQtPluginHandle(const Plugin id) : |
26 | 89 |
d_ptr(NULL) |
90 |
{ |
|
27 | 91 |
Plugin localId; |
26 | 92 |
if (id < PluginLast) { |
27 | 93 |
localId = id; |
26 | 94 |
} |
95 |
else { |
|
27 | 96 |
localId = PluginUndefined; |
26 | 97 |
} |
27 | 98 |
d_ptr.reset(new EapQtPluginHandlePrivate(handleMapper[localId].mType, |
99 |
handleMapper[localId].mUid)); |
|
26 | 100 |
} |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
|
34 | 102 |
EapQtPluginHandle::EapQtPluginHandle(const EapQtExpandedEapType& type, const int uid) : |
26 | 103 |
d_ptr(new EapQtPluginHandlePrivate(type, uid)) |
104 |
{ |
|
105 |
} |
|
106 |
||
49 | 107 |
EapQtPluginHandle::EapQtPluginHandle(const EapQtExpandedEapType& type) |
26 | 108 |
{ |
49 | 109 |
if (( type.type() < EapQtExpandedEapType::TypeLast) && |
110 |
( typeMapper[type.type()] < EapQtPluginHandle::PluginLast) ) |
|
111 |
{ |
|
112 |
d_ptr.reset(new EapQtPluginHandlePrivate(type, handleMapper[typeMapper[type.type()]].mUid)); |
|
113 |
} |
|
114 |
else |
|
115 |
{ |
|
116 |
d_ptr.reset(NULL); |
|
117 |
} |
|
26 | 118 |
} |
119 |
||
120 |
EapQtPluginHandle::EapQtPluginHandle(const EapQtPluginHandle& handle) : |
|
121 |
d_ptr(new EapQtPluginHandlePrivate(handle.type(), handle.protocolImplementationUid())) |
|
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
{ |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
} |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
EapQtPluginHandle::~EapQtPluginHandle() |
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
{ |
26 | 127 |
// scoped pointer delete |
22
093cf0757204
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
} |
26 | 129 |
|
130 |
EapQtExpandedEapType EapQtPluginHandle::type() const |
|
131 |
{ |
|
132 |
return d_ptr->mType; |
|
133 |
} |
|
134 |
||
135 |
int EapQtPluginHandle::protocolImplementationUid() const |
|
136 |
{ |
|
137 |
return d_ptr->mProtocolImplementationUid; |
|
138 |
} |
|
139 |
||
140 |
EapQtPluginHandle::Plugin EapQtPluginHandle::pluginId() const |
|
141 |
{ |
|
142 |
return typeMapper[d_ptr->mType.type()]; |
|
143 |
} |
|
144 |
||
145 |
EapQtPluginHandle& EapQtPluginHandle::operator=(const EapQtPluginHandle &handle) |
|
146 |
{ |
|
147 |
// check if assigning to myself |
|
148 |
if (this != &handle) { |
|
149 |
d_ptr.reset(new EapQtPluginHandlePrivate(handle.type(), handle.protocolImplementationUid())); |
|
150 |
} |
|
151 |
return *this; |
|
152 |
} |
|
153 |
||
34 | 154 |
bool EapQtPluginHandle::operator ==(const EapQtPluginHandle &right_type_value) const |
155 |
{ |
|
156 |
return (right_type_value.d_ptr->mProtocolImplementationUid == d_ptr->mProtocolImplementationUid) |
|
157 |
&& (right_type_value.d_ptr->mType == d_ptr->mType); |
|
158 |
} |
|
159 |
||
160 |
bool EapQtPluginHandle::operator !=(const EapQtPluginHandle &right_type_value) const |
|
161 |
{ |
|
162 |
return (right_type_value.d_ptr->mProtocolImplementationUid != d_ptr->mProtocolImplementationUid) |
|
163 |
|| (right_type_value.d_ptr->mType != d_ptr->mType); |
|
164 |
} |