bluetooth/btstack/secman/secevent.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef SECEVENT_H
       
    17 #define SECEVENT_H
       
    18 
       
    19 #include <e32std.h>
       
    20 
       
    21 //forward decs
       
    22 class CBTSecMan;
       
    23 class CBTAccessRequester;
       
    24 class CBTAuthorisor;
       
    25 class CBTNumericComparator;
       
    26 class CBTPasskeyEntry;
       
    27 class CHCIFacade;
       
    28 class CPhysicalLink;
       
    29 class CPhysicalLinksManager;
       
    30 class CBTInquiryMgr;
       
    31 class CBTHostResolver;
       
    32 class CSecNotifierRequester;
       
    33 class CBTAccessRequesterStateFactory;
       
    34 
       
    35 /**
       
    36 BT Security Event base class.
       
    37 */
       
    38 class TBTSecEvent
       
    39 	{
       
    40 public:
       
    41 	enum TEventType
       
    42 		{
       
    43 		EStart,
       
    44 		EPhysicalLinkUp,
       
    45 		EPhysicalLinkDown,
       
    46 		ERequestAuthentication,
       
    47 		EAuthenticationRequested,
       
    48 		EAuthenticationComplete,
       
    49 		ERequestEncryptionChange,
       
    50 		EEncryptionChangeRequested,
       
    51 		EEncryptionChangeComplete,
       
    52 		ERequestAuthorisation,
       
    53 		EAuthorisationRequested,
       
    54 		EAuthorisationComplete,
       
    55 		// Simple Pairing events
       
    56 		EHostsupportedFeatures,
       
    57 		EIOCapsRequested,
       
    58 		EIOCapsResponse,
       
    59 		EUserConfirmationRequested,
       
    60 		EUserConfirmationRequestComplete,
       
    61 		// we probably shouldn't have this as an event, secman should handle this statically (and assert debug).
       
    62 		EPasskeyNotfication,
       
    63 		EKeypressEntry,
       
    64 		EKeypressComplete,
       
    65 		ERemoteOOBDataRequested,
       
    66 		ERemoteOOBDataRequestComplete,
       
    67 		EAuthoriseSspIOCapsRequested,
       
    68 		EUndefinedEvent,
       
    69 		};
       
    70 
       
    71 public:
       
    72 	TBTSecEvent(TEventType aEvent, TInt aError = KErrNone)
       
    73 		: iEvent(aEvent)
       
    74 		, iError(aError)
       
    75 		{}
       
    76 
       
    77 public:
       
    78 	TEventType Event() const { return iEvent; }
       
    79 	TInt Error() const { return iError; }
       
    80 	
       
    81 private:
       
    82 	TEventType iEvent;
       
    83 	TInt iError;
       
    84 	};
       
    85 
       
    86 class TBTSecEventStart : public TBTSecEvent
       
    87 	{
       
    88 public:
       
    89 	TBTSecEventStart()
       
    90 		: TBTSecEvent(EStart, KErrNone)
       
    91 		{}
       
    92 	static TBTSecEventStart* Cast(TBTSecEvent* aEvent);
       
    93 	};
       
    94 
       
    95 class TBTSecEventPhysicalLinkUp : public TBTSecEvent
       
    96 	{
       
    97 public:
       
    98 	TBTSecEventPhysicalLinkUp(TInt aError = KErrNone)
       
    99 		: TBTSecEvent(EPhysicalLinkUp, aError)
       
   100 		{}
       
   101 	static TBTSecEventPhysicalLinkUp* Cast(TBTSecEvent* aEvent);
       
   102 	};
       
   103 
       
   104 class TBTSecEventRemoteOOBDataRequest: public TBTSecEvent
       
   105 	{
       
   106 public:
       
   107 	TBTSecEventRemoteOOBDataRequest(TInt aError = KErrNone)
       
   108 		: TBTSecEvent(ERemoteOOBDataRequested, aError)
       
   109 		{}
       
   110 	static TBTSecEventRemoteOOBDataRequest* Cast(TBTSecEvent* aEvent);
       
   111 	};
       
   112 
       
   113 class TBTSecEventAuthenticationComplete : public TBTSecEvent
       
   114 	{
       
   115 public:
       
   116 	TBTSecEventAuthenticationComplete(TInt aError = KErrNone)
       
   117 		: TBTSecEvent(EAuthenticationComplete, aError)
       
   118 		{}
       
   119 	static TBTSecEventAuthenticationComplete* Cast(TBTSecEvent* aEvent);
       
   120 	};
       
   121 
       
   122 class TBTSecEventEncryptionChangeComplete : public TBTSecEvent
       
   123 	{
       
   124 public:
       
   125 	TBTSecEventEncryptionChangeComplete(TInt aError = KErrNone)
       
   126 		: TBTSecEvent(EEncryptionChangeComplete, aError)
       
   127 		{}
       
   128 	static TBTSecEventEncryptionChangeComplete* Cast(TBTSecEvent* aEvent);
       
   129 	};
       
   130 
       
   131 class TBTSecEventAuthenticationRequested: public TBTSecEvent
       
   132 	{
       
   133 public:
       
   134 	TBTSecEventAuthenticationRequested(TInt aError = KErrNone)
       
   135 		: TBTSecEvent(EAuthenticationRequested, aError)
       
   136 		{}
       
   137 	static TBTSecEventAuthenticationRequested* Cast(TBTSecEvent* aEvent);
       
   138 	};
       
   139 
       
   140 class TBTSecEventRequestAuthentication: public TBTSecEvent
       
   141 	{
       
   142 public:
       
   143 	TBTSecEventRequestAuthentication(TInt aError = KErrNone)
       
   144 		: TBTSecEvent(ERequestAuthentication, aError)
       
   145 		{}
       
   146 	static TBTSecEventRequestAuthentication* Cast(TBTSecEvent* aEvent);
       
   147 	};
       
   148 
       
   149 class TBTSecEventAuthorisationRequested: public TBTSecEvent
       
   150 	{
       
   151 public:
       
   152 	TBTSecEventAuthorisationRequested(TInt aError = KErrNone)
       
   153 		: TBTSecEvent(EAuthorisationRequested, aError)
       
   154 		{}
       
   155 	static TBTSecEventAuthorisationRequested* Cast(TBTSecEvent* aEvent);
       
   156 	};
       
   157 
       
   158 class TBTSecEventRequestAuthorisation: public TBTSecEvent
       
   159 	{
       
   160 public:
       
   161 	TBTSecEventRequestAuthorisation(TInt aError = KErrNone)
       
   162 		: TBTSecEvent(ERequestAuthorisation, aError)
       
   163 		{}
       
   164 	static TBTSecEventRequestAuthorisation* Cast(TBTSecEvent* aEvent);
       
   165 	};
       
   166 
       
   167 class TBTSecEventIoCapabilityRequested : public TBTSecEvent
       
   168 	{
       
   169 public:
       
   170 	TBTSecEventIoCapabilityRequested(TInt aError = KErrNone)
       
   171 		: TBTSecEvent(EIOCapsRequested, aError)
       
   172 		{}
       
   173 	static TBTSecEventIoCapabilityRequested* Cast(TBTSecEvent* aEvent);
       
   174 	};
       
   175 
       
   176 class TBTSecEventIoCapabilityResponse : public TBTSecEvent
       
   177 	{
       
   178 public:
       
   179 	TBTSecEventIoCapabilityResponse(THCIIoCapability aIoCapability,
       
   180 									THCIOobDataPresence aOobDataPresent,
       
   181 									THCIAuthenticationRequirement aAuthenticationRequirements,
       
   182 									TInt aError = KErrNone)
       
   183 		: TBTSecEvent(EIOCapsResponse, aError)
       
   184 		, iIoCapability(aIoCapability)
       
   185 		, iOobDataPresent(aOobDataPresent)
       
   186 		, iAuthenticationRequirements(aAuthenticationRequirements)
       
   187 		{}
       
   188 	
       
   189 	static TBTSecEventIoCapabilityResponse* Cast(TBTSecEvent* aEvent);
       
   190 		
       
   191 	THCIIoCapability IoCapability() const { return iIoCapability; }
       
   192 	THCIOobDataPresence OobDataPresent() const { return iOobDataPresent;  }
       
   193 	THCIAuthenticationRequirement AuthenticationRequirements() const { return iAuthenticationRequirements; }
       
   194 
       
   195 private:
       
   196 	THCIIoCapability iIoCapability;
       
   197 	THCIOobDataPresence iOobDataPresent;
       
   198 	THCIAuthenticationRequirement iAuthenticationRequirements;
       
   199 	};
       
   200 
       
   201 class TBTSecEventUserConfirmationRequest : public TBTSecEvent
       
   202 	{
       
   203 public:
       
   204 	TBTSecEventUserConfirmationRequest(TUint32 aNumericValue, TInt aError = KErrNone)
       
   205 		: TBTSecEvent(EUserConfirmationRequested, aError)
       
   206 		, iNumericValue(aNumericValue)
       
   207 		{}
       
   208 	
       
   209 	static TBTSecEventUserConfirmationRequest* Cast(TBTSecEvent* aEvent); 
       
   210 		
       
   211 	TUint32 NumericValue() const { return iNumericValue; }
       
   212 
       
   213 private:
       
   214 	TUint32 iNumericValue;
       
   215 	};
       
   216 
       
   217 class TBTSecEventUserConfirmationComplete : public TBTSecEvent
       
   218 	{
       
   219 public:
       
   220 	TBTSecEventUserConfirmationComplete(TInt aError)
       
   221 		: TBTSecEvent(EUserConfirmationRequestComplete, aError)
       
   222 		, iError(aError)
       
   223 		{}
       
   224 
       
   225 	TInt Status() const { return iError; }
       
   226 	
       
   227 private:
       
   228 	TInt iError;
       
   229 	};
       
   230 
       
   231 class TBTSecEventAuthorisationComplete : public TBTSecEvent
       
   232 	{
       
   233 public:
       
   234 	TBTSecEventAuthorisationComplete(TBool aAccessAllowed)
       
   235 		: TBTSecEvent(EAuthorisationComplete, KErrNone)
       
   236 		, iAccessAllowed(aAccessAllowed)
       
   237 		{}
       
   238 	
       
   239 	static TBTSecEventAuthorisationComplete* Cast(TBTSecEvent* aEvent);
       
   240 
       
   241 	TInt AccessAllowed() const { return iAccessAllowed; }
       
   242 	
       
   243 private:
       
   244 	TInt iAccessAllowed;
       
   245 	};
       
   246 
       
   247 class TBTSecEventPasskeyNotification : public TBTSecEvent
       
   248 	{
       
   249 public:
       
   250 	TBTSecEventPasskeyNotification(TUint32 aPasskey, TInt aError = KErrNone)
       
   251 		: TBTSecEvent(EPasskeyNotfication, aError)
       
   252 		, iPasskey(aPasskey)
       
   253 		{}
       
   254 		
       
   255 	TUint32 Passkey() const { return iPasskey; }
       
   256 
       
   257 private:
       
   258 	TUint32 iPasskey;
       
   259 	};
       
   260 
       
   261 class TBTSecEventKeypressEntry : public TBTSecEvent
       
   262 	{
       
   263 public:
       
   264 	TBTSecEventKeypressEntry(TUint32 aNotificationType, TInt aError = KErrNone)
       
   265 		: TBTSecEvent(EKeypressEntry, aError)
       
   266 		, iNotificationType(aNotificationType)
       
   267 		{}
       
   268 	
       
   269 	static TBTSecEventKeypressEntry* Cast(TBTSecEvent* aEvent);
       
   270 		
       
   271 	TUint8 NotificationType() const { return iNotificationType; }
       
   272 
       
   273 private:
       
   274 	TUint8 iNotificationType;
       
   275 	};
       
   276 
       
   277 #endif // SECEVENT_H