1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
28 An enumeration to represent the possible levels of Man-in-the-Middle protection
29 that a Bluetooth service may specify.
31 enum TBluetoothMitmProtection
33 EMitmNotRequired = 0x0, /*!< No Man-in-the-Middle protection is required. */
34 EMitmDesired = 0x1, /*!< Man-in-the-Middle protection should be used where possible. */
35 EMitmRequired = 0x2 /*!< Man-in-the-Middle protection is required. */
38 NONSHARABLE_CLASS(TBTAccessRequirements)
39 /** The access requirements set up by a bluetooth service.
41 An incoming connection must satisfy these criteria before the connection may proceed.
42 Not spectacularly useful for applications; mainly used by other Bluetooth libraries
48 IMPORT_C TBTAccessRequirements();
49 IMPORT_C void SetAuthentication(TBool aPreference);
50 IMPORT_C void SetAuthorisation(TBool aPreference);
51 IMPORT_C void SetEncryption(TBool aPreference);
52 IMPORT_C void SetDenied(TBool aPreference);
53 IMPORT_C void SetAuthentication(TBluetoothMitmProtection aPreference);
54 IMPORT_C TInt SetPasskeyMinLength(TUint aPasskeyMinLength);
55 IMPORT_C TBool AuthenticationRequired() const;
56 IMPORT_C TBool AuthorisationRequired() const;
57 IMPORT_C TBool EncryptionRequired() const;
58 IMPORT_C TBool Denied() const;
59 IMPORT_C TUint PasskeyMinLength() const;
60 IMPORT_C TBool operator==(const TBTAccessRequirements& aRequirements) const;
61 IMPORT_C TBluetoothMitmProtection MitmProtection() const;
65 TUint iPasskeyMinLength;
68 enum TBTServiceSecuritySettings
74 EMitm = 0x30, // 2 bit field for MITM
77 enum TBTAccessRequirementsMitmProtection
79 EAccessRequirementsMitmUndefined = 0x00,
80 EAccessRequirementsMitmNotRequired = 0x10,
81 EAccessRequirementsMitmDesired = 0x20,
82 EAccessRequirementsMitmRequired = 0x30
86 NONSHARABLE_CLASS(TBTServiceSecurity)
87 /** The security settings of a bluetooth service.
89 Contains information regarding the service UID and the access requirements.
95 IMPORT_C TBTServiceSecurity(const TBTServiceSecurity& aService);
96 IMPORT_C TBTServiceSecurity();
97 IMPORT_C void SetUid(TUid aUid);
98 IMPORT_C void SetAuthentication(TBool aPreference);
99 IMPORT_C void SetAuthorisation(TBool aPreference);
100 IMPORT_C void SetEncryption(TBool aPreference);
101 IMPORT_C void SetDenied(TBool aPreference);
102 IMPORT_C void SetAuthentication(TBluetoothMitmProtection aPreference);
103 IMPORT_C TInt SetPasskeyMinLength(TUint aPasskeyMinLength);
104 IMPORT_C TBool AuthorisationRequired() const;
105 IMPORT_C TBool EncryptionRequired() const;
106 IMPORT_C TBool AuthenticationRequired() const;
107 IMPORT_C TBool Denied() const;
108 IMPORT_C TUint PasskeyMinLength() const;
109 IMPORT_C TUid Uid() const;
110 IMPORT_C TBluetoothMitmProtection MitmProtection() const;
113 TUid iUid; //<The UID of the service. Will be used by the UI to work out the name of the service when prompting the user.
114 TBTAccessRequirements iSecurityRequirements; //<Whether the service requires authentication, authorisation, encryption or min passkey len.
117 typedef TPckgBuf<TBTServiceSecurity> TBTServiceSecurityPckg; /*!< Package definition for securty settings */
120 #endif // BTSECURITY_H