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 |
#include <etelqos.h>
|
|
17 |
#include <comms-infras/ss_metaconnprov.h>
|
|
18 |
#include <comms-infras/ss_nodeinterfaces.h>
|
|
19 |
#include <elements/nm_messages_errorrecovery.h>
|
|
20 |
#include <comms-infras/ss_mcprnodemessages.h>
|
|
21 |
#include "pdpmcpr.h"
|
|
22 |
#include "pdpmcprstates.h"
|
|
23 |
|
|
24 |
using namespace ESock;
|
|
25 |
using namespace NetStateMachine;
|
|
26 |
using namespace Messages;
|
|
27 |
|
|
28 |
namespace PdpMCprStates
|
|
29 |
{
|
|
30 |
}
|
|
31 |
|
|
32 |
namespace PdpMCprErrorRecoveryActivity
|
|
33 |
{
|
|
34 |
|
|
35 |
DEFINE_SMELEMENT(CPdpErrorRecoveryActivity::TAwaitingContentionResult, NetStateMachine::MState, PdpMCprStates::TContext)
|
|
36 |
TBool CPdpErrorRecoveryActivity::TAwaitingContentionResult::Accept()
|
|
37 |
{
|
|
38 |
TPDPMessages::TPdpContentionResultMessage* msg = message_cast<TPDPMessages::TPdpContentionResultMessage>(&iContext.iMessage);
|
|
39 |
CPdpErrorRecoveryActivity& activity = static_cast<CPdpErrorRecoveryActivity&>(*iContext.iNodeActivity);
|
|
40 |
if(msg && msg->iNodeId == activity.iPendingCprId)
|
|
41 |
{
|
|
42 |
return ETrue;
|
|
43 |
}
|
|
44 |
return EFalse;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
DEFINE_SMELEMENT(CPdpErrorRecoveryActivity::TPdpContentionNoTagOrError, NetStateMachine::MStateFork, PdpMCprStates::TContext)
|
|
49 |
TInt CPdpErrorRecoveryActivity::TPdpContentionNoTagOrError::TransitionTag()
|
|
50 |
{
|
|
51 |
CPdpErrorRecoveryActivity& activity = static_cast<CPdpErrorRecoveryActivity&>(*iContext.iNodeActivity);
|
|
52 |
|
|
53 |
if (activity.iPendingCprId == Messages::TNodeId::NullId())
|
|
54 |
{
|
|
55 |
return MeshMachine::KErrorTag;
|
|
56 |
}
|
|
57 |
else
|
|
58 |
{
|
|
59 |
return MeshMachine::KNoTag;
|
|
60 |
}
|
|
61 |
}
|
|
62 |
|
|
63 |
DEFINE_SMELEMENT(CPdpErrorRecoveryActivity::TProcessErrorRecoveryReq, NetStateMachine::MStateTransition, PdpMCprStates::TContext)
|
|
64 |
void CPdpErrorRecoveryActivity::TProcessErrorRecoveryReq::DoL()
|
|
65 |
{
|
|
66 |
TEErrorRecovery::TErrorRecoveryRequest& req = message_cast<TEErrorRecovery::TErrorRecoveryRequest>(iContext.iMessage);
|
|
67 |
TInt error = req.iErrContext.iStateChange.iError;
|
|
68 |
|
|
69 |
#ifdef SYMBIAN_NETWORKING_CONTENTION_MANAGEMENT
|
|
70 |
if (req.iErrContext.iStateChange.iError == KErrUmtsMaxNumOfContextExceededByNetwork ||
|
|
71 |
req.iErrContext.iStateChange.iError == KErrUmtsMaxNumOfContextExceededByPhone)
|
|
72 |
{
|
|
73 |
// Get sender's priority
|
|
74 |
TClientIter<TDefaultClientMatchPolicy> iter = iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TCFClientType(TCFClientType::EData));
|
|
75 |
ESock::RCFNodePriorityInterface* dataClient;
|
|
76 |
TBool wasFound = EFalse;
|
|
77 |
TUint cprPriority = KMaxTUint;
|
|
78 |
while ((dataClient = static_cast<RCFNodePriorityInterface*>(iter++)) != NULL)
|
|
79 |
{
|
|
80 |
if (dataClient->RecipientId() == req.iErrContext.iOriginator)
|
|
81 |
{
|
|
82 |
cprPriority = dataClient->Priority();
|
|
83 |
wasFound = ETrue;
|
|
84 |
}
|
|
85 |
}
|
|
86 |
if (wasFound)
|
|
87 |
{
|
|
88 |
TInt err = KErrNone;
|
|
89 |
TBool result = EFalse;
|
|
90 |
TRAP(err, result = iContext.Node().GetTierManager()->HandleContentionL(&iContext.Node(), req.iErrContext.iOriginator, cprPriority));
|
|
91 |
if (err == KErrNone && result)
|
|
92 |
{
|
|
93 |
CPdpErrorRecoveryActivity& activity = static_cast<CPdpErrorRecoveryActivity&>(*iContext.iNodeActivity);
|
|
94 |
activity.iPendingCprId = req.iErrContext.iOriginator;
|
|
95 |
activity.iCprActivity = req.iErrContext.iActivitySigId;
|
|
96 |
activity.iCprMessageId = req.iErrContext.iMessageId;
|
|
97 |
activity.iErrorCode = error;
|
|
98 |
// The contention request has been added into query, Reset message error code.
|
|
99 |
// TErrResponse will be send from Mcpr's ContentionResolved function.
|
|
100 |
error = KErrNone;
|
|
101 |
}
|
|
102 |
}
|
|
103 |
}
|
|
104 |
#endif
|
|
105 |
|
|
106 |
if (error != KErrNone)
|
|
107 |
{
|
|
108 |
TErrResponse propagateResp(TErrResponse::EPropagate, error, req.iErrContext.iMessageId);
|
|
109 |
TEErrorRecovery::TErrorRecoveryResponse rawResp (propagateResp);
|
|
110 |
|
|
111 |
TCFSafeMessage::TResponseCarrierWest<TEErrorRecovery::TErrorRecoveryResponse> resp(rawResp, iContext.iSender);
|
|
112 |
iContext.PostToSender(resp);
|
|
113 |
}
|
|
114 |
}
|
|
115 |
|
|
116 |
DEFINE_SMELEMENT(CPdpErrorRecoveryActivity::TProcessContentionResult, NetStateMachine::MStateTransition, PdpMCprStates::TContext)
|
|
117 |
void CPdpErrorRecoveryActivity::TProcessContentionResult::DoL()
|
|
118 |
{
|
|
119 |
TPDPMessages::TPdpContentionResultMessage* msg = message_cast<TPDPMessages::TPdpContentionResultMessage>(&iContext.iMessage);
|
|
120 |
CPdpErrorRecoveryActivity& activity = static_cast<CPdpErrorRecoveryActivity&>(*iContext.iNodeActivity);
|
|
121 |
if (msg->iValue != 0)
|
|
122 |
{
|
|
123 |
TErrResponse retryResp(TErrResponse::ERetry, 0, activity.iCprMessageId);
|
|
124 |
TEErrorRecovery::TErrorRecoveryResponse rawResp (retryResp);
|
|
125 |
TCFSafeMessage::TResponseCarrierWest<TEErrorRecovery::TErrorRecoveryResponse> resp(rawResp, activity.iOriginators[0].RecipientId());
|
|
126 |
iContext.PostToSender(resp);
|
|
127 |
}
|
|
128 |
else
|
|
129 |
{
|
|
130 |
TErrResponse propagateResp(TErrResponse::EPropagate, activity.iErrorCode, activity.iCprMessageId);
|
|
131 |
TEErrorRecovery::TErrorRecoveryResponse rawResp (propagateResp);
|
|
132 |
TCFSafeMessage::TResponseCarrierWest<TEErrorRecovery::TErrorRecoveryResponse> resp(rawResp, activity.iOriginators[0].RecipientId());
|
|
133 |
iContext.PostToSender(resp);
|
|
134 |
}
|
|
135 |
}
|
|
136 |
}
|
|
137 |
|