diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index b286787..1a82f8d 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
{ },
};
+static void l2cap_frame_init(struct l2cap_frame *frame,
+ uint16_t index, bool in, uint16_t handle,
+ uint16_t cid, const void *data, uint16_t size)
+{
+ frame->index = index;
+ frame->in = in;
+ frame->handle = handle;
+ frame->cid = cid;
+ frame->data = data;
+ frame->size = size;
+ frame->psm = get_psm(frame);
+ frame->mode = get_mode(frame);
+ frame->chan = get_chan(frame);
+}
+
static void bredr_sig_packet(uint16_t index, bool in, uint16_t handle,
uint16_t cid, const void *data, uint16_t size)
{
uint16_t cid, const void *data, uint16_t size)
{
struct l2cap_frame frame;
- uint16_t psm, chan;
- uint8_t mode;
switch (cid) {
case 0x0001:
break;
default:
l2cap_frame_init(&frame, index, in, handle, cid, data, size);
- psm = get_psm(&frame);
- frame.psm = psm;
- mode = get_mode(&frame);
- chan = get_chan(&frame);
print_indent(6, COLOR_CYAN, "Channel:", "", COLOR_OFF,
" %d len %d [PSM %d mode %d] {chan %d}",
- cid, size, psm, mode, chan);
+ cid, size, frame.psm,
+ frame.mode, frame.chan);
- switch (psm) {
+ switch (frame.psm) {
case 0x0001:
- sdp_packet(&frame, chan);
+ sdp_packet(&frame);
break;
case 0x001f:
att_packet(index, in, handle, cid, data, size);
diff --git a/monitor/l2cap.h b/monitor/l2cap.h
index 851b5c4..a0f844b 100644
--- a/monitor/l2cap.h
+++ b/monitor/l2cap.h
bool in;
uint16_t handle;
uint16_t cid;
+ uint16_t psm;
+ uint16_t chan;
+ uint8_t mode;
const void *data;
uint16_t size;
- uint16_t psm;
};
-static inline void l2cap_frame_init(struct l2cap_frame *frame,
- uint16_t index, bool in, uint16_t handle,
- uint16_t cid, const void *data, uint16_t size)
-{
- frame->index = index;
- frame->in = in;
- frame->handle = handle;
- frame->cid = cid;
- frame->data = data;
- frame->size = size;
-}
-
static inline void l2cap_frame_pull(struct l2cap_frame *frame,
const struct l2cap_frame *source, uint16_t len)
{
frame->in = source->in;
frame->handle = source->handle;
frame->cid = source->cid;
+ frame->psm = source->psm;
+ frame->chan = source->chan;
+ frame->mode = source->mode;
frame->data = source->data + len;
frame->size = source->size - len;
}
diff --git a/monitor/sdp.c b/monitor/sdp.c
index 8acc8bd..1b904ee 100644
--- a/monitor/sdp.c
+++ b/monitor/sdp.c
{ }
};
-void sdp_packet(const struct l2cap_frame *frame, uint16_t channel)
+void sdp_packet(const struct l2cap_frame *frame)
{
uint8_t pdu;
uint16_t tid, plen;
print_indent(6, pdu_color, "SDP: ", pdu_str, COLOR_OFF,
" (0x%2.2x) tid %d len %d", pdu, tid, plen);
- tid_info = get_tid(tid, channel);
+ tid_info = get_tid(tid, frame->chan);
if (!sdp_data || !sdp_data->func || !tid_info) {
packet_hexdump(frame->data + 5, frame->size - 5);
diff --git a/monitor/sdp.h b/monitor/sdp.h
index ca2cd45..c8a9bb0 100644
--- a/monitor/sdp.h
+++ b/monitor/sdp.h
*
*/
-void sdp_packet(const struct l2cap_frame *frame, uint16_t channel);
+void sdp_packet(const struct l2cap_frame *frame);