69
|
1 |
/**
|
|
2 |
* Copyright (c) 2010 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 |
* Header file declaring the RawIP Provisioning structures.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
@internalTechnology
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifdef SYMBIAN_NETWORKING_CONTENTION_MANAGEMENT
|
|
26 |
|
|
27 |
#ifndef PDP_CONTENTION_H
|
|
28 |
#define PDP_CONTENTION_H
|
|
29 |
|
|
30 |
#include <comms-infras/contentionmanager.h>
|
|
31 |
|
|
32 |
class CMBMSEngine;
|
|
33 |
class CContextStatusMonitor;
|
|
34 |
class CContextTypeChecker;
|
|
35 |
|
|
36 |
|
|
37 |
class MContextEventsObserver
|
|
38 |
{
|
|
39 |
public:
|
|
40 |
virtual void PrimaryContextAddedL(const TName* aContextName) = 0;
|
|
41 |
virtual void SecondaryContextAdded(const TName* aContextName) = 0;
|
|
42 |
virtual void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor) = 0;
|
|
43 |
virtual void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError) = 0;
|
|
44 |
virtual void ContextTypeCheckingError(const TName* aContextName, TInt aError) = 0;
|
|
45 |
};
|
|
46 |
|
|
47 |
class CContextStatusMonitor : public CActive
|
|
48 |
{
|
|
49 |
public:
|
|
50 |
CContextStatusMonitor(RPacketService& aPacketService, MContextEventsObserver& aCallback);
|
|
51 |
~CContextStatusMonitor();
|
|
52 |
|
|
53 |
public:
|
|
54 |
TBool StartL(const TName& aContextName);
|
|
55 |
inline TBool IsPassedThroughActiveState() const;
|
|
56 |
|
|
57 |
private:
|
|
58 |
void RunL();
|
|
59 |
void DoCancel();
|
|
60 |
TInt RunError(TInt aError);
|
|
61 |
|
|
62 |
private:
|
|
63 |
RPacketService& iPacketService;
|
|
64 |
RPacketContext iPacketContext;
|
|
65 |
RPacketContext::TContextStatus iContextStatus;
|
|
66 |
MContextEventsObserver& iCallback;
|
|
67 |
TName iContextName;
|
|
68 |
TBool iWasActive;
|
|
69 |
};
|
|
70 |
|
|
71 |
|
|
72 |
class CPrimaryContextsMonitor : public CActive, MContextEventsObserver
|
|
73 |
{
|
|
74 |
enum TState {EEnumeratingContexts, EGettingInfo, EListening};
|
|
75 |
public:
|
|
76 |
CPrimaryContextsMonitor(RPacketService& aPacketService, MContentionObserver& aCallback);
|
|
77 |
~CPrimaryContextsMonitor();
|
|
78 |
public:
|
|
79 |
void StartL();
|
|
80 |
|
|
81 |
// from MContextEventsObserver
|
|
82 |
void PrimaryContextAddedL(const TName* aContextName);
|
|
83 |
void SecondaryContextAdded(const TName* aContextName);
|
|
84 |
void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor);
|
|
85 |
void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError);
|
|
86 |
void ContextTypeCheckingError(const TName* aContextName, TInt aError);
|
|
87 |
|
|
88 |
private:
|
|
89 |
void RunL();
|
|
90 |
void DoCancel();
|
|
91 |
TInt RunError(TInt aError);
|
|
92 |
void DeleteContextStatusMonitor(const CContextStatusMonitor* aContextStatusMonitor);
|
|
93 |
void SwitchStateL();
|
|
94 |
void StartContextStatusMonitoringL(const TName& aContextName);
|
|
95 |
void RemoveContextNameAndCheckNext(const TName* aContextName);
|
|
96 |
void ProcessError(TInt aError);
|
|
97 |
|
|
98 |
private:
|
|
99 |
RPointerArray<CContextStatusMonitor> iContextMonitors;
|
|
100 |
RPointerArray<TName> iAddedContextsNames;
|
|
101 |
CContextTypeChecker* iContextTypeChecker;
|
|
102 |
RPacketService& iPacketService;
|
|
103 |
TState iState;
|
|
104 |
RPacketService::TNifInfoV2 iCurrentNifInfo;
|
|
105 |
TInt iInitialNifsCount;
|
|
106 |
TInt iCurrentNifIndex;
|
|
107 |
TBool iFirstContextAdded;
|
|
108 |
MContentionObserver& iCallback;
|
|
109 |
};
|
|
110 |
|
|
111 |
class CContextTypeChecker : public CActive
|
|
112 |
{
|
|
113 |
public:
|
|
114 |
CContextTypeChecker(RPacketService& aPacketService, MContextEventsObserver& aCallback);
|
|
115 |
~CContextTypeChecker();
|
|
116 |
|
|
117 |
public:
|
|
118 |
void Start(const TName* aContextName);
|
|
119 |
void RunL();
|
|
120 |
TInt RunError(TInt aError);
|
|
121 |
void DoCancel();
|
|
122 |
|
|
123 |
private:
|
|
124 |
RPacketService& iPacketService;
|
|
125 |
const TName* iContextName;
|
|
126 |
MContextEventsObserver& iCallback;
|
|
127 |
TInt iCountInNif;
|
|
128 |
};
|
|
129 |
|
|
130 |
class CPdpContentionManager : public CContentionManager
|
|
131 |
{
|
|
132 |
public:
|
|
133 |
static CPdpContentionManager* NewL(const ESock::CTierManagerBase& aTierManager, RPacketService& aPacketService);
|
|
134 |
~CPdpContentionManager();
|
|
135 |
|
|
136 |
public:
|
|
137 |
void StartMonitoringL();
|
|
138 |
|
|
139 |
private:
|
|
140 |
void ConstructL(RPacketService& aPacketService);
|
|
141 |
CPdpContentionManager(const ESock::CTierManagerBase& aTierManager);
|
|
142 |
|
|
143 |
private:
|
|
144 |
// from CContentionManager
|
|
145 |
virtual void ContentionResolved(const TContentionRequestItem& aContentionRequest, TBool aResult);
|
|
146 |
virtual void ContentionOccured(ESock::CMetaConnectionProviderBase& aMcpr);
|
|
147 |
virtual void ReportContentionAvailabilityStatus(ESock::CMetaConnectionProviderBase& aMcpr, const ESock::TAvailabilityStatus& aStatus) const;
|
|
148 |
|
|
149 |
private:
|
|
150 |
CPrimaryContextsMonitor* iPrimaryContextsMonitor;
|
|
151 |
};
|
|
152 |
|
|
153 |
inline TBool CContextStatusMonitor::IsPassedThroughActiveState() const
|
|
154 |
{
|
|
155 |
return iWasActive;
|
|
156 |
}
|
|
157 |
#endif
|
|
158 |
|
|
159 |
#endif
|