telephonyprotocols/rawipnif/rawipnif2/inc/BinderBase.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
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 defines the base class for the protocol interface classes.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #ifndef BINDERBASE_H__
       
    23 #define BINDERBASE_H__
       
    24 
       
    25 #include <comms-infras/nifif.h>
       
    26 #include <comms-infras/commsbufchain.h>
       
    27 #include <es_mbuf.h>
       
    28 #include <comms-infras/ss_flowbinders.h>
       
    29 #include <comms-infras/linkprovision.h>
       
    30 #include "Constants.h"
       
    31 #include <comms-infras/es_protbinder.h>
       
    32 #include <networking/bca2.h>
       
    33 
       
    34 class CRawIP2Flow;
       
    35 class CBttLogger;
       
    36 
       
    37 class CBinderBase : public CBase, public ESock::MLowerDataSender, public ESock::MLowerControl,
       
    38 						BasebandChannelAdaptation2::MUpperControl, BasebandChannelAdaptation2::MUpperDataReceiver
       
    39 	{
       
    40 public:
       
    41 	friend class CRawIP2Flow;
       
    42 	CBinderBase(CRawIP2Flow& aFlow, CBttLogger* aTheLogger);
       
    43 	virtual ~CBinderBase();
       
    44 
       
    45 public:
       
    46 	// from ESock::MLowerControl
       
    47 	virtual TInt BlockFlow(ESock::MLowerControl::TBlockOption aOption);
       
    48 	virtual void ChangeFlow(CRawIP2Flow& aNewFlow);
       
    49 
       
    50 	//
       
    51 	// Utility calls from Flow during binding
       
    52 	//
       
    53 	ESock::MLowerDataSender* Bind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl);
       
    54 	void Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl);
       
    55 
       
    56 	// from BasebandChannelAdaptation2::MUpperControl
       
    57 	virtual void StartSending();
       
    58 	virtual void Error(TInt aErr);
       
    59 
       
    60 	virtual void SetProvision(const CIPConfig& aProvision) = 0;
       
    61 
       
    62 public:
       
    63 	virtual void UpdateContextConfigL(const TPacketDataConfigBase& aConfig);
       
    64 	virtual void UpdateConnectionSpeed(TUint aConnectionSpeed);
       
    65 
       
    66 	virtual TBool WantsProtocol(TUint16 aProtocolCode)=0;
       
    67 	
       
    68 	//from ESock::MUpperDataReceiver
       
    69 	virtual void Process(RMBufChain& aPdu) = 0;
       
    70 	virtual ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu) = 0; 
       
    71 	
       
    72 	//from BasebandChannelAdaptation2::MUpperDataReceiver
       
    73 	virtual void Process(RCommsBufChain& aPdu) = 0; 
       
    74 	
       
    75 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
       
    76 	void SetType(TUint16 aType); 
       
    77 #endif
       
    78 	void SetSender(BasebandChannelAdaptation2::MLowerDataSender* aLowerDataSender);
       
    79 
       
    80 public:
       
    81 	inline CRawIP2Flow& GetFlow();
       
    82 
       
    83 protected:
       
    84 	CRawIP2Flow* iFlow; // not owned
       
    85 	ESock::MUpperControl* iUpperControl;  // not owned
       
    86 	ESock::MUpperDataReceiver* iUpperReceiver;  // not owned
       
    87 	BasebandChannelAdaptation2::MLowerDataSender* iLowerDataSender; // not owned
       
    88 	CBttLogger* iTheLogger;
       
    89 	
       
    90 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
       
    91 	CIPTagHeader* iIPTagHeader; // owned
       
    92 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
       
    93 	
       
    94 	TBool iStarted:1; 
       
    95 
       
    96 	};
       
    97 
       
    98 
       
    99 CRawIP2Flow& CBinderBase::GetFlow()
       
   100 /**
       
   101  * Returns to reference to RawIPFlow2
       
   102  *
       
   103  * @return reference to CRawIPFlow2 class
       
   104  */
       
   105 	{
       
   106 	ASSERT(iFlow);
       
   107 	return *iFlow;
       
   108 	}
       
   109 
       
   110 #endif