telephonyprotocols/rawipnif/rawipnif2/src/BinderBase.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 /**
    18 /**
    19  @file
    19  @file
    20 */
    20 */
    21 
    21 
    22 
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "BinderBaseTraces.h"
       
    26 #endif
       
    27 
       
    28 #include <nifmbuf.h>
    22 #include <nifmbuf.h>
    29 #include "BinderBase.h"
    23 #include "BinderBase.h"
    30 #include "RawIP2Flow.h"
    24 #include "RawIP2Flow.h"
    31 #include "BcaController.h"
    25 #include "BcaController.h"
    32 
    26 
    33 CBinderBase::CBinderBase(CRawIP2Flow& aFlow)
    27 CBinderBase::CBinderBase(CRawIP2Flow& aFlow, CBttLogger* aTheLogger)
    34 /**
    28 /**
    35  * Constructor
    29  * Constructor
    36  *
    30  *
    37  * @param aNifMain A pointer to CRawIPFlow
    31  * @param aNifMain A pointer to CRawIPFlow
    38  */
    32  */
    39 	:iFlow(&aFlow),
    33 	:iFlow(&aFlow),
       
    34 	iTheLogger(aTheLogger),
    40 	iStarted(EFalse)
    35 	iStarted(EFalse)
    41 	{	
    36 	{	
    42 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
    37 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
    43 	iIPTagHeader = new (ELeave) CIPTagHeader();
    38 	iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger);
    44 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
    39 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
    45 	}
    40 	}
    46 
    41 
    47 CBinderBase::~CBinderBase()
    42 CBinderBase::~CBinderBase()
    48 /**
    43 /**
    58 void CBinderBase::SetType(TUint16 aType)
    53 void CBinderBase::SetType(TUint16 aType)
    59 {
    54 {
    60 /**
    55 /**
    61  *	Used to specify the type of the IP header.
    56  *	Used to specify the type of the IP header.
    62  */
    57  */
    63 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBINDERBASE_SETTYPE_1, "CBinderBase::SetType");
    58 	_LOG_L1C1(_L8("CBinderBase::SetType"));
    64 	
    59 	
    65 	iIPTagHeader->SetType(aType);	
    60 	iIPTagHeader->SetType(aType);	
    66 }
    61 }
    67 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
    62 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
    68 
    63 
   106  *
   101  *
   107  * @param aUpperReceiver A pointer to Upper layer Receive class
   102  * @param aUpperReceiver A pointer to Upper layer Receive class
   108  * @param aUpperControl A pointer to Upper layer control class
   103  * @param aUpperControl A pointer to Upper layer control class
   109  */
   104  */
   110 	{
   105 	{
   111     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBINDERBASE_BIND_1, "CBinderBase:\tBind()");
   106     _LOG_L1C1(_L8("CBinderBase:\tBind()"));
   112 
   107 
   113 	iUpperReceiver = aUpperReceiver;
   108 	iUpperReceiver = aUpperReceiver;
   114 	iUpperControl = aUpperControl;
   109 	iUpperControl = aUpperControl;
   115 	return this;
   110 	return this;
   116 	}
   111 	}
   117 
   112 
   118 void CBinderBase::Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl)
   113 void CBinderBase::Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl)
   119     {
   114     {
   120 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBINDERBASE_UNBIND_1, "CBinderBase:\tUnbind()");
   115 	_LOG_L1C1(_L8("CBinderBase:\tUnbind()"));
   121 	
   116 	
   122 #ifndef _DEBUG
   117 #ifndef _DEBUG
   123 	(void) aUpperReceiver;
   118 	(void) aUpperReceiver;
   124 	(void) aUpperControl;
   119 	(void) aUpperControl;
   125 #endif
   120 #endif
   135  * Indicates to the protocol layer that the NIF is ready to send packets.
   130  * Indicates to the protocol layer that the NIF is ready to send packets.
   136  *
   131  *
   137  * @param aProtocol A pointer to a protocol
   132  * @param aProtocol A pointer to a protocol
   138  */
   133  */
   139 	{
   134 	{
   140 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBINDERBASE_STARTSENDING_1, "CBinderBase:\tStartSending()");
   135 	_LOG_L1C1(_L8("CBinderBase:\tStartSending()"));
   141 
   136 
   142 	if (!iStarted)
   137 	if (!iStarted)
   143 		{
   138 		{
   144 		GetFlow().LinkLayerUp();
   139 		GetFlow().LinkLayerUp();
   145 		iStarted = ETrue;
   140 		iStarted = ETrue;
   155  * Indicates to the protocol layer that a fatal error has occured in the BCA.
   150  * Indicates to the protocol layer that a fatal error has occured in the BCA.
   156  *
   151  *
   157  * @param aProtocol A pointer to a protocol
   152  * @param aProtocol A pointer to a protocol
   158  */
   153  */
   159 	{
   154 	{
   160 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBINDERBASE_ERROR_1, "CBinderBase:\tError()");
   155 	_LOG_L1C1(_L8("CBinderBase:\tError()"));
   161 
   156 
   162 	// Default implementation.
   157 	// Default implementation.
   163 	// Uses iProtocol instead aProtocol.
   158 	// Uses iProtocol instead aProtocol.
   164 	iUpperControl->Error(aErr);
   159 	iUpperControl->Error(aErr);
   165 	}
   160 	}