vpnengine/kmdapi/inc/kmdapi.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   KMD api
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef R_KMD_H
       
    19 #define R_KMD_H
       
    20 
       
    21 #include "vpnmandefs.h"
       
    22 
       
    23 //
       
    24 // KMD API Error codes
       
    25 // NOTE! The error code values below MUST be kept in sync with
       
    26 // the corresponding error code values defined together by
       
    27 // vpnapi/data/vpnerr.rss and vpnapi/data/vpnerr.ra
       
    28 //
       
    29 const TInt KKmdTooWeakCryptoLib             = -5253;
       
    30 const TInt KKmdNoAlgorithmsFile             = -5254;
       
    31 const TInt KKmdIkePolicyFileErr             = -5255;
       
    32 const TInt KKmdIkeNegotFailed               = -5256;
       
    33 const TInt KKmdIkeNoResponseErr             = -5257;
       
    34 const TInt KKmdIkeNoProposalErr             = -5258;
       
    35 const TInt KKmdIkeAuthFailedErr             = -5259;
       
    36 const TInt KKmdIkePeerAuthFailed            = -5260;
       
    37 const TInt KKmdIkeNoCertFoundErr            = -5261;
       
    38 const TInt KKmdIkeNoPolicyErr               = -5262;
       
    39 
       
    40 /**
       
    41  *  VPN real connection parameters.
       
    42  *
       
    43  *  @lib kmdapi.lib
       
    44  */
       
    45 class TVpnRealConnectionParams
       
    46     {
       
    47 public:    
       
    48     /**
       
    49      * Real IAP Id.
       
    50      * Own.
       
    51      */
       
    52     TUint32 iRealIapId;
       
    53     
       
    54     /**
       
    55      * Real NET Id.
       
    56      * Own.
       
    57      */
       
    58     TUint32 iRealNetId;
       
    59     };
       
    60 
       
    61 /**
       
    62  *  Enumeration of VPN connection stopping types.
       
    63  *
       
    64  *  @lib kmdapi.lib
       
    65  */
       
    66 class TKmdStopConnection
       
    67     {	
       
    68 public:	
       
    69     enum TType
       
    70         {           
       
    71         ENormal = 0,
       
    72         EForced 
       
    73         };
       
    74     };
       
    75 
       
    76 /**
       
    77  *  KMD API.
       
    78  *  A handle to KMD server.
       
    79  *
       
    80  *  @lib kmdapi.lib
       
    81  */
       
    82 class RKMD : public RSessionBase
       
    83     {
       
    84 public:
       
    85         
       
    86 	/**
       
    87      * Creates session to KMD server. If server is not running, it is started.
       
    88      */
       
    89     IMPORT_C TInt Connect();
       
    90 
       
    91 	/**
       
    92 	 * Start a real network connection.
       
    93 	 * Outstanding request can be cancelled any time by calling
       
    94 	 * CancelStartConnection(). 
       
    95 	 * 
       
    96 	 *  @param aVpnIapId Used VPN IAP Id
       
    97 	 *  @param aRealConfig If request completes with KErrNone, contains IAP
       
    98 	 *                     and NET Ids of used real network connecetion
       
    99 	 *                     (returned).
       
   100 	 *  @param aStatus Completes with KErrNone if real network connection 
       
   101 	 *                 is successfully opened (returned).
       
   102 	 * 
       
   103      */
       
   104     IMPORT_C void StartRealConnection( TUint32 aVpnIapId, 
       
   105                                        TPckg<TVpnRealConnectionParams>& aRealConfig,
       
   106                                        TRequestStatus& aStatus ) const;
       
   107         
       
   108 	/**
       
   109      * Cancel starting of real network connection.
       
   110      */
       
   111     IMPORT_C void CancelStartRealConnection() const;        
       
   112     	
       
   113 
       
   114 	/**
       
   115      * Asynchronous activation command to activate VPN connection (IKE policy).
       
   116      * If there is no virtual IP address protocols configured the activate
       
   117      * request completes immediatelly.
       
   118      * 
       
   119 	 *  @param aVpnIapId Used VPN IAP Id
       
   120 	 *  @param aVpnIfName VPN interface name 
       
   121      *  @param aIkeConf IKE policy data 
       
   122      *  @param aVPNAddress Contains the IP config of the VPN connection, when 
       
   123      *                     request completes (returned).
       
   124      *  @param aStatus Completion status, KErrNone if successfull (returned).
       
   125      */
       
   126     IMPORT_C void Activate( TUint32 aVpnIapId,
       
   127                             const TDesC& aVpnIfName,
       
   128                             const TDesC8& aIkeConf, 
       
   129                             TVPNAddressPckg& aVPNAddress,
       
   130                             TRequestStatus& aStatus ) const;
       
   131 
       
   132 	/**
       
   133      * Cancels ongoing activate request.
       
   134      */
       
   135     IMPORT_C void CancelActivate() const;
       
   136 	
       
   137 	/**
       
   138      * Stops VPN connection.
       
   139      * @param aVpnIapId Used VPN IAP
       
   140    	 * @param aType: Specifies stopping type.
       
   141 	 *               ENormal = All IKE and IPSEC SA:s related to VPN connection
       
   142 	 *               shall be deleted (= ISAKMP delete payload is transmitted
       
   143 	 *               to SA peer)
       
   144 	 *               EForced = Delete payload is not transmitted to SA peer.
       
   145      */
       
   146     IMPORT_C TInt StopVpnConnection( TUint32 aVpnIapId,
       
   147                                      TKmdStopConnection::TType aType = TKmdStopConnection::ENormal );
       
   148 
       
   149 	/**
       
   150      * Resolve an IP address from FQDN. 
       
   151      * There can be only one outstanding query per session.
       
   152      * @param aVpnIapId Used VPN IAP Id                       
       
   153 	 * @param aFqdn: Domain Name to be resolved.
       
   154      * @param aResult: Result of name resolution (returned)
       
   155      * @param aStatus: Completion status (returned)
       
   156      */
       
   157     IMPORT_C void ResolveAddress( TUint32 aVpnIapId, 
       
   158                                   const TDesC& aFqdn,
       
   159                                   TNameEntry& aResult,
       
   160                                   TRequestStatus& aStatus ) const;
       
   161 	/**
       
   162      * Cancel outstanding resolve address query.
       
   163      */        
       
   164     IMPORT_C void CancelResolve() const;	    
       
   165     };
       
   166 
       
   167 #endif // R_KMD_H