vpnengine/ikev1lib/inc/ikev1crack.h
changeset 0 33413c0669b9
child 23 d1a0d37b52a1
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2005-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:   IKEv1 Crack authentication
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IKEV1CRACK_H
       
    19 #define IKEV1CRACK_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "ikev1dialog.h"
       
    23 
       
    24 /*---------------------------------------------------------------------------
       
    25  *
       
    26  *  CRACK return codes for public methods
       
    27  *
       
    28  *---------------------------------------------------------------------------*/
       
    29 #define CRACK_SUCCESS       0
       
    30 #define CRACK_CONTINUE      0x1
       
    31 #define CRACK_IGNORE_MSG    0x2
       
    32 #define CRACK_FAILED        0x4
       
    33 
       
    34 /*---------------------------------------------------------------------------
       
    35  *
       
    36  *  CRACK iState flags                          
       
    37  *
       
    38  *---------------------------------------------------------------------------*/
       
    39 #define WAITING_USER_RSP      0x1
       
    40 #define WAITING_PEER_RSP      0x2
       
    41 #define CHALLENGE_RECEIVED    0x4
       
    42 #define CRACK_AUTHENTICATED   0x8 
       
    43 #define SHOW_ERROR_DIALOG     0x10
       
    44 #define SECURID_NEXT_PIN_MODE 0x20
       
    45 
       
    46 /*---------------------------------------------------------------------------
       
    47  *
       
    48  *  CAuthDialogInfo class
       
    49  *
       
    50  *---------------------------------------------------------------------------*/
       
    51 #define DIALOG_INFO_ID        0xfedcba98
       
    52 #define XAUTH_DIALOG_ID       0x76543210
       
    53 
       
    54 class CIkev1Negotiation;
       
    55 class TNotificationISAKMP;
       
    56 class TCHREISAKMP;
       
    57 class ThdrISAKMP;
       
    58 class CIkev1PluginSession;
       
    59 class MIkeDebug;
       
    60 
       
    61 class CAuthDialogInfo : public CBase
       
    62     {
       
    63 public:
       
    64     CAuthDialogInfo(CIkev1PluginSession* aPluginSession, TUint32 aObjId, TUint32 aSAId, TUint32 aMsgId)
       
    65                     { iPluginSession = aPluginSession; iSAId = aSAId; iObjId  = aObjId; iMsgId  = aMsgId; }
       
    66     ~CAuthDialogInfo() {iObjId = 0;}    
       
    67     inline CIkev1PluginSession* PluginSession() { return iPluginSession;}
       
    68     inline TUint32     SAId() { return iSAId;}  
       
    69     inline TUint32     GetObjId() { return iObjId;}
       
    70     inline TUint32     GetMsgId() { return iMsgId;}     
       
    71     
       
    72 private:
       
    73     TUint32    iObjId;      // Object identifier 
       
    74     CIkev1PluginSession* iPluginSession;  // Plugin session pointer  
       
    75     TUint32    iSAId;       // SA id of CIkev1Negotiation
       
    76     TUint32    iMsgId;      // Transaction exchange message ID
       
    77     
       
    78 public: 
       
    79 //  Credentials data get from user with asynchronous dialog 
       
    80 	HBufC8     *iUsername;     
       
    81     HBufC8     *iSecret;
       
    82     HBufC8     *iDomain;    
       
    83     };
       
    84 
       
    85 
       
    86 NONSHARABLE_CLASS(CIKECRACKNegotiation) : public CBase, public MIkeDialogComplete
       
    87 {
       
    88 public:
       
    89     CIKECRACKNegotiation( MIkeDebug& aDebug );
       
    90     ~CIKECRACKNegotiation();    
       
    91     TInt   ConstructL(TInt aLAMType, CIkev1Negotiation *aNegotiation, const TDesC &aDomain);
       
    92     TInt   ExecuteCRACKMsgL(const ThdrISAKMP &aHdr);
       
    93     TInt   ProcessUserResponseL(CAuthDialogInfo *aUserInfo);
       
    94     TInt   CrackAuthenticationFailedL(const TNotificationISAKMP *aNotifPayload);
       
    95 	
       
    96 	TInt   DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain);
       
    97 	
       
    98     
       
    99 private:
       
   100     TInt    GetDataL(HBufC8* aChallenge);
       
   101     TInt    GetDatafromUserL(HBufC8 *aChallenge);
       
   102     TInt    GetUNPWDFromPolicyL();
       
   103     TInt    ProcessCHREAttibutesL(const TCHREISAKMP *aCHRE_PAYLOAD);
       
   104     void    SendCredentialsL(TUint16 aAttr1, TUint16 aAttr2, TUint16 aAttr3,
       
   105                              HBufC8* aBfr1, HBufC8* aBfr2, HBufC8* aBfr3);
       
   106 
       
   107 private:
       
   108     TInt       iLAMType;    // Legacy Authentication Method type code
       
   109     TInt       iState;      // CRACK negotiation state
       
   110     TInt       iMsgCount;   // CRACK message count xmitted (does not contain retries)
       
   111 
       
   112     CIkev1PluginSession*      iPluginSession;      // IKEv1 plugin session 
       
   113     CIkev1Negotiation* iNegotiation; // Current negotiation object (related to CRACK)
       
   114     CIkev1Dialog*      iDialog;      // Pending dialog object
       
   115     CAuthDialogInfo*   iDialogInfo;  // Dialog info object
       
   116 
       
   117 	HBufC8           *iUserName;    // Saved for User name caching 	
       
   118 	HBufC8           *iDomain;      // Fixed domain value for this CRACK negotiation
       
   119 	
       
   120 	MIkeDebug& iDebug;
       
   121 };
       
   122 
       
   123 
       
   124 #endif // IKEV1CRACK_H