natplugins/natpnatfwsdpprovider/tsrc/testconsole/inc/nsptestconsolesession.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NSPTESTCONSOLESESSION_H
       
    19 #define NSPTESTCONSOLESESSION_H
       
    20 
       
    21 #include "nspsessionobserver.h"
       
    22 
       
    23 class CRepository;
       
    24 class CSdpDocument;
       
    25 class CNSPPlugin;
       
    26 class CTestConsoleStream;
       
    27 class MAsyncService;
       
    28 
       
    29 
       
    30 class CNSPTestConsoleSession : public CBase, public MNSPSessionObserver
       
    31 	{
       
    32 public: // Enums
       
    33 
       
    34 	enum TSessionState
       
    35 		{
       
    36 		EInitializing = 0,
       
    37 		EIdle,
       
    38 		ECreateOffer,
       
    39 		ECreateAnswer,
       
    40 		EDecodeOffer,
       
    41 		EDecodeAnswer,
       
    42 		EUpdating
       
    43 		};
       
    44 
       
    45 public: // Methods
       
    46 	static CNSPTestConsoleSession* NewL( CNSPPlugin& aApi, CRepository& aCenrep,
       
    47 			 MAsyncService& aAsync );
       
    48 	static CNSPTestConsoleSession* NewLC( CNSPPlugin& aApi, CRepository& aCenrep,
       
    49 			 MAsyncService& aAsync );
       
    50 	virtual ~CNSPTestConsoleSession();
       
    51 	
       
    52 	// From MNSPSessionObserver
       
    53     virtual void Initialized( TUint aSessionId );
       
    54     virtual void OfferReady( TUint aSessionId, CSdpDocument* aOffer );
       
    55 	virtual void AnswerReady( TUint aSessionId, CSdpDocument* aAnswer );
       
    56     virtual void UpdateSdp( TUint aSessionId, CSdpDocument* aOffer );
       
    57     virtual void ErrorOccurred( TUint aSessionId, TInt aError );
       
    58     virtual void IcmpErrorOccurred( TUint aSessionId, TInt aError );
       
    59     
       
    60     // New methods
       
    61     TInt CreateOfferL( CTestConsoleStream& aOutStream );
       
    62     TInt ResolveL( CTestConsoleStream& aInStream, CTestConsoleStream& aOutStream );
       
    63     TInt DecodeAnswerL( CTestConsoleStream& aInStream );
       
    64     void UpdateL( CTestConsoleStream& aInStream );
       
    65     TSessionState State() const;
       
    66     void StoreOutStream( CTestConsoleStream* aOutStream );
       
    67     void StoreInStream( CTestConsoleStream* aInStream );
       
    68 
       
    69 protected: // Methods
       
    70 	CNSPTestConsoleSession( CNSPPlugin& aApi, MAsyncService& aAsync );
       
    71 	void ConstructL( CRepository& aCenrep );
       
    72 	
       
    73 	void StoreOffer( CSdpDocument* aOffer );
       
    74 	void StoreAnswer( CSdpDocument* aAnswer );
       
    75 
       
    76 private: // data	
       
    77 	TSessionState iState;
       
    78 	TUint iSessionId;
       
    79 	CNSPPlugin& iApi;
       
    80 	MAsyncService& iAsync;
       
    81 	CSdpDocument* iOffer; // own.
       
    82 	CSdpDocument* iAnswer; // own.
       
    83 	CTestConsoleStream* iOutStream; // own.
       
    84 	CTestConsoleStream* iInStream; // own.
       
    85 	};
       
    86 
       
    87 #endif // NSPTESTCONSOLESESSION_H