Bluetooth: SMP: Move smp_create_pdu function up in a file

This is in prepartion for BR/EDR support.

Change-Id: Ie9e8f6368b74e6e9768e775d6ccf718fb6927e3a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2016-09-07 15:17:14 +02:00 committed by Johan Hedberg
commit fa726a8d99

View file

@ -318,6 +318,23 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
return 0;
}
static struct net_buf *smp_create_pdu(struct bt_conn *conn, uint8_t op,
size_t len)
{
struct bt_smp_hdr *hdr;
struct net_buf *buf;
buf = bt_l2cap_create_pdu(&smp_buf);
if (!buf) {
return NULL;
}
hdr = net_buf_add(buf, sizeof(*hdr));
hdr->code = op;
return buf;
}
static int smp_ah(const uint8_t irk[16], const uint8_t r[3], uint8_t out[3])
{
uint8_t res[16];
@ -678,23 +695,6 @@ static void smp_timeout(struct nano_work *work)
atomic_set_bit(smp->flags, SMP_FLAG_TIMEOUT);
}
static struct net_buf *smp_create_pdu(struct bt_conn *conn, uint8_t op,
size_t len)
{
struct bt_smp_hdr *hdr;
struct net_buf *buf;
buf = bt_l2cap_create_pdu(&smp_buf);
if (!buf) {
return NULL;
}
hdr = net_buf_add(buf, sizeof(*hdr));
hdr->code = op;
return buf;
}
static void smp_send(struct bt_smp *smp, struct net_buf *buf)
{
bt_l2cap_send(smp->chan.chan.conn, BT_L2CAP_CID_SMP, buf);