telephonyprotocols/secondarypdpcontextumtsdriver/te_spudRSubConn/src/te_spudRSubConnSvr.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 // te_spudRSubConSvr.cpp
       
    15 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to
       
    16 // be started in the process of the client. The client initialises the server
       
    17 // by calling the one and only ordinal.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #include "te_spudRSubConnSvr.h"
       
    27 #include "te_spudRSubConnSteps.h"
       
    28 
       
    29 _LIT(KServerName,"TE_SpudRSubConnSvr");
       
    30 
       
    31 
       
    32 
       
    33 
       
    34 // EKA2 much simpler
       
    35 // just an E32Main and a MainL()
       
    36 
       
    37 /**
       
    38  * Much simpler, uses the new Rendezvous() call to sync with the client.
       
    39  *
       
    40  * @internalComponent
       
    41  *
       
    42  * @leave When new(ELeave) leaves 
       
    43  */
       
    44 LOCAL_C void MainL()
       
    45 	{
       
    46 	// leave the hooks in for platform security
       
    47 #if (defined __DATA_CAGING__)
       
    48 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    49 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    50 #endif
       
    51 	CActiveScheduler* sched = NULL;
       
    52 	sched = new(ELeave) CActiveScheduler;
       
    53 	CActiveScheduler::Install(sched);
       
    54 
       
    55 	CSpudRSubConTestServer* server = NULL;
       
    56 	// create the CTestServer derived server
       
    57 	TRAPD(err,server = CSpudRSubConTestServer::NewL());
       
    58 	if (!err)
       
    59 		{
       
    60 		// Sync with the client and enter the active scheduler
       
    61 		RProcess::Rendezvous(KErrNone);
       
    62 		sched->Start();
       
    63 		}
       
    64 	delete server;
       
    65 	delete sched;
       
    66 	}
       
    67 
       
    68 // only a DLL on emulator for typhoon and earlier
       
    69 
       
    70 /**
       
    71  * Main entry point.
       
    72  *
       
    73  * @internalComponent
       
    74  *
       
    75  * @return Standard Epoc error codes.
       
    76  */
       
    77 GLDEF_C TInt E32Main()
       
    78 	{
       
    79 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    80 	if (cleanup == NULL)
       
    81 		{
       
    82 		return KErrNoMemory;
       
    83 		}
       
    84 	TRAP_IGNORE(MainL());
       
    85 	delete cleanup;
       
    86 	return KErrNone;
       
    87     }
       
    88 
       
    89 // Create a thread in the calling process
       
    90 // Emulator typhoon and earlier
       
    91 
       
    92 /**
       
    93  * Called inside the MainL() function to create and start the CTestServer derived server.
       
    94  *
       
    95  * @internalComponent
       
    96  *
       
    97  * @return Instance of the test server.
       
    98  */
       
    99 CSpudRSubConTestServer* CSpudRSubConTestServer::NewL()
       
   100 	{
       
   101 	CSpudRSubConTestServer * server = new (ELeave) CSpudRSubConTestServer();
       
   102 	CleanupStack::PushL(server);
       
   103 	
       
   104 	// CServer base class call
       
   105 	server->StartL(KServerName);
       
   106 	CleanupStack::Pop(server);
       
   107 	return server;
       
   108 	}
       
   109 	
       
   110 
       
   111 
       
   112 
       
   113 /**
       
   114  * @return - A CTestStep derived instance
       
   115  * Implementation of CTestServer pure virtual
       
   116  */
       
   117 CTestStep* CSpudRSubConTestServer::CreateTestStep(const TDesC& aStepName)
       
   118 	{
       
   119 	CTestStep* step = NULL;
       
   120 	
       
   121 	// removed ELeave as harness will test ptr. This is more efficient
       
   122 	// than using TRAP_IGNORE
       
   123 	if(aStepName == KCUdp1)
       
   124 		{
       
   125 		step = new CUdp1;			
       
   126 		}
       
   127 	else if(aStepName == KCUdp2)
       
   128 		{
       
   129 		step = new CUdp2;
       
   130 		}
       
   131 	else if(aStepName == KCLoopbackPpp1)
       
   132 		{
       
   133 		step = new CLoopbackPpp1;			
       
   134 		}
       
   135 	else if(aStepName == KCUpperFlowOnLowerNifDown)
       
   136 		{
       
   137 		step = new CUpperFlowOnLowerNifDown;			
       
   138 		}
       
   139 	else if(aStepName == KCSpudPppPrimaryStop)
       
   140 		{
       
   141 		step = new CSpudPppPrimaryStop;
       
   142 		}
       
   143 	return step;
       
   144 	}
       
   145 
       
   146 
       
   147 
       
   148 
       
   149 
       
   150 
       
   151 
       
   152 
       
   153 
       
   154 
       
   155