diff options
author | 2021-03-07 10:03:55 -0800 | |
---|---|---|
committer | 2022-05-05 18:54:55 +0200 | |
commit | aee82afabfcf763618f58c95f9613b40dcf334b0 (patch) | |
tree | 16508d80b64f52d915e5bf122a0c4cf6d0aca85f /tools | |
parent | a070a2e0b8774132a2c90822ba22580c4d1842da (diff) | |
download | libimobiledevice-aee82afabfcf763618f58c95f9613b40dcf334b0.tar.gz libimobiledevice-aee82afabfcf763618f58c95f9613b40dcf334b0.tar.bz2 |
idevicebtlogger: Cleanup warnings, todos and magic numbers
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicebtlogger.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c index fc42290..5446ecf 100644 --- a/tools/idevicebtlogger.c +++ b/tools/idevicebtlogger.c | |||
@@ -43,9 +43,7 @@ | |||
43 | 43 | ||
44 | #include <libimobiledevice/libimobiledevice.h> | 44 | #include <libimobiledevice/libimobiledevice.h> |
45 | #include <libimobiledevice/bt_packet_logger.h> | 45 | #include <libimobiledevice/bt_packet_logger.h> |
46 | #include <pcap.h>// todo windows??? | 46 | #include <pcap.h> |
47 | |||
48 | #define BT_MAX_PACKET_SIZE 65535 | ||
49 | 47 | ||
50 | static int quit_flag = 0; | 48 | static int quit_flag = 0; |
51 | static int exit_on_disconnect = 0; | 49 | static int exit_on_disconnect = 0; |
@@ -57,12 +55,6 @@ static int use_network = 0; | |||
57 | static char* out_filename = NULL; | 55 | static char* out_filename = NULL; |
58 | static pcap_dumper_t * dump; | 56 | static pcap_dumper_t * dump; |
59 | 57 | ||
60 | typedef struct { | ||
61 | uint32_t length; | ||
62 | uint32_t ts_secs; | ||
63 | uint32_t ts_usecs; | ||
64 | } PacketHeaderType; | ||
65 | |||
66 | typedef enum { | 58 | typedef enum { |
67 | HCI_COMMAND = 0x00, | 59 | HCI_COMMAND = 0x00, |
68 | HCI_EVENT = 0x01, | 60 | HCI_EVENT = 0x01, |
@@ -72,12 +64,12 @@ typedef enum { | |||
72 | 64 | ||
73 | static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_data) | 65 | static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_data) |
74 | { | 66 | { |
75 | PacketHeaderType * header = (PacketHeaderType *)data; | 67 | bt_packet_logger_header_t * header = (bt_packet_logger_header_t *)data; |
76 | uint16_t offset = sizeof(PacketHeaderType); | 68 | uint16_t offset = sizeof(bt_packet_logger_header_t); |
77 | 69 | ||
78 | struct pcap_pkthdr pcap_header; | 70 | struct pcap_pkthdr pcap_header; |
79 | pcap_header.caplen = ntohl(header->length); | 71 | pcap_header.caplen = ntohl(header->length); |
80 | pcap_header.len = len - sizeof(PacketHeaderType); | 72 | pcap_header.len = len - sizeof(bt_packet_logger_header_t); |
81 | pcap_header.ts.tv_sec = ntohl(header->ts_secs); | 73 | pcap_header.ts.tv_sec = ntohl(header->ts_secs); |
82 | pcap_header.ts.tv_usec = ntohl(header->ts_usecs); | 74 | pcap_header.ts.tv_usec = ntohl(header->ts_usecs); |
83 | 75 | ||