genericopenlibs/openenvcore/backend/test/testbackenddes/src/tbackenddesblocks.cpp
changeset 31 ce057bb09d0b
child 45 4b03adbd26ca
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     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 // Name        : tbackenddesblocks.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32svr.h>
       
    19 #include "tbackenddes.h"
       
    20 #include "sysif.h"
       
    21 #include <pthread.h>
       
    22 #include <errno.h>
       
    23 #include <unistd.h>
       
    24 #include <fcntl.h>
       
    25 #include <sys/stat.h>
       
    26 #include <sys/types.h>
       
    27 #include <sys/socket.h>
       
    28 #include <sys/ioctl.h>
       
    29 #include <stdapis/netinet/in.h>
       
    30 #include <stdapis/arpa/inet.h>
       
    31 #include <netdb.h>
       
    32 
       
    33 #include <stdio.h>
       
    34 #include <semaphore.h>
       
    35 
       
    36 #ifdef __EPOC32__
       
    37 #define BACKEND_ORDINAL_NUMBER	7
       
    38 #else
       
    39 #define BACKEND_ORDINAL_NUMBER	6
       
    40 #endif
       
    41 
       
    42 //Utility functions
       
    43 void CTestBackendDes::ReadIntParam(TInt &aInt)
       
    44 {
       
    45 	_LIT( Kparam, "Param%d" );
       
    46      TBuf<8> pNameBuf;
       
    47      TPtrC string;
       
    48      pNameBuf.Format(Kparam,++iParamCnt);
       
    49 	 TBool res = GetIntFromConfig(ConfigSection(), pNameBuf, aInt);
       
    50 	 if(!res)
       
    51 	 	{
       
    52 	 	_LIT(Kerr , "Unable to retrieve integer parameter") ;
       
    53 	 	INFO_PRINTF1(Kerr);
       
    54 	  	}
       
    55 	 return;
       
    56 }
       
    57 
       
    58 // ============================ MEMBER FUNCTIONS ===============================
       
    59 // -----------------------------------------------------------------------------
       
    60 // CTestLibcbackend::CLSIDesTest
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 TInt CTestBackendDes::CLSIDesTest()
       
    64     {
       
    65 	int retVal = 0;
       
    66 	RLibrary lBackendLib;
       
    67 	TLibraryFunction backendFn = NULL;
       
    68 	CLocalSystemInterface* lClsi = 0;
       
    69 	lClsi = lClsi;
       
    70 	typedef CLocalSystemInterface* (*fnBackend)();
       
    71 	
       
    72 	fnBackend backendFnActual = NULL;
       
    73 	
       
    74 	_LIT(KInfo, "Loading backend.dll") ;
       
    75 	INFO_PRINTF1(KInfo);
       
    76 	retVal = lBackendLib.Load(_L("backend.dll"));
       
    77 	if(retVal!=KErrNone)
       
    78 		{
       
    79 		_LIT(Kerr , "Unable to load backend.dll") ;
       
    80 		INFO_PRINTF1(Kerr);
       
    81 		return retVal;
       
    82 		}
       
    83 	
       
    84 	backendFn = lBackendLib.Lookup(BACKEND_ORDINAL_NUMBER);
       
    85 	if(backendFn == NULL)
       
    86 		{
       
    87 		_LIT(Kerr , "Unable to lookup Backend()") ;
       
    88 		INFO_PRINTF1(Kerr);
       
    89 		}
       
    90 	else
       
    91 		{
       
    92 		_LIT(KInfo4, "Invoking Backend()") ;
       
    93 		INFO_PRINTF1(KInfo4);
       
    94 		backendFnActual = (fnBackend)backendFn;
       
    95 		lClsi = backendFnActual();
       
    96 		}
       
    97 	
       
    98 	_LIT(KInfo2, "Closing backend.dll") ;
       
    99 	INFO_PRINTF1(KInfo2);	
       
   100 	lBackendLib.Close();
       
   101 	_LIT(KInfo3, "backend.dll unloaded successfully") ;
       
   102 	INFO_PRINTF1(KInfo3);
       
   103 
       
   104 	return retVal;
       
   105     }
       
   106 	
       
   107 //  End of File