github-advanced-security[bot] commented on code in PR #1677:
URL: https://github.com/apache/mynewt-nimble/pull/1677#discussion_r1469104456


##########
nimble/host/src/ble_iso.c:
##########
@@ -176,6 +286,152 @@
     return rc;
 }
 
+int
+ble_iso_big_sync_create(struct ble_iso_big_sync_create_param *param,
+                        uint8_t *big_handle)
+{
+    struct ble_hci_le_big_create_sync_cp *cp;
+    uint8_t buf[sizeof(*cp) + MYNEWT_VAL(BLE_MAX_BIS)];
+    struct ble_iso_big *big;
+    int rc;
+
+    big = ble_iso_big_alloc();
+    if (big == NULL) {
+        return BLE_HS_ENOMEM;
+    }
+
+    big->bis_cnt = param->bis_cnt;
+    big->cb = param->cb;
+    big->cb_arg = param->cb_arg;
+
+    cp = (void *)buf;
+    cp->big_handle = big->handle;
+    put_le16(&cp->sync_handle, param->sync_handle);
+
+    if (param->broadcast_code != NULL) {
+        cp->encryption = BLE_HCI_ISO_BIG_ENCRYPTION_ENCRYPTED;
+        memcpy(cp->broadcast_code, param->broadcast_code, 
sizeof(cp->broadcast_code));
+    } else {
+        cp->encryption = BLE_HCI_ISO_BIG_ENCRYPTION_UNENCRYPTED;
+        memset(cp->broadcast_code, 0, sizeof(cp->broadcast_code));
+    }
+
+    cp->mse = param->mse;
+    put_le16(&cp->sync_timeout, param->big_sync_timeout);
+    cp->num_bis = param->bis_cnt;
+
+    for (uint8_t i = 0; i < param->bis_cnt; i++) {
+        struct ble_iso_bis *bis;
+
+        bis = ble_iso_bis_alloc(big);
+        if (bis == NULL) {
+            ble_iso_big_free(big);
+            return BLE_HS_ENOMEM;
+        }
+
+        bis->conn.cb = param->bis_param[i].cb;
+        bis->conn.cb_arg = param->bis_param[i].cb_arg;
+
+        cp->bis[i] = param->bis_param[i].bis_index;
+    }
+
+    rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
+                                      BLE_HCI_OCF_LE_BIG_CREATE_SYNC),
+                           cp, sizeof(*cp) * cp->num_bis, NULL, 0);
+    if (rc != 0) {
+        ble_iso_big_free(big);
+    } else {
+        *big_handle = big->handle;
+    }
+
+    return rc;
+}
+
+int
+ble_iso_big_sync_terminate(uint8_t big_handle)
+{
+    struct ble_hci_le_big_terminate_sync_cp cp;
+    struct ble_iso_big *big;
+    int rc;
+
+    big = ble_iso_big_find_by_handle(big_handle);
+    if (big == NULL) {
+        BLE_HS_LOG_ERROR("No BIG with handle=%d\n", big_handle);
+        return BLE_HS_ENOENT;
+    }
+
+    cp.big_handle = big->handle;
+
+    rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
+                                      BLE_HCI_OCF_LE_BIG_TERMINATE_SYNC),
+                           &cp, sizeof(cp), NULL, 0);
+
+    return rc;
+}
+
+int
+ble_iso_data_path_setup(const struct ble_iso_data_path_setup_param *param)
+{
+    struct ble_hci_le_setup_iso_data_path_rp rp;
+    struct ble_hci_le_setup_iso_data_path_cp *cp;
+    uint8_t buf[sizeof(*cp) + UINT8_MAX]; /* FIXME */

Review Comment:
   ## FIXME comment
   
   FIXME comment
   
   [Show more 
details](https://github.com/apache/mynewt-nimble/security/code-scanning/79)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to