diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index de27132..285215d 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
}
}
+ if (event == EVT_DISCONN_COMPLETE) {
+ evt_disconn_complete *evt = frm->ptr;
+ l2cap_clear(btohs(evt->handle));
+ }
+
if (!(parser.flags & DUMP_VERBOSE)) {
raw_dump(level, frm);
return;
diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index f92a2e1..c3a0e95 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
static handle_info handle_table[HANDLE_TABLE_SIZE];
typedef struct {
+ uint16_t handle;
uint16_t cid;
uint16_t psm;
uint16_t num;
return add_handle(handle);
}
-static void add_cid(int in, uint16_t cid, uint16_t psm)
+static void add_cid(int in, uint16_t handle, uint16_t cid, uint16_t psm)
{
register cid_info *table = cid_table[in];
register int i, pos = -1;
}
if (pos >= 0) {
- table[pos].cid = cid;
- table[pos].psm = psm;
- table[pos].num = num;
- table[pos].mode = 0;
+ table[pos].handle = handle;
+ table[pos].cid = cid;
+ table[pos].psm = psm;
+ table[pos].num = num;
+ table[pos].mode = 0;
}
}
for (t = 0; t < 2; t++) {
for (i = 0; i < CID_TABLE_SIZE; i++)
if (cid_table[t][i].cid == cid[t]) {
- cid_table[t][i].cid = 0;
- cid_table[t][i].psm = 0;
- cid_table[t][i].num = 0;
- cid_table[t][i].mode = 0;
+ cid_table[t][i].handle = 0;
+ cid_table[t][i].cid = 0;
+ cid_table[t][i].psm = 0;
+ cid_table[t][i].num = 0;
+ cid_table[t][i].mode = 0;
break;
}
}
}
+static void del_handle(uint16_t handle)
+{
+ register int t, i;
+
+ for (t = 0; t < 2; t++) {
+ for (i = 0; i < CID_TABLE_SIZE; i++)
+ if (cid_table[t][i].handle == handle) {
+ cid_table[t][i].handle = 0;
+ cid_table[t][i].cid = 0;
+ cid_table[t][i].psm = 0;
+ cid_table[t][i].num = 0;
+ cid_table[t][i].mode = 0;
+ break;
+ }
+ }
+}
static uint16_t get_psm(int in, uint16_t cid)
{
register cid_info *table = cid_table[in];
uint16_t psm = btohs(h->psm);
uint16_t scid = btohs(h->scid);
- add_cid(frm->in, scid, psm);
+ add_cid(frm->in, frm->handle, scid, psm);
if (p_filter(FILT_L2CAP))
return;
switch (h->result) {
case L2CAP_CR_SUCCESS:
if ((psm = get_psm(!frm->in, scid)))
- add_cid(frm->in, dcid, psm);
+ add_cid(frm->in, frm->handle, dcid, psm);
break;
case L2CAP_CR_PEND:
}
}
}
+
+void l2cap_clear(uint16_t handle)
+{
+ del_handle(handle);
+}
diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index ef0cdb1..96feee5 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
void set_proto(uint16_t handle, uint16_t psm, uint8_t channel, uint32_t proto);
uint32_t get_proto(uint16_t handle, uint16_t psm, uint8_t channel);
+void l2cap_clear(uint16_t handle);
+
void ascii_dump(int level, struct frame *frm, int num);
void hex_dump(int level, struct frame *frm, int num);
void ext_dump(int level, struct frame *frm, int num);