mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-29 16:53:31 +00:00
nimble/l2cap: Add error return to ble_l2cap_recv_ready
This commit is contained in:
@@ -187,7 +187,7 @@ int ble_l2cap_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
|
||||
ble_l2cap_event_fn *cb, void *cb_arg);
|
||||
int ble_l2cap_disconnect(struct ble_l2cap_chan *chan);
|
||||
int ble_l2cap_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx);
|
||||
void ble_l2cap_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx);
|
||||
int ble_l2cap_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx);
|
||||
int ble_l2cap_get_scid(struct ble_l2cap_chan *chan);
|
||||
int ble_l2cap_get_dcid(struct ble_l2cap_chan *chan);
|
||||
int ble_l2cap_get_our_mtu(struct ble_l2cap_chan *chan);
|
||||
|
||||
@@ -170,10 +170,10 @@ ble_l2cap_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu)
|
||||
return ble_l2cap_coc_send(chan, sdu);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
ble_l2cap_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
{
|
||||
ble_l2cap_coc_recv_ready(chan, sdu_rx);
|
||||
return ble_l2cap_coc_recv_ready(chan, sdu_rx);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -446,12 +446,16 @@ ble_l2cap_coc_le_credits_update(uint16_t conn_handle, uint16_t dcid,
|
||||
ble_l2cap_coc_continue_tx(chan);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
struct ble_l2cap_chan *c;
|
||||
|
||||
if (!sdu_rx) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
chan->coc_rx.sdu = sdu_rx;
|
||||
|
||||
ble_hs_lock();
|
||||
@@ -459,7 +463,7 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
c = ble_hs_conn_chan_find_by_scid(conn, chan->scid);
|
||||
if (!c) {
|
||||
ble_hs_unlock();
|
||||
return;
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
/* We want to back only that much credits which remote side is missing
|
||||
@@ -474,6 +478,8 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
}
|
||||
|
||||
ble_hs_unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,13 +65,13 @@ struct ble_l2cap_chan * ble_l2cap_coc_chan_alloc(uint16_t conn_handle,
|
||||
void ble_l2cap_coc_cleanup_chan(struct ble_l2cap_chan *chan);
|
||||
void ble_l2cap_coc_le_credits_update(uint16_t conn_handle, uint16_t dcid,
|
||||
uint16_t credits);
|
||||
void ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
|
||||
struct os_mbuf *sdu_rx);
|
||||
int ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
|
||||
struct os_mbuf *sdu_rx);
|
||||
int ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx);
|
||||
#else
|
||||
#define ble_l2cap_coc_init() 0
|
||||
#define ble_l2cap_coc_create_server(psm, mtu, cb, cb_arg) BLE_HS_ENOTSUP
|
||||
#define ble_l2cap_coc_recv_ready(chan, sdu_rx)
|
||||
#define ble_l2cap_coc_recv_ready(chan, sdu_rx) BLE_HS_ENOTSUP
|
||||
#define ble_l2cap_coc_cleanup_chan(chan)
|
||||
#define ble_l2cap_coc_send(chan, sdu_tx) BLE_HS_ENOTSUP
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user