aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-05-26 22:34:33 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-05-26 22:34:33 +0000
commita002e7b0c84862b504437e20e6fcac321c177bac (patch)
tree7b230b09de373f040a98d743977a818821697ce9 /epan
parenta8491db2012a33f4976f08f934c25554b87b977d (diff)
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
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-btl2cap.c15
-rw-r--r--epan/dissectors/packet-btl2cap.h9
2 files changed, 22 insertions, 2 deletions
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 <epan/packet.h>
#include <etypes.h>
#include <epan/emem.h>
+#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