vpnengine/vpnmanager/src/requestdispatcher.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Dispatches requests from clients (API) to CVpnApiServant.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "requestdispatcher.h"
       
    19 #include "vpnapiservant.h"
       
    20 
       
    21 
       
    22 CRequestDispatcher* CRequestDispatcher::NewL(RFs& aFs)
       
    23     {
       
    24     CRequestDispatcher* self = new (ELeave) CRequestDispatcher(aFs);
       
    25     CleanupStack::PushL(self) ;
       
    26     self->ConstructL() ;
       
    27     CleanupStack::Pop(self);
       
    28     return self ;
       
    29     }
       
    30 
       
    31 void CRequestDispatcher::ConstructL()
       
    32     {
       
    33     iVpnApiServant = CVpnApiServant::NewL(iFs);
       
    34     }
       
    35 
       
    36 CRequestDispatcher::CRequestDispatcher(RFs& aFs)
       
    37     : iFs(aFs)
       
    38     {
       
    39     }
       
    40 
       
    41 CRequestDispatcher::~CRequestDispatcher()
       
    42     {
       
    43     delete iVpnApiServant;
       
    44     }
       
    45 
       
    46 TBool CRequestDispatcher::ServiceL(const RMessage2& aMessage, CSession2* /*aSession*/)
       
    47     {
       
    48     TBool requestHandled = EFalse;
       
    49 
       
    50     requestHandled = iVpnApiServant->ServiceL(aMessage);
       
    51     
       
    52     if (!requestHandled)
       
    53         {
       
    54         User::Leave(KErrNotSupported);
       
    55         }
       
    56 
       
    57 	return requestHandled;
       
    58     }