telephonyprotocols/qosextnapi/src/imsextn.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
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 // imsapi.cpp - IMS QoS API
       
    15 //
       
    16 
       
    17 #include "imsextn.h"
       
    18 #include "qosextn_log.h"
       
    19 
       
    20 //#ifdef SYMBIAN_NETWORKING_UMTS5
       
    21 
       
    22 #include "qosextn_constants.h"
       
    23 #include <networking/qosparameters.h>
       
    24 // Buffer size
       
    25 const TUint KImsApiBufSize = 8192;
       
    26 
       
    27 
       
    28 EXPORT_C TImsParameter::TImsParameter() : iIMSSignallingIndicator(EFalse)
       
    29 	{
       
    30 	}
       
    31 
       
    32 EXPORT_C TBool TImsParameter::GetIMSSigallingIndicator() const
       
    33 	{
       
    34 	return iIMSSignallingIndicator;
       
    35 	}
       
    36 
       
    37 EXPORT_C void TImsParameter::SetIMSSigallingIndicator(const TBool aIMSSignallingIndicator)
       
    38 	{
       
    39 	iIMSSignallingIndicator = aIMSSignallingIndicator;
       
    40 	}
       
    41 
       
    42 //
       
    43 // CImsPolicy
       
    44 //
       
    45 EXPORT_C CImsPolicy* CImsPolicy::NewL()
       
    46 	{
       
    47 	CImsPolicy* policy = new (ELeave) CImsPolicy();
       
    48 	CleanupStack::PushL(policy);
       
    49 	policy->ConstructL();
       
    50 	CleanupStack::Pop();
       
    51 	return policy;
       
    52 	}
       
    53 
       
    54 CImsPolicy::CImsPolicy()
       
    55 	{
       
    56 	iType = KPfqosExtensionIMS;
       
    57 	}
       
    58 
       
    59 void CImsPolicy::ConstructL()
       
    60 	{
       
    61 	iData = HBufC8::NewL(KImsApiBufSize);
       
    62 	}
       
    63 
       
    64 EXPORT_C CImsPolicy::~CImsPolicy()
       
    65 	{
       
    66 	//iData is deleted in the base
       
    67 	}
       
    68 
       
    69 static void SetIntValue(pfqos_configblock_int& data, TInt aValue,
       
    70 						const TDesC8& aName)
       
    71 	{
       
    72 	data.len = sizeof(pfqos_configblock_int)/8;
       
    73 	data.padding = data.reserved = 0;
       
    74 	data.type = KPfqosTypeInteger;
       
    75 	data.value = aValue;
       
    76 	Mem::FillZ(data.id, KPfqosMaxName);
       
    77 	Mem::Copy(data.id, aName.Ptr(), aName.Length());
       
    78 	}
       
    79 
       
    80 
       
    81 
       
    82 EXPORT_C TDesC8& CImsPolicy::Data()
       
    83 	{
       
    84 	TPtr8 bufPtr = iData->Des();
       
    85 	bufPtr.SetLength(0);
       
    86 	const int byte_len = (sizeof(pfqos_configure)+sizeof(pfqos_extension)+sizeof(pfqos_configblock_int));
       
    87 
       
    88 	pfqos_configure header;
       
    89 	header.pfqos_configure_len = (TUint16)((byte_len + 7) / 8);
       
    90 	header.pfqos_ext_type = EPfqosExtExtension;
       
    91 	header.reserved = 0;
       
    92 	header.protocol_id = 0;
       
    93 	bufPtr.Append((TUint8*)&header, sizeof(pfqos_configure));
       
    94 
       
    95 	pfqos_extension extensionType;
       
    96 	extensionType.pfqos_ext_len = 0;
       
    97 	extensionType.pfqos_ext_type = EPfqosExtExtension;
       
    98 	extensionType.pfqos_extension_type = KPfqosExtensionIMS;
       
    99 	bufPtr.Append((TUint8*)&extensionType, sizeof(pfqos_extension));
       
   100 
       
   101 	pfqos_configblock_int iExt;
       
   102 
       
   103 	// Minimum
       
   104 	SetIntValue(iExt, iIms.GetIMSSigallingIndicator(), KDescIMSSignallingIndicator);
       
   105 	bufPtr.Append((TUint8*)&iExt, sizeof(pfqos_configblock_int));
       
   106 
       
   107 	bufPtr.AppendFill(0, header.pfqos_configure_len * 8 - byte_len);
       
   108 	return *iData;
       
   109 	}
       
   110 
       
   111 EXPORT_C TInt CImsPolicy::ParseMessage(const TDesC8& /*aData*/)
       
   112 	{
       
   113 	return KErrNone;
       
   114 	}
       
   115 
       
   116 EXPORT_C CExtensionBase* CImsPolicy::CreateL()
       
   117 	{
       
   118 	CImsPolicy *extension = CImsPolicy::NewL();
       
   119 	return extension;
       
   120 	}
       
   121 
       
   122 EXPORT_C TInt CImsPolicy::Copy(const CExtensionBase& aExtension)
       
   123 	{
       
   124 	if (aExtension.Type() != iType)
       
   125 		return KErrArgument;
       
   126 	const CImsPolicy& policy = (const CImsPolicy&)aExtension;
       
   127 	policy.GetImsParameter(iIms);
       
   128 	return KErrNone;
       
   129 	}
       
   130 
       
   131 EXPORT_C void CImsPolicy::SetImsParameter(const TImsParameter& aIms)
       
   132 	{
       
   133 	iIms = aIms;
       
   134 	
       
   135 	LOG(Log::Printf(_L("<------------------------------------------------\n")));
       
   136 	LOG(Log::Printf(_L("CImsPolicy::SetImsParameter")));
       
   137 	LOG(Log::Printf(_L("\n")));
       
   138 	LOG(Log::Printf(_L("IMS VALUE SUPPLIED BY CLIENT IS \n")));
       
   139 	LOG(Log::Printf(_L("\n")));
       
   140 	LOG(Log::Printf(_L("[IMS Signalling Indicator value is  :	 = %d]\n"),aIms.GetIMSSigallingIndicator()));
       
   141 	LOG(Log::Printf(_L("------------------------------------------------>\n")));
       
   142 	
       
   143 	}
       
   144 
       
   145 EXPORT_C void CImsPolicy::GetImsParameter(TImsParameter& aIms) const
       
   146 	{
       
   147 	aIms = iIms;
       
   148 	}
       
   149 
       
   150 //#endif // SYMBIAN_NETWORKING_UMTS5