35 { |
36 { |
36 public: |
37 public: |
37 virtual void PacketServiceAttachedCallbackL() = 0; |
38 virtual void PacketServiceAttachedCallbackL() = 0; |
38 }; |
39 }; |
39 |
40 |
40 class MContextEventsObserver |
|
41 { |
|
42 public: |
|
43 virtual void PrimaryContextAddedL(const TName* aContextName) = 0; |
|
44 virtual void SecondaryContextAdded(const TName* aContextName) = 0; |
|
45 virtual void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor) = 0; |
|
46 virtual void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError) = 0; |
|
47 virtual void ContextTypeCheckingError(const TName* aContextName, TInt aError) = 0; |
|
48 }; |
|
49 |
|
50 class CContextStatusMonitor : public CActive |
|
51 { |
|
52 public: |
|
53 CContextStatusMonitor(RPacketService& aPacketService, MContextEventsObserver& aCallback); |
|
54 ~CContextStatusMonitor(); |
|
55 |
|
56 public: |
|
57 TBool StartL(const TName& aContextName); |
|
58 inline TBool IsPassedThroughActiveState() const; |
|
59 |
|
60 private: |
|
61 void RunL(); |
|
62 void DoCancel(); |
|
63 TInt RunError(TInt aError); |
|
64 |
|
65 private: |
|
66 RPacketService& iPacketService; |
|
67 RPacketContext iPacketContext; |
|
68 RPacketContext::TContextStatus iContextStatus; |
|
69 MContextEventsObserver& iCallback; |
|
70 TName iContextName; |
|
71 TBool iWasActive; |
|
72 }; |
|
73 |
|
74 |
|
75 class CPrimaryContextsMonitor : public CActive, MContextEventsObserver |
|
76 { |
|
77 enum TState {EEnumeratingContexts, EGettingInfo, EListening}; |
|
78 public: |
|
79 CPrimaryContextsMonitor(RPacketService& aPacketService, MContentionObserver& aCallback); |
|
80 ~CPrimaryContextsMonitor(); |
|
81 public: |
|
82 void StartL(); |
|
83 |
|
84 // from MContextEventsObserver |
|
85 void PrimaryContextAddedL(const TName* aContextName); |
|
86 void SecondaryContextAdded(const TName* aContextName); |
|
87 void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor); |
|
88 void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError); |
|
89 void ContextTypeCheckingError(const TName* aContextName, TInt aError); |
|
90 |
|
91 private: |
|
92 void RunL(); |
|
93 void DoCancel(); |
|
94 TInt RunError(TInt aError); |
|
95 void DeleteContextStatusMonitor(const CContextStatusMonitor* aContextStatusMonitor); |
|
96 void SwitchStateL(); |
|
97 void StartContextStatusMonitoringL(const TName& aContextName); |
|
98 void RemoveContextNameAndCheckNext(const TName* aContextName); |
|
99 void ProcessError(TInt aError); |
|
100 |
|
101 private: |
|
102 RPointerArray<CContextStatusMonitor> iContextMonitors; |
|
103 RPointerArray<TName> iAddedContextsNames; |
|
104 CContextTypeChecker* iContextTypeChecker; |
|
105 RPacketService& iPacketService; |
|
106 TState iState; |
|
107 RPacketService::TNifInfoV2 iCurrentNifInfo; |
|
108 TInt iInitialNifsCount; |
|
109 TInt iCurrentNifIndex; |
|
110 TBool iFirstContextAdded; |
|
111 MContentionObserver& iCallback; |
|
112 }; |
|
113 |
|
114 class CContextTypeChecker : public CActive |
|
115 { |
|
116 public: |
|
117 CContextTypeChecker(RPacketService& aPacketService, MContextEventsObserver& aCallback); |
|
118 ~CContextTypeChecker(); |
|
119 |
|
120 public: |
|
121 void Start(const TName* aContextName); |
|
122 void RunL(); |
|
123 TInt RunError(TInt aError); |
|
124 void DoCancel(); |
|
125 |
|
126 private: |
|
127 RPacketService& iPacketService; |
|
128 const TName* iContextName; |
|
129 MContextEventsObserver& iCallback; |
|
130 TInt iCountInNif; |
|
131 }; |
|
132 |
|
133 class CPdpContentionManager : public CContentionManager |
|
134 { |
|
135 public: |
|
136 static CPdpContentionManager* NewL(const ESock::CTierManagerBase& aTierManager, RPacketService& aPacketService); |
|
137 ~CPdpContentionManager(); |
|
138 |
|
139 public: |
|
140 void StartMonitoringL(); |
|
141 |
|
142 private: |
|
143 void ConstructL(RPacketService& aPacketService); |
|
144 CPdpContentionManager(const ESock::CTierManagerBase& aTierManager); |
|
145 |
|
146 private: |
|
147 // from CContentionManager |
|
148 virtual void ContentionResolved(const TContentionRequestItem& aContentionRequest, TBool aResult); |
|
149 virtual void ContentionOccured(ESock::CMetaConnectionProviderBase& aMcpr); |
|
150 virtual void ReportContentionAvailabilityStatus(ESock::CMetaConnectionProviderBase& aMcpr, const ESock::TAvailabilityStatus& aStatus) const; |
|
151 |
|
152 private: |
|
153 CPrimaryContextsMonitor* iPrimaryContextsMonitor; |
|
154 }; |
|
155 |
41 |
156 //PDP Tier Manager |
42 //PDP Tier Manager |
157 class CPDPTierManager : public CCoreTierManager, public MPacketServiceNotifier |
43 class CPDPTierManager : public CCoreTierManager, public MPacketServiceNotifier |
158 { |
44 { |
159 public: |
45 public: |