vpnengine/vpnins/src/vpninsexe.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:23:21 +0100
branchRCL_3
changeset 24 e06095241a65
parent 23 473321461bba
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description: VPN Installer.
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <e32base.h>
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    21
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    22
    #include <centralrepository.h> // link against centralrepository.lib
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    23
    #include <settingsinternalcrkeys.h>
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    25
    #include <certificateapps.h>
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    26
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    27
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    28
_LIT(KVpnManagementUiDllName, "vpnmanagementui.dll");
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    29
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    30
LOCAL_C void setKeysAndOtherSettingsL();
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
// The starting point
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
GLDEF_C TInt E32Main()
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
    {
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    __UHEAP_MARK;
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    CTrapCleanup* cleanup = CTrapCleanup::New();
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    37
    TRAPD(error, setKeysAndOtherSettingsL());
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    if (error != KErrNone)
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
        {
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
        ;
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
        }
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    delete cleanup;
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    __UHEAP_MARKEND;
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    return 0;
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    }
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
 
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    48
LOCAL_C void setKeysAndOtherSettingsL()
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    {
24
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    50
    // Connecting and initialization:
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    51
    CRepository* repository = CRepository::NewL( KCRUidCommunicationSettings );
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    52
    repository->Set( KSettingsVPNSupported, 1 );
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    53
    repository->Set( KSettingsVPNImplementation, KVpnManagementUiDllName );
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    54
    delete repository;
e06095241a65 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 23
diff changeset
    55
0
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    CCertificateAppInfoManager* manager = CCertificateAppInfoManager::NewLC();
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
    
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    const TUid KUidVpn = {0x101F7993};
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
    _LIT(KVpnApplicationName, "VPN");
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
    TName vpnApplicationName(KVpnApplicationName);
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    TCertificateAppInfo client(KUidVpn, vpnApplicationName);
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    manager->AddL(client);
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    CleanupStack::PopAndDestroy(); // manager
33413c0669b9 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    }