networkingtestandutils/networkingunittest/tdummyetel/etelQoS.cpp
changeset 0 af10295192d8
child 21 abbed5a4b42a
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2001-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 // Multimode Quality of Service (QoS) Support
       
    15 // GPRS, CDMAOne, CDMA2000
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "Et_clsvr.h"
       
    20 #include "ETELEXT.H"
       
    21 
       
    22 // ETel Packet header files
       
    23 #include "etelQoS.h"
       
    24 #include "pcktptr.h"
       
    25 #include "pcktcs.h"
       
    26 
       
    27 // Used by ETel to instruct TSY to create a name for the newly opened object
       
    28 _LIT(KETelNewQoSName, "::");
       
    29 
       
    30 /***********************************************************************************/
       
    31 //
       
    32 // RPacketQoS
       
    33 //
       
    34 /***********************************************************************************/
       
    35 
       
    36 EXPORT_C RPacketQoS::RPacketQoS()
       
    37 	:iEtelPacketQoSPtrHolder(NULL)
       
    38 	{
       
    39 	}
       
    40 
       
    41 void RPacketQoS::ConstructL()
       
    42 	{
       
    43 	__ASSERT_ALWAYS(iEtelPacketQoSPtrHolder == NULL, PanicClient(EEtelPanicHandleNotClosed));
       
    44 	iEtelPacketQoSPtrHolder = CPacketQoSPtrHolder::NewL(CEtelPacketPtrHolder::EMaxNumPacketQoSPtrSlots);
       
    45 	}
       
    46 
       
    47 void RPacketQoS::Destruct()
       
    48 	{
       
    49 	delete iEtelPacketQoSPtrHolder;
       
    50 	iEtelPacketQoSPtrHolder = NULL;
       
    51 	}
       
    52 
       
    53 EXPORT_C TInt RPacketQoS::OpenNewQoS(RPacketContext& aPacketContext, TDes& aProfileName)
       
    54 	{
       
    55 	RSessionBase session = aPacketContext.SessionHandle();
       
    56 	
       
    57 	TRAPD(ret,ConstructL());
       
    58 	if (ret)
       
    59 		{
       
    60 		return ret;
       
    61 		}
       
    62 	TInt subSessionHandle=aPacketContext.SubSessionHandle();
       
    63 	__ASSERT_ALWAYS(subSessionHandle!=0,PanicClient(EEtelPanicNullHandle)); // client has no existing sub-session!
       
    64 	TPtrC name(KETelNewQoSName);	// necessary so that server knows to ask TSY for new name
       
    65 	TIpcArgs args;
       
    66 	args.Set(0,&name);
       
    67 	args.Set(1,&aProfileName); // name to be created & passed back
       
    68 	args.Set(2,subSessionHandle);
       
    69 	SetSessionHandle(session);
       
    70 	ret = CreateSubSession(session,EEtelOpenFromSubSession,args);
       
    71 	if (ret)
       
    72 		Destruct();
       
    73 	return ret;
       
    74 	}
       
    75 
       
    76 EXPORT_C TInt RPacketQoS::OpenExistingQoS(RPacketContext& aPacketContext, const TDesC& aProfileName)
       
    77 //
       
    78 //	Opens a handle on existing QoS object. Returns KErrNotFound if it does not exist
       
    79 //
       
    80 	{
       
    81 	RSessionBase session = aPacketContext.SessionHandle();
       
    82 	
       
    83 	TRAPD(ret,ConstructL());
       
    84 	if (ret)
       
    85 		{
       
    86 		Destruct();
       
    87 		return ret;
       
    88 		}
       
    89 	TInt subSessionHandle=aPacketContext.SubSessionHandle();
       
    90 	__ASSERT_ALWAYS(subSessionHandle != 0,PanicClient(EEtelPanicNullHandle));
       
    91 	__ASSERT_ALWAYS(aProfileName.Length() != 0,PanicClient(KErrBadName));
       
    92 
       
    93 	TIpcArgs args;
       
    94 	args.Set(0,REINTERPRET_CAST(TAny*,CONST_CAST(TDesC*,&aProfileName)));
       
    95 	args.Set(1,TIpcArgs::ENothing);
       
    96 	args.Set(2,REINTERPRET_CAST(TAny*,subSessionHandle));
       
    97 	SetSessionHandle(session);
       
    98 	ret = CreateSubSession(session,EEtelOpenByNameFromSubSession,args);
       
    99 	if (ret)
       
   100 		Destruct();
       
   101 	return ret;
       
   102 	}
       
   103 
       
   104 EXPORT_C void RPacketQoS::Close()
       
   105 //
       
   106 // Close the client's current sub-session with ETel
       
   107 //
       
   108 	{
       
   109 	CloseSubSession(EEtelClose);
       
   110 	Destruct();
       
   111 	}
       
   112 
       
   113 EXPORT_C void RPacketQoS::SetProfileParameters(TRequestStatus& aStatus, TDes8& aProfile) const
       
   114 	{
       
   115 	Set(EPacketQoSSetProfileParams, aStatus, aProfile);
       
   116 	}
       
   117 
       
   118 EXPORT_C void RPacketQoS::GetProfileParameters(TRequestStatus& aStatus, TDes8& aProfile) const
       
   119 	{
       
   120 	Get(EPacketQoSGetProfileParams, aStatus, aProfile);
       
   121 	}
       
   122 
       
   123 EXPORT_C void RPacketQoS::GetProfileCapabilities(TRequestStatus& aStatus, TDes8& aProfileCaps) const
       
   124 	{
       
   125 	Get(EPacketQoSGetProfileCaps, aStatus, aProfileCaps);
       
   126 	}
       
   127 
       
   128 EXPORT_C void RPacketQoS::NotifyProfileChanged(TRequestStatus& aStatus, TDes8& aProfile) const
       
   129 	{
       
   130 	Get(EPacketQoSNotifyProfileChanged, aStatus, aProfile);
       
   131 	}
       
   132 
       
   133 
       
   134 EXPORT_C RPacketQoS::TQoSCapsGPRS::TQoSCapsGPRS()
       
   135 :TPacketDataConfigBase()
       
   136 	{
       
   137 	iExtensionId = KConfigGPRS;
       
   138 
       
   139 	iPrecedence = EUnspecifiedPrecedence;
       
   140 	iDelay = EUnspecifiedDelayClass;
       
   141 	iReliability = EUnspecifiedReliabilityClass;
       
   142 	iPeak = EUnspecifiedPeakThroughput;
       
   143 	iMean = EUnspecifiedMeanThroughput;
       
   144 	}
       
   145 
       
   146 EXPORT_C RPacketQoS::TQoSGPRSRequested::TQoSGPRSRequested()
       
   147 :TPacketDataConfigBase()
       
   148 	{
       
   149 	iExtensionId = KConfigGPRS;
       
   150 
       
   151 	iReqPrecedence = EUnspecifiedPrecedence;
       
   152 	iMinPrecedence = EUnspecifiedPrecedence;
       
   153 	iReqDelay = EUnspecifiedDelayClass;
       
   154 	iMinDelay = EUnspecifiedDelayClass;
       
   155 	iReqReliability = EUnspecifiedReliabilityClass;
       
   156 	iMinReliability = EUnspecifiedReliabilityClass;
       
   157 	iReqPeakThroughput = EUnspecifiedPeakThroughput;
       
   158 	iMinPeakThroughput = EUnspecifiedPeakThroughput;
       
   159 	iReqMeanThroughput = EUnspecifiedMeanThroughput;
       
   160 	iMinMeanThroughput = EUnspecifiedMeanThroughput;
       
   161 
       
   162 	}
       
   163 
       
   164 EXPORT_C RPacketQoS::TQoSGPRSNegotiated::TQoSGPRSNegotiated()
       
   165 :TPacketDataConfigBase()
       
   166 	{
       
   167 	iExtensionId = KConfigGPRS;
       
   168 
       
   169 	iPrecedence = EUnspecifiedPrecedence;
       
   170 	iDelay = EUnspecifiedDelayClass;
       
   171 	iReliability = EUnspecifiedReliabilityClass;
       
   172 	iPeakThroughput = EUnspecifiedPeakThroughput;
       
   173 	iMeanThroughput = EUnspecifiedMeanThroughput;
       
   174 
       
   175 	}
       
   176