telephonyprotocols/rawipnif/src/BinderBase.cpp
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-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 "BinderBase.h"
       
    24 #include "RawIPFlow.h"
       
    25 
       
    26 using namespace ESock;
       
    27 
       
    28 CBinderBase::CBinderBase(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
       
    29 /**
       
    30  * Constructor
       
    31  *
       
    32  * @param aNifMain A pointer to CRawIPFlow
       
    33  */
       
    34 	:iFlow(&aFlow),
       
    35 	 iTheLogger(aTheLogger)
       
    36 	{
       
    37 	}
       
    38 
       
    39 CBinderBase::~CBinderBase()
       
    40 /**
       
    41  * Destructor
       
    42  */
       
    43 	{
       
    44 	}
       
    45 
       
    46 // from ESock::MLowerControl
       
    47 TInt CBinderBase::BlockFlow(MLowerControl::TBlockOption /*aOption*/)
       
    48 	{
       
    49 	return KErrNotSupported;
       
    50 	}
       
    51 	
       
    52 void CBinderBase::ChangeFlow(CRawIPFlow& aNewFlow)
       
    53     {
       
    54     ASSERT(iFlow);
       
    55     iFlow = &aNewFlow;
       
    56     }
       
    57 
       
    58 MLowerDataSender* CBinderBase::Bind(MUpperDataReceiver* aUpperReceiver, MUpperControl* aUpperControl)
       
    59 /**
       
    60  * Binds TCP/IP protocol to Flow
       
    61  *
       
    62  * @param aUpperReceiver A pointer to Upper layer Receive class
       
    63  * @param aUpperControl A pointer to Upper layer control class
       
    64  */
       
    65 	{
       
    66     _LOG_L1C1(_L8("CBinderBase:\tBind()"));
       
    67 
       
    68 	iUpperReceiver = aUpperReceiver;
       
    69 	iUpperControl = aUpperControl;
       
    70 	return this;
       
    71 	}
       
    72 
       
    73 void CBinderBase::Unbind(MUpperDataReceiver* aUpperReceiver, MUpperControl* aUpperControl)
       
    74     {
       
    75 	_LOG_L1C1(_L8("CBinderBase:\tUnbind()"));
       
    76 	
       
    77 #ifndef _DEBUG
       
    78 	(void) aUpperReceiver;
       
    79 	(void) aUpperControl;
       
    80 #endif
       
    81 
       
    82 	ASSERT(aUpperReceiver == iUpperReceiver);
       
    83 	ASSERT(aUpperControl == iUpperControl);
       
    84 	iUpperReceiver = NULL;
       
    85 	iUpperControl = NULL;
       
    86 	}
       
    87 
       
    88 void CBinderBase::StartSending()
       
    89 /**
       
    90  * Indicates to the protocol layer that the NIF is ready to send packets.
       
    91  *
       
    92  * @param aProtocol A pointer to a protocol
       
    93  */
       
    94 	{
       
    95 	_LOG_L1C1(_L8("CBinderBase:\tStartSending()"));
       
    96 
       
    97 	// Default implementation.
       
    98 	// Uses iProtocol instead aProtocol.
       
    99 	iUpperControl->StartSending();
       
   100 	}
       
   101 
       
   102 void CBinderBase::UpdateContextConfigL(const TPacketDataConfigBase& /*aConfig*/)
       
   103 /**
       
   104  * Method overidden by UpdateContextConfig on IPv4ProtocolIf class
       
   105  *
       
   106  * @param aConfig Not used
       
   107  */
       
   108 	{
       
   109 	// Default implementation does nothing.
       
   110 	}
       
   111 
       
   112 void CBinderBase::UpdateConnectionSpeed(TUint /*aConnectionSpeed*/)
       
   113 /**
       
   114  * Method overidden by UpdateConnectionSpeed on IPv4Binder class
       
   115  *
       
   116  * @param aConnectionSpeed Not used
       
   117  */
       
   118 	{
       
   119 	// Default implementation does nothing.
       
   120 	}