24
|
1 |
// Copyright (c) 2007-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 |
#ifndef __CONTEXT_H__
|
|
17 |
#define __CONTEXT_H__
|
|
18 |
|
|
19 |
#include <networking/umtsnifcontrolif.h> // ..for TContextConfig, etc..
|
|
20 |
#include <timeout.h>
|
|
21 |
|
|
22 |
#include "parameters.h" // ..for TPacketFilter, etc..
|
|
23 |
|
|
24 |
class CRequestBase;
|
|
25 |
class TFTInfo;
|
|
26 |
class RExtensionData;
|
|
27 |
class CFlowData;
|
|
28 |
class CNif;
|
|
29 |
|
|
30 |
/*
|
|
31 |
* The returned sblp sub error should be between 1-7 in the PCO buffer
|
|
32 |
* see TS 29.207, annex D for details
|
|
33 |
*/
|
|
34 |
enum TSblpSubErrorRange
|
|
35 |
{
|
|
36 |
ESblpSubErrorValueMinimum = 1,
|
|
37 |
ESblpSubErrorValueMaximum = 7
|
|
38 |
};
|
|
39 |
|
|
40 |
|
|
41 |
const TUint KMaxPacketFilters = 8;
|
|
42 |
|
|
43 |
class RContextConfig : public TContextConfig
|
|
44 |
/**
|
|
45 |
* Add some access functions to the TContextConfig
|
|
46 |
*/
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
// Allow access to TFTInfo without needing a copy
|
|
50 |
inline TTFTInfo& TFTInfo() { return iTFTInfo; }
|
|
51 |
};
|
|
52 |
|
|
53 |
class CPdpContext : public CBase
|
|
54 |
{
|
|
55 |
friend class CNif;
|
|
56 |
friend class CRequestBase;
|
|
57 |
public:
|
|
58 |
|
|
59 |
static CPdpContext* NewL(CNif& aNifItem, const TContextType& aType, TUint8 aContextId);
|
|
60 |
|
|
61 |
~CPdpContext();
|
|
62 |
|
|
63 |
TInt Activate();
|
|
64 |
void ActivateReply(CRequestBase* aRequest, const TContextParameters& aParams);
|
|
65 |
|
|
66 |
TInt ModifyActive();
|
|
67 |
void ModifyActiveReply(CRequestBase* aRequest, const TContextParameters& aParams);
|
|
68 |
|
|
69 |
TInt SetQoS();
|
|
70 |
TInt SetQoS(const TQoSParameters& aGeneric, const TQoSRequested& aUmts);
|
|
71 |
void SetQoSReply(CRequestBase* aRequest, const TContextParameters& aParams);
|
|
72 |
|
|
73 |
TInt ModifyTft(const TTFTOperationCode& aTFTOperationCode, const TTFTInfo& aTft);
|
|
74 |
void ModifyTftReply(CRequestBase* aRequest, const TContextParameters& aParams);
|
|
75 |
|
|
76 |
void ParametersChangedEvent(const TContextParameters& aParams);
|
|
77 |
void DeleteEvent(const TContextParameters& aParams);
|
|
78 |
|
|
79 |
TInt Delete();
|
|
80 |
TInt AddPacketFilter(CFlowData& aFlow, TTFTInfo& aTft);
|
|
81 |
TInt RemovePacketFilter(TTFTInfo& aTft, const CFlowData* aFlow = NULL);
|
|
82 |
|
|
83 |
void Block();
|
|
84 |
void UnBlock();
|
|
85 |
inline TUint IsFlowBlocked() const;
|
|
86 |
|
|
87 |
void FlowAttached();
|
|
88 |
void FlowDetached();
|
|
89 |
void SetContextStatus(const RPacketContext::TContextStatus& aStatus);
|
|
90 |
|
|
91 |
TInt GetQoSRanking();
|
|
92 |
TBool IsPrimary() const;
|
|
93 |
|
|
94 |
inline TInt RefCount() const;
|
|
95 |
inline TInt ContextId() const;
|
|
96 |
inline TInt ChannelId() const;
|
|
97 |
inline void SetChannelId(TInt aChannelId);
|
|
98 |
inline CNif& Nif();
|
|
99 |
inline const RExtensionData& Extension() const;
|
|
100 |
inline TBool ContextActive() const;
|
|
101 |
inline TBool ContextInactive() const;
|
|
102 |
inline RPacketContext::TContextStatus ContextStatus() const;
|
|
103 |
inline TInt TrafficClass() const;
|
|
104 |
inline TDblQue<CFlowData>& Flows();
|
|
105 |
inline TContextType ContextType() const;
|
|
106 |
|
|
107 |
protected:
|
|
108 |
TSglQueLink iNext;
|
|
109 |
|
|
110 |
CPdpContext(CNif& aNifItem, TContextType aType, TUint8 aContextId);
|
|
111 |
static TBool CheckSblpErrorInPcoBuffer(const TContextParameters& aParams, TUint8& parsedSblpErrorValue);
|
|
112 |
|
|
113 |
void ConstructL();
|
|
114 |
void GenerateEvent(TUint aEventType, const TContextParameters& aParams);
|
|
115 |
TBool MatchPacketFilter(const TPacketFilter& aFlow, const TPacketFilter& aFilter) const;
|
|
116 |
TInt FindPacketFilterId();
|
|
117 |
void Update(const TContextParameters& aParams);
|
|
118 |
|
|
119 |
private:
|
|
120 |
void NotifyBlockingState(TUint aOldBlocking);
|
|
121 |
|
|
122 |
TInt iRefs; // count of attached flows (just for information)
|
|
123 |
|
|
124 |
// Blocked/Unblocked status as indicated by NIF. If NIF reports
|
|
125 |
// "blocked", the context stays blocked until NIF reports "unblock"
|
|
126 |
// This is totally independent of context status and flow blocking:
|
|
127 |
// flows are blocked if context is "blocked" *OR* status is not active.
|
|
128 |
TUint8 iBlocked;
|
|
129 |
|
|
130 |
TUint8 iContextId;
|
|
131 |
TInt iChannelId;
|
|
132 |
TContextType iContextType;
|
|
133 |
RPacketContext::TContextStatus iContextStatus;
|
|
134 |
|
|
135 |
CNif& iNifItem; // Nif interface
|
|
136 |
TDblQue<CFlowData> iFlows; // Flow list
|
|
137 |
|
|
138 |
// Currently Active filters.
|
|
139 |
TInt iNumFilters;
|
|
140 |
TPacketFilter iFilters[KMaxPacketFilters];
|
|
141 |
|
|
142 |
// Current parameters/configuration
|
|
143 |
TQoSNegotiated iNegotiated;
|
|
144 |
public:
|
|
145 |
// Timeout handling
|
|
146 |
void Timeout();
|
|
147 |
RTimeout iTimeout;
|
|
148 |
};
|
|
149 |
|
|
150 |
// inline methods
|
|
151 |
inline TContextType CPdpContext::ContextType() const
|
|
152 |
{ return iContextType; }
|
|
153 |
|
|
154 |
inline TInt CPdpContext::ContextId() const
|
|
155 |
{ return iContextId; }
|
|
156 |
|
|
157 |
inline TInt CPdpContext::ChannelId() const
|
|
158 |
{ return iChannelId; }
|
|
159 |
|
|
160 |
inline void CPdpContext::SetChannelId(TInt aChannelId)
|
|
161 |
{ iChannelId = aChannelId; }
|
|
162 |
|
|
163 |
inline CNif& CPdpContext::Nif()
|
|
164 |
{ return iNifItem; }
|
|
165 |
|
|
166 |
inline TInt CPdpContext::RefCount() const
|
|
167 |
{ return iRefs; }
|
|
168 |
|
|
169 |
inline TBool CPdpContext::ContextActive() const
|
|
170 |
{ return (iContextStatus == RPacketContext::EStatusActive); }
|
|
171 |
|
|
172 |
inline TBool CPdpContext::ContextInactive() const
|
|
173 |
{ return (iContextStatus == RPacketContext::EStatusInactive); }
|
|
174 |
|
|
175 |
inline RPacketContext::TContextStatus CPdpContext::ContextStatus() const
|
|
176 |
{ return iContextStatus; }
|
|
177 |
|
|
178 |
inline TInt CPdpContext::TrafficClass() const
|
|
179 |
{ return iNegotiated.iTrafficClass; }
|
|
180 |
|
|
181 |
inline TDblQue<CFlowData>& CPdpContext::Flows()
|
|
182 |
{ return iFlows; }
|
|
183 |
|
|
184 |
inline TUint CPdpContext::IsFlowBlocked() const
|
|
185 |
// Flows are blocked if either explicit blocking from NIF is on,
|
|
186 |
// or the context is not active.
|
|
187 |
{ return iBlocked || !ContextActive(); }
|
|
188 |
|
|
189 |
typedef TDblQueIter<CFlowData> TDblFlowIter;
|
|
190 |
|
|
191 |
#endif
|