vpnengine/vpncommon/inc/vpnnotifierdefs.h
changeset 0 33413c0669b9
child 46 29c8f9bc68e1
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:   VPN notifier definitions
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef VPNNOTIFIERDEFS_H
       
    19 #define VPNNOTIFIERDEFS_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 class MVpnNotifierCallback;
       
    24 class MVpnDialog;
       
    25 
       
    26 _LIT(KVpnDialogManagerDll, "vpndialogmanager.dll");
       
    27 
       
    28 /**
       
    29  @file
       
    30  @released
       
    31  @publishedPartner
       
    32  
       
    33  VPN Notifier definitions
       
    34 */
       
    35 
       
    36 class MVpnDialog
       
    37     {
       
    38 public:
       
    39     virtual void CancelL() = 0;
       
    40     };
       
    41 
       
    42 class TNoteDialog
       
    43     {
       
    44 public:
       
    45     enum TDialogId
       
    46         {
       
    47         EInfo = -10,
       
    48         EWarning,
       
    49         EError
       
    50         };
       
    51     };
       
    52 
       
    53 class TVpnDialogInfo
       
    54     {
       
    55 public:
       
    56     TVpnDialogInfo()
       
    57         {
       
    58         iDialogId = 0;
       
    59         iNoteDialogId = 0;
       
    60         iNoteExtraInput.SetLength(0);
       
    61         }
       
    62 
       
    63     TVpnDialogInfo(TInt aDialogId, TInt aNoteDialogId)
       
    64         {
       
    65         iDialogId = aDialogId;
       
    66         iNoteDialogId = aNoteDialogId;
       
    67         iNoteExtraInput.SetLength(0);
       
    68         }
       
    69 
       
    70     TVpnDialogInfo(TInt aDialogId, TInt aNoteDialogId, TDesC8& aInput)
       
    71         {
       
    72         iDialogId = aDialogId;
       
    73         iNoteDialogId = aNoteDialogId;
       
    74         iNoteExtraInput.SetLength(aInput.Length());
       
    75         iNoteExtraInput.Copy(aInput.Left(256));
       
    76         }
       
    77 
       
    78     void SetExtraInput(TDesC8& aInput) 
       
    79         {
       
    80         iNoteExtraInput.Copy(aInput.Left(256));
       
    81         }
       
    82     TInt DialogId() {return iDialogId;}
       
    83     TInt NoteDialogId() {return iNoteDialogId;}
       
    84     TDesC8& NoteExtraInput() 
       
    85         {
       
    86         return iNoteExtraInput;
       
    87         }
       
    88 
       
    89 private:
       
    90     TInt iDialogId;
       
    91     TInt iNoteDialogId;
       
    92     TBuf8<256> iNoteExtraInput;
       
    93     };
       
    94 
       
    95 class TVpnDialogOutput
       
    96     {
       
    97 public:
       
    98     TVpnDialogOutput()
       
    99         {
       
   100         Clear();
       
   101         }
       
   102     void Clear()
       
   103         {
       
   104         iOutBuf.SetLength(0);
       
   105         iOutBuf2.SetLength(0);
       
   106         iOutInt = 0;
       
   107         iOutInt2 = 0;
       
   108         }
       
   109 
       
   110 public:
       
   111     TBuf<256> iOutBuf;
       
   112     TBuf<64> iOutBuf2;
       
   113     TInt iOutInt;
       
   114     TInt iOutInt2;
       
   115     };
       
   116 
       
   117 // typedefs for backward compatibility
       
   118 // typedef new_type old_type
       
   119 typedef TVpnDialogInfo TIPSecDialogInfo;
       
   120 typedef TVpnDialogOutput TIPSecDialogOutput;
       
   121 
       
   122 
       
   123 // 
       
   124 // KMD notifier definitions
       
   125 //
       
   126 
       
   127 class TKmdDialog
       
   128     {
       
   129 public:
       
   130     enum TDialogId
       
   131         {
       
   132         EUserPwd = 2000, // MUST be greater than the last value in enum TNoteDialog::TDialogId
       
   133         ESecurIdPin,
       
   134         ESecurIdNextPin        
       
   135         };
       
   136     };
       
   137 
       
   138 const TUid KUidVpnDialogNotifier = {0x101F6EB7};
       
   139 
       
   140 _LIT(KVpnNotifierResource,"\\resource\\VPNECOMNOTIFIER.RSC");
       
   141 
       
   142 const TUint KDialogParamSep = '#';
       
   143 
       
   144 
       
   145 class TVpnDialog
       
   146     {
       
   147 public:
       
   148     enum TDialogId
       
   149         {
       
   150         EServerIdentity = 100, // MUST be greater than the last value in enum TNoteDialog::TDialogId
       
   151         ELegacyAuthentication,              // 101
       
   152         ELegacyAuthenticationIn,            // 102
       
   153         EContentUpdateDetails,              // 103
       
   154         EContentUpdateDetailsNote,          // 104
       
   155         // VPN releated dialogs             
       
   156         EUserIdentity = 1000,               // 1000
       
   157         EPolicyUpdateConfirmation,          // 1001
       
   158         EPolicyInstallConfirmation,         // 1002
       
   159         EPKCS12Password,                    // 1003
       
   160         EPKCS12WrongPassword,               // 1004
       
   161         EDeviceLockConfirmation,            // 1005
       
   162         EGenericProgress,                   // 1006
       
   163         EPolicyInstallInProgress            // 1007
       
   164         };
       
   165     };
       
   166 
       
   167 class TVpnNoteDialog
       
   168     {
       
   169 public:
       
   170     enum TTextId
       
   171         {
       
   172         EWrongServerIdentityCode = 1,
       
   173         ENextServerIdentity,
       
   174         EAuthenticationFailed,
       
   175         EInvalidServerCert,
       
   176         EInvalidClientCert,
       
   177         // VPN related notes
       
   178         EPolicyUpdateSucceeded = 1000,
       
   179         EPolicyUpdateFailed,
       
   180         EPolicyDeleteSucceeded,
       
   181         EVpnUserNameMissing,
       
   182         EVpnFqdnMissing,
       
   183         EPolicyInstallationFailed,
       
   184         EVpnWrongPKCS12Password,
       
   185         EVpnCannotForceDeviceLock,
       
   186         EVpnPolicyInstalled,
       
   187         // Kmd related notes
       
   188         EKmdAuthenticationFailed = 2000
       
   189         };
       
   190     };
       
   191 
       
   192 // typedefs for backward compatibility
       
   193 // typedef existing_type old_type
       
   194 typedef TKmdDialog TKMDDialog;
       
   195 
       
   196 class VpnNotifierUtil 
       
   197     {
       
   198 public:
       
   199     inline static HBufC8* To8BitL(TDesC16& aText);
       
   200     inline static HBufC16* To16BitL(TDesC8& aText);
       
   201     };
       
   202     
       
   203 HBufC8* VpnNotifierUtil::To8BitL(TDesC16& aText) 
       
   204     {
       
   205     HBufC8* text = HBufC8::NewL(aText.Length());
       
   206     text->Des().Copy(aText);
       
   207     return text;
       
   208     }
       
   209 
       
   210 HBufC16* VpnNotifierUtil::To16BitL(TDesC8& aText) 
       
   211     {
       
   212     HBufC16* text = HBufC16::NewL(aText.Length());
       
   213     text->Des().Copy(aText);
       
   214     return text;
       
   215     }
       
   216 
       
   217 
       
   218 class MVpnNotifierCallback 
       
   219     {
       
   220 public:
       
   221     virtual void DialogCompleteL(TInt aReturnCode, TVpnDialogOutput& aOutput) = 0;
       
   222     virtual void DialogComplete(TInt aReturnCode) = 0;
       
   223     };
       
   224 
       
   225 class MVpnDialogManager
       
   226     {
       
   227 public:
       
   228     virtual MVpnDialog* LaunchDialogL(MVpnNotifierCallback* aNotifier, TInt aDialogId,
       
   229                                 TInt aNoteDialogId, const TDesC8& aInput) = 0;
       
   230     virtual TInt GetNoteTextId(TInt aNoteDialogId) = 0;
       
   231     virtual MVpnDialog* ShowNoteDialogL(MVpnNotifierCallback* aNotifier, TInt aNoteDialogId) = 0;
       
   232     virtual ~MVpnDialogManager() {};
       
   233     };
       
   234 
       
   235 
       
   236 #endif  // VPNNOTIFIERDEFS_H