lib: Add definitions for ISO socket
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 29 Jul 2019 10:09:24 +0000 (13:09 +0300)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:54 +0000 (14:55 +0530)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Makefile.am
lib/bluetooth.h
lib/iso.h [new file with mode: 0644]

index c9e7e5f..e3dcbdf 100755 (executable)
@@ -69,7 +69,7 @@ lib_headers = lib/bluetooth.h lib/hci.h lib/hci_lib.h \
                lib/sco.h lib/l2cap.h lib/sdp.h lib/sdp_lib.h \
                lib/rfcomm.h lib/bnep.h lib/cmtp.h lib/hidp.h
 
-extra_headers = lib/mgmt.h lib/uuid.h lib/a2mp.h lib/amp.h
+extra_headers = lib/mgmt.h lib/uuid.h lib/a2mp.h lib/amp.h lib/iso.h
 extra_sources = lib/uuid.c
 
 local_headers = $(foreach file,$(lib_headers), lib/bluetooth/$(notdir $(file)))
index 29e5b21..aaaa835 100755 (executable)
@@ -37,6 +37,7 @@ extern "C" {
 #define BTPROTO_CMTP   5
 #define BTPROTO_HIDP   6
 #define BTPROTO_AVDTP  7
+#define BTPROTO_ISO    8
 
 #define SOL_HCI                0
 #define SOL_L2CAP      6
@@ -150,7 +151,39 @@ struct le_conn_param {
 
 #define BT_SCM_PKT_STATUS      0x03
 
-#define BT_CODEC 19
+#define BT_ISO_QOS             17
+
+#define BT_ISO_QOS_CIG_UNSET   0xff
+#define BT_ISO_QOS_CIS_UNSET   0xff
+
+struct bt_iso_io_qos {
+       uint32_t interval;
+       uint16_t latency;
+       uint16_t sdu;
+       uint8_t  phy;
+       uint8_t  rtn;
+};
+
+struct bt_iso_qos {
+       union {
+               uint8_t  cig;
+               uint8_t  big;
+       };
+       union {
+               uint8_t  cis;
+               uint8_t  bis;
+       };
+       union {
+               uint8_t  sca;
+               uint8_t  sync_interval;
+       };
+       uint8_t  packing;
+       uint8_t  framing;
+       struct bt_iso_io_qos in;
+       struct bt_iso_io_qos out;
+};
+
+#define BT_CODEC               19
 struct bt_codec {
        uint8_t id;
        uint16_t cid;
@@ -168,6 +201,7 @@ struct bt_codecs {
        struct bt_codec codecs[];
 } __attribute__((packed));
 
+
 /* Connection and socket states */
 enum {
        BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
@@ -181,6 +215,8 @@ enum {
        BT_CLOSED
 };
 
+#define BT_ISO_BASE            20
+
 /* Byte order conversions */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define htobs(d)  (d)
diff --git a/lib/iso.h b/lib/iso.h
new file mode 100644 (file)
index 0000000..1e9f79c
--- /dev/null
+++ b/lib/iso.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2022  Intel Corporation.
+ *
+ */
+
+#ifndef __ISO_H
+#define __ISO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ISO defaults */
+#define ISO_DEFAULT_MTU                251
+#define ISO_MAX_NUM_BIS                0x1f
+
+/* ISO socket broadcast address */
+struct sockaddr_iso_bc {
+       bdaddr_t        bc_bdaddr;
+       uint8_t         bc_bdaddr_type;
+       uint8_t         bc_sid;
+       uint8_t         bc_num_bis;
+       uint8_t         bc_bis[ISO_MAX_NUM_BIS];
+};
+
+/* ISO socket address */
+struct sockaddr_iso {
+       sa_family_t     iso_family;
+       bdaddr_t        iso_bdaddr;
+       uint8_t         iso_bdaddr_type;
+       struct sockaddr_iso_bc iso_bc[];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ISO_H */