Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Macros | Functions | Variables
SMPTypes.cpp File Reference
#include <cstring>
#include <string>
#include <memory>
#include <cstdint>
#include <vector>
#include <cstdio>
#include <jau/debug.hpp>
#include "SMPTypes.hpp"
Include dependency graph for SMPTypes.cpp:

Go to the source code of this file.

Macros

#define PAIRSTATE_ENUM(X)
 
#define CASE_TO_STRING_PAIRSTATE(V)   case SMPPairingState::V: return #V;
 
#define IOCAP_ENUM(X)
 
#define CASE_TO_STRING_IOCAP(V)   case SMPIOCapability::V: return #V;
 
#define PM_JUST__WORKS   PairingMode::JUST_WORKS
 Mapping SMPIOCapability from initiator and responder to PairingMode. More...
 
#define PM_PASSKEY_INI   PairingMode::PASSKEY_ENTRY_ini
 
#define PM_PASSKEY_RES   PairingMode::PASSKEY_ENTRY_res
 
#define PM_PASSKEY_ALL   PairingMode::PASSKEY_ENTRY_ini
 
#define PM_NUMCOMP_INI   PairingMode::NUMERIC_COMPARE_ini
 
#define PM_NUMCOMP_RES   PairingMode::NUMERIC_COMPARE_res
 
#define PM_NUMCOMP_ANY   PairingMode::NUMERIC_COMPARE_ini
 
#define KEYDISTFMT_ENUM(X)
 
#define CASE_TO_STRING_KEYDISTFMT(V)   case direct_bt::SMPKeyType::V: return #V;
 
#define LTKPROP_ENUM(X)
 
#define CASE_TO_STRING_LTKPROPFMT(V)   case SMPLongTermKeyInfo::Property::V: return #V;
 
#define CSRKPROP_ENUM(X)
 
#define CASE_TO_STRING_CSRKPROPFMT(V)   case SMPSignatureResolvingKeyInfo::Property::V: return #V;
 
#define OPCODE_ENUM(X)
 
#define CASE_TO_STRING_OPCODE(V)   case Opcode::V: return #V;
 
#define TYPECODE_ENUM(X)
 
#define CASE_TO_STRING_TYPECODE(V)   case TypeCode::V: return #V;
 

Functions

static std::string _getSMPKeyTypeBitStr (const direct_bt::SMPKeyType bit) noexcept
 
static std::string _getPropertyBitStr (const SMPLongTermKeyInfo::Property bit) noexcept
 
static std::string _getPropertyBitStr (const SMPSignatureResolvingKeyInfo::Property bit) noexcept
 

Variables

static const PairingMode legacy_pairing [5][5]
 
static const PairingMode seccon_pairing [5][5]
 

Macro Definition Documentation

◆ CASE_TO_STRING_CSRKPROPFMT

#define CASE_TO_STRING_CSRKPROPFMT (   V)    case SMPSignatureResolvingKeyInfo::Property::V: return #V;

Definition at line 328 of file SMPTypes.cpp.

◆ CASE_TO_STRING_IOCAP

#define CASE_TO_STRING_IOCAP (   V)    case SMPIOCapability::V: return #V;

Definition at line 70 of file SMPTypes.cpp.

◆ CASE_TO_STRING_KEYDISTFMT

#define CASE_TO_STRING_KEYDISTFMT (   V)    case direct_bt::SMPKeyType::V: return #V;

Definition at line 256 of file SMPTypes.cpp.

◆ CASE_TO_STRING_LTKPROPFMT

#define CASE_TO_STRING_LTKPROPFMT (   V)    case SMPLongTermKeyInfo::Property::V: return #V;

Definition at line 288 of file SMPTypes.cpp.

◆ CASE_TO_STRING_OPCODE

#define CASE_TO_STRING_OPCODE (   V)    case Opcode::V: return #V;

Definition at line 375 of file SMPTypes.cpp.

◆ CASE_TO_STRING_PAIRSTATE

#define CASE_TO_STRING_PAIRSTATE (   V)    case SMPPairingState::V: return #V;

Definition at line 52 of file SMPTypes.cpp.

◆ CASE_TO_STRING_TYPECODE

#define CASE_TO_STRING_TYPECODE (   V)    case TypeCode::V: return #V;

Definition at line 414 of file SMPTypes.cpp.

◆ CSRKPROP_ENUM

#define CSRKPROP_ENUM (   X)
Value:
X(NONE) \
X(RESPONDER) \
X(AUTH)

Definition at line 323 of file SMPTypes.cpp.

◆ IOCAP_ENUM

#define IOCAP_ENUM (   X)
Value:
X(DISPLAY_ONLY) \
X(DISPLAY_YES_NO) \
X(KEYBOARD_ONLY) \
X(NO_INPUT_NO_OUTPUT) \
X(KEYBOARD_DISPLAY) \
X(UNSET)

Definition at line 62 of file SMPTypes.cpp.

◆ KEYDISTFMT_ENUM

#define KEYDISTFMT_ENUM (   X)
Value:
X(NONE) \
X(ENC_KEY) \
X(ID_KEY) \
X(SIGN_KEY) \
X(LINK_KEY) \
X(RFU_1) \
X(RFU_2) \
X(RFU_3) \
X(RFU_4)

Definition at line 245 of file SMPTypes.cpp.

◆ LTKPROP_ENUM

