datacommsserver/esockserver/test/TS_MultiHoming/TS_MultiHomingSuite.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2002-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 // Header for CTS_MultiHomingSuite class. This is the container
       
    15 // class for all the MultiHoming test steps
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 #if (!defined __TS_MULTIHOMING_H__)
       
    24 #define __TS_MULTIHOMING_H__
       
    25 
       
    26 #include <e32std.h>
       
    27 #include <c32comm.h>
       
    28 
       
    29 #include <es_sock.h>
       
    30 #include <in_sock.h>
       
    31 #include <networking/testsuite.h>
       
    32 #include <commdbconnpref.h>
       
    33 
       
    34 #define MAX_NAME_LENGTH		10			//< Maximum length of connection name
       
    35 #if defined (__WINS__)
       
    36 #define PDD_NAME _L("ECDRV")
       
    37 #define LDD_NAME _L("ECOMM")
       
    38 #else
       
    39 #define PDD_NAME _L("EUART1")
       
    40 #define LDD_NAME _L("ECOMM")
       
    41 #endif
       
    42 
       
    43 
       
    44 _LIT (KTxtVersion,"1.00");				//< Version string for ScheduleTest
       
    45 
       
    46 
       
    47 
       
    48 class CTS_MultiHomingStep;
       
    49 class CEnhancedScheduler;
       
    50 
       
    51 /**
       
    52  * Struct to hold the connection details
       
    53  * Contains a Socketserver and a connection
       
    54  */
       
    55 class TConnDetails
       
    56 {
       
    57 public:
       
    58 
       
    59 	TBool MatchName(const TDesC& aName) 
       
    60 		{
       
    61 		TInt ret = iName.Compare(aName);
       
    62 		if (ret==0)
       
    63 			return ETrue;
       
    64 		return EFalse;
       
    65 		}
       
    66 	TConnDetails() : iConnectionType(undefined), iClients(0), iNumStarts(0) {}
       
    67 
       
    68 	// Type of connection
       
    69 	enum { undefined, implicitConn, explicitConn, defaultConn } iConnectionType;
       
    70 
       
    71 	RConnection iConnection;		//< Reference to the Connection object
       
    72 	RSocketServ iSocketServ;		//< Reference to socket server object
       
    73 	RSocket		iSocket;			//< Referece to the socket used in implicit connections
       
    74 	TCommDbConnPref iConnPrefs;		//< Connection Prefererences
       
    75 	TBuf<MAX_NAME_LENGTH>	iName;	//< Friendly name of connection
       
    76 
       
    77 	TUint iClients;					//< Number of clients of this connection
       
    78 private:
       
    79 	TUint iNumStarts;				//< Number of times this connection has been started
       
    80 };
       
    81 
       
    82 class CTS_MultiHomingSuite : public CTestSuite
       
    83 {
       
    84 public:
       
    85 	virtual		~CTS_MultiHomingSuite();
       
    86 	void		InitialiseL( void );
       
    87 	void		AddTestStepL( CTS_MultiHomingStep* ptrTestStep );
       
    88 	TPtrC		GetVersion( void );	
       
    89 
       
    90 	// Connection details encapsulation
       
    91 	TConnDetails		*GetNewTConnection( );
       
    92 	TInt				AddConnection(const TConnDetails& aConn);
       
    93 	TConnDetails		*GetTConnection(const TDesC& aName);
       
    94 	RConnection			*GetRConnection(const TDesC& aName);
       
    95 	RSocketServ			*GetRSocketServ(const TDesC& aName);
       
    96 	TInt				CloseConnection(const TDesC& aName);
       
    97 	TInt				StopConnection(const TDesC& aName);
       
    98 	TInt				DisplayConnectionDetailsL();
       
    99 	TBool				CompareLinkLocalAddressesL();
       
   100 
       
   101 	CEnhancedScheduler*		iScheduler;		//< The ActiveScheduler
       
   102 	enum { MAX_CONNECTIONS = 100 };
       
   103 private:
       
   104 	TInt					GetConnIndex(const TDesC& aName);
       
   105 	TConnDetails	    iConnections[MAX_CONNECTIONS];	//< List of connections
       
   106 	
       
   107 };
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 class CEnhancedScheduler : public CActiveScheduler
       
   114 	{
       
   115 	public:
       
   116 		CEnhancedScheduler() : iEchoSocketCounter(0) {};
       
   117 		virtual ~CEnhancedScheduler() {};
       
   118 		
       
   119 		// Additional counter...
       
   120 		TInt GetCount() { return iEchoSocketCounter;};
       
   121 		void IncCount() { iEchoSocketCounter++;	};
       
   122 		void DecCount() { iEchoSocketCounter--; };
       
   123 
       
   124 	private:
       
   125 		TInt	iEchoSocketCounter;
       
   126 	};
       
   127 
       
   128 
       
   129 
       
   130 #endif /* __TS_MULTIHOMING_H__ */
       
   131