ipcm_plat/access_point_engine_misc_api/inc/VpnAPEngine.h
changeset 71 9f263f780e41
parent 70 ac5daea24fb0
child 72 0c32cf868819
equal deleted inserted replaced
70:ac5daea24fb0 71:9f263f780e41
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     Declares the main handler, CVpnAPEngine and the public API for 
       
    16 *     the Vpn Access Point Engine.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef VPN_AP_ENGINE_H
       
    22 #define VPN_AP_ENGINE_H
       
    23 
       
    24 // Deprecation warning
       
    25 #warning This header file has been deprecated and will be fully removed between weeks 12 and 18 of 2010. See Polonium CR #153 for details.
       
    26  
       
    27  
       
    28 // INCLUDES
       
    29 #include    <e32base.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CCommsDatabase;
       
    36 class CVpnApItem;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40 * CVpnApEngine class: It is the main handler for the VPN Access Point Engine.
       
    41 * It contains the only public API for other (sub)systems.
       
    42 *
       
    43 */
       
    44 NONSHARABLE_CLASS( CVpnApEngine ) : public CBase
       
    45     {
       
    46 
       
    47     public: // Constructors and destructor
       
    48 
       
    49 
       
    50         /**
       
    51         * Two-phased constructor. Leaves on failure.
       
    52         * This function shall be used to create the VPN access point engine
       
    53         * object. This object is a thin layer above the VpnApEngine which 
       
    54         * uses Access Point Engine (ApEngine) and it provides a 
       
    55         * simple interface to the VPN ApEngine enabling creation, deletion 
       
    56         * and editing of VPN access points.
       
    57         * @param aDb a pointer to a CCommsDataBase object, might be NULL
       
    58         * @return The constructed CVpnApEngine object.
       
    59         *
       
    60         * @deprecated
       
    61         */
       
    62         IMPORT_C static CVpnApEngine* NewLC( CCommsDatabase* aDb = NULL );
       
    63 
       
    64 
       
    65 
       
    66         /**
       
    67         * Destructor.
       
    68         *
       
    69         * @deprecated
       
    70         */
       
    71         IMPORT_C ~CVpnApEngine( );
       
    72 
       
    73 
       
    74 
       
    75     protected:
       
    76         /**
       
    77         * Second-phase constructor.
       
    78         * @param aDb The database
       
    79         *
       
    80         * @deprecated
       
    81         */
       
    82         IMPORT_C void ConstructL( CCommsDatabase* aDb );
       
    83 
       
    84 
       
    85     private:
       
    86         /**
       
    87         * Constructor.
       
    88         *
       
    89         * @deprecated
       
    90         */
       
    91         IMPORT_C CVpnApEngine( );
       
    92 
       
    93 
       
    94     public: // New functions
       
    95 
       
    96         /**
       
    97         * Creates a new VPN from the passed CVpnApItem
       
    98         * @param aVpnApItem a CVpnApItem holding the data
       
    99         * @return The WAP ID of the succesfully created VPN AP.
       
   100         *
       
   101         * @deprecated
       
   102         */
       
   103         IMPORT_C TUint32 CreateVpnApL( CVpnApItem& aVpnApItem );
       
   104 
       
   105 
       
   106         /**
       
   107         * Creates a new VPN from the passed VPN data
       
   108         * @param aName The name of the access point.
       
   109         * @param aIapId A TUint32 holding the real internet access point ID
       
   110         * @param aPolicy a TDesC& Holding the policy for the VPN
       
   111         * @param aProxyServerAddress a TDesC* holding the proxy server address
       
   112         * @param aProxyPort A TUint32 specifying the proxy's port number
       
   113         * @return The created VPN access point's WAP ID
       
   114         *
       
   115         * @deprecated
       
   116         */
       
   117         IMPORT_C TUint32 CreateVpnApL( TDesC& aName, 
       
   118                                        TUint32 aIapId, 
       
   119                                        TDesC& aPolicy, 
       
   120                                        TDesC* aProxyServerAddress = NULL, 
       
   121                                        TUint32 aProxyPort = 0 );
       
   122 
       
   123 
       
   124         /**
       
   125         * Deletes the VPN access poitn indentified by it's WAP ID
       
   126         * @param aVpnApId A TUint32 The WAP ID of the vpn access point to be 
       
   127         *   deleted
       
   128         * Might Leave on error.
       
   129         *
       
   130         * @deprecated
       
   131         */
       
   132         IMPORT_C void DeleteVpnL( TUint32 aVpnApId );
       
   133 
       
   134 
       
   135 
       
   136         /**
       
   137         * Reads up one VPN access point's data from the database.
       
   138         * Expects that CVpnApEngine has been created and the database had
       
   139         * been opened.
       
   140         * In case of error, function leaves with error code.
       
   141         * <br>Error conditions:
       
   142         *   - Insufficient memory,
       
   143         *   - AP does not exists,
       
   144         *   - Server connection failure.
       
   145         *
       
   146         * @param aUid The WAP Uid of the VPN access point to be read
       
   147         * @param aApItem A reference to a CApAccessPointItem to hold the data.
       
   148         * @return no return value.
       
   149         *
       
   150         * @deprecated
       
   151         */
       
   152         IMPORT_C void VpnDataL( TUint32 aUid, CVpnApItem& aVpnApItem );
       
   153 
       
   154 
       
   155 
       
   156         // update
       
   157         /**
       
   158         * Updates data stored in an existing VPN access point.
       
   159         * Expects that CVpnApEngine has been created and the database had
       
   160         * been opened.
       
   161         * In case of error, no data is stored.
       
   162         * <br>Error conditions:
       
   163         *   - Insufficient memory
       
   164         *   - Server connection failure
       
   165         *   - Lock already present by other task
       
   166         *   - Uid does not exists.
       
   167         *   - Attempting to update read-only records will result
       
   168         *     in KErrAccessDenied
       
   169         *
       
   170         * @param aApItem A reference to a CApAccessPointItem holding the data
       
   171         * @return No return value.
       
   172         *
       
   173         * @deprecated
       
   174         */
       
   175         IMPORT_C void UpdateVpnDataL( CVpnApItem& aVpnApItem );
       
   176 
       
   177 
       
   178         /**
       
   179         * Gives whether the access point identified by the passed WAP ID
       
   180         * is a VPN access point or not.
       
   181         * @param aUid The UID of the access point
       
   182         *
       
   183         * @deprecated
       
   184         */
       
   185         IMPORT_C TBool IsVpnApL( const TUint32 aUid );
       
   186 
       
   187 
       
   188         /**
       
   189         * Component Validation Test.
       
   190         * @return KErrNone.
       
   191         *
       
   192         * @deprecated
       
   193         */
       
   194         IMPORT_C static TInt Cvt();
       
   195 
       
   196 
       
   197     protected:  // New functions
       
   198         /**
       
   199         * Creates a new VPN from the passed VPN item
       
   200         * @param aIsNew Booleasn stating whether it is a new AP or not
       
   201         * @param aVpnApItem A CVpnApItem holding the VPN access point data
       
   202         * @return The created VPN access point's WAP ID
       
   203         */
       
   204         TUint32 DoCreateVpnApL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   205         
       
   206         
       
   207         /**
       
   208         * Writes the VPN data part from the passed VPN item
       
   209         * @param aIsNew Booleasn stating whether it is a new AP or not
       
   210         * @param aVpnApItem A CVpnApItem holding the VPN access point data
       
   211         */
       
   212         void WriteVpnDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   213 
       
   214 
       
   215         /**
       
   216         * Creates a virtual bearer record if needed
       
   217         * @return The virtual bearer record ID
       
   218         */
       
   219         TUint32 CreateVirtBearerIfNeededL();
       
   220 
       
   221 
       
   222         /**
       
   223         * Writes the VPN-IAP data part from the passed VPN item
       
   224         * @param aIsNew Booleasn stating whether it is a new AP or not
       
   225         * @param aVpnApItem A CVpnApItem holding the VPN access point data
       
   226         * @return The IAP ID for the VPN part
       
   227         */
       
   228         TUint32 WriteVpnIapRecordL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   229 
       
   230 
       
   231         /**
       
   232         * Gets the location record ID
       
   233         * @return The ID of the location record 
       
   234         */
       
   235         TUint32 GetLocationIdL();
       
   236 
       
   237 
       
   238         /**
       
   239         * Writes the VPN-WAP data part from the passed VPN item
       
   240         * @param aIsNew Booleasn stating whether it is a new AP or not
       
   241         * @param aVpnApItem A CVpnApItem holding the VPN access point data
       
   242         */
       
   243         void    WriteVpnWapApDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   244 
       
   245 
       
   246         /**
       
   247         * Writes the VPN-WAP bearer data part from the passed VPN item
       
   248         * @param aIsNew Booleasn stating whether it is a new AP or not
       
   249         * @param aVpnApItem A CVpnApItem holding the VPN access point data
       
   250         */
       
   251         void    WriteVpnWapBearerDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   252 
       
   253 
       
   254         /**
       
   255         * Reads up the VPN-WAP bearer data part into the passed VPN item
       
   256         * @param aUid The WAP-bearer part's record ID
       
   257         * @param aVpnApItem A CVpnApItem to hold the readed data
       
   258         */
       
   259         void    ReadVpnWapBearerDataL( TUint32 aUid, CVpnApItem& aVpnApItem );
       
   260 
       
   261 
       
   262         /**
       
   263         * Reads up the VPN-WAP data part into the passed VPN item
       
   264         * The WAP record ID should already been set by an earlier call to
       
   265         * ReadVpnWapBearerDataL
       
   266         * @param aVpnApItem A CVpnApItem to hold the readed data
       
   267         */
       
   268         void    ReadVpnWapApDataL( CVpnApItem& aVpnApItem );
       
   269 
       
   270 
       
   271         /**
       
   272         * Reads up the VPN-IAP data part into the passed VPN item
       
   273         * The IAP record ID should already been set by an earlier call to
       
   274         * ReadVpnWapApDataL
       
   275         * @param aVpnApItem A CVpnApItem to hold the readed data
       
   276         */
       
   277         void    ReadVpnIapRecordL( CVpnApItem& aVpnApItem );
       
   278 
       
   279 
       
   280         /**
       
   281         * Reads up the VPN data part into the passed VPN item
       
   282         * The VPN record ID should already been set by an earlier call to
       
   283         * ReadVpnIapRecordL
       
   284         * @param aVpnApItem A CVpnApItem to hold the readed data
       
   285         */
       
   286         void    ReadVpnDataL( CVpnApItem& aVpnApItem );
       
   287 
       
   288 
       
   289         /**
       
   290         * Writes the proxy data of the passed VPN access point item 
       
   291         * @param aIsNew Boolean stating whether the access point is new
       
   292         * @param aVpnApItem A CVpnApItem holding the current VPN data
       
   293         */
       
   294         void    WriteProxyDataL( TBool aIsNew, const CVpnApItem& aVpnApItem );
       
   295 
       
   296 
       
   297         /**
       
   298         * Reads the proxy data into the passed VPN access point item 
       
   299         * @param aVpnApItem A CVpnApItem holding the current VPN data
       
   300         */
       
   301         void    ReadProxyDataL( CVpnApItem& aVpnApItem );
       
   302 
       
   303 
       
   304         /**
       
   305         * Deletes the VPN proxy data
       
   306         * @param aIspId The Isp record ID for which the proxy data should be
       
   307         * deleted 
       
   308         */
       
   309         void    RemoveVpnProxyDataL( TUint32 aIspId );
       
   310 
       
   311 
       
   312         /**
       
   313         * Deletes the VPN data
       
   314         * @param aUid The UID of the VPN access point to be deleted.
       
   315         */
       
   316         void    DoDeleteVpnL( TUint32 aUid );
       
   317 
       
   318 
       
   319 
       
   320         /**
       
   321         * Removes a record from a table
       
   322         * @param aTable The table to remove from
       
   323         * @param aUid   The record ID to remove
       
   324         */
       
   325         void    RemoveRecordL( const TDesC& aTable, TUint32 aUid );
       
   326 
       
   327 
       
   328         /**
       
   329         * Writes the network data of the passed VPN access point item 
       
   330         * @param aIsNew Boolean stating whether the access point is new
       
   331         * @param aVpnApItem A CVpnApItem holding the current network data
       
   332         */
       
   333         void    WriteNetworkDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
       
   334 
       
   335 
       
   336         /**
       
   337         * Reads up the network data into the passed VPN access point item
       
   338         * @param aVpnApItem A CVpnApItem holding the current VPN data
       
   339         */
       
   340         void    ReadNetworkDataL( CVpnApItem& aVpnApItem );
       
   341 
       
   342 
       
   343         /**
       
   344         * Removes a network data
       
   345         * @param aIspId The Network record ID which should be deleted
       
   346         */
       
   347         void    RemoveNetworkDataL( TUint32 aIspId );
       
   348 
       
   349 
       
   350     protected:  // Functions from base classes
       
   351 
       
   352 
       
   353     private: //data 
       
   354         TBool               iOwnDb;
       
   355         CCommsDatabase*     iDb;
       
   356     };
       
   357 
       
   358 #endif 
       
   359 
       
   360 // End of File