messagingfw/wappushfw/tpush/DummyStack/dummycapcodec.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2000-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 //
       
    15 
       
    16 #include "dummycapcodec.h"
       
    17 
       
    18 
       
    19 EXPORT_C CCapCodec::~CCapCodec()
       
    20 	{
       
    21 	}
       
    22 
       
    23 /**
       
    24  * Clear class members to defaults and release memory
       
    25  * 
       
    26  * Uses Nokia defaults specified in 
       
    27  * '\wapstack\wapstksrv\include\cap_codec.h'
       
    28  */
       
    29 EXPORT_C void CCapCodec::Reset()
       
    30 	{
       
    31 	iProtOptions=0x0004;	//WPS_CAP_ProtocolOptions
       
    32 	iClientSDUSize=1400;	//WPS_CAP_DEFAULT_ClientSDUSize
       
    33 	iServerSDUSize=1400;	//WPS_CAP_DEFAULT_ServerSDUSize
       
    34 	iMethodMOR=1;			//WPS_CAP_DEFAULT_MethodMOR
       
    35 	iPushMOR=1;				//WPS_CAP_DEFAULT_PushMOR
       
    36 	}
       
    37     
       
    38 /** 
       
    39  * Client application calls to construct a new capabilities class
       
    40  */
       
    41 EXPORT_C CCapCodec* CCapCodec::NewL()
       
    42 	{
       
    43 	CCapCodec* self=new (ELeave) CCapCodec();
       
    44 	CleanupStack::PushL(self);	
       
    45 	self->ConstructL();
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 /** 
       
    51  * Overloaded to take an encoded capabilities buffer retrieved from the client API
       
    52  * using a RWSPCOConn::GetSessionData() call
       
    53  */
       
    54 EXPORT_C CCapCodec* CCapCodec::NewL(const TDesC8& /*aEncodeBuf*/)
       
    55 	{
       
    56 	return static_cast<CCapCodec*>(NULL);
       
    57 	}
       
    58     
       
    59 /** 
       
    60  * Set protocol options
       
    61  */
       
    62 EXPORT_C void CCapCodec::SetProtocolOptions(const  TUint32 aProtOptions)
       
    63 	{
       
    64 	iProtOptions=aProtOptions;
       
    65 	}
       
    66 /**
       
    67  * Get protocol options
       
    68  */
       
    69 EXPORT_C void CCapCodec::GetProtocolOptions(TUint32& aProtOptions)
       
    70 	{
       
    71 	aProtOptions=iProtOptions;
       
    72 	}
       
    73     
       
    74 /**
       
    75  * Set Client SDU size
       
    76  */
       
    77 EXPORT_C void CCapCodec::SetClientSDUSize(const TUint32 aSize)
       
    78 	{
       
    79 	iClientSDUSize=aSize;
       
    80 	}
       
    81 
       
    82 /**
       
    83  * Get Client SDU size
       
    84  */
       
    85 EXPORT_C void CCapCodec::ClientSDUSize(TUint32& aSize) const
       
    86 	{
       
    87 	aSize=iClientSDUSize;
       
    88 	}
       
    89 
       
    90 /**
       
    91  * Set Server SDU size
       
    92  */
       
    93 EXPORT_C void CCapCodec::SetServerSDUSize(const TUint32 aSize)
       
    94 	{
       
    95 	iServerSDUSize=aSize;
       
    96 	}
       
    97 
       
    98 /**
       
    99  * Get Server SDU size
       
   100  */
       
   101 EXPORT_C void CCapCodec::GetServerSDUSize(TUint32& aSize) const
       
   102 	{
       
   103 	aSize=iServerSDUSize;
       
   104 	}
       
   105 
       
   106 /**
       
   107  * Set method Maximum Outstanding Requests
       
   108  *
       
   109  */
       
   110 EXPORT_C void CCapCodec::SetMethodMOR(const TUint8 aVal)
       
   111 	{
       
   112 	iMethodMOR=aVal;
       
   113 	}
       
   114 
       
   115 /**
       
   116  * Get method Maximum Outstanding Requests
       
   117  *
       
   118  */
       
   119 EXPORT_C void CCapCodec::MethodMOR(TUint8& aVal) const
       
   120 	{
       
   121 	aVal=iMethodMOR;
       
   122 	}
       
   123 
       
   124 /**
       
   125  * Set push Maximum Outstanding Requests
       
   126  *
       
   127  */
       
   128 EXPORT_C void CCapCodec::SetPushMOR(const TUint8 aVal)
       
   129 	{
       
   130 	iPushMOR=aVal;
       
   131 	}
       
   132 
       
   133 /**
       
   134  * Get for Maximum Outstanding Requests
       
   135  *
       
   136  */
       
   137 EXPORT_C void CCapCodec::GetPushMOR(TUint8& aVal) const
       
   138 	{
       
   139 	aVal=iPushMOR;
       
   140 	}
       
   141 
       
   142 /** 
       
   143  * Set and Get for class extended methods
       
   144  * returns Nokia defined code , 0 = No Error
       
   145  */
       
   146 EXPORT_C TInt CCapCodec::AddExtendedMethod(TDes8& /*aMethod*/,const TUint8 /*aVal*/)
       
   147 	{
       
   148 	return KErrNone;
       
   149 	}
       
   150 
       
   151 /**
       
   152  * Call NumExtendedMethods() first
       
   153  * aIndex is between (0 to (aNumExtendedMethods - 1)
       
   154  * Return KErrNone or KErrTooBig if aIndex is out of range or
       
   155  * the descriptor is too small. 
       
   156  */	
       
   157 EXPORT_C TInt CCapCodec::GetExtendedMethod(const TInt /*aIndex*/,TDes8& /*aMethod*/,TUint8& /*aVal*/) const
       
   158 	{
       
   159 	return KErrNone;
       
   160 	}
       
   161 
       
   162 EXPORT_C void CCapCodec::NumExtendedMethods(TInt& /*aNumExtendedMethods*/) const
       
   163 	{
       
   164 	}
       
   165 
       
   166 /** 
       
   167  * Set and Get for class code pages
       
   168  * returns Nokia defined code , 0 = No Error
       
   169  */
       
   170 EXPORT_C TInt CCapCodec::AddCodePage(TDes8& /*aCodePage*/,const TUint8 /*aVal*/)
       
   171 	{	
       
   172 	return KErrNone;
       
   173 	}
       
   174 
       
   175 /**
       
   176  * Call NumCodePages() first
       
   177  * aIndex is between (0 to (aNumCodePages - 1)
       
   178  * Return KErrNone or KErrTooBig if aIndex is out of range or
       
   179  * the descriptor is too small.
       
   180  */
       
   181 EXPORT_C TInt CCapCodec::GetCodePage(const TInt /*aIndex*/,TDes8& /*aCodePage*/,TUint8& /*aVal*/) const
       
   182 	{
       
   183 	return KErrNone;
       
   184 	}
       
   185 
       
   186 EXPORT_C void CCapCodec::NumCodePages(TInt& /*aNumCodePages*/) const
       
   187 	{
       
   188 	}
       
   189 
       
   190 /**
       
   191  * Set and Get for Unknown/Other capabilities
       
   192  * returns Nokia defined code , 0 = No Error
       
   193  */
       
   194 EXPORT_C TInt CCapCodec::AddUnknownCap(TDes8& /*aName*/,const TDesC8& /*aValue*/)
       
   195 	{
       
   196 	return KErrNone;
       
   197 	}
       
   198 
       
   199 
       
   200 /** 
       
   201  * Call NumUnknownCap first
       
   202  * aIndex is between (0 to (aNumUnknown - 1)
       
   203  * Return KErrNone or KErrTooBig if aIndex is out of range or one or more
       
   204  * of the descriptors is too small.
       
   205  */
       
   206 EXPORT_C TInt CCapCodec::GetUnknownCap(const TInt /*aIndex*/,TDes8& /*aName*/,TDes8& /*aValue*/) const
       
   207 	{
       
   208 	return KErrNone;
       
   209 	}
       
   210 
       
   211 /** 
       
   212  * Set and Get for class aliases
       
   213  * Requires the use of an Alias class 
       
   214  * Returns Nokia defined code, 0 = no error
       
   215  */
       
   216 EXPORT_C void CCapCodec::NumUnknownCap(TInt& /*aNumUnknown*/) const
       
   217 	{
       
   218 	}
       
   219 
       
   220 EXPORT_C TInt CCapCodec::AddAliasAddress(const TAliasAddress& /*aAddress*/)
       
   221 	{
       
   222 	return KErrNone;
       
   223 	}
       
   224 
       
   225 /** 
       
   226  * Call NumAliasAddress() first
       
   227  * aIndex is between (0 to (aNumAddresses - 1)
       
   228  * Return KErrNone or KErrTooBig if aIndex is out of range 
       
   229  */
       
   230 EXPORT_C TInt CCapCodec::GetAliasAddress(const TInt /*aIndex*/, TAliasAddress& /*aAddress*/) const
       
   231 	{
       
   232 	return KErrNone;
       
   233 	}
       
   234 
       
   235 EXPORT_C void CCapCodec::NumAliasAddress(TInt& /*aNumAddresses*/) const
       
   236 	{
       
   237 	}
       
   238 
       
   239 
       
   240 EXPORT_C TInt CCapCodec::CapEncodeSize(void) const
       
   241 	{
       
   242 	return KErrNone;
       
   243 	}
       
   244 
       
   245 EXPORT_C TInt CCapCodec::Encode(TDes8& /*aDestCapSet*/) const
       
   246 	{
       
   247 	return KErrNone;
       
   248 	}
       
   249 
       
   250 EXPORT_C TInt CCapCodec::Decode(const TDesC8& /*aSrcCapSet*/)
       
   251 	{
       
   252 	return KErrNone;
       
   253 	}
       
   254 
       
   255 EXPORT_C void CCapCodec::ConstructL()
       
   256 	{
       
   257 	}
       
   258 
       
   259 EXPORT_C void CCapCodec::ConstructL(const TDesC8& /*aDecodeBuf*/)
       
   260 	{
       
   261 	}
       
   262 
       
   263 
       
   264 
       
   265 
       
   266 
       
   267 
       
   268 
       
   269 
       
   270 
       
   271 /**
       
   272  * For Get and Set of Alias Address
       
   273  *
       
   274  */
       
   275 EXPORT_C TAliasAddress::~TAliasAddress()
       
   276 	{
       
   277 	}
       
   278 	
       
   279 EXPORT_C TAliasAddress::TAliasAddress()
       
   280 	{
       
   281 	iHasPort = FALSE;
       
   282 	iHasBearer = FALSE;
       
   283 	}
       
   284     
       
   285 EXPORT_C void TAliasAddress::SetPort(const TUint16 aPort)
       
   286 	{
       
   287 	iPort = aPort;
       
   288 	iHasPort = TRUE;
       
   289 	}
       
   290 
       
   291 EXPORT_C void TAliasAddress::SetBearer(const TUint8 aBearer)
       
   292 	{
       
   293 	iBearer = aBearer;
       
   294 	iHasBearer = TRUE;
       
   295 	}
       
   296 	
       
   297 EXPORT_C TInt TAliasAddress::SetAddress(const TDesC8& aAddress)
       
   298 	{
       
   299 	if(aAddress.Length() >iAddress.MaxLength())
       
   300 		return KErrTooBig;
       
   301 	iAddress = aAddress;
       
   302 	return KErrNone;
       
   303 	}
       
   304 
       
   305 EXPORT_C TUint8 TAliasAddress::HasBearer(void) const
       
   306 	{
       
   307 	return iHasBearer;
       
   308 	}
       
   309 	
       
   310 EXPORT_C TUint8 TAliasAddress::HasPort(void) const
       
   311 	{
       
   312 	return iHasPort;
       
   313 	}
       
   314 
       
   315 EXPORT_C TUint8 TAliasAddress::Bearer(void) const
       
   316 	{
       
   317 	return iBearer;
       
   318 	}
       
   319 	
       
   320 EXPORT_C TUint16 TAliasAddress::Port(void) const
       
   321 	{
       
   322 	return iPort;
       
   323 	}
       
   324 	
       
   325 EXPORT_C const TDesC8& TAliasAddress::Address() const
       
   326 	{
       
   327 	return iAddress;
       
   328 	}
       
   329 	
       
   330 EXPORT_C void TAliasAddress::Reset(void)
       
   331 	{
       
   332 	iHasPort = FALSE;
       
   333 	iHasBearer = FALSE;
       
   334 	iAddress.SetLength(0);
       
   335 	}