|
1 // Copyright (c) 1997-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 // |
|
15 |
|
16 #include <f32file.h> |
|
17 #include "PPPBASE.H" |
|
18 |
|
19 // |
|
20 // PPP Link Interface Support |
|
21 // |
|
22 |
|
23 MPppRecvr::MPppRecvr(CPppLcp* aPppLcp, TPppPhase aPhase, TUint aPppId) |
|
24 { |
|
25 // Implementation moved to MPppRecvr::Init(CPppLcp* aPppLcp, TPppPhase aPhase, TUint aPppId). |
|
26 Init(aPppLcp, aPhase, aPppId); |
|
27 } |
|
28 |
|
29 |
|
30 MPppRecvr::MPppRecvr() |
|
31 { |
|
32 } |
|
33 |
|
34 void MPppRecvr::Init(CPppLcp* aPppLcp, TPppPhase aPhase, TUint aPppId) |
|
35 { |
|
36 // Copied here from MPppRecvr::MPppRecvr(CPppLcp* aPppLcp, TPppPhase aPhase, TUint aPppId) |
|
37 |
|
38 iPppRecvrListLink.iNext = &iPppRecvrListLink; |
|
39 iPppRecvrListLink.iPrev = &iPppRecvrListLink; |
|
40 iPppId = aPppId; |
|
41 iActivePhase = aPhase; |
|
42 iPppLcp = aPppLcp; |
|
43 iPppAbortCode = KErrNone; |
|
44 // We dont auto-register LCP as LCP wont be ready |
|
45 // to accept the registration at this stage |
|
46 // if (aPppId!=KPppIdUnknown && aPppId!=KPppIdLcp) |
|
47 // Register(); |
|
48 } |
|
49 |
|
50 MPppRecvr::~MPppRecvr() |
|
51 { |
|
52 iPppRecvrListLink.Deque(); |
|
53 } |
|
54 |
|
55 EXPORT_C void MPppRecvr::FlowOn() |
|
56 { |
|
57 } |
|
58 |
|
59 void MPppRecvr::LowerLayerUp() |
|
60 { |
|
61 } |
|
62 |
|
63 void MPppRecvr::LowerLayerDown(TInt) |
|
64 { |
|
65 } |
|
66 |
|
67 void MPppRecvr::Deque() |
|
68 { |
|
69 iPppRecvrListLink.Deque(); |
|
70 iPppRecvrListLink.iNext = &iPppRecvrListLink; |
|
71 iPppRecvrListLink.iPrev = &iPppRecvrListLink; |
|
72 } |
|
73 |
|
74 void MPppRecvr::Register(TUint aPppId) |
|
75 { |
|
76 if (aPppId!=KPppIdAsIs) |
|
77 SetId(aPppId); |
|
78 iPppLcp->RegisterRecvr(this); |
|
79 } |
|
80 |
|
81 void MPppRecvr::Reregister(TUint aPppId, TPppPhase aPhase) |
|
82 { |
|
83 if (aPppId!=KPppIdAsIs) |
|
84 SetId(aPppId); |
|
85 SetPhase(aPhase); |
|
86 iPppLcp->ReregisterRecvr(this); |
|
87 } |
|
88 |
|
89 void MPppRecvr::Deregister() |
|
90 { |
|
91 iPppLcp->DeregisterRecvr(this); |
|
92 } |
|
93 |
|
94 |
|
95 typedef CNifFactory* (*TPppFactoryNewL)(); |
|
96 CNifFactory* MPppRecvr::FindPppFactoryL(const TDesC& aFilename, TUid aUid2, CObjectCon& aCon) |
|
97 // |
|
98 // Basically this is all the stuff required to load a DLL appart from the |
|
99 // Factory->CreatMe call |
|
100 // |
|
101 { |
|
102 CNifFactory* Factory=NULL; |
|
103 TParse parse; |
|
104 User::LeaveIfError(parse.Set(aFilename, 0, 0)); |
|
105 |
|
106 TName dummy1; |
|
107 TInt find=0; |
|
108 |
|
109 if(aCon.FindByName(find, parse.Name(), dummy1)!=KErrNone) |
|
110 { |
|
111 |
|
112 // Else load the module |
|
113 TAutoClose<RLibrary> lib; |
|
114 User::LeaveIfError(lib.iObj.Load(aFilename)); |
|
115 lib.PushL(); |
|
116 |
|
117 // The Uid check |
|
118 if(lib.iObj.Type()[1]!=aUid2) |
|
119 User::Leave(KErrBadLibraryEntryPoint); |
|
120 |
|
121 TPppFactoryNewL libEntry=(TPppFactoryNewL)lib.iObj.Lookup(1); |
|
122 if (libEntry==NULL) |
|
123 User::Leave(KErrNoMemory); |
|
124 |
|
125 Factory =(*libEntry)(); // Opens CObject |
|
126 if (!Factory) |
|
127 User::Leave(KErrBadDriver); |
|
128 |
|
129 CleanupStack::PushL(TCleanupItem(CNifFactory::Cleanup, Factory)); |
|
130 Factory->InitL(lib.iObj, aCon); // Transfers the library object if successful |
|
131 |
|
132 // Can pop the library now - auto close will have no effect because handle is null |
|
133 CleanupStack::Pop(); |
|
134 lib.Pop(); |
|
135 |
|
136 } |
|
137 else |
|
138 { |
|
139 Factory=(CNifFactory*)aCon.At(find); |
|
140 Factory->Open(); |
|
141 } |
|
142 return Factory; |
|
143 } |
|
144 |