linklayerprotocols/pppnif/SPPP/CCPINI.CPP
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 1997-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 "CCPINI.H"
       
    17 #include "PPPCFG.H"
       
    18 
       
    19 CPppIniData* CPppIniData::NewL()
       
    20 	{
       
    21 	CPppIniData* p=new(ELeave) CPppIniData;
       
    22 	CleanupStack::PushL(p);
       
    23 	p->ConstructL();
       
    24 	CleanupStack::Pop();
       
    25 	return p;
       
    26 	}
       
    27 
       
    28 CPppIniData::~CPppIniData()
       
    29 	{
       
    30 	}
       
    31 
       
    32 CPppIniData::CPppIniData()
       
    33 : iSearchPtr(NULL,0)
       
    34 	{
       
    35 	}
       
    36 
       
    37 void CPppIniData::ConstructL()
       
    38 	{
       
    39 	CESockIniData::ConstructL(CCP_INI_DATA);
       
    40 	iSearchPtr.Set(iPtr);
       
    41 	}
       
    42 
       
    43 TBool CPppIniData::ReadCompressorInfo(CPppCompConfig* aData, TUint aNumberOfTurns)
       
    44 //
       
    45 // Read the filename data into the config structure,
       
    46 // 
       
    47 //
       
    48 	{
       
    49 	TBool	retCode = EFalse;
       
    50 	TBuf<3> section;
       
    51 	//
       
    52 	// Add Section Name
       
    53 	//
       
    54 	TPtrC dllName;
       
    55 	section.Append(aNumberOfTurns+0x30);
       
    56 	
       
    57 	if ( FindVar(section, _L("dll") ,dllName))
       
    58 		{
       
    59 		TRAPD(ret,aData->AddNameL(dllName))
       
    60 		if (ret == KErrNone)
       
    61 			{
       
    62 			TInt	temp;
       
    63 			if ( FindVar(section, _L("id") ,temp))
       
    64 				{
       
    65 				aData->AddID((TUint8)temp);
       
    66 				if ( FindVar(section, _L("optlen"),temp))
       
    67 					{
       
    68 					if (temp)
       
    69 						{
       
    70 						//
       
    71 						// We have to sort out the options
       
    72 						//
       
    73 						TPtrC options;
       
    74 						if ( FindVar(section, _L("opts"),options))
       
    75 							{
       
    76 							TRAPD(ret,aData->AddOptionsL(options))
       
    77 							if (ret == KErrNone)
       
    78 								{
       
    79 								retCode = ETrue;
       
    80 								}
       
    81 							}
       
    82 						}
       
    83 					else
       
    84 						{
       
    85 						// Added because of predictor that has no "opts"
       
    86 						TPtrC Options(_L("0"));
       
    87 						// Ignore Error code, when '0 opts' are passed to 
       
    88 						// AddOptionsL nothing is added to the config class.
       
    89 						TRAP_IGNORE(aData->AddOptionsL(Options))
       
    90 						retCode = ETrue;
       
    91 						}
       
    92 					}
       
    93 				}
       
    94 			}
       
    95 		}
       
    96 
       
    97 	return retCode;
       
    98 	}