summaryrefslogtreecommitdiff
path: root/monitor/lmp.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-10-07 23:15:23 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-10-07 23:33:57 +0200
commit3112a1be16d59f528d4dc396447a29f0759b617b (patch)
tree8f6a54ab0c8b0514ecda60c4d66728b5796d1046 /monitor/lmp.c
parent90799f6da988723a7d100610f51f2b7f30f40d4f (diff)
downloadbluez-3112a1be16d59f528d4dc396447a29f0759b617b.tar.gz
monitor: Decode the LMP name request procedure
Diffstat (limited to 'monitor/lmp.c')
-rw-r--r--monitor/lmp.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/monitor/lmp.c b/monitor/lmp.c
index d36861aac..f85b4d871 100644
--- a/monitor/lmp.c
+++ b/monitor/lmp.c
@@ -27,6 +27,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include "src/shared/util.h"
#include "display.h"
@@ -54,6 +55,26 @@ static void print_opcode(uint16_t opcode)
print_field("Operation: %s (%u)", str, opcode);
}
+static void name_req(const void *data, uint8_t size)
+{
+ const struct bt_lmp_name_req *pdu = data;
+
+ print_field("Offset: %u", pdu->offset);
+}
+
+static void name_rsp(const void *data, uint8_t size)
+{
+ const struct bt_lmp_name_rsp *pdu = data;
+ char str[15];
+
+ memcpy(str, pdu->fragment, 14);
+ str[14] = '\0';
+
+ print_field("Offset: %u", pdu->offset);
+ print_field("Length: %u", pdu->length);
+ print_field("Fragment: %s", str);
+}
+
static void accepted(const void *data, uint8_t size)
{
const struct bt_lmp_accepted *pdu = data;
@@ -625,8 +646,8 @@ struct lmp_data {
};
static const struct lmp_data lmp_table[] = {
- { 1, "LMP_name_req" },
- { 2, "LMP_name_res" },
+ { 1, "LMP_name_req", name_req, 1, true },
+ { 2, "LMP_name_res", name_rsp, 16, true },
{ 3, "LMP_accepted", accepted, 1, true },
{ 4, "LMP_not_accepted", not_accepted, 2, true },
{ 5, "LMP_clkoffset_req", clkoffset_req, 0, true },