2012-05-02 01:44:40 +00:00
/* packet-peekremote.c
*
* Routines for the disassembly of packets sent from Cisco WLAN
* Controllers , possibly other Cisco access points , and possibly
* other devices such as Aruba access points . See
*
2020-05-20 11:17:06 +00:00
* https : //web.archive.org/web/20130117041444/http://www.wildpackets.com/elements/omnipeek/OmniPeek_UserGuide.pdf
2012-05-02 01:44:40 +00:00
*
* which speaks of Aruba access points supporting remote capture and
* defaulting to port 5000 for this , and also speaks of Cisco access
* points supporting remote capture without any reference to a port
* number . The two types of remote capture are described separately ;
* there ' s no indication of whether they use the same protocol for
* streaming packets but perhaps other protocols for , for example ,
* discovery and setup , or whether they use different protocols
* for streaming packets .
*
2020-05-20 11:27:05 +00:00
* A later manual at
*
* https : //community.liveaction.com/wp-content/uploads/2020/02/Omnipeek-UserGuide-2-20.pdf
*
* speaks of Aruba and Cisco access points together , mentioning port 5000.
*
2015-05-17 21:35:50 +00:00
* Apparently Aruba supports several protocols , including Peek remote .
* See the packet - aruba - erm dissector .
*
2012-05-02 01:44:40 +00:00
* Tested with frames captured from a Cisco WCS .
*
* Copyright 2007 Joerg Mayer ( see AUTHORS file )
*
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
* Copyright 1998 Gerald Combs
*
2018-02-12 11:23:27 +00:00
* SPDX - License - Identifier : GPL - 2.0 - or - later
2012-05-02 01:44:40 +00:00
*/
/*
* TODO : Decode meta information .
* Check on fillup bytes in capture ( fcs sometimes wrong )
* From :
* http : //www.cisco.com/univercd/cc/td/doc/product/wireless/pahcont/oweb.pdf
* " It will include information on timestamp, signal strength, packet size
* and so on "
*/
2013-12-21 01:50:54 +00:00
# define NEW_PROTO_TREE_API
2012-09-20 02:03:38 +00:00
# include "config.h"
2012-05-02 01:44:40 +00:00
2015-06-20 22:57:57 +00:00
# include <wiretap/wtap.h>
2012-05-02 01:44:40 +00:00
# include <epan/packet.h>
2014-12-20 21:23:59 +00:00
# include <epan/expert.h>
2013-12-21 20:54:26 +00:00
2021-03-10 09:42:51 +00:00
# include <wsutil/802_11-utils.h>
2015-05-31 15:48:55 +00:00
# define IS_ARUBA 0x01
2012-05-02 01:44:40 +00:00
2016-10-05 20:33:54 +00:00
# define PEEKREMOTE_PORT 5000 /* Not IANA registered */
2013-12-14 12:45:57 +00:00
void proto_register_peekremote ( void ) ;
void proto_reg_handoff_peekremote ( void ) ;
2013-12-21 20:54:26 +00:00
static int proto_peekremote ;
2016-01-13 01:16:04 +00:00
static dissector_handle_t peekremote_handle ;
2013-12-21 20:54:26 +00:00
2014-10-28 03:59:53 +00:00
/*
* XXX - we don ' t have all the MCS index values here .
* We should probably just show the MCS index as a number ( those
* numbers are used in 802.11 ) , and have separate items for the
* number of spatial streams , the modulation type , and the coding rate .
* Note that some modes with more than one spatial stream use * different *
* modulation types for the different streams . See section 20.6
* " Parameters for HT MCSs " in 802.11 - 2012.
*/
static const value_string peekremote_mcs_index_vals [ ] = {
2014-03-09 10:40:56 +00:00
{ 0 , " Spatial streams: 1, Modulation type: BPSK, Codingrate: 1/2 " } ,
{ 1 , " Spatial streams: 1, Modulation type: QPSK, Codingrate: 1/2 " } ,
{ 2 , " Spatial streams: 1, Modulation type: QPSK, Codingrate: 3/4 " } ,
{ 3 , " Spatial streams: 1, Modulation type: 16-QAM, Codingrate: 1/2 " } ,
{ 4 , " Spatial streams: 1, Modulation type: 16-QAM, Codingrate: 3/4 " } ,
{ 5 , " Spatial streams: 1, Modulation type: 64-QAM, Codingrate: 2/3 " } ,
{ 6 , " Spatial streams: 1, Modulation type: 64-QAM, Codingrate: 3/4 " } ,
{ 7 , " Spatial streams: 1, Modulation type: 64-QAM, Codingrate: 5/6 " } ,
{ 8 , " Spatial streams: 2, Modulation type: BPSK, Codingrate: 1/2 " } ,
{ 9 , " Spatial streams: 2, Modulation type: QPSK, Codingrate: 1/2 " } ,
{ 10 , " Spatial streams: 2, Modulation type: QPSK, Codingrate: 3/4 " } ,
{ 11 , " Spatial streams: 2, Modulation type: 16-QAM, Codingrate: 1/2 " } ,
{ 12 , " Spatial streams: 2, Modulation type: 16-QAM, Codingrate: 3/4 " } ,
{ 13 , " Spatial streams: 2, Modulation type: 64-QAM, Codingrate: 2/3 " } ,
{ 14 , " Spatial streams: 2, Modulation type: 64-QAM, Codingrate: 3/4 " } ,
{ 15 , " Spatial streams: 2, Modulation type: 64-QAM, Codingrate: 5/6 " } ,
{ 16 , " Spatial streams: 3, Modulation type: BPSK, Codingrate: 1/2 " } ,
{ 17 , " Spatial streams: 3, Modulation type: QPSK, Codingrate: 1/2 " } ,
{ 18 , " Spatial streams: 3, Modulation type: QPSK, Codingrate: 3/4 " } ,
{ 19 , " Spatial streams: 3, Modulation type: 16-QAM, Codingrate: 1/2 " } ,
{ 20 , " Spatial streams: 3, Modulation type: 16-QAM, Codingrate: 3/4 " } ,
{ 21 , " Spatial streams: 3, Modulation type: 64-QAM, Codingrate: 2/3 " } ,
{ 22 , " Spatial streams: 3, Modulation type: 64-QAM, Codingrate: 3/4 " } ,
{ 23 , " Spatial streams: 3, Modulation type: 64-QAM, Codingrate: 5/6 " } ,
{ 24 , " Spatial streams: 4, Modulation type: BPSK, Codingrate: 1/2 " } ,
{ 25 , " Spatial streams: 4, Modulation type: QPSK, Codingrate: 1/2 " } ,
{ 26 , " Spatial streams: 4, Modulation type: QPSK, Codingrate: 3/4 " } ,
{ 27 , " Spatial streams: 4, Modulation type: 16-QAM, Codingrate: 1/2 " } ,
{ 28 , " Spatial streams: 4, Modulation type: 16-QAM, Codingrate: 3/4 " } ,
{ 29 , " Spatial streams: 4, Modulation type: 64-QAM, Codingrate: 2/3 " } ,
{ 30 , " Spatial streams: 4, Modulation type: 64-QAM, Codingrate: 3/4 " } ,
{ 31 , " Spatial streams: 4, Modulation type: 64-QAM, Codingrate: 5/6 " } ,
{ 0 , NULL }
} ;
2014-10-28 03:59:53 +00:00
static value_string_ext peekremote_mcs_index_vals_ext = VALUE_STRING_EXT_INIT ( peekremote_mcs_index_vals ) ;
2020-04-03 15:06:21 +00:00
/* There is no reason to define a separate set of constants for HE(11ax) as it only adds a MCS 10 and 11. MCS0-9 stay the same. We could even imagine an 11ac implementation with MCS10 and 11 (nonstandard)
*/
2017-10-26 12:32:56 +00:00
static const value_string peekremote_mcs_index_vals_ac [ ] = {
{ 0 , " Modulation type: BPSK, Codingrate: 1/2 " } ,
{ 1 , " Modulation type: QPSK, Codingrate: 1/2 " } ,
{ 2 , " Modulation type: QPSK, Codingrate: 3/4 " } ,
{ 3 , " Modulation type: 16-QAM, Codingrate: 1/2 " } ,
{ 4 , " Modulation type: 16-QAM, Codingrate: 3/4 " } ,
{ 5 , " Modulation type: 64-QAM, Codingrate: 2/3 " } ,
{ 6 , " Modulation type: 64-QAM, Codingrate: 3/4 " } ,
{ 7 , " Modulation type: 64-QAM, Codingrate: 5/6 " } ,
{ 8 , " Modulation type: 256-QAM, Codingrate: 3/4 " } ,
{ 9 , " Modulation type: 256-QAM, Codingrate: 5/6 " } ,
2020-04-03 15:06:21 +00:00
{ 10 , " Modulation type: 1024-QAM, Codingrate: 3/4 " } ,
{ 11 , " Modulation type: 1024-QAM, Codingrate: 5/6 " } ,
2017-10-26 12:32:56 +00:00
{ 0 , NULL }
} ;
2020-04-03 15:06:21 +00:00
2018-02-28 14:26:03 +00:00
static const value_string spatialstreams_vals [ ] = {
{ 0 , " 1 " } ,
{ 1 , " 2 " } ,
{ 2 , " 3 " } ,
{ 3 , " 4 " } ,
2020-04-03 15:06:21 +00:00
{ 4 , " 5 " } ,
{ 5 , " 6 " } ,
{ 6 , " 7 " } ,
{ 7 , " 8 " } ,
2018-02-28 14:26:03 +00:00
{ 0 , NULL }
} ;
2014-03-09 10:40:56 +00:00
static const value_string peekremote_type_vals [ ] = {
{ 6 , " kMediaSpecificHdrType_Wireless3 " } ,
{ 0 , NULL }
} ;
2015-06-22 22:04:28 +00:00
/*
* Extended flags .
*
* Some determined from bug 10637 , some determined from bug 9586 ,
* and the ones present in both agree , so we ' re assuming that
* the " remote Peek " protocol and the " Peek tagged " file format
* use the same bits ( which wouldn ' t be too surprising , as they
* both come from Wildpackets ) .
*/
# define EXT_FLAG_20_MHZ_LOWER 0x00000001
# define EXT_FLAG_20_MHZ_UPPER 0x00000002
# define EXT_FLAG_40_MHZ 0x00000004
# define EXT_FLAGS_BANDWIDTH 0x00000007
# define EXT_FLAG_HALF_GI 0x00000008
# define EXT_FLAG_FULL_GI 0x00000010
# define EXT_FLAGS_GI 0x00000018
# define EXT_FLAG_AMPDU 0x00000020
# define EXT_FLAG_AMSDU 0x00000040
# define EXT_FLAG_802_11ac 0x00000080
# define EXT_FLAG_MCS_INDEX_USED 0x00000100
2018-02-28 14:26:03 +00:00
# define EXT_FLAG_80MHZ 0x00000200
# define EXT_FLAG_SHORTPREAMBLE 0x00000400
# define EXT_FLAG_SPATIALSTREAMS 0x0001C000
2020-04-03 15:06:21 +00:00
# define EXT_FLAG_HEFLAG 0x00020000
# define EXT_FLAG_160MHZ 0x00040000
# define EXT_FLAGS_RESERVED 0xFFFC0000
2015-06-22 22:04:28 +00:00
2013-12-21 01:50:54 +00:00
/* hfi elements */
# define THIS_HF_INIT HFI_INIT(proto_peekremote)
static header_field_info * hfi_peekremote = NULL ;
2013-12-21 20:54:26 +00:00
/* Common to both headers */
static header_field_info hfi_peekremote_channel THIS_HF_INIT =
{ " Channel " , " peekremote.channel " , FT_UINT16 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2014-03-13 19:41:00 +00:00
static header_field_info hfi_peekremote_signal_dbm THIS_HF_INIT =
{ " Signal [dBm] " , " peekremote.signal_dbm " , FT_INT8 , BASE_DEC , NULL ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_noise_dbm THIS_HF_INIT =
{ " Noise [dBm] " , " peekremote.noise_dbm " , FT_INT8 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_packetlength THIS_HF_INIT =
{ " Packet length " , " peekremote.packetlength " , FT_UINT16 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_slicelength THIS_HF_INIT =
{ " Slice length " , " peekremote.slicelength " , FT_UINT16 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
2013-12-21 20:54:26 +00:00
static header_field_info hfi_peekremote_flags THIS_HF_INIT =
{ " Flags " , " peekremote.flags " , FT_UINT8 , BASE_HEX , NULL ,
0x0 , NULL , HFILL } ;
2014-03-13 08:28:08 +00:00
static header_field_info hfi_peekremote_flags_control_frame THIS_HF_INIT =
{ " Is a Control frame " , " peekremote.flags.control_frame " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
2014-03-10 21:28:08 +00:00
0x01 , NULL , HFILL } ;
static header_field_info hfi_peekremote_flags_crc_error THIS_HF_INIT =
{ " Has CRC error " , " peekremote.flags.has_crc_error " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
0x02 , NULL , HFILL } ;
static header_field_info hfi_peekremote_flags_frame_error THIS_HF_INIT =
{ " Has frame error " , " peekremote.flags.has_frame_error " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
0x04 , NULL , HFILL } ;
static header_field_info hfi_peekremote_flags_reserved THIS_HF_INIT =
{ " Reserved " , " peekremote.flags.reserved " , FT_UINT8 , BASE_HEX , NULL ,
0xF8 , " Must be zero " , HFILL } ;
2013-12-21 20:54:26 +00:00
static header_field_info hfi_peekremote_status THIS_HF_INIT =
{ " Status " , " peekremote.status " , FT_UINT8 , BASE_HEX , NULL ,
0x0 , NULL , HFILL } ;
2014-03-13 08:28:08 +00:00
static header_field_info hfi_peekremote_status_protected THIS_HF_INIT =
{ " Protected " , " peekremote.status.protected " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
2014-03-10 21:28:08 +00:00
0x04 , NULL , HFILL } ;
static header_field_info hfi_peekremote_status_with_decrypt_error THIS_HF_INIT =
{ " With decrypt error " , " peekremote.status.with_decrypt_error " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
0x08 , NULL , HFILL } ;
static header_field_info hfi_peekremote_status_with_short_preamble THIS_HF_INIT =
{ " With short preamble " , " peekremote.status.with_short_preamble " , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) ,
0x40 , NULL , HFILL } ;
static header_field_info hfi_peekremote_status_reserved THIS_HF_INIT =
{ " Reserved " , " peekremote.status.reserved " , FT_UINT8 , BASE_HEX , NULL ,
0xB3 , " Must be zero " , HFILL } ;
2013-12-25 23:03:12 +00:00
static header_field_info hfi_peekremote_timestamp THIS_HF_INIT =
{ " TSF timestamp " , " peekremote.timestamp " , FT_UINT64 , BASE_DEC , NULL ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
2014-10-28 03:59:53 +00:00
static header_field_info hfi_peekremote_mcs_index THIS_HF_INIT =
{ " MCS index " , " peekremote.mcs_index " , FT_UINT16 , BASE_DEC | BASE_EXT_STRING , & peekremote_mcs_index_vals_ext ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2017-10-26 12:32:56 +00:00
static header_field_info hfi_peekremote_mcs_index_ac THIS_HF_INIT =
2020-04-03 15:06:21 +00:00
{ " 11ac/11ax MCS index " , " peekremote.mcs_index_ac " , FT_UINT16 , BASE_DEC , VALS ( peekremote_mcs_index_vals_ac ) ,
2017-10-26 12:32:56 +00:00
0x0 , NULL , HFILL } ;
2014-03-13 19:41:00 +00:00
static header_field_info hfi_peekremote_signal_percent THIS_HF_INIT =
{ " Signal [percent] " , " peekremote.signal_percent " , FT_UINT8 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2014-03-13 19:41:00 +00:00
static header_field_info hfi_peekremote_noise_percent THIS_HF_INIT =
{ " Noise [percent] " , " peekremote.noise_percent " , FT_UINT8 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2014-03-13 19:41:00 +00:00
/* Legacy header only */
static header_field_info hfi_peekremote_speed THIS_HF_INIT =
{ " Data rate [500kHz] " , " peekremote.data_rate " , FT_UINT8 , BASE_DEC , NULL ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
/* New header only */
static header_field_info hfi_peekremote_magic_number THIS_HF_INIT =
{ " Magic number " , " peekremote.magic_number " , FT_UINT32 , BASE_HEX , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_header_version THIS_HF_INIT =
{ " Header version " , " peekremote.header_version " , FT_UINT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_header_size THIS_HF_INIT =
{ " Header size " , " peekremote.header_size " , FT_UINT32 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_type THIS_HF_INIT =
2014-03-09 10:40:56 +00:00
{ " Type " , " peekremote.type " , FT_UINT32 , BASE_DEC , VALS ( peekremote_type_vals ) ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_frequency THIS_HF_INIT =
2014-03-09 10:40:56 +00:00
{ " Frequency [Mhz] " , " peekremote.frequency " , FT_UINT32 , BASE_DEC , NULL ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_band THIS_HF_INIT =
{ " Band " , " peekremote.band " , FT_UINT32 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags THIS_HF_INIT =
{ " Extended flags " , " peekremote.extflags " , FT_UINT32 , BASE_HEX , NULL ,
2013-12-21 20:54:26 +00:00
0x0 , NULL , HFILL } ;
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_20mhz_lower THIS_HF_INIT =
{ " 20 MHz Lower " , " peekremote.extflags.20mhz_lower " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_20_MHZ_LOWER , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_20mhz_upper THIS_HF_INIT =
{ " 20 MHz Upper " , " peekremote.extflags.20mhz_upper " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_20_MHZ_UPPER , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_40mhz THIS_HF_INIT =
{ " 40 MHz " , " peekremote.extflags.40mhz " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_40_MHZ , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_half_gi THIS_HF_INIT =
{ " Half Guard Interval " , " peekremote.extflags.half_gi " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_HALF_GI , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_full_gi THIS_HF_INIT =
{ " Full Guard Interval " , " peekremote.extflags.full_gi " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_FULL_GI , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_ampdu THIS_HF_INIT =
{ " AMPDU " , " peekremote.extflags.ampdu " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_AMPDU , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_amsdu THIS_HF_INIT =
{ " AMSDU " , " peekremote.extflags.amsdu " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_AMSDU , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_11ac THIS_HF_INIT =
{ " 802.11ac " , " peekremote.extflags.11ac " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_802_11ac , NULL , HFILL } ;
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_future_use THIS_HF_INIT =
{ " MCS index used " , " peekremote.extflags.future_use " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
2015-06-22 22:04:28 +00:00
EXT_FLAG_MCS_INDEX_USED , NULL , HFILL } ;
2014-03-10 21:28:08 +00:00
2018-02-28 14:26:03 +00:00
static header_field_info hfi_peekremote_extflags_80mhz THIS_HF_INIT =
{ " 80 Mhz " , " peekremote.extflags.80mhz " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
EXT_FLAG_80MHZ , NULL , HFILL } ;
static header_field_info hfi_peekremote_extflags_shortpreamble THIS_HF_INIT =
{ " Short preamble " , " peekremote.extflags.shortpreamble " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
EXT_FLAG_SHORTPREAMBLE , NULL , HFILL } ;
static header_field_info hfi_peekremote_extflags_spatialstreams THIS_HF_INIT =
{ " Spatial streams " , " peekremote.extflags.spatialstreams " , FT_UINT32 , BASE_DEC , VALS ( spatialstreams_vals ) ,
EXT_FLAG_SPATIALSTREAMS , NULL , HFILL } ;
2020-04-03 15:06:21 +00:00
static header_field_info hfi_peekremote_extflags_heflag THIS_HF_INIT =
{ " 802.11ax " , " peekremote.extflags.11ax " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
EXT_FLAG_HEFLAG , NULL , HFILL } ;
static header_field_info hfi_peekremote_extflags_160mhz THIS_HF_INIT =
{ " 160Mhz " , " peekremote.extflags.160mhz " , FT_BOOLEAN , 32 , TFS ( & tfs_yes_no ) ,
EXT_FLAG_160MHZ , NULL , HFILL } ;
2014-10-28 06:41:13 +00:00
static header_field_info hfi_peekremote_extflags_reserved THIS_HF_INIT =
{ " Reserved " , " peekremote.extflags.reserved " , FT_UINT32 , BASE_HEX , NULL ,
2015-06-22 22:04:28 +00:00
EXT_FLAGS_RESERVED , " Must be zero " , HFILL } ;
2014-03-10 21:28:08 +00:00
2013-12-21 20:54:26 +00:00
/* XXX - are the numbers antenna numbers? */
static header_field_info hfi_peekremote_signal_1_dbm THIS_HF_INIT =
{ " Signal 1 [dBm] " , " peekremote.signal_1_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_signal_2_dbm THIS_HF_INIT =
{ " Signal 2 [dBm] " , " peekremote.signal_2_dbm " , FT_INT8 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2013-12-21 20:54:26 +00:00
static header_field_info hfi_peekremote_signal_3_dbm THIS_HF_INIT =
{ " Signal 3 [dBm] " , " peekremote.signal_3_dbm " , FT_INT8 , BASE_DEC , NULL ,
2013-12-21 01:50:54 +00:00
0x0 , NULL , HFILL } ;
2013-12-21 20:54:26 +00:00
static header_field_info hfi_peekremote_signal_4_dbm THIS_HF_INIT =
{ " Signal 4 [dBm] " , " peekremote.signal_4_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_noise_1_dbm THIS_HF_INIT =
{ " Noise 1 [dBm] " , " peekremote.noise_1_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_noise_2_dbm THIS_HF_INIT =
{ " Noise 2 [dBm] " , " peekremote.noise_2_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_noise_3_dbm THIS_HF_INIT =
{ " Noise 3 [dBm] " , " peekremote.noise_3_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static header_field_info hfi_peekremote_noise_4_dbm THIS_HF_INIT =
{ " Noise 4 [dBm] " , " peekremote.noise_4_dbm " , FT_INT8 , BASE_DEC , NULL ,
0x0 , NULL , HFILL } ;
static expert_field ei_peekremote_unknown_header_version = EI_INIT ;
static expert_field ei_peekremote_invalid_header_size = EI_INIT ;
2012-05-02 01:44:40 +00:00
static gint ett_peekremote = - 1 ;
2014-03-10 21:28:08 +00:00
static gint ett_peekremote_flags = - 1 ;
static gint ett_peekremote_status = - 1 ;
2014-10-28 06:41:13 +00:00
static gint ett_peekremote_extflags = - 1 ;
2012-05-02 01:44:40 +00:00
2015-06-20 22:57:57 +00:00
static dissector_handle_t wlan_radio_handle ;
2015-05-31 15:48:55 +00:00
2012-05-02 01:44:40 +00:00
2014-03-10 21:28:08 +00:00
static int
2014-10-28 06:41:13 +00:00
dissect_peekremote_extflags ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset )
2014-03-10 21:28:08 +00:00
{
2014-10-28 06:41:13 +00:00
proto_tree * extflags_tree ;
proto_item * ti_extflags ;
ti_extflags = proto_tree_add_item ( tree , & hfi_peekremote_extflags , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
extflags_tree = proto_item_add_subtree ( ti_extflags , ett_peekremote_extflags ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_20mhz_lower , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_20mhz_upper , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_40mhz , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_half_gi , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_full_gi , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_ampdu , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_amsdu , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_11ac , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_future_use , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2018-02-28 14:26:03 +00:00
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_80mhz , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_shortpreamble , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_spatialstreams , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2020-04-03 15:06:21 +00:00
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_heflag , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_160mhz , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2014-10-28 06:41:13 +00:00
proto_tree_add_item ( extflags_tree , & hfi_peekremote_extflags_reserved , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2014-03-10 21:28:08 +00:00
return 4 ;
}
static int
dissect_peekremote_flags ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset )
{
proto_tree * flags_tree ;
proto_item * ti_flags ;
ti_flags = proto_tree_add_item ( tree , & hfi_peekremote_flags , tvb , offset , 1 , ENC_NA ) ;
flags_tree = proto_item_add_subtree ( ti_flags , ett_peekremote_flags ) ;
2014-03-13 08:28:08 +00:00
proto_tree_add_item ( flags_tree , & hfi_peekremote_flags_control_frame , tvb , offset , 1 , ENC_NA ) ;
2014-03-10 21:28:08 +00:00
proto_tree_add_item ( flags_tree , & hfi_peekremote_flags_crc_error , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( flags_tree , & hfi_peekremote_flags_frame_error , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( flags_tree , & hfi_peekremote_flags_reserved , tvb , offset , 1 , ENC_NA ) ;
return 1 ;
}
static int
dissect_peekremote_status ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset )
{
proto_tree * status_tree ;
proto_item * ti_status ;
ti_status = proto_tree_add_item ( tree , & hfi_peekremote_status , tvb , offset , 1 , ENC_NA ) ;
status_tree = proto_item_add_subtree ( ti_status , ett_peekremote_status ) ;
2014-03-13 08:28:08 +00:00
proto_tree_add_item ( status_tree , & hfi_peekremote_status_protected , tvb , offset , 1 , ENC_NA ) ;
2014-03-10 21:28:08 +00:00
proto_tree_add_item ( status_tree , & hfi_peekremote_status_with_decrypt_error , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( status_tree , & hfi_peekremote_status_with_short_preamble , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( status_tree , & hfi_peekremote_status_reserved , tvb , offset , 1 , ENC_NA ) ;
return 1 ;
}
2013-12-21 20:54:26 +00:00
static gboolean
dissect_peekremote_new ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * u _U_ )
{
static const guint8 magic [ 4 ] = { 0x00 , 0xFF , 0xAB , 0xCD } ;
2013-12-21 22:05:42 +00:00
int offset = 0 ;
2013-12-21 20:54:26 +00:00
proto_tree * peekremote_tree = NULL ;
proto_item * ti = NULL ;
2013-12-21 22:12:46 +00:00
proto_item * ti_header_version , * ti_header_size ;
2013-12-21 20:54:26 +00:00
guint8 header_version ;
2017-04-02 15:50:15 +00:00
gint header_size ;
2015-06-20 22:57:57 +00:00
struct ieee_802_11_phdr phdr ;
2015-06-22 22:04:28 +00:00
guint32 extflags ;
2015-06-20 22:57:57 +00:00
guint16 frequency ;
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have
a union with structures holding PHY-type-specific information, as a
bunch of attributes are PHY-specific.
If we have a channel and band, but don't have the frequency, attempt to
calculate the frequency, and add that to the radio information if we
succeed. If we have the frequency, but don't have the channel, attempt
to calculate the channel, and add that to the radio information if we
succeed.
Handle FHSS information, 11a "half/quarter-clocked" and turbo
information, 11g normal vs. Super G, additional 11n and 11ac
information, and the "short preamble" flag for 11b and 11g.
Add a PHY type for 11 legacy DSSS and detect it if possible.
Clean up the AVS dissector - make all fields wlancap. fields (if you
want generic fields, use the wlan_radio. fields).
Set more fields when writing out Commview Wi-Fi files.
Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69
Reviewed-on: https://code.wireshark.org/review/9146
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-25 19:14:39 +00:00
guint16 mcs_index ;
2013-12-21 20:54:26 +00:00
tvbuff_t * next_tvb ;
if ( tvb_memeql ( tvb , 0 , magic , 4 ) = = - 1 ) {
/*
* Not big enough to hold the magic number , or doesn ' t start
* with the magic number .
*/
return FALSE ;
}
2015-06-20 22:57:57 +00:00
/* We don't have any 802.11 metadata yet. */
2015-12-09 22:26:46 +00:00
memset ( & phdr , 0 , sizeof ( phdr ) ) ;
2015-06-20 22:57:57 +00:00
phdr . fcs_len = 4 ; /* has an FCS */
phdr . decrypted = FALSE ;
phdr . datapad = FALSE ;
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have
a union with structures holding PHY-type-specific information, as a
bunch of attributes are PHY-specific.
If we have a channel and band, but don't have the frequency, attempt to
calculate the frequency, and add that to the radio information if we
succeed. If we have the frequency, but don't have the channel, attempt
to calculate the channel, and add that to the radio information if we
succeed.
Handle FHSS information, 11a "half/quarter-clocked" and turbo
information, 11g normal vs. Super G, additional 11n and 11ac
information, and the "short preamble" flag for 11b and 11g.
Add a PHY type for 11 legacy DSSS and detect it if possible.
Clean up the AVS dissector - make all fields wlancap. fields (if you
want generic fields, use the wlan_radio. fields).
Set more fields when writing out Commview Wi-Fi files.
Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69
Reviewed-on: https://code.wireshark.org/review/9146
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-25 19:14:39 +00:00
phdr . phy = PHDR_802_11_PHY_UNKNOWN ;
2015-06-20 22:57:57 +00:00
2013-12-21 20:54:26 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " PEEKREMOTE " ) ;
col_clear ( pinfo - > cinfo , COL_INFO ) ;
ti = proto_tree_add_item ( tree , hfi_peekremote , tvb , 0 , - 1 , ENC_NA ) ;
peekremote_tree = proto_item_add_subtree ( ti , ett_peekremote ) ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_magic_number , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
header_version = tvb_get_guint8 ( tvb , offset ) ;
2013-12-21 22:12:46 +00:00
ti_header_version = proto_tree_add_uint ( peekremote_tree , & hfi_peekremote_header_version , tvb , offset , 1 , header_version ) ;
2013-12-21 20:54:26 +00:00
offset + = 1 ;
header_size = tvb_get_ntohl ( tvb , offset ) ;
ti_header_size = proto_tree_add_uint ( peekremote_tree , & hfi_peekremote_header_size , tvb , offset , 4 , header_size ) ;
offset + = 4 ;
switch ( header_version ) {
case 2 :
if ( header_size ! = 55 ) {
expert_add_info ( pinfo , ti_header_size , & ei_peekremote_invalid_header_size ) ;
if ( header_size > 9 )
offset + = ( header_size - 9 ) ;
} else {
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_type , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have
a union with structures holding PHY-type-specific information, as a
bunch of attributes are PHY-specific.
If we have a channel and band, but don't have the frequency, attempt to
calculate the frequency, and add that to the radio information if we
succeed. If we have the frequency, but don't have the channel, attempt
to calculate the channel, and add that to the radio information if we
succeed.
Handle FHSS information, 11a "half/quarter-clocked" and turbo
information, 11g normal vs. Super G, additional 11n and 11ac
information, and the "short preamble" flag for 11b and 11g.
Add a PHY type for 11 legacy DSSS and detect it if possible.
Clean up the AVS dissector - make all fields wlancap. fields (if you
want generic fields, use the wlan_radio. fields).
Set more fields when writing out Commview Wi-Fi files.
Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69
Reviewed-on: https://code.wireshark.org/review/9146
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-25 19:14:39 +00:00
mcs_index = tvb_get_ntohs ( tvb , offset ) ;
2017-10-26 12:32:56 +00:00
extflags = tvb_get_ntohl ( tvb , offset + 12 ) ;
2020-04-03 15:06:21 +00:00
if ( extflags & EXT_FLAG_HEFLAG ) {
2017-10-26 12:32:56 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_mcs_index_ac , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2020-04-03 15:06:21 +00:00
phdr . phy = PHDR_802_11_PHY_11AX ;
2017-10-28 03:29:25 +00:00
} else {
2020-04-03 15:06:21 +00:00
if ( extflags & EXT_FLAG_802_11ac ) {
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_mcs_index_ac , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
phdr . phy = PHDR_802_11_PHY_11AC ;
} else {
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_mcs_index , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
phdr . phy = PHDR_802_11_PHY_11N ;
phdr . phy_info . info_11n . has_mcs_index = TRUE ;
phdr . phy_info . info_11n . mcs_index = mcs_index ;
}
2017-10-28 03:29:25 +00:00
}
2013-12-21 20:54:26 +00:00
offset + = 2 ;
2015-12-09 22:26:46 +00:00
phdr . has_channel = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . channel = tvb_get_ntohs ( tvb , offset ) ;
2013-12-21 20:54:26 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_channel , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
2015-06-20 22:57:57 +00:00
frequency = tvb_get_ntohl ( tvb , offset ) ;
if ( frequency ! = 0 ) {
2015-12-09 22:26:46 +00:00
phdr . has_frequency = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . frequency = frequency ;
}
2013-12-21 20:54:26 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_frequency , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_band , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2014-03-10 21:28:08 +00:00
offset + = 4 ;
2014-10-28 06:41:13 +00:00
offset + = dissect_peekremote_extflags ( tvb , pinfo , peekremote_tree , offset ) ;
2015-12-09 22:26:46 +00:00
phdr . has_signal_percent = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . signal_percent = tvb_get_guint8 ( tvb , offset ) ;
2013-12-21 20:54:26 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_percent , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
2015-12-09 22:26:46 +00:00
phdr . has_noise_percent = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . noise_percent = tvb_get_guint8 ( tvb , offset ) ;
2013-12-21 20:54:26 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_percent , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
2015-12-09 22:26:46 +00:00
phdr . has_signal_dbm = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . signal_dbm = tvb_get_guint8 ( tvb , offset ) ;
2014-03-13 19:41:00 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_dbm , tvb , offset , 1 , ENC_NA ) ;
2013-12-21 20:54:26 +00:00
offset + = 1 ;
2015-12-09 22:26:46 +00:00
phdr . has_noise_dbm = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . noise_dbm = tvb_get_guint8 ( tvb , offset ) ;
2013-12-21 20:54:26 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_1_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_2_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_3_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_4_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_1_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_2_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_3_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_4_dbm , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_packetlength , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_slicelength , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
2014-03-10 21:28:08 +00:00
offset + = dissect_peekremote_flags ( tvb , pinfo , peekremote_tree , offset ) ;
offset + = dissect_peekremote_status ( tvb , pinfo , peekremote_tree , offset ) ;
2013-12-25 23:03:12 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_timestamp , tvb , offset , 8 , ENC_BIG_ENDIAN ) ;
2015-12-09 22:26:46 +00:00
phdr . has_tsf_timestamp = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . tsf_timestamp = tvb_get_ntoh64 ( tvb , offset ) ;
2013-12-25 23:03:12 +00:00
offset + = 8 ;
2013-12-21 20:54:26 +00:00
}
break ;
default :
2013-12-21 22:12:46 +00:00
expert_add_info ( pinfo , ti_header_version , & ei_peekremote_unknown_header_version ) ;
2013-12-21 20:54:26 +00:00
if ( header_size > 9 )
offset + = ( header_size - 9 ) ;
break ;
}
2014-05-29 09:34:14 +00:00
proto_item_set_end ( ti , tvb , offset ) ;
2013-12-21 20:54:26 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2015-06-20 22:57:57 +00:00
call_dissector_with_data ( wlan_radio_handle , next_tvb , pinfo , tree , & phdr ) ;
2013-12-21 20:54:26 +00:00
return TRUE ;
}
2013-12-21 01:50:54 +00:00
static int
2015-05-31 15:48:55 +00:00
dissect_peekremote_legacy ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2012-05-02 01:44:40 +00:00
{
tvbuff_t * next_tvb ;
proto_tree * peekremote_tree = NULL ;
proto_item * ti = NULL ;
2015-06-20 22:57:57 +00:00
struct ieee_802_11_phdr phdr ;
2015-05-31 15:48:55 +00:00
guint8 signal_percent ;
2012-05-02 01:44:40 +00:00
2015-12-09 22:26:46 +00:00
memset ( & phdr , 0 , sizeof ( phdr ) ) ;
2013-12-21 20:54:26 +00:00
/*
* Check whether this is peekremote - ng , and dissect it as such if it
* is .
*/
2015-05-31 15:48:55 +00:00
if ( dissect_peekremote_new ( tvb , pinfo , tree , data ) ) {
2013-12-21 20:54:26 +00:00
/* Yup, it was peekremote-ng, and it's been dissected as such. */
2015-04-19 19:39:40 +00:00
return tvb_reported_length ( tvb ) ;
2013-12-21 20:54:26 +00:00
}
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " PEEKREMOTE " ) ;
2012-05-02 01:44:40 +00:00
col_clear ( pinfo - > cinfo , COL_INFO ) ;
if ( tree ) {
2013-12-21 01:50:54 +00:00
ti = proto_tree_add_item ( tree , hfi_peekremote , tvb , 0 , - 1 , ENC_NA ) ;
2012-05-02 01:44:40 +00:00
peekremote_tree = proto_item_add_subtree ( ti , ett_peekremote ) ;
2014-03-13 19:41:00 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_dbm , tvb , 0 , 1 , ENC_NA ) ;
2014-03-10 21:28:08 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_dbm , tvb , 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_packetlength , tvb , 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_slicelength , tvb , 4 , 2 , ENC_BIG_ENDIAN ) ;
dissect_peekremote_flags ( tvb , pinfo , peekremote_tree , 6 ) ;
dissect_peekremote_status ( tvb , pinfo , peekremote_tree , 7 ) ;
2013-12-25 23:03:12 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_timestamp , tvb , 8 , 8 , ENC_BIG_ENDIAN ) ;
2013-12-21 01:50:54 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_speed , tvb , 16 , 1 , ENC_NA ) ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_channel , tvb , 17 , 1 , ENC_BIG_ENDIAN ) ;
2014-03-13 19:41:00 +00:00
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_signal_percent , tvb , 18 , 1 , ENC_NA ) ;
proto_tree_add_item ( peekremote_tree , & hfi_peekremote_noise_percent , tvb , 19 , 1 , ENC_NA ) ;
2012-05-02 01:44:40 +00:00
}
2015-05-31 15:48:55 +00:00
signal_percent = tvb_get_guint8 ( tvb , 18 ) ;
2014-05-29 09:34:14 +00:00
proto_item_set_end ( ti , tvb , 20 ) ;
2012-05-02 01:44:40 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , 20 ) ;
2015-05-31 15:48:55 +00:00
/* When signal = 100 % and coming from ARUBA ERM, it is TX packet and there is no FCS */
2015-06-20 22:57:57 +00:00
if ( GPOINTER_TO_INT ( data ) = = IS_ARUBA & & signal_percent = = 100 ) {
phdr . fcs_len = 0 ; /* TX packet, no FCS */
2015-05-31 15:48:55 +00:00
} else {
2015-06-20 22:57:57 +00:00
phdr . fcs_len = 4 ; /* We have an FCS */
2015-05-31 15:48:55 +00:00
}
2015-06-20 22:57:57 +00:00
phdr . decrypted = FALSE ;
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have
a union with structures holding PHY-type-specific information, as a
bunch of attributes are PHY-specific.
If we have a channel and band, but don't have the frequency, attempt to
calculate the frequency, and add that to the radio information if we
succeed. If we have the frequency, but don't have the channel, attempt
to calculate the channel, and add that to the radio information if we
succeed.
Handle FHSS information, 11a "half/quarter-clocked" and turbo
information, 11g normal vs. Super G, additional 11n and 11ac
information, and the "short preamble" flag for 11b and 11g.
Add a PHY type for 11 legacy DSSS and detect it if possible.
Clean up the AVS dissector - make all fields wlancap. fields (if you
want generic fields, use the wlan_radio. fields).
Set more fields when writing out Commview Wi-Fi files.
Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69
Reviewed-on: https://code.wireshark.org/review/9146
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-25 19:14:39 +00:00
phdr . phy = PHDR_802_11_PHY_UNKNOWN ;
2015-12-09 22:26:46 +00:00
phdr . has_channel = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . channel = tvb_get_guint8 ( tvb , 17 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_data_rate = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . data_rate = tvb_get_guint8 ( tvb , 16 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_signal_percent = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . signal_percent = tvb_get_guint8 ( tvb , 18 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_noise_percent = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . noise_percent = tvb_get_guint8 ( tvb , 18 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_signal_dbm = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . signal_dbm = tvb_get_guint8 ( tvb , 0 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_noise_dbm = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . noise_dbm = tvb_get_guint8 ( tvb , 1 ) ;
2015-12-09 22:26:46 +00:00
phdr . has_tsf_timestamp = TRUE ;
2015-06-20 22:57:57 +00:00
phdr . tsf_timestamp = tvb_get_ntoh64 ( tvb , 8 ) ;
2021-03-10 09:42:51 +00:00
/*
* We don ' t know they PHY , but we do have the data rate ;
* try to guess the PHY based on the data rate and channel .
*/
if ( RATE_IS_DSSS ( phdr . data_rate ) ) {
/* 11b */
phdr . phy = PHDR_802_11_PHY_11B ;
phdr . phy_info . info_11b . has_short_preamble = FALSE ;
} else if ( RATE_IS_OFDM ( phdr . data_rate ) ) {
/* 11a or 11g, depending on the band. */
if ( CHAN_IS_BG ( phdr . channel ) ) {
/* 11g */
phdr . phy = PHDR_802_11_PHY_11G ;
phdr . phy_info . info_11g . has_mode = FALSE ;
} else {
/* 11a */
phdr . phy = PHDR_802_11_PHY_11A ;
phdr . phy_info . info_11a . has_channel_type = FALSE ;
phdr . phy_info . info_11a . has_turbo_type = FALSE ;
}
}
2015-06-20 22:57:57 +00:00
return 20 + call_dissector_with_data ( wlan_radio_handle , next_tvb , pinfo , tree , & phdr ) ;
2012-05-02 01:44:40 +00:00
}
void
proto_register_peekremote ( void )
{
2013-12-21 01:50:54 +00:00
# ifndef HAVE_HFI_SECTION_INIT
2013-12-21 03:04:27 +00:00
static header_field_info * hfi [ ] = {
2014-03-13 19:41:00 +00:00
& hfi_peekremote_signal_dbm ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_noise_dbm ,
2013-12-21 01:50:54 +00:00
& hfi_peekremote_packetlength ,
& hfi_peekremote_slicelength ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_flags ,
2014-03-13 08:28:08 +00:00
& hfi_peekremote_flags_control_frame ,
2014-03-10 21:28:08 +00:00
& hfi_peekremote_flags_crc_error ,
& hfi_peekremote_flags_frame_error ,
& hfi_peekremote_flags_reserved ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_status ,
2014-03-13 08:28:08 +00:00
& hfi_peekremote_status_protected ,
2014-03-10 21:28:08 +00:00
& hfi_peekremote_status_with_decrypt_error ,
& hfi_peekremote_status_with_short_preamble ,
& hfi_peekremote_status_reserved ,
2013-12-25 23:03:12 +00:00
& hfi_peekremote_timestamp ,
2013-12-21 01:50:54 +00:00
& hfi_peekremote_speed ,
& hfi_peekremote_channel ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_magic_number ,
& hfi_peekremote_header_version ,
& hfi_peekremote_header_size ,
& hfi_peekremote_type ,
2014-10-28 03:59:53 +00:00
& hfi_peekremote_mcs_index ,
2017-10-26 12:32:56 +00:00
& hfi_peekremote_mcs_index_ac ,
2014-03-13 19:41:00 +00:00
& hfi_peekremote_signal_percent ,
& hfi_peekremote_noise_percent ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_frequency ,
& hfi_peekremote_band ,
2014-10-28 06:41:13 +00:00
& hfi_peekremote_extflags ,
& hfi_peekremote_extflags_20mhz_lower ,
& hfi_peekremote_extflags_20mhz_upper ,
& hfi_peekremote_extflags_40mhz ,
& hfi_peekremote_extflags_half_gi ,
& hfi_peekremote_extflags_full_gi ,
& hfi_peekremote_extflags_ampdu ,
& hfi_peekremote_extflags_amsdu ,
& hfi_peekremote_extflags_11ac ,
& hfi_peekremote_extflags_future_use ,
2018-02-28 14:26:03 +00:00
& hfi_peekremote_extflags_80mhz ,
& hfi_peekremote_extflags_shortpreamble ,
& hfi_peekremote_extflags_spatialstreams ,
2020-04-03 15:06:21 +00:00
& hfi_peekremote_extflags_heflag ,
& hfi_peekremote_extflags_160mhz ,
2014-10-28 06:41:13 +00:00
& hfi_peekremote_extflags_reserved ,
2013-12-21 20:54:26 +00:00
& hfi_peekremote_signal_1_dbm ,
& hfi_peekremote_signal_2_dbm ,
& hfi_peekremote_signal_3_dbm ,
& hfi_peekremote_signal_4_dbm ,
& hfi_peekremote_noise_1_dbm ,
& hfi_peekremote_noise_2_dbm ,
& hfi_peekremote_noise_3_dbm ,
& hfi_peekremote_noise_4_dbm ,
2012-05-02 01:44:40 +00:00
} ;
2013-12-21 01:50:54 +00:00
# endif
2012-05-02 01:44:40 +00:00
static gint * ett [ ] = {
& ett_peekremote ,
2014-03-10 21:28:08 +00:00
& ett_peekremote_flags ,
& ett_peekremote_status ,
2014-10-28 06:41:13 +00:00
& ett_peekremote_extflags
2012-05-02 01:44:40 +00:00
} ;
2013-12-21 20:54:26 +00:00
static ei_register_info ei [ ] = {
{ & ei_peekremote_unknown_header_version , { " peekremote.unknown_header_version " , PI_UNDECODED , PI_ERROR , " Unknown header version " , EXPFILL } } ,
{ & ei_peekremote_invalid_header_size , { " peekremote.invalid_header_size " , PI_UNDECODED , PI_ERROR , " Invalid header size for that header version " , EXPFILL } } ,
} ;
expert_module_t * expert_peekremote ;
2013-12-21 01:50:54 +00:00
2012-05-02 01:44:40 +00:00
proto_peekremote = proto_register_protocol (
" AiroPeek/OmniPeek encapsulated IEEE 802.11 " , " PEEKREMOTE " , " peekremote " ) ;
2013-12-21 01:50:54 +00:00
hfi_peekremote = proto_registrar_get_nth ( proto_peekremote ) ;
proto_register_fields ( proto_peekremote , hfi , array_length ( hfi ) ) ;
2012-05-02 01:44:40 +00:00
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2013-12-21 20:54:26 +00:00
expert_peekremote = expert_register_protocol ( proto_peekremote ) ;
expert_register_field_array ( expert_peekremote , ei , array_length ( ei ) ) ;
2014-03-14 15:53:22 +00:00
2016-01-13 01:16:04 +00:00
peekremote_handle = register_dissector ( " peekremote " , dissect_peekremote_legacy , proto_peekremote ) ;
2012-05-02 01:44:40 +00:00
}
void
proto_reg_handoff_peekremote ( void )
{
2016-03-16 13:02:52 +00:00
wlan_radio_handle = find_dissector_add_dependency ( " wlan_radio " , proto_peekremote ) ;
2012-05-02 01:44:40 +00:00
2016-10-05 20:33:54 +00:00
dissector_add_uint_with_preference ( " udp.port " , PEEKREMOTE_PORT , peekremote_handle ) ;
2013-12-21 20:54:26 +00:00
2015-07-13 00:40:31 +00:00
heur_dissector_add ( " udp " , dissect_peekremote_new , " OmniPeek Remote over UDP " , " peekremote_udp " , proto_peekremote , HEURISTIC_ENABLE ) ;
2012-05-02 01:44:40 +00:00
}
2014-03-14 15:53:22 +00:00
/*
2019-07-26 18:43:17 +00:00
* Editor modelines - https : //www.wireshark.org/tools/modelines.html
2014-03-14 15:53:22 +00:00
*
* Local variables :
* c - basic - offset : 2
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
* vi : set shiftwidth = 2 tabstop = 8 expandtab :
* : indentSize = 2 : tabSize = 8 : noTabs = true :
*/