BT BR/EDR RF: Move common code to a header file.

The BT LMP dissector calls btbredr_rf_add_esco_link and
btbredr_rf_remove_esco_link. Move their prototypes and required struct
definitions to a header file.
This commit is contained in:
Gerald Combs 2021-04-16 13:47:50 -07:00 committed by Wireshark GitLab Utility
parent 922f9f4520
commit 6341257fae
4 changed files with 37 additions and 30 deletions

View File

@ -271,6 +271,7 @@ set(DISSECTOR_PUBLIC_HEADERS
packet-btavctp.h
packet-btavdtp.h
packet-btavrcp.h
packet-btbredr_rf.h
packet-bthci_acl.h
packet-bthci_cmd.h
packet-bthci_evt.h

View File

@ -22,6 +22,7 @@
#include <wiretap/wtap.h>
#include "packet-bluetooth.h"
#include "packet-btbredr_rf.h"
#include "packet-bthci_acl.h"
/*
@ -202,28 +203,9 @@ typedef struct _device_info_t {
gint8 dir;
} device_info_t;
typedef struct _reassembly_t {
guint segment_len_rem;
guint32 l2cap_index;
guint seqn : 1;
} reassembly_t;
#define BDADDR_MASTER 0
#define BDADDR_SLAVE 1
typedef struct _connection_info_t {
reassembly_t reassembly[2];
nstime_t timestamp;
guint32 btclock;
guint32 interface_id;
guint32 adapter_id;
guint16 escosize[2];
guint8 bd_addr[2][6];
guint8 lt_addr;
guint8 escohandle;
guint8 esco : 1;
} connection_info_t;
typedef struct _btbredr_frame_info_t {
guint retransmit : 1; /* 0 = No, 1 = Retransmitted frame */
guint ack : 1; /* 0 = Nack, 1 = Ack */

View File

@ -0,0 +1,33 @@
/* packet-btbredr_rf.h
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
typedef struct _reassembly_t {
guint segment_len_rem;
guint32 l2cap_index;
guint seqn : 1;
} reassembly_t;
typedef struct _connection_info_t {
reassembly_t reassembly[2];
nstime_t timestamp;
guint32 btclock;
guint32 interface_id;
guint32 adapter_id;
guint16 escosize[2];
guint8 bd_addr[2][6];
guint8 lt_addr;
guint8 escohandle;
guint8 esco : 1;
} connection_info_t;
connection_info_t *
btbredr_rf_add_esco_link(connection_info_t *cinfo, packet_info *pinfo, guint8 handle, guint32 ltaddr, guint16 pktszms, guint16 pktszsm);
void
btbredr_rf_remove_esco_link(connection_info_t *cinfo, packet_info *pinfo, guint8 handle);

View File

@ -18,16 +18,7 @@
#include <wiretap/wtap.h>
#include "packet-bluetooth.h"
struct _connection_info_t;
extern struct _connection_info_t *
btbredr_rf_add_esco_link(struct _connection_info_t *cinfo, packet_info *pinfo, guint8 handle, guint32 ltaddr, guint16 pktszms, guint16 pktszsm);
extern void
btbredr_rf_remove_esco_link(struct _connection_info_t *cinfo, packet_info *pinfo, guint8 handle);
#include "packet-btbredr_rf.h"
static int proto_btlmp = -1;
@ -570,7 +561,7 @@ dissect_btlmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree *btlmp_tree;
gint offset = 0;
guint16 opcode;
struct _connection_info_t *connection_info = (struct _connection_info_t *)data;
connection_info_t *connection_info = (connection_info_t *)data;
btlmp_item = proto_tree_add_item(tree, proto_btlmp, tvb, offset, -1, ENC_NA);
btlmp_tree = proto_item_add_subtree(btlmp_item, ett_btlmp);