servicediscoveryandcontrol/pnp/test/upnp/Server/Flow/src/cprotocolhandler.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 // @file
       
    15 // @internalComponent
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "cprotocolhandler.h"
       
    20 
       
    21 
       
    22 CProtocolHandler::CProtocolHandler ( )
       
    23 	:iSocketHandler ( *this )
       
    24 	{
       
    25 	}
       
    26 CProtocolHandler::CProtocolHandler ( RInternalSocket& aSocket)
       
    27 : iSocketHandler ( *this ),
       
    28 iSocket ( aSocket )
       
    29 	{
       
    30 		
       
    31 	}	
       
    32 CProtocolHandler::~CProtocolHandler ( )
       
    33 	{
       
    34 	iTransactions.Reset ( );
       
    35 	// Cancel all socket operations
       
    36 	iSocketHandler.CancelAll( );
       
    37 	iSocket.Close( );
       
    38 	iTimer->StopTimer ();
       
    39 	delete iTimer;
       
    40 	}
       
    41 
       
    42 void CProtocolHandler::ConstructL () 
       
    43 	{
       
    44 	iTimer = CUPnPTimer::NewL ( *this );
       
    45 	}
       
    46 	
       
    47 TInt CProtocolHandler::FindTransaction ( CTransaction* aTransaction ) const
       
    48 	{
       
    49     return iTransactions.Find ( aTransaction );
       
    50     }
       
    51     
       
    52 TInt CProtocolHandler::FindTransaction ( const CRequest* aRequest ) const
       
    53 	{
       
    54 	for ( TInt i = 0; i < iTransactions.Count ( ); i++ )
       
    55 		{
       
    56 		if ( iTransactions[i]->Request ( ) == aRequest )
       
    57 			{
       
    58 			return i;
       
    59 			}
       
    60 		}
       
    61 	return KErrNotFound;
       
    62 	}
       
    63 
       
    64 
       
    65