From a002e7b0c84862b504437e20e6fcac321c177bac Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Fri, 26 May 2006 22:34:33 +0000 Subject: pass both chandle and cid from l2cap to higher layer protocols. higher layer protocols need the chandle, cid and direction (from pinfo) in order to identify packets for the same "conversation" (it is not a conversation per se in bluetooth butn one unidirectional flow that we track) svn path=/trunk/; revision=18220 --- epan/dissectors/packet-btl2cap.c | 15 +++++++++++++-- epan/dissectors/packet-btl2cap.h | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c index ac41d6cb1d..74e0e66a84 100644 --- a/epan/dissectors/packet-btl2cap.c +++ b/epan/dissectors/packet-btl2cap.c @@ -36,6 +36,7 @@ #include #include #include +#include "packet-bthci_acl.h" #include "packet-btl2cap.h" /* Initialize the protocol and registered fields */ @@ -435,7 +436,11 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_ -/* Code to actually dissect the packets */ +/* Code to actually dissect the packets + * This dissector will only be called ontop of BTHCI ACL + * and this dissector _REQUIRES_ that + * pinfo->private_data points to a valid bthci_acl_data_t structure + */ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset=0; @@ -445,6 +450,8 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 psm; tvbuff_t *next_tvb; psm_data_t *psm_data; + bthci_acl_data_t *acl_data; + btl2cap_data_t *l2cap_data; if(check_col(pinfo->cinfo, COL_PROTOCOL)){ col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2CAP"); @@ -459,7 +466,6 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) btl2cap_tree=proto_item_add_subtree(ti, ett_btl2cap); } - length = tvb_get_letohs(tvb, offset); proto_tree_add_item(btl2cap_tree, hf_btl2cap_length, tvb, offset, 2, TRUE); offset+=2; @@ -468,6 +474,11 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(btl2cap_tree, hf_btl2cap_cid, tvb, offset, 2, TRUE); offset+=2; + acl_data=(bthci_acl_data_t *)pinfo->private_data; + l2cap_data=ep_alloc(sizeof(btl2cap_data_t)); + l2cap_data->chandle=acl_data->chandle; + l2cap_data->cid=cid; + pinfo->private_data=l2cap_data; if(cid==0x0001){ /* This is a command packet*/ while(offset<(length+4)) { diff --git a/epan/dissectors/packet-btl2cap.h b/epan/dissectors/packet-btl2cap.h index 01464e5864..9074f42c8b 100644 --- a/epan/dissectors/packet-btl2cap.h +++ b/epan/dissectors/packet-btl2cap.h @@ -28,4 +28,13 @@ #define BTL2CAP_PSM_RFCOMM 0x0003 #define BTL2CAP_PSM_BNEP 0x000f +/* This structure is passed to higher layer protocols through + * pinfo->private_data so that they can track "conversations" based on + * chandle, cid and direction + */ +typedef struct _btl2cap_data_t { + guint16 chandle; /* only low 12 bits used */ + guint16 cid; +} btl2cap_data_t; + #endif -- cgit v1.2.1