#define LTKPROP_ENUM (   X)
Value:
X(NONE) \
X(RESPONDER) \
X(AUTH) \
X(SC)

Definition at line 282 of file SMPTypes.cpp.

◆ OPCODE_ENUM

#define OPCODE_ENUM (   X)
Value:
X(UNDEFINED) \
X(PAIRING_REQUEST) \
X(PAIRING_RESPONSE) \
X(PAIRING_CONFIRM) \
X(PAIRING_RANDOM) \
X(PAIRING_FAILED) \
X(ENCRYPTION_INFORMATION) \
X(MASTER_IDENTIFICATION) \
X(IDENTITY_INFORMATION) \
X(IDENTITY_ADDRESS_INFORMATION) \
X(SIGNING_INFORMATION) \
X(SECURITY_REQUEST) \
X(PAIRING_PUBLIC_KEY) \
X(PAIRING_DHKEY_CHECK) \
X(PAIRING_KEYPRESS_NOTIFICATION)

Definition at line 358 of file SMPTypes.cpp.

◆ PAIRSTATE_ENUM

#define PAIRSTATE_ENUM (   X)
Value:
X(NONE) \
X(FAILED) \
X(REQUESTED_BY_RESPONDER) \
X(FEATURE_EXCHANGE_STARTED) \
X(FEATURE_EXCHANGE_COMPLETED) \
X(PASSKEY_EXPECTED) \
X(NUMERIC_COMPARE_EXPECTED) \
X(OOB_EXPECTED) \
X(KEY_DISTRIBUTION) \
X(COMPLETED)

Definition at line 40 of file SMPTypes.cpp.

◆ PM_JUST__WORKS

#define PM_JUST__WORKS   PairingMode::JUST_WORKS

Mapping SMPIOCapability from initiator and responder to PairingMode.

Notable, the following is deduced from BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.5.1 Selecting key generation method Table 2.8 and differs a little from BlueZ smp.c implementation.

Index values, using SMPIOCapabilities as follows: DISPLAY_ONLY = 0x00, DISPLAY_YES_NO = 0x01, KEYBOARD_ONLY = 0x02, NO_INPUT_NO_OUTPUT = 0x03, KEYBOARD_DISPLAY = 0x04

Definition at line 200 of file SMPTypes.cpp.

◆ PM_NUMCOMP_ANY

#define PM_NUMCOMP_ANY   PairingMode::NUMERIC_COMPARE_ini

Definition at line 206 of file SMPTypes.cpp.

◆ PM_NUMCOMP_INI

#define PM_NUMCOMP_INI   PairingMode::NUMERIC_COMPARE_ini

Definition at line 204 of file SMPTypes.cpp.

◆ PM_NUMCOMP_RES

#define PM_NUMCOMP_RES   PairingMode::NUMERIC_COMPARE_res

Definition at line 205 of file SMPTypes.cpp.

◆ PM_PASSKEY_ALL

#define PM_PASSKEY_ALL   PairingMode::PASSKEY_ENTRY_ini

Definition at line 203 of file SMPTypes.cpp.

◆ PM_PASSKEY_INI

#define PM_PASSKEY_INI   PairingMode::PASSKEY_ENTRY_ini

Definition at line 201 of file SMPTypes.cpp.

◆ PM_PASSKEY_RES

#define PM_PASSKEY_RES   PairingMode::PASSKEY_ENTRY_res

Definition at line 202 of file SMPTypes.cpp.

◆ TYPECODE_ENUM

#define TYPECODE_ENUM (   X)
Value:
X(PASSKEY_ENTRY_STARTED) \
X(PASSKEY_DIGIT_ENTERED) \
X(PASSKEY_DIGIT_ERASED) \
X(PASSKEY_CLEARED) \
X(PASSKEY_ENTRY_COMPLETED)

Definition at line 407 of file SMPTypes.cpp.

Function Documentation

◆ _getPropertyBitStr() [1/2]

static std::string _getPropertyBitStr ( const SMPLongTermKeyInfo::Property  bit)
staticnoexcept

Definition at line 289 of file SMPTypes.cpp.

Here is the caller graph for this function:

◆ _getPropertyBitStr() [2/2]

static std::string _getPropertyBitStr ( const SMPSignatureResolvingKeyInfo::Property  bit)
staticnoexcept

Definition at line 329 of file SMPTypes.cpp.

◆ _getSMPKeyTypeBitStr()

static std::string _getSMPKeyTypeBitStr ( const direct_bt::SMPKeyType  bit)
staticnoexcept

Definition at line 257 of file SMPTypes.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ legacy_pairing

const PairingMode legacy_pairing[5][5]
static

◆ seccon_pairing

const PairingMode seccon_pairing[5][5]
static
PM_JUST__WORKS
#define PM_JUST__WORKS
Mapping SMPIOCapability from initiator and responder to PairingMode.
Definition: SMPTypes.cpp:199
PM_PASSKEY_INI
#define PM_PASSKEY_INI
Definition: SMPTypes.cpp:200
PM_NUMCOMP_ANY
#define PM_NUMCOMP_ANY
Definition: SMPTypes.cpp:205
PM_PASSKEY_ALL
#define PM_PASSKEY_ALL
Definition: SMPTypes.cpp:202
PM_PASSKEY_RES
#define PM_PASSKEY_RES
Definition: SMPTypes.cpp:201