Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6dd48ee authored by Hui Peng's avatar Hui Peng Committed by Gerrit Code Review
Browse files

Merge "[Invisalign2] reorder the fields in SecurityClientInterface" into main

parents ffd840de 6ec04384
Loading
Loading
Loading
Loading
+17 −11
Original line number Original line Diff line number Diff line
@@ -40,28 +40,34 @@ static void BTM_SecConfirmReqReply(tBTM_STATUS res, tBT_TRANSPORT transport,
static SecurityClientInterface security = {
static SecurityClientInterface security = {
    .BTM_Sec_Init = BTM_Sec_Init,
    .BTM_Sec_Init = BTM_Sec_Init,
    .BTM_Sec_Free = BTM_Sec_Free,
    .BTM_Sec_Free = BTM_Sec_Free,
    .BTM_SecRegister = BTM_SecRegister,

    .BTM_SecAddDevice = BTM_SecAddDevice,
    .BTM_SecAddDevice = BTM_SecAddDevice,
    .BTM_SecAddRmtNameNotifyCallback = BTM_SecAddRmtNameNotifyCallback,
    .BTM_SecAddBleDevice = BTM_SecAddBleDevice,
    .BTM_SecDeleteDevice = BTM_SecDeleteDevice,
    .BTM_SecDeleteDevice = BTM_SecDeleteDevice,
    .BTM_SecRegister = BTM_SecRegister,
    .BTM_SecReadDevName = BTM_SecReadDevName,
    .BTM_SecBond = BTM_SecBond,
    .BTM_SecBondCancel = BTM_SecBondCancel,
    .BTM_SecAddBleKey = BTM_SecAddBleKey,
    .BTM_SecAddBleKey = BTM_SecAddBleKey,
    .BTM_SecAddBleDevice = BTM_SecAddBleDevice,
    .BTM_SecClearSecurityFlags = BTM_SecClearSecurityFlags,
    .BTM_SecClearSecurityFlags = BTM_SecClearSecurityFlags,
    .BTM_SetEncryption = BTM_SetEncryption,
    .BTM_IsEncrypted = BTM_IsEncrypted,
    .BTM_SecIsSecurityPending = BTM_SecIsSecurityPending,
    .BTM_IsLinkKeyKnown = BTM_IsLinkKeyKnown,

    .BTM_SecClrService = BTM_SecClrService,
    .BTM_SecClrService = BTM_SecClrService,
    .BTM_SecClrServiceByPsm = BTM_SecClrServiceByPsm,
    .BTM_SecClrServiceByPsm = BTM_SecClrServiceByPsm,

    .BTM_SecBond = BTM_SecBond,
    .BTM_SecBondCancel = BTM_SecBondCancel,

    .BTM_RemoteOobDataReply = BTM_RemoteOobDataReply,
    .BTM_RemoteOobDataReply = BTM_RemoteOobDataReply,
    .BTM_PINCodeReply = BTM_PINCodeReply,
    .BTM_PINCodeReply = BTM_PINCodeReply,
    .BTM_SecConfirmReqReply = BTM_SecConfirmReqReply,
    .BTM_SecConfirmReqReply = BTM_SecConfirmReqReply,
    .BTM_SecDeleteRmtNameNotifyCallback = BTM_SecDeleteRmtNameNotifyCallback,
    .BTM_SetEncryption = BTM_SetEncryption,
    .BTM_IsEncrypted = BTM_IsEncrypted,
    .BTM_SecIsSecurityPending = BTM_SecIsSecurityPending,
    .BTM_IsLinkKeyKnown = BTM_IsLinkKeyKnown,
    .BTM_BleSirkConfirmDeviceReply = BTM_BleSirkConfirmDeviceReply,
    .BTM_BleSirkConfirmDeviceReply = BTM_BleSirkConfirmDeviceReply,

    .BTM_GetSecurityMode = BTM_GetSecurityMode,
    .BTM_GetSecurityMode = BTM_GetSecurityMode,

    .BTM_SecReadDevName = BTM_SecReadDevName,
    .BTM_SecAddRmtNameNotifyCallback = BTM_SecAddRmtNameNotifyCallback,
    .BTM_SecDeleteRmtNameNotifyCallback = BTM_SecDeleteRmtNameNotifyCallback,
};
};


const SecurityClientInterface& get_security_client_interface() {
const SecurityClientInterface& get_security_client_interface() {
+37 −20
Original line number Original line Diff line number Diff line
@@ -95,35 +95,26 @@ struct tBTM_APPL_INFO {
typedef struct {
typedef struct {
  void (*BTM_Sec_Init)();
  void (*BTM_Sec_Init)();
  void (*BTM_Sec_Free)();
  void (*BTM_Sec_Free)();

  bool (*BTM_SecRegister)(const tBTM_APPL_INFO* p_cb_info);

  // Update/Query in-memory device records
  bool (*BTM_SecAddDevice)(const RawAddress& bd_addr, const DEV_CLASS dev_class,
  bool (*BTM_SecAddDevice)(const RawAddress& bd_addr, const DEV_CLASS dev_class,
                           const BD_NAME& bd_name, uint8_t* features,
                           const BD_NAME& bd_name, uint8_t* features,
                           LinkKey* link_key, uint8_t key_type,
                           LinkKey* link_key, uint8_t key_type,
                           uint8_t pin_length);
                           uint8_t pin_length);
  bool (*BTM_SecAddRmtNameNotifyCallback)(tBTM_RMT_NAME_CALLBACK* p_callback);
  void (*BTM_SecAddBleDevice)(const RawAddress& bd_addr,
                              tBT_DEVICE_TYPE dev_type,
                              tBLE_ADDR_TYPE addr_type);

  bool (*BTM_SecDeleteDevice)(const RawAddress& bd_addr);
  bool (*BTM_SecDeleteDevice)(const RawAddress& bd_addr);
  bool (*BTM_SecRegister)(const tBTM_APPL_INFO* p_cb_info);

  const char* (*BTM_SecReadDevName)(const RawAddress& bd_addr);
  tBTM_STATUS (*BTM_SecBond)(const RawAddress& bd_addr,
                             tBLE_ADDR_TYPE addr_type, tBT_TRANSPORT transport,
                             tBT_DEVICE_TYPE device_type);
  tBTM_STATUS (*BTM_SecBondCancel)(const RawAddress& bd_addr);
  void (*BTM_SecAddBleKey)(const RawAddress& bd_addr,
  void (*BTM_SecAddBleKey)(const RawAddress& bd_addr,
                           tBTM_LE_KEY_VALUE* p_le_key,
                           tBTM_LE_KEY_VALUE* p_le_key,
                           tBTM_LE_KEY_TYPE key_type);
                           tBTM_LE_KEY_TYPE key_type);
  void (*BTM_SecAddBleDevice)(const RawAddress& bd_addr,

                              tBT_DEVICE_TYPE dev_type,
                              tBLE_ADDR_TYPE addr_type);
  void (*BTM_SecClearSecurityFlags)(const RawAddress& bd_addr);
  void (*BTM_SecClearSecurityFlags)(const RawAddress& bd_addr);
  uint8_t (*BTM_SecClrService)(uint8_t service_id);

  uint8_t (*BTM_SecClrServiceByPsm)(uint16_t psm);
  void (*BTM_RemoteOobDataReply)(tBTM_STATUS res, const RawAddress& bd_addr,
                                 const Octet16& c, const Octet16& r);
  void (*BTM_PINCodeReply)(const RawAddress& bd_addr, tBTM_STATUS res,
                           uint8_t pin_len, uint8_t* p_pin);
  void (*BTM_SecConfirmReqReply)(tBTM_STATUS res, tBT_TRANSPORT transport,
                                 const RawAddress bd_addr);
  bool (*BTM_SecDeleteRmtNameNotifyCallback)(
      tBTM_RMT_NAME_CALLBACK* p_callback);
  tBTM_STATUS (*BTM_SetEncryption)(const RawAddress& bd_addr,
  tBTM_STATUS (*BTM_SetEncryption)(const RawAddress& bd_addr,
                                   tBT_TRANSPORT transport,
                                   tBT_TRANSPORT transport,
                                   tBTM_SEC_CALLBACK* p_callback,
                                   tBTM_SEC_CALLBACK* p_callback,
@@ -132,8 +123,34 @@ typedef struct {
  bool (*BTM_SecIsSecurityPending)(const RawAddress& bd_addr);
  bool (*BTM_SecIsSecurityPending)(const RawAddress& bd_addr);
  bool (*BTM_IsLinkKeyKnown)(const RawAddress& bd_addr,
  bool (*BTM_IsLinkKeyKnown)(const RawAddress& bd_addr,
                             tBT_TRANSPORT transport);
                             tBT_TRANSPORT transport);

  // Securre service management
  uint8_t (*BTM_SecClrService)(uint8_t service_id);
  uint8_t (*BTM_SecClrServiceByPsm)(uint16_t psm);

  // Pairing related APIs
  tBTM_STATUS (*BTM_SecBond)(const RawAddress& bd_addr,
                             tBLE_ADDR_TYPE addr_type, tBT_TRANSPORT transport,
                             tBT_DEVICE_TYPE device_type);
  tBTM_STATUS (*BTM_SecBondCancel)(const RawAddress& bd_addr);

  void (*BTM_RemoteOobDataReply)(tBTM_STATUS res, const RawAddress& bd_addr,
                                 const Octet16& c, const Octet16& r);
  void (*BTM_PINCodeReply)(const RawAddress& bd_addr, tBTM_STATUS res,
                           uint8_t pin_len, uint8_t* p_pin);
  void (*BTM_SecConfirmReqReply)(tBTM_STATUS res, tBT_TRANSPORT transport,
                                 const RawAddress bd_addr);
  void (*BTM_BleSirkConfirmDeviceReply)(const RawAddress& bd_addr, uint8_t res);
  void (*BTM_BleSirkConfirmDeviceReply)(const RawAddress& bd_addr, uint8_t res);

  // other misc APIs
  uint8_t (*BTM_GetSecurityMode)();
  uint8_t (*BTM_GetSecurityMode)();

  // remote name request related APIs
  // TODO: remove them from this structure
  const char* (*BTM_SecReadDevName)(const RawAddress& bd_addr);
  bool (*BTM_SecAddRmtNameNotifyCallback)(tBTM_RMT_NAME_CALLBACK* p_callback);
  bool (*BTM_SecDeleteRmtNameNotifyCallback)(
      tBTM_RMT_NAME_CALLBACK* p_callback);
} SecurityClientInterface;
} SecurityClientInterface;


const SecurityClientInterface& get_security_client_interface();
const SecurityClientInterface& get_security_client_interface();
+46 −37
Original line number Original line Diff line number Diff line
@@ -114,38 +114,54 @@ struct btm_client_interface_t default_btm_client_interface = {
    .security = {
    .security = {
        .BTM_Sec_Init = []() {},
        .BTM_Sec_Init = []() {},
        .BTM_Sec_Free = []() {},
        .BTM_Sec_Free = []() {},
        .BTM_SecAddDevice = BTM_SecAddDevice,

        .BTM_SecAddRmtNameNotifyCallback =
            [](tBTM_RMT_NAME_CALLBACK* /* p_callback */) -> bool {
          return false;
        },
        .BTM_SecDeleteDevice = BTM_SecDeleteDevice,
        .BTM_SecRegister = [](const tBTM_APPL_INFO* /* p_cb_info */) -> bool {
        .BTM_SecRegister = [](const tBTM_APPL_INFO* /* p_cb_info */) -> bool {
          return false;
          return false;
        },
        },
        .BTM_SecReadDevName = [](const RawAddress& /* bd_addr */)

            -> const char* { return nullptr; },
        .BTM_SecAddDevice = BTM_SecAddDevice,
        .BTM_SecBond = [](const RawAddress& /* bd_addr */,
                          tBLE_ADDR_TYPE /* addr_type */,
                          tBT_TRANSPORT /* transport */,
                          tBT_DEVICE_TYPE /* device_type */) -> tBTM_STATUS {
          return BTM_SUCCESS;
        },
        .BTM_SecBondCancel = [](const RawAddress& /* bd_addr */)
            -> tBTM_STATUS { return BTM_SUCCESS; },
        .BTM_SecAddBleKey = [](const RawAddress& /* bd_addr */,
                               tBTM_LE_KEY_VALUE* /* p_le_key */,
                               tBTM_LE_KEY_TYPE /* key_type */) {},
        .BTM_SecAddBleDevice = [](const RawAddress& /* bd_addr */,
        .BTM_SecAddBleDevice = [](const RawAddress& /* bd_addr */,
                                  tBT_DEVICE_TYPE /* dev_type */,
                                  tBT_DEVICE_TYPE /* dev_type */,
                                  tBLE_ADDR_TYPE /* addr_type */) {},
                                  tBLE_ADDR_TYPE /* addr_type */) {},

        .BTM_SecDeleteDevice = BTM_SecDeleteDevice,

        .BTM_SecAddBleKey = [](const RawAddress& /* bd_addr */,
                               tBTM_LE_KEY_VALUE* /* p_le_key */,
                               tBTM_LE_KEY_TYPE /* key_type */) {},
        .BTM_SecClearSecurityFlags = BTM_SecClearSecurityFlags,
        .BTM_SecClearSecurityFlags = BTM_SecClearSecurityFlags,
        .BTM_SetEncryption =
            [](const RawAddress& /* bd_addr */, tBT_TRANSPORT /* transport */,
               tBTM_SEC_CALLBACK* /* p_callback */, void* /* p_ref_data */,
               tBTM_BLE_SEC_ACT /* sec_act */) -> tBTM_STATUS {
          return BTM_SUCCESS;
        },
        .BTM_IsEncrypted = [](const RawAddress& /* bd_addr */,
                              tBT_TRANSPORT /* transport */) -> bool {
          return false;
        },
        .BTM_SecIsSecurityPending =
            [](const RawAddress& /* bd_addr */) -> bool { return false; },
        .BTM_IsLinkKeyKnown = [](const RawAddress& /* bd_addr */,
                                 tBT_TRANSPORT /* transport */) -> bool {
          return false;
        },

        .BTM_SecClrService = [](uint8_t /* service_id */) -> uint8_t {
        .BTM_SecClrService = [](uint8_t /* service_id */) -> uint8_t {
          return 0;
          return 0;
        },
        },
        .BTM_SecClrServiceByPsm = [](uint16_t /* psm */) -> uint8_t {
        .BTM_SecClrServiceByPsm = [](uint16_t /* psm */) -> uint8_t {
          return 0;
          return 0;
        },
        },

        .BTM_SecBond = [](const RawAddress& /* bd_addr */,
                          tBLE_ADDR_TYPE /* addr_type */,
                          tBT_TRANSPORT /* transport */,
                          tBT_DEVICE_TYPE /* device_type */) -> tBTM_STATUS {
          return BTM_SUCCESS;
        },
        .BTM_SecBondCancel = [](const RawAddress& /* bd_addr */)
            -> tBTM_STATUS { return BTM_SUCCESS; },
        .BTM_RemoteOobDataReply =
        .BTM_RemoteOobDataReply =
            [](tBTM_STATUS /* res */, const RawAddress& /* bd_addr */,
            [](tBTM_STATUS /* res */, const RawAddress& /* bd_addr */,
               const Octet16& /* c */, const Octet16& /* r */) {},
               const Octet16& /* c */, const Octet16& /* r */) {},
@@ -155,29 +171,22 @@ struct btm_client_interface_t default_btm_client_interface = {
        .BTM_SecConfirmReqReply = [](tBTM_STATUS /* res */,
        .BTM_SecConfirmReqReply = [](tBTM_STATUS /* res */,
                                     tBT_TRANSPORT /* transport */,
                                     tBT_TRANSPORT /* transport */,
                                     const RawAddress /* bd_addr */) {},
                                     const RawAddress /* bd_addr */) {},
        .BTM_SecDeleteRmtNameNotifyCallback =
        .BTM_BleSirkConfirmDeviceReply = [](const RawAddress& /* bd_addr */,
                                            uint8_t /* res */) {},

        .BTM_GetSecurityMode = []() -> uint8_t { return 0; },

        .BTM_SecReadDevName = [](const RawAddress& /* bd_addr */)
            -> const char* { return nullptr; },

        .BTM_SecAddRmtNameNotifyCallback =
            [](tBTM_RMT_NAME_CALLBACK* /* p_callback */) -> bool {
            [](tBTM_RMT_NAME_CALLBACK* /* p_callback */) -> bool {
          return false;
          return false;
        },
        },
        .BTM_SetEncryption =
        .BTM_SecDeleteRmtNameNotifyCallback =
            [](const RawAddress& /* bd_addr */, tBT_TRANSPORT /* transport */,
            [](tBTM_RMT_NAME_CALLBACK* /* p_callback */) -> bool {
               tBTM_SEC_CALLBACK* /* p_callback */, void* /* p_ref_data */,
               tBTM_BLE_SEC_ACT /* sec_act */) -> tBTM_STATUS {
          return BTM_SUCCESS;
        },
        .BTM_IsEncrypted = [](const RawAddress& /* bd_addr */,
                              tBT_TRANSPORT /* transport */) -> bool {
          return false;
        },
        .BTM_SecIsSecurityPending =
            [](const RawAddress& /* bd_addr */) -> bool { return false; },
        .BTM_IsLinkKeyKnown = [](const RawAddress& /* bd_addr */,
                                 tBT_TRANSPORT /* transport */) -> bool {
          return false;
          return false;
        },
        },
        .BTM_BleSirkConfirmDeviceReply = [](const RawAddress& /* bd_addr */,
                                            uint8_t /* res */) {},
        .BTM_GetSecurityMode = []() -> uint8_t { return 0; },
    },
    },
    .ble = {
    .ble = {
        .BTM_BleGetEnergyInfo =
        .BTM_BleGetEnergyInfo =