javatools/certificatesconfigurator/src.s60/trustrootpolicy.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:07:20 +0300
branchRCL_3
changeset 17 0fd27995241b
parent 14 04becd199f91
permissions -rw-r--r--
Revision: v2.1.24 Kit: 201019

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#include <e32base.h>
#include <xml/contenthandler.h> // for MContentHandler
#include <xml/parser.h> // for CParser
#include <f32file.h>
#include <string>
#include <vector>

using namespace Xml;
using namespace std;

class TrustRoot
{
public:
    TrustRoot();

public:

    std::string iName;
    std::string iDomain;
    std::string iMcc;
    std::string iMnc;
    bool iCanDelete;
    bool iCanDisable;
};

class CTrustRootPolicy: public CBase, MContentHandler
{

public:

    static CTrustRootPolicy* NewL();

    virtual ~CTrustRootPolicy();

public:

    void ReadFromFileL(const TDesC& aFileName, vector<TrustRoot>& aTrustRoots);

private:

    CTrustRootPolicy();

    void ConstructL();

private: // from MContentHandler

    void OnStartDocumentL(const RDocumentParameters &aDocParam, TInt aErrorCode);

    void OnEndDocumentL(TInt aErrorCode);

    void OnStartElementL(const RTagInfo &aElement, const RAttributeArray &aAttributes,
                         TInt aErrorCode);

    void OnEndElementL(const RTagInfo &aElement, TInt aErrorCode);

    void OnContentL(const TDesC8 &aBytes, TInt aErrorCode);

    void OnStartPrefixMappingL(const RString &aPrefix, const RString &aUri,
                               TInt aErrorCode);

    void OnEndPrefixMappingL(const RString &aPrefix, TInt aErrorCode);

    void OnIgnorableWhiteSpaceL(const TDesC8 &aBytes, TInt aErrorCode);

    void OnSkippedEntityL(const RString &aName, TInt aErrorCode);

    void OnProcessingInstructionL(const TDesC8 &aTarget, const TDesC8 &aData,
                                  TInt aErrorCode);

    void OnError(TInt aErrorCode);

    TAny *GetExtendedInterface(const TInt32 aUid);

private:

    CParser*             iParser;
    RFs                  iRfs;
    vector<TrustRoot>*  iTrustRoots;
    string               iCurrentContent;
    TrustRoot           iTrustRoot;
};