summaryrefslogtreecommitdiff
path: root/btio
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-01-31 17:25:34 -0800
committerJohan Hedberg <johan.hedberg@intel.com>2012-01-31 18:32:34 -0800
commit11dbefe49d06185e4c7248715d58c6550cd399da (patch)
tree044feaedb5baf9c7a694d6a3fd2ff1cc70d4b5f6 /btio
parent42d63192e58b81550b1ed78f802b0fed82eb0452 (diff)
downloadbluez-11dbefe49d06185e4c7248715d58c6550cd399da.tar.gz
btio: Add L2ERTM type
L2ERTM type uses L2CAP socket in SOCK_STREAM instead of SOCK_SEQPACKET
Diffstat (limited to 'btio')
-rw-r--r--btio/btio.c17
-rw-r--r--btio/btio.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/btio/btio.c b/btio/btio.c
index 825907dcc..9781ec417 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1161,6 +1161,7 @@ static gboolean get_valist(GIOChannel *io, BtIOType type, GError **err,
switch (type) {
case BT_IO_L2RAW:
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
return l2cap_get(sock, err, opt1, args);
case BT_IO_RFCOMM:
return rfcomm_get(sock, err, opt1, args);
@@ -1223,6 +1224,7 @@ gboolean bt_io_set(GIOChannel *io, BtIOType type, GError **err,
switch (type) {
case BT_IO_L2RAW:
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
return l2cap_set(sock, opts.sec_level, opts.imtu, opts.omtu,
opts.mode, opts.master, opts.flushable,
opts.priority, err);
@@ -1283,6 +1285,20 @@ static GIOChannel *create_io(BtIOType type, gboolean server,
opts->priority, err))
goto failed;
break;
+ case BT_IO_L2ERTM:
+ sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP);
+ if (sock < 0) {
+ ERROR_FAILED(err, "socket(STREAM, L2CAP)", errno);
+ return NULL;
+ }
+ if (l2cap_bind(sock, &opts->src, server ? opts->psm : 0,
+ opts->cid, err) < 0)
+ goto failed;
+ if (!l2cap_set(sock, opts->sec_level, opts->imtu, opts->omtu,
+ opts->mode, opts->master, opts->flushable,
+ opts->priority, err))
+ goto failed;
+ break;
case BT_IO_RFCOMM:
sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if (sock < 0) {
@@ -1353,6 +1369,7 @@ GIOChannel *bt_io_connect(BtIOType type, BtIOConnect connect,
err = l2cap_connect(sock, &opts.dst, 0, opts.cid);
break;
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
err = l2cap_connect(sock, &opts.dst, opts.psm, opts.cid);
break;
case BT_IO_RFCOMM:
diff --git a/btio/btio.h b/btio/btio.h
index 7e3e130eb..126d5d93b 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -40,6 +40,7 @@ GQuark bt_io_error_quark(void);
typedef enum {
BT_IO_L2RAW,
BT_IO_L2CAP,
+ BT_IO_L2ERTM,
BT_IO_RFCOMM,
BT_IO_SCO,
} BtIOType;