diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-25 11:33:51 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-25 11:33:51 +0300 |
commit | 0cda9502f74107c4bcea7b1709a89cd376ef6d76 (patch) | |
tree | 759f260f3f504851e5bebf73461c616661c0f9cb /monitor/sdp.c | |
parent | b8e280747401534acab90404f38f299e6f161a1f (diff) | |
download | bluez-0cda9502f74107c4bcea7b1709a89cd376ef6d76.tar.gz |
monitor/sdp: Make use of l2cap_frame_get*
Diffstat (limited to 'monitor/sdp.c')
-rw-r--r-- | monitor/sdp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/monitor/sdp.c b/monitor/sdp.c index 1b904eee1..d0ad688d7 100644 --- a/monitor/sdp.c +++ b/monitor/sdp.c @@ -694,7 +694,6 @@ void sdp_packet(const struct l2cap_frame *frame) struct tid_data *tid_info; const struct sdp_data *sdp_data = NULL; const char *pdu_color, *pdu_str; - int i; if (frame->size < 5) { @@ -703,13 +702,15 @@ void sdp_packet(const struct l2cap_frame *frame) return; } - pdu = *((uint8_t *) frame->data); - tid = get_be16(frame->data + 1); - plen = get_be16(frame->data + 3); + l2cap_frame_pull(&sdp_frame, frame, 0); + + l2cap_frame_get_u8(&sdp_frame, &pdu); + l2cap_frame_get_be16(&sdp_frame, &tid); + l2cap_frame_get_be16(&sdp_frame, &plen); - if (frame->size != plen + 5) { + if (sdp_frame.size != plen) { print_text(COLOR_ERROR, "invalid frame size"); - packet_hexdump(frame->data, frame->size); + packet_hexdump(sdp_frame.data, sdp_frame.size); return; } @@ -740,10 +741,9 @@ void sdp_packet(const struct l2cap_frame *frame) tid_info = get_tid(tid, frame->chan); if (!sdp_data || !sdp_data->func || !tid_info) { - packet_hexdump(frame->data + 5, frame->size - 5); + packet_hexdump(sdp_frame.data, sdp_frame.size); return; } - l2cap_frame_pull(&sdp_frame, frame, 5); sdp_data->func(&sdp_frame, tid_info); } |