Bluetooth: L2CAP: Rename LE Connection Response Results
Rename connection response results to map those that are defined for BR. BR: BT_L2CAP_BR_* LE: BT_L2CAP_LE_* Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
94d3b6a211
commit
2c6065c2d1
2 changed files with 25 additions and 25 deletions
|
@ -761,24 +761,24 @@ static void le_conn_req(struct bt_l2cap *l2cap, u8_t ident,
|
|||
/* Check if there is a server registered */
|
||||
server = l2cap_server_lookup_psm(psm);
|
||||
if (!server) {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_PSM_NOT_SUPP);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_PSM_NOT_SUPP);
|
||||
goto rsp;
|
||||
}
|
||||
|
||||
/* Check if connection has minimum required security level */
|
||||
if (conn->sec_level < server->sec_level) {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_AUTHENTICATION);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_AUTHENTICATION);
|
||||
goto rsp;
|
||||
}
|
||||
|
||||
if (!L2CAP_LE_CID_IS_DYN(scid)) {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_INVALID_SCID);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_INVALID_SCID);
|
||||
goto rsp;
|
||||
}
|
||||
|
||||
chan = bt_l2cap_le_lookup_tx_cid(conn, scid);
|
||||
if (chan) {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_SCID_IN_USE);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_SCID_IN_USE);
|
||||
goto rsp;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, u8_t ident,
|
|||
* TODO: Handle different errors, it may be required to respond async.
|
||||
*/
|
||||
if (server->accept(conn, &chan) < 0) {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_NO_RESOURCES);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_NO_RESOURCES);
|
||||
goto rsp;
|
||||
}
|
||||
|
||||
|
@ -824,9 +824,9 @@ static void le_conn_req(struct bt_l2cap *l2cap, u8_t ident,
|
|||
rsp->mps = sys_cpu_to_le16(ch->rx.mps);
|
||||
rsp->mtu = sys_cpu_to_le16(ch->rx.mtu);
|
||||
rsp->credits = sys_cpu_to_le16(ch->rx.init_credits);
|
||||
rsp->result = BT_L2CAP_SUCCESS;
|
||||
rsp->result = BT_L2CAP_LE_SUCCESS;
|
||||
} else {
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_NO_RESOURCES);
|
||||
rsp->result = sys_cpu_to_le16(BT_L2CAP_LE_ERR_NO_RESOURCES);
|
||||
}
|
||||
rsp:
|
||||
bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf);
|
||||
|
@ -900,13 +900,13 @@ static void le_disconn_req(struct bt_l2cap *l2cap, u8_t ident,
|
|||
static int l2cap_change_security(struct bt_l2cap_le_chan *chan, u16_t err)
|
||||
{
|
||||
switch (err) {
|
||||
case BT_L2CAP_ERR_ENCRYPTION:
|
||||
case BT_L2CAP_LE_ERR_ENCRYPTION:
|
||||
if (chan->chan.required_sec_level >= BT_SECURITY_MEDIUM) {
|
||||
return -EALREADY;
|
||||
}
|
||||
chan->chan.required_sec_level = BT_SECURITY_MEDIUM;
|
||||
break;
|
||||
case BT_L2CAP_ERR_AUTHENTICATION:
|
||||
case BT_L2CAP_LE_ERR_AUTHENTICATION:
|
||||
if (chan->chan.required_sec_level < BT_SECURITY_MEDIUM) {
|
||||
chan->chan.required_sec_level = BT_SECURITY_MEDIUM;
|
||||
} else if (chan->chan.required_sec_level < BT_SECURITY_HIGH) {
|
||||
|
@ -947,9 +947,9 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, u8_t ident,
|
|||
mtu, mps, credits, result);
|
||||
|
||||
/* Keep the channel in case of security errors */
|
||||
if (result == BT_L2CAP_SUCCESS ||
|
||||
result == BT_L2CAP_ERR_AUTHENTICATION ||
|
||||
result == BT_L2CAP_ERR_ENCRYPTION) {
|
||||
if (result == BT_L2CAP_LE_SUCCESS ||
|
||||
result == BT_L2CAP_LE_ERR_AUTHENTICATION ||
|
||||
result == BT_L2CAP_LE_ERR_ENCRYPTION) {
|
||||
chan = l2cap_lookup_ident(conn, ident);
|
||||
} else {
|
||||
chan = l2cap_remove_ident(conn, ident);
|
||||
|
@ -967,7 +967,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, u8_t ident,
|
|||
chan->chan.ident = 0;
|
||||
|
||||
switch (result) {
|
||||
case BT_L2CAP_SUCCESS:
|
||||
case BT_L2CAP_LE_SUCCESS:
|
||||
chan->tx.cid = dcid;
|
||||
chan->tx.mtu = mtu;
|
||||
chan->tx.mps = mps;
|
||||
|
@ -984,8 +984,8 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, u8_t ident,
|
|||
l2cap_chan_rx_give_credits(chan, chan->rx.init_credits);
|
||||
|
||||
break;
|
||||
case BT_L2CAP_ERR_AUTHENTICATION:
|
||||
case BT_L2CAP_ERR_ENCRYPTION:
|
||||
case BT_L2CAP_LE_ERR_AUTHENTICATION:
|
||||
case BT_L2CAP_LE_ERR_ENCRYPTION:
|
||||
/* If security needs changing wait it to be completed */
|
||||
if (l2cap_change_security(chan, result) == 0) {
|
||||
return;
|
||||
|
|
|
@ -164,16 +164,16 @@ struct bt_l2cap_le_conn_req {
|
|||
} __packed;
|
||||
|
||||
/* valid results in conn response on LE */
|
||||
#define BT_L2CAP_SUCCESS 0x0000
|
||||
#define BT_L2CAP_ERR_PSM_NOT_SUPP 0x0002
|
||||
#define BT_L2CAP_ERR_NO_RESOURCES 0x0004
|
||||
#define BT_L2CAP_ERR_AUTHENTICATION 0x0005
|
||||
#define BT_L2CAP_ERR_AUTHORIZATION 0x0006
|
||||
#define BT_L2CAP_ERR_KEY_SIZE 0x0007
|
||||
#define BT_L2CAP_ERR_ENCRYPTION 0x0008
|
||||
#define BT_L2CAP_ERR_INVALID_SCID 0x0009
|
||||
#define BT_L2CAP_ERR_SCID_IN_USE 0x000A
|
||||
#define BT_L2CAP_ERR_UNACCEPT_PARAMS 0x000B
|
||||
#define BT_L2CAP_LE_SUCCESS 0x0000
|
||||
#define BT_L2CAP_LE_ERR_PSM_NOT_SUPP 0x0002
|
||||
#define BT_L2CAP_LE_ERR_NO_RESOURCES 0x0004
|
||||
#define BT_L2CAP_LE_ERR_AUTHENTICATION 0x0005
|
||||
#define BT_L2CAP_LE_ERR_AUTHORIZATION 0x0006
|
||||
#define BT_L2CAP_LE_ERR_KEY_SIZE 0x0007
|
||||
#define BT_L2CAP_LE_ERR_ENCRYPTION 0x0008
|
||||
#define BT_L2CAP_LE_ERR_INVALID_SCID 0x0009
|
||||
#define BT_L2CAP_LE_ERR_SCID_IN_USE 0x000A
|
||||
#define BT_L2CAP_LE_ERR_UNACCEPT_PARAMS 0x000B
|
||||
|
||||
#define BT_L2CAP_LE_CONN_RSP 0x15
|
||||
struct bt_l2cap_le_conn_rsp {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue