You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/03/07 00:05:20 UTC
[25/50] incubator-mynewt-core git commit: nimble/l2cap: Fix handling
scid/dcid in the channel.
nimble/l2cap: Fix handling scid/dcid in the channel.
This patch makes sure that each l2cap channel has corretly
set scid and dcid. In the same time dcid is use when sending
data.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/357d8bd1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/357d8bd1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/357d8bd1
Branch: refs/heads/1_0_0_dev
Commit: 357d8bd17c5055d5df8e2521d072f286c8658912
Parents: 07b86ff
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Thu Feb 16 06:31:43 2017 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Mar 6 15:51:02 2017 -0800
----------------------------------------------------------------------
net/nimble/host/src/ble_att.c | 1 +
net/nimble/host/src/ble_l2cap.c | 2 +-
net/nimble/host/src/ble_l2cap_priv.h | 2 +-
net/nimble/host/src/ble_l2cap_sig.c | 1 +
net/nimble/host/src/ble_sm.c | 1 +
5 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/357d8bd1/net/nimble/host/src/ble_att.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att.c b/net/nimble/host/src/ble_att.c
index ff1eebf..329fcec 100644
--- a/net/nimble/host/src/ble_att.c
+++ b/net/nimble/host/src/ble_att.c
@@ -561,6 +561,7 @@ ble_att_create_chan(void)
}
chan->scid = BLE_L2CAP_CID_ATT;
+ chan->dcid = BLE_L2CAP_CID_ATT;
chan->my_mtu = ble_att_preferred_mtu_val;
chan->rx_fn = ble_att_rx;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/357d8bd1/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index e94a234..09ca9dc 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -385,7 +385,7 @@ ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
{
int rc;
- txom = ble_l2cap_prepend_hdr(txom, chan->scid, OS_MBUF_PKTLEN(txom));
+ txom = ble_l2cap_prepend_hdr(txom, chan->dcid, OS_MBUF_PKTLEN(txom));
if (txom == NULL) {
return BLE_HS_ENOMEM;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/357d8bd1/net/nimble/host/src/ble_l2cap_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_priv.h b/net/nimble/host/src/ble_l2cap_priv.h
index cc4e0ed..81e350d 100644
--- a/net/nimble/host/src/ble_l2cap_priv.h
+++ b/net/nimble/host/src/ble_l2cap_priv.h
@@ -66,6 +66,7 @@ typedef int ble_l2cap_rx_fn(uint16_t conn_handle, struct os_mbuf **rxom);
struct ble_l2cap_chan {
SLIST_ENTRY(ble_l2cap_chan) next;
+ uint16_t dcid;
uint16_t scid;
uint16_t my_mtu;
uint16_t peer_mtu; /* 0 if not exchanged. */
@@ -78,7 +79,6 @@ struct ble_l2cap_chan {
#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) != 0
uint16_t conn_handle;
- uint16_t dcid;
uint16_t psm;
struct ble_l2cap_coc_endpoint coc_rx;
struct ble_l2cap_coc_endpoint coc_tx;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/357d8bd1/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 40cda11..94bb271 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -1060,6 +1060,7 @@ ble_l2cap_sig_create_chan(void)
}
chan->scid = BLE_L2CAP_CID_SIG;
+ chan->dcid = BLE_L2CAP_CID_SIG;
chan->my_mtu = BLE_L2CAP_SIG_MTU;
chan->rx_fn = ble_l2cap_sig_rx;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/357d8bd1/net/nimble/host/src/ble_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c
index bb2c1aa..2a880dc 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -2512,6 +2512,7 @@ ble_sm_create_chan(void)
}
chan->scid = BLE_L2CAP_CID_SM;
+ chan->dcid = BLE_L2CAP_CID_SM;
chan->my_mtu = BLE_SM_MTU;
chan->rx_fn = ble_sm_rx;