diff options
author | 2024-05-31 08:39:11 -0700 | |
---|---|---|
committer | 2024-05-31 23:42:50 +0000 | |
commit | 19259136f81bd27d265fc4b97ac87467ea15366c (patch) | |
tree | e1f881d0a8725dad6de46eacdc63e61c3abd1ba9 | |
parent | 7a51b10822a1f93abf7a063d3f80268bd4e00441 (diff) |
stack::l2cap: Properly name L2CA_Register2 => L2CA_RegisterWithSecurity
Bug: 343941946
Test: m .
Flag: EXEMPT, Mechanical Refactor
Change-Id: I7414241506c78067200c94d27dc9fd1aad4ed062
-rw-r--r-- | system/stack/avct/avct_api.cc | 11 | ||||
-rw-r--r-- | system/stack/avdt/avdt_api.cc | 5 | ||||
-rw-r--r-- | system/stack/bnep/bnep_main.cc | 7 | ||||
-rw-r--r-- | system/stack/fuzzers/avrc_fuzzer.cc | 4 | ||||
-rw-r--r-- | system/stack/fuzzers/bnep_fuzzer.cc | 4 | ||||
-rw-r--r-- | system/stack/fuzzers/gatt_fuzzer.cc | 4 | ||||
-rw-r--r-- | system/stack/fuzzers/l2cap_fuzzer.cc | 9 | ||||
-rw-r--r-- | system/stack/fuzzers/sdp_fuzzer.cc | 4 | ||||
-rw-r--r-- | system/stack/gap/gap_conn.cc | 6 | ||||
-rw-r--r-- | system/stack/gatt/gatt_main.cc | 4 | ||||
-rw-r--r-- | system/stack/hid/hidd_conn.cc | 12 | ||||
-rw-r--r-- | system/stack/hid/hidh_conn.cc | 12 | ||||
-rw-r--r-- | system/stack/include/l2c_api.h | 2 | ||||
-rw-r--r-- | system/stack/l2cap/l2c_api.cc | 8 | ||||
-rw-r--r-- | system/stack/sdp/sdp_main.cc | 5 | ||||
-rw-r--r-- | system/stack/test/hid/stack_hid_test.cc | 2 | ||||
-rw-r--r-- | system/stack/test/sdp/stack_sdp_parse_test.cc | 4 | ||||
-rw-r--r-- | system/stack/test/sdp/stack_sdp_test.cc | 4 | ||||
-rw-r--r-- | system/stack/test/sdp/stack_sdp_utils_test.cc | 4 | ||||
-rw-r--r-- | system/test/mock/mock_stack_l2cap_api.cc | 12 | ||||
-rw-r--r-- | system/test/mock/mock_stack_l2cap_api.h | 6 |
21 files changed, 67 insertions, 62 deletions
diff --git a/system/stack/avct/avct_api.cc b/system/stack/avct/avct_api.cc index f8f25cfa8e..c9dd22ec31 100644 --- a/system/stack/avct/avct_api.cc +++ b/system/stack/avct/avct_api.cc @@ -62,8 +62,9 @@ void AVCT_Register() { memset(&avct_cb, 0, sizeof(tAVCT_CB)); /* register PSM with L2CAP */ - if (!L2CA_Register2(AVCT_PSM, avct_l2c_appl, true /* enable_snoop */, nullptr, - kAvrcMtu, 0, BTA_SEC_AUTHENTICATE)) { + if (!L2CA_RegisterWithSecurity(AVCT_PSM, avct_l2c_appl, + true /* enable_snoop */, nullptr, kAvrcMtu, 0, + BTA_SEC_AUTHENTICATE)) { log::error( "Unable to register with L2CAP AVCT profile psm:AVCT_PSM[0x0017]"); } @@ -72,9 +73,9 @@ void AVCT_Register() { tL2CAP_ERTM_INFO ertm_info; ertm_info.preferred_mode = L2CAP_FCR_ERTM_MODE; - if (!L2CA_Register2(AVCT_BR_PSM, avct_l2c_br_appl, true /*enable_snoop*/, - &ertm_info, kAvrcBrMtu, AVCT_MIN_BROWSE_MTU, - BTA_SEC_AUTHENTICATE)) { + if (!L2CA_RegisterWithSecurity(AVCT_BR_PSM, avct_l2c_br_appl, + true /*enable_snoop*/, &ertm_info, kAvrcBrMtu, + AVCT_MIN_BROWSE_MTU, BTA_SEC_AUTHENTICATE)) { log::error( "Unable to register with L2CAP AVCT_BR profile " "psm:AVCT_BR_PSM[0x001b]"); diff --git a/system/stack/avdt/avdt_api.cc b/system/stack/avdt/avdt_api.cc index a0aeaa20ca..e40f3c65d4 100644 --- a/system/stack/avdt/avdt_api.cc +++ b/system/stack/avdt/avdt_api.cc @@ -98,8 +98,9 @@ void avdt_scb_transport_channel_timer_timeout(void* data) { ******************************************************************************/ void AVDT_Register(AvdtpRcb* p_reg, tAVDT_CTRL_CBACK* p_cback) { /* register PSM with L2CAP */ - if (!L2CA_Register2(AVDT_PSM, avdt_l2c_appl, true /* enable_snoop */, nullptr, - kAvdtpMtu, 0, BTA_SEC_AUTHENTICATE)) { + if (!L2CA_RegisterWithSecurity(AVDT_PSM, avdt_l2c_appl, + true /* enable_snoop */, nullptr, kAvdtpMtu, 0, + BTA_SEC_AUTHENTICATE)) { log::error( "Unable to register with L2CAP profile AVDT psm:AVDT_PSM[0x0019]"); } diff --git a/system/stack/bnep/bnep_main.cc b/system/stack/bnep/bnep_main.cc index 5d885d27f1..e761f129a9 100644 --- a/system/stack/bnep/bnep_main.cc +++ b/system/stack/bnep/bnep_main.cc @@ -89,9 +89,10 @@ tBNEP_RESULT bnep_register_with_l2cap(void) { bnep_cb.reg_info.pL2CA_Error_Cb = bnep_on_l2cap_error; /* Now, register with L2CAP */ - if (!L2CA_Register2(BT_PSM_BNEP, bnep_cb.reg_info, false /* enable_snoop */, - nullptr, BNEP_MTU_SIZE, BNEP_MTU_SIZE, - BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { + if (!L2CA_RegisterWithSecurity(BT_PSM_BNEP, bnep_cb.reg_info, + false /* enable_snoop */, nullptr, + BNEP_MTU_SIZE, BNEP_MTU_SIZE, + BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { log::error("BNEP - Registration failed"); return BNEP_SECURITY_FAIL; } diff --git a/system/stack/fuzzers/avrc_fuzzer.cc b/system/stack/fuzzers/avrc_fuzzer.cc index de42354aa7..dfffe6a181 100644 --- a/system/stack/fuzzers/avrc_fuzzer.cc +++ b/system/stack/fuzzers/avrc_fuzzer.cc @@ -74,7 +74,7 @@ class FakeBtStack { "assert failed: p_bd_addr == kDummyRemoteAddr"); return kDummyCid; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, uint16_t sec_level) { @@ -95,7 +95,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_Deregister = {}; } }; diff --git a/system/stack/fuzzers/bnep_fuzzer.cc b/system/stack/fuzzers/bnep_fuzzer.cc index 9e3d19621b..99edaa4d13 100644 --- a/system/stack/fuzzers/bnep_fuzzer.cc +++ b/system/stack/fuzzers/bnep_fuzzer.cc @@ -70,7 +70,7 @@ class FakeBtStack { "assert failed: p_bd_addr == kDummyRemoteAddr"); return kDummyCid; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, uint16_t sec_level) { @@ -84,7 +84,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_Deregister = {}; } }; diff --git a/system/stack/fuzzers/gatt_fuzzer.cc b/system/stack/fuzzers/gatt_fuzzer.cc index f7aaf72422..8691f7689b 100644 --- a/system/stack/fuzzers/gatt_fuzzer.cc +++ b/system/stack/fuzzers/gatt_fuzzer.cc @@ -101,7 +101,7 @@ class FakeBtStack { fixed_chnl_reg = *p_freg; return true; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, uint16_t sec_level) { @@ -129,7 +129,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; test::mock::stack_l2cap_api::L2CA_SendFixedChnlData = {}; test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_RegisterLECoc = {}; test::mock::stack_l2cap_api::L2CA_SetIdleTimeoutByBdAddr = {}; test::mock::stack_l2cap_api::L2CA_SetLeGattTimeout = {}; diff --git a/system/stack/fuzzers/l2cap_fuzzer.cc b/system/stack/fuzzers/l2cap_fuzzer.cc index a1a293de52..52f84490b0 100644 --- a/system/stack/fuzzers/l2cap_fuzzer.cc +++ b/system/stack/fuzzers/l2cap_fuzzer.cc @@ -210,10 +210,11 @@ static void Fuzz(const uint8_t* data, size_t size) { bool, tL2CAP_LE_CFG_INFO*) {}, .pL2CA_CreditBasedCollisionInd_Cb = [](const RawAddress&) {}, }; - log::assert_that(L2CA_Register2(BT_PSM_ATT, appl_info, false, nullptr, - L2CAP_MTU_SIZE, 0, BTM_SEC_NONE), - "assert failed: L2CA_Register2(BT_PSM_ATT, appl_info, " - "false, nullptr, L2CAP_MTU_SIZE, 0, BTM_SEC_NONE)"); + log::assert_that( + L2CA_RegisterWithSecurity(BT_PSM_ATT, appl_info, false, nullptr, + L2CAP_MTU_SIZE, 0, BTM_SEC_NONE), + "assert failed: L2CA_RegisterWithSecurity(BT_PSM_ATT, appl_info, " + "false, nullptr, L2CAP_MTU_SIZE, 0, BTM_SEC_NONE)"); log::assert_that(L2CA_RegisterLECoc(BT_PSM_EATT, appl_info, BTM_SEC_NONE, {}), "assert failed: L2CA_RegisterLECoc(BT_PSM_EATT, appl_info, " "BTM_SEC_NONE, {{}})"); diff --git a/system/stack/fuzzers/sdp_fuzzer.cc b/system/stack/fuzzers/sdp_fuzzer.cc index d8ae22ce98..e2bc87f7f4 100644 --- a/system/stack/fuzzers/sdp_fuzzer.cc +++ b/system/stack/fuzzers/sdp_fuzzer.cc @@ -96,7 +96,7 @@ class FakeL2cap { test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t lcid) { return true; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, uint16_t sec_level) { @@ -110,7 +110,7 @@ class FakeL2cap { test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; } }; diff --git a/system/stack/gap/gap_conn.cc b/system/stack/gap/gap_conn.cc index 6d5270ed3a..f0f060d48f 100644 --- a/system/stack/gap/gap_conn.cc +++ b/system/stack/gap/gap_conn.cc @@ -240,9 +240,9 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, /* Register the PSM with L2CAP */ if (transport == BT_TRANSPORT_BR_EDR) { - p_ccb->psm = - L2CA_Register2(psm, conn.reg_info, false /* enable_snoop */, - &p_ccb->ertm_info, L2CAP_SDU_LENGTH_MAX, 0, security); + p_ccb->psm = L2CA_RegisterWithSecurity( + psm, conn.reg_info, false /* enable_snoop */, &p_ccb->ertm_info, + L2CAP_SDU_LENGTH_MAX, 0, security); if (p_ccb->psm == 0) { log::error("Failure registering PSM 0x{:04x}", psm); gap_release_ccb(p_ccb); diff --git a/system/stack/gatt/gatt_main.cc b/system/stack/gatt/gatt_main.cc index 65d9abc71a..44b7899166 100644 --- a/system/stack/gatt/gatt_main.cc +++ b/system/stack/gatt/gatt_main.cc @@ -138,8 +138,8 @@ void gatt_init(void) { osi_property_get_bool("bluetooth.gatt.over_bredr.enabled", true); /* Now, register with L2CAP for ATT PSM over BR/EDR */ if (gatt_cb.over_br_enabled && - !L2CA_Register2(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr, - GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) { + !L2CA_RegisterWithSecurity(BT_PSM_ATT, dyn_info, false /* enable_snoop */, + nullptr, GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) { log::error("ATT Dynamic Registration failed"); } diff --git a/system/stack/hid/hidd_conn.cc b/system/stack/hid/hidd_conn.cc index a935723446..54ffdd60c2 100644 --- a/system/stack/hid/hidd_conn.cc +++ b/system/stack/hid/hidd_conn.cc @@ -582,9 +582,9 @@ tHID_STATUS hidd_conn_reg(void) { hd_cb.l2cap_intr_cfg.mtu_present = TRUE; hd_cb.l2cap_intr_cfg.mtu = HID_DEV_MTU_SIZE; - if (!L2CA_Register2(HID_PSM_CONTROL, dev_reg_info, false /* enable_snoop */, - nullptr, HID_DEV_MTU_SIZE, 0, - BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { + if (!L2CA_RegisterWithSecurity( + HID_PSM_CONTROL, dev_reg_info, false /* enable_snoop */, nullptr, + HID_DEV_MTU_SIZE, 0, BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { log::error("HID Control (device) registration failed"); log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: HIDD_ERR_L2CAP_FAILED_CONTROL, @@ -592,9 +592,9 @@ tHID_STATUS hidd_conn_reg(void) { return (HID_ERR_L2CAP_FAILED); } - if (!L2CA_Register2(HID_PSM_INTERRUPT, dev_reg_info, false /* enable_snoop */, - nullptr, HID_DEV_MTU_SIZE, 0, - BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { + if (!L2CA_RegisterWithSecurity( + HID_PSM_INTERRUPT, dev_reg_info, false /* enable_snoop */, nullptr, + HID_DEV_MTU_SIZE, 0, BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { L2CA_Deregister(HID_PSM_CONTROL); log::error("HID Interrupt (device) registration failed"); log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: diff --git a/system/stack/hid/hidh_conn.cc b/system/stack/hid/hidh_conn.cc index 459549fafb..d0a6b04a97 100644 --- a/system/stack/hid/hidh_conn.cc +++ b/system/stack/hid/hidh_conn.cc @@ -106,18 +106,18 @@ tHID_STATUS hidh_conn_reg(void) { hh_cb.l2cap_cfg.mtu = HID_HOST_MTU; /* Now, register with L2CAP */ - if (!L2CA_Register2(HID_PSM_CONTROL, hst_reg_info, false /* enable_snoop */, - nullptr, HID_HOST_MTU, 0, - BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { + if (!L2CA_RegisterWithSecurity( + HID_PSM_CONTROL, hst_reg_info, false /* enable_snoop */, nullptr, + HID_HOST_MTU, 0, BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { log::error("HID-Host Control Registration failed"); log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: HIDH_ERR_L2CAP_FAILED_AT_REGISTER_CONTROL, 1); return (HID_ERR_L2CAP_FAILED); } - if (!L2CA_Register2(HID_PSM_INTERRUPT, hst_reg_info, false /* enable_snoop */, - nullptr, HID_HOST_MTU, 0, - BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { + if (!L2CA_RegisterWithSecurity( + HID_PSM_INTERRUPT, hst_reg_info, false /* enable_snoop */, nullptr, + HID_HOST_MTU, 0, BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) { L2CA_Deregister(HID_PSM_CONTROL); log::error("HID-Host Interrupt Registration failed"); log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: diff --git a/system/stack/include/l2c_api.h b/system/stack/include/l2c_api.h index 71528fd70d..71ed8aa3ed 100644 --- a/system/stack/include/l2c_api.h +++ b/system/stack/include/l2c_api.h @@ -361,7 +361,7 @@ void l2c_free(); ****************************************************************************/ // Also does security for you -[[nodiscard]] uint16_t L2CA_Register2( +[[nodiscard]] uint16_t L2CA_RegisterWithSecurity( uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, uint16_t sec_level); diff --git a/system/stack/l2cap/l2c_api.cc b/system/stack/l2cap/l2c_api.cc index 22dc618e23..e3165e76c4 100644 --- a/system/stack/l2cap/l2c_api.cc +++ b/system/stack/l2cap/l2c_api.cc @@ -65,10 +65,10 @@ tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) { return BT_TRANSPORT_BR_EDR; } -uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, - bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, - uint16_t my_mtu, uint16_t required_remote_mtu, - uint16_t sec_level) { +uint16_t L2CA_RegisterWithSecurity( + uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, + tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, + uint16_t required_remote_mtu, uint16_t sec_level) { auto ret = L2CA_Register(psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu, sec_level); get_btm_client_interface().security.BTM_SetSecurityLevel( diff --git a/system/stack/sdp/sdp_main.cc b/system/stack/sdp/sdp_main.cc index d68c593444..307da94a57 100644 --- a/system/stack/sdp/sdp_main.cc +++ b/system/stack/sdp/sdp_main.cc @@ -426,8 +426,9 @@ void sdp_init(void) { sdp_cb.reg_info.pL2CA_Error_Cb = sdp_on_l2cap_error; /* Now, register with L2CAP */ - if (!L2CA_Register2(BT_PSM_SDP, sdp_cb.reg_info, true /* enable_snoop */, - nullptr, SDP_MTU_SIZE, 0, BTM_SEC_NONE)) { + if (!L2CA_RegisterWithSecurity(BT_PSM_SDP, sdp_cb.reg_info, + true /* enable_snoop */, nullptr, SDP_MTU_SIZE, + 0, BTM_SEC_NONE)) { log::error("SDP Registration failed"); } } diff --git a/system/stack/test/hid/stack_hid_test.cc b/system/stack/test/hid/stack_hid_test.cc index 20c509892d..5b04dd3b36 100644 --- a/system/stack/test/hid/stack_hid_test.cc +++ b/system/stack/test/hid/stack_hid_test.cc @@ -55,7 +55,7 @@ class StackHidTest : public Test { TEST_F(StackHidTest, disconnect_bad_cid) { tL2CAP_APPL_INFO l2cap_callbacks; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [&l2cap_callbacks](uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, diff --git a/system/stack/test/sdp/stack_sdp_parse_test.cc b/system/stack/test/sdp/stack_sdp_parse_test.cc index 973004ca1b..1d00401c8c 100644 --- a/system/stack/test/sdp/stack_sdp_parse_test.cc +++ b/system/stack/test/sdp/stack_sdp_parse_test.cc @@ -67,7 +67,7 @@ class StackSdpParserWithMocksTest : public ::testing::Test { }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& /* p_cb_info */, bool /* enable_snoop */, tL2CAP_ERTM_INFO* /* p_ertm_info */, uint16_t /* my_mtu */, uint16_t /* required_remote_mtu */, @@ -75,7 +75,7 @@ class StackSdpParserWithMocksTest : public ::testing::Test { } void TearDown() override { - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; diff --git a/system/stack/test/sdp/stack_sdp_test.cc b/system/stack/test/sdp/stack_sdp_test.cc index 96c7e34e53..5c9223011e 100644 --- a/system/stack/test/sdp/stack_sdp_test.cc +++ b/system/stack/test/sdp/stack_sdp_test.cc @@ -56,7 +56,7 @@ class StackSdpWithMocksTest : public ::testing::Test { }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t psm, const tL2CAP_APPL_INFO& /* p_cb_info */, bool /* enable_snoop */, tL2CAP_ERTM_INFO* /* p_ertm_info */, uint16_t /* my_mtu */, uint16_t /* required_remote_mtu */, @@ -65,7 +65,7 @@ class StackSdpWithMocksTest : public ::testing::Test { void TearDown() override { test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; diff --git a/system/stack/test/sdp/stack_sdp_utils_test.cc b/system/stack/test/sdp/stack_sdp_utils_test.cc index 3e7221054e..e3cfac1ddb 100644 --- a/system/stack/test/sdp/stack_sdp_utils_test.cc +++ b/system/stack/test/sdp/stack_sdp_utils_test.cc @@ -261,7 +261,7 @@ class StackSdpMockAndFakeTest : public ::testing::Test { }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; - test::mock::stack_l2cap_api::L2CA_Register2.body = + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity.body = [](uint16_t /* psm */, const tL2CAP_APPL_INFO& /* p_cb_info */, bool /* enable_snoop */, tL2CAP_ERTM_INFO* /* p_ertm_info */, uint16_t /* my_mtu */, uint16_t /* required_remote_mtu */, @@ -272,7 +272,7 @@ class StackSdpMockAndFakeTest : public ::testing::Test { void TearDown() override { test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity = {}; - test::mock::stack_l2cap_api::L2CA_Register2 = {}; + test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity = {}; test::mock::stack_l2cap_api::L2CA_DataWrite = {}; test::mock::stack_l2cap_api::L2CA_DisconnectReq = {}; } diff --git a/system/test/mock/mock_stack_l2cap_api.cc b/system/test/mock/mock_stack_l2cap_api.cc index b132832630..9e8e3b1c34 100644 --- a/system/test/mock/mock_stack_l2cap_api.cc +++ b/system/test/mock/mock_stack_l2cap_api.cc @@ -35,7 +35,7 @@ namespace stack_l2cap_api { // Function state capture and return values, if needed struct l2c_get_transport_from_fixed_cid l2c_get_transport_from_fixed_cid; -struct L2CA_Register2 L2CA_Register2; +struct L2CA_RegisterWithSecurity L2CA_RegisterWithSecurity; struct L2CA_Register L2CA_Register; struct L2CA_Deregister L2CA_Deregister; struct L2CA_AllocateLePSM L2CA_AllocateLePSM; @@ -84,12 +84,12 @@ tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) { return test::mock::stack_l2cap_api::l2c_get_transport_from_fixed_cid( fixed_cid); } -uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, - bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, - uint16_t my_mtu, uint16_t required_remote_mtu, - uint16_t sec_level) { +uint16_t L2CA_RegisterWithSecurity( + uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, + tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, + uint16_t required_remote_mtu, uint16_t sec_level) { inc_func_call_count(__func__); - return test::mock::stack_l2cap_api::L2CA_Register2( + return test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity( psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu, sec_level); } diff --git a/system/test/mock/mock_stack_l2cap_api.h b/system/test/mock/mock_stack_l2cap_api.h index f13da10743..08aafaa9a3 100644 --- a/system/test/mock/mock_stack_l2cap_api.h +++ b/system/test/mock/mock_stack_l2cap_api.h @@ -49,11 +49,11 @@ struct l2c_get_transport_from_fixed_cid { tBT_TRANSPORT operator()(uint16_t fixed_cid) { return body(fixed_cid); }; }; extern struct l2c_get_transport_from_fixed_cid l2c_get_transport_from_fixed_cid; -// Name: L2CA_Register2 +// Name: L2CA_RegisterWithSecurity // Params: uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, // tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, // uint16_t sec_level Returns: uint16_t -struct L2CA_Register2 { +struct L2CA_RegisterWithSecurity { std::function<uint16_t(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, @@ -70,7 +70,7 @@ struct L2CA_Register2 { required_remote_mtu, sec_level); }; }; -extern struct L2CA_Register2 L2CA_Register2; +extern struct L2CA_RegisterWithSecurity L2CA_RegisterWithSecurity; // Name: L2CA_Register // Params: uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, // tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, |