summaryrefslogtreecommitdiff
path: root/btio/btio.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-08-29 09:03:39 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2012-08-29 09:03:39 -0700
commitb643623460db6d57436efc5da022480d7ddd16c4 (patch)
tree2b55db39e2e35573e40cce224cac2fc330cc597b /btio/btio.c
parent5dd93fc16a76b57e1a5fd93f89b47268ceaf0599 (diff)
downloadbluez-b643623460db6d57436efc5da022480d7ddd16c4.tar.gz
btio: Remove BT_IO_L2ERTM
There's no need to have a separate type for ERTM. The mode parameter takes care of most needs and if necessary a "reliable" parameter can be added later which will map to SOCK_STREAM usage.
Diffstat (limited to 'btio/btio.c')
-rw-r--r--btio/btio.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/btio/btio.c b/btio/btio.c
index 9d05cdee9..9557503a4 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -50,7 +50,6 @@
typedef enum {
BT_IO_L2CAP,
- BT_IO_L2ERTM,
BT_IO_RFCOMM,
BT_IO_SCO,
BT_IO_INVALID,
@@ -96,7 +95,7 @@ struct server {
static BtIOType bt_io_get_type(GIOChannel *io, GError **gerr)
{
int sk = g_io_channel_unix_get_fd(io);
- int domain, type, proto, err;
+ int domain, proto, err;
socklen_t len;
domain = 0;
@@ -126,29 +125,13 @@ static BtIOType bt_io_get_type(GIOChannel *io, GError **gerr)
return BT_IO_RFCOMM;
case BTPROTO_SCO:
return BT_IO_SCO;
- }
-
- type = 0;
- len = sizeof(type);
- err = getsockopt(sk, SOL_SOCKET, SO_TYPE, &type, &len);
- if (err < 0) {
- ERROR_FAILED(gerr, "getsockopt(SO_TYPE)", errno);
- return BT_IO_INVALID;
- }
-
- switch (proto) {
case BTPROTO_L2CAP:
- switch (type) {
- case SOCK_SEQPACKET:
- return BT_IO_L2CAP;
- case SOCK_STREAM:
- return BT_IO_L2ERTM;
- }
+ return BT_IO_L2CAP;
+ default:
+ g_set_error(gerr, BT_IO_ERROR, EINVAL,
+ "Unknown BtIO socket type");
+ return BT_IO_INVALID;
}
-
- g_set_error(gerr, BT_IO_ERROR, EINVAL, "Unknown BtIO socket type");
-
- return BT_IO_INVALID;
}
static void server_remove(struct server *server)
@@ -1239,7 +1222,6 @@ static gboolean get_valist(GIOChannel *io, BtIOType type, GError **err,
switch (type) {
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);
@@ -1305,7 +1287,6 @@ gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...)
switch (type) {
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);
@@ -1359,20 +1340,6 @@ 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) {
@@ -1420,9 +1387,6 @@ static BtIOType get_opts_type(struct set_opts *opts)
if (opts->channel)
return BT_IO_RFCOMM;
- if (opts->mode)
- return BT_IO_L2ERTM;
-
if (opts->psm || opts->cid)
return BT_IO_L2CAP;
@@ -1457,7 +1421,6 @@ GIOChannel *bt_io_connect(BtIOConnect connect, gpointer user_data,
switch (type) {
case BT_IO_L2CAP:
- case BT_IO_L2ERTM:
err = l2cap_connect(sock, &opts.dst, opts.dst_type,
opts.psm, opts.cid);
break;