24
|
1 |
// Copyright (c) 2002-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 |
// This file implements the base class for the protocol interface classes.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <nifmbuf.h>
|
|
23 |
#include "ProtocolIfBase.h"
|
|
24 |
#include "RawIPNifMain.h"
|
|
25 |
|
|
26 |
CProtocolIfBase::CProtocolIfBase(CRawIPNifMain& aNifMain, CBttLogger* aTheLogger)
|
|
27 |
/**
|
|
28 |
* Constructor
|
|
29 |
*
|
|
30 |
* @param aNifMain A pointer to CRawIPNifMain
|
|
31 |
*/
|
|
32 |
:iNifMain(aNifMain),
|
|
33 |
iTheLogger(aTheLogger)
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
CProtocolIfBase::~CProtocolIfBase()
|
|
38 |
/**
|
|
39 |
* Destructor
|
|
40 |
*/
|
|
41 |
{
|
|
42 |
}
|
|
43 |
|
|
44 |
void CProtocolIfBase::BindL(TAny *aId)
|
|
45 |
/**
|
|
46 |
* Binds TCP/IP protocol to Nif
|
|
47 |
*
|
|
48 |
* @param aId A pointer to protocol object
|
|
49 |
*/
|
|
50 |
|
|
51 |
{
|
|
52 |
_LOG_L1C2(_L8("CProtocolIfBase::BindL [aId=%X]"), aId);
|
|
53 |
|
|
54 |
if (iProtocol)
|
|
55 |
_BTT_PANIC(KNifName, KNifProtocolInUse);
|
|
56 |
iProtocol = reinterpret_cast<CProtocolBase*>(aId);
|
|
57 |
}
|
|
58 |
|
|
59 |
TInt CProtocolIfBase::State()
|
|
60 |
/**
|
|
61 |
* Used to retrieve the Nif state
|
|
62 |
*
|
|
63 |
* @return The Nif state
|
|
64 |
*/
|
|
65 |
{
|
|
66 |
_LOG_L1C1(_L8("CProtocolIfBase::State"));
|
|
67 |
|
|
68 |
return GetNifMain().State();
|
|
69 |
}
|
|
70 |
|
|
71 |
TInt CProtocolIfBase::Control(TUint aLevel, TUint aName, TDes8& aOption, TAny* aSource)
|
|
72 |
/**
|
|
73 |
* This method will call the control method in IPv4Protocol
|
|
74 |
*
|
|
75 |
*/
|
|
76 |
{
|
|
77 |
_LOG_L1C1(_L8("CProtocolIfBase::Control"));
|
|
78 |
|
|
79 |
return GetNifMain().Control(aLevel, aName, aOption, aSource);
|
|
80 |
}
|
|
81 |
|
|
82 |
TInt CProtocolIfBase::Send(RMBufChain& aPdu, TAny* aSource)
|
|
83 |
/**
|
|
84 |
* Send and IP packet. This method is overriden by the IPv4ProtocolIf class.
|
|
85 |
*
|
|
86 |
* @param aPdu The outgoing packet
|
|
87 |
* @param aSource The source of the packet
|
|
88 |
* @return Standard error codes
|
|
89 |
*/
|
|
90 |
{
|
|
91 |
_LOG_L1C1(_L8("CProtocolIfBase::Send"));
|
|
92 |
|
|
93 |
return GetNifMain().Send(aPdu, aSource);
|
|
94 |
}
|
|
95 |
|
|
96 |
void CProtocolIfBase::Info(TNifIfInfo& aInfo) const
|
|
97 |
/**
|
|
98 |
* Used to retrieved Nif information
|
|
99 |
*
|
|
100 |
* @param aInfo Nif Information structure
|
|
101 |
*/
|
|
102 |
{
|
|
103 |
_LOG_L1C1(_L8("CProtocolIfBase::Info"));
|
|
104 |
|
|
105 |
aInfo.iVersion = TVersion(KNifMajorVersionNumber, KNifMinorVersionNumber,
|
|
106 |
KNifBuildVersionNumber);
|
|
107 |
aInfo.iFlags = KNifIfIsBase | KNifIfUsesNotify | KNifIfCreatedByLink;
|
|
108 |
// Doesn't fill in aInfo.iName, as this is done by derived classes.
|
|
109 |
aInfo.iProtocolSupported = KProtocolInetIp;
|
|
110 |
}
|
|
111 |
|
|
112 |
TInt CProtocolIfBase::Notification(TAgentToNifEventType /*aEvent*/, void* /*aInfo*/)
|
|
113 |
/**
|
|
114 |
* Method overidden by the notification method on IPv4ProtocolIf class.
|
|
115 |
*
|
|
116 |
* @param aEvent Not used
|
|
117 |
* @param aInfo Not used
|
|
118 |
*/
|
|
119 |
{
|
|
120 |
_LOG_L1C1(_L8("CProtocolIfBase::Notification"));
|
|
121 |
|
|
122 |
return KErrNone;
|
|
123 |
}
|
|
124 |
|
|
125 |
void CProtocolIfBase::StartSending(CProtocolBase* /*aProtocol*/)
|
|
126 |
/**
|
|
127 |
* Indicates to the protocol layer that the NIF is ready to send packets.
|
|
128 |
*
|
|
129 |
* @param aProtocol A pointer to a protocol
|
|
130 |
*/
|
|
131 |
{
|
|
132 |
_LOG_L1C1(_L8("CProtocolIfBase::StartSending"));
|
|
133 |
|
|
134 |
// Default implementation.
|
|
135 |
// Uses iProtocol instead aProtocol.
|
|
136 |
iProtocol->StartSending(reinterpret_cast<CProtocolBase*>(this));
|
|
137 |
}
|
|
138 |
|
|
139 |
|
|
140 |
void CProtocolIfBase::UpdateContextConfigL(const
|
|
141 |
RPacketContext::TContextConfigGPRS& /*aConfig*/)
|
|
142 |
/**
|
|
143 |
* Method overidden by UpdateContextConfig on IPv4ProtocolIf class
|
|
144 |
*
|
|
145 |
* @param aConfig Not used
|
|
146 |
*/
|
|
147 |
{
|
|
148 |
// Default implementation does nothing.
|
|
149 |
}
|
|
150 |
|
|
151 |
void CProtocolIfBase::UpdateConnectionSpeed(TUint /*aConnectionSpeed*/)
|
|
152 |
/**
|
|
153 |
* Method overidden by UpdateConnectionSpeed on IPv4ProtocolIf class
|
|
154 |
*
|
|
155 |
* @param aConnectionSpeed Not used
|
|
156 |
*/
|
|
157 |
{
|
|
158 |
// Default implementation does nothing.
|
|
159 |
}
|