diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-ppi.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-ppi.c')
-rw-r--r-- | epan/dissectors/packet-ppi.c | 426 |
1 files changed, 213 insertions, 213 deletions
diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c index 9205cbc4..15780377 100644 --- a/epan/dissectors/packet-ppi.c +++ b/epan/dissectors/packet-ppi.c @@ -49,17 +49,17 @@ * The PPH struct has the following format: * * typedef struct ppi_packetheader { - * guint8 pph_version; // Version. Currently 0 - * guint8 pph_flags; // Flags. - * guint16 pph_len; // Length of entire message, including this header and TLV payload. - * guint32 pph_dlt; // libpcap Data Link Type of the captured packet data. + * uint8_t pph_version; // Version. Currently 0 + * uint8_t pph_flags; // Flags. + * uint16_t pph_len; // Length of entire message, including this header and TLV payload. + * uint32_t pph_dlt; // libpcap Data Link Type of the captured packet data. * } ppi_packetheader_t; * * The PFH struct has the following format: * * typedef struct ppi_fieldheader { - * guint16 pfh_type; // Type - * guint16 pfh_datalen; // Length of data + * uint16_t pfh_type; // Type + * uint16_t pfh_datalen; // Length of data * } ppi_fieldheader_t; * * Anyone looking to add their own PPI dissector would probably do well to imitate the GPS @@ -164,7 +164,7 @@ typedef enum { /* 30000 - 65535: Private types */ INTEL_CORP_PRIVATE = 30000, MOHAMED_THAGA_PRIVATE = 30001, - PPI_GPS_INFO = 30002, /* 30002 - 30005 described in PPI-GEOLOCATION specifcation */ + PPI_GPS_INFO = 30002, /* 30002 - 30005 described in PPI-GEOLOCATION specification */ PPI_VECTOR_INFO = 30003, /* currently available in draft from. jellch@harris.com */ PPI_SENSOR_INFO = 30004, PPI_ANTENNA_INFO = 30005, @@ -174,147 +174,147 @@ typedef enum { } ppi_field_type; /* Protocol */ -static int proto_ppi = -1; +static int proto_ppi; /* Packet header */ -static int hf_ppi_head_version = -1; -static int hf_ppi_head_flags = -1; -static int hf_ppi_head_flag_alignment = -1; -static int hf_ppi_head_flag_reserved = -1; -static int hf_ppi_head_len = -1; -static int hf_ppi_head_dlt = -1; +static int hf_ppi_head_version; +static int hf_ppi_head_flags; +static int hf_ppi_head_flag_alignment; +static int hf_ppi_head_flag_reserved; +static int hf_ppi_head_len; +static int hf_ppi_head_dlt; /* Field header */ -static int hf_ppi_field_type = -1; -static int hf_ppi_field_len = -1; +static int hf_ppi_field_type; +static int hf_ppi_field_len; /* 802.11 Common */ -static int hf_80211_common_tsft = -1; -static int hf_80211_common_flags = -1; -static int hf_80211_common_flags_fcs = -1; -static int hf_80211_common_flags_tsft = -1; -static int hf_80211_common_flags_fcs_valid = -1; -static int hf_80211_common_flags_phy_err = -1; -static int hf_80211_common_rate = -1; -static int hf_80211_common_chan_freq = -1; -static int hf_80211_common_chan_flags = -1; - -static int hf_80211_common_chan_flags_turbo = -1; -static int hf_80211_common_chan_flags_cck = -1; -static int hf_80211_common_chan_flags_ofdm = -1; -static int hf_80211_common_chan_flags_2ghz = -1; -static int hf_80211_common_chan_flags_5ghz = -1; -static int hf_80211_common_chan_flags_passive = -1; -static int hf_80211_common_chan_flags_dynamic = -1; -static int hf_80211_common_chan_flags_gfsk = -1; - -static int hf_80211_common_fhss_hopset = -1; -static int hf_80211_common_fhss_pattern = -1; -static int hf_80211_common_dbm_antsignal = -1; -static int hf_80211_common_dbm_antnoise = -1; +static int hf_80211_common_tsft; +static int hf_80211_common_flags; +static int hf_80211_common_flags_fcs; +static int hf_80211_common_flags_tsft; +static int hf_80211_common_flags_fcs_valid; +static int hf_80211_common_flags_phy_err; +static int hf_80211_common_rate; +static int hf_80211_common_chan_freq; +static int hf_80211_common_chan_flags; + +static int hf_80211_common_chan_flags_turbo; +static int hf_80211_common_chan_flags_cck; +static int hf_80211_common_chan_flags_ofdm; +static int hf_80211_common_chan_flags_2ghz; +static int hf_80211_common_chan_flags_5ghz; +static int hf_80211_common_chan_flags_passive; +static int hf_80211_common_chan_flags_dynamic; +static int hf_80211_common_chan_flags_gfsk; + +static int hf_80211_common_fhss_hopset; +static int hf_80211_common_fhss_pattern; +static int hf_80211_common_dbm_antsignal; +static int hf_80211_common_dbm_antnoise; /* 802.11n MAC */ -static int hf_80211n_mac_flags = -1; -static int hf_80211n_mac_flags_greenfield = -1; -static int hf_80211n_mac_flags_ht20_40 = -1; -static int hf_80211n_mac_flags_rx_guard_interval = -1; -static int hf_80211n_mac_flags_duplicate_rx = -1; -static int hf_80211n_mac_flags_more_aggregates = -1; -static int hf_80211n_mac_flags_aggregate = -1; -static int hf_80211n_mac_flags_delimiter_crc_after = -1; -static int hf_80211n_mac_ampdu_id = -1; -static int hf_80211n_mac_num_delimiters = -1; -static int hf_80211n_mac_reserved = -1; +static int hf_80211n_mac_flags; +static int hf_80211n_mac_flags_greenfield; +static int hf_80211n_mac_flags_ht20_40; +static int hf_80211n_mac_flags_rx_guard_interval; +static int hf_80211n_mac_flags_duplicate_rx; +static int hf_80211n_mac_flags_more_aggregates; +static int hf_80211n_mac_flags_aggregate; +static int hf_80211n_mac_flags_delimiter_crc_after; +static int hf_80211n_mac_ampdu_id; +static int hf_80211n_mac_num_delimiters; +static int hf_80211n_mac_reserved; /* 802.11n MAC+PHY */ -static int hf_80211n_mac_phy_mcs = -1; -static int hf_80211n_mac_phy_num_streams = -1; -static int hf_80211n_mac_phy_rssi_combined = -1; -static int hf_80211n_mac_phy_rssi_ant0_ctl = -1; -static int hf_80211n_mac_phy_rssi_ant1_ctl = -1; -static int hf_80211n_mac_phy_rssi_ant2_ctl = -1; -static int hf_80211n_mac_phy_rssi_ant3_ctl = -1; -static int hf_80211n_mac_phy_rssi_ant0_ext = -1; -static int hf_80211n_mac_phy_rssi_ant1_ext = -1; -static int hf_80211n_mac_phy_rssi_ant2_ext = -1; -static int hf_80211n_mac_phy_rssi_ant3_ext = -1; -static int hf_80211n_mac_phy_ext_chan_freq = -1; -static int hf_80211n_mac_phy_ext_chan_flags = -1; -static int hf_80211n_mac_phy_ext_chan_flags_turbo = -1; -static int hf_80211n_mac_phy_ext_chan_flags_cck = -1; -static int hf_80211n_mac_phy_ext_chan_flags_ofdm = -1; -static int hf_80211n_mac_phy_ext_chan_flags_2ghz = -1; -static int hf_80211n_mac_phy_ext_chan_flags_5ghz = -1; -static int hf_80211n_mac_phy_ext_chan_flags_passive = -1; -static int hf_80211n_mac_phy_ext_chan_flags_dynamic = -1; -static int hf_80211n_mac_phy_ext_chan_flags_gfsk = -1; -static int hf_80211n_mac_phy_dbm_ant0signal = -1; -static int hf_80211n_mac_phy_dbm_ant0noise = -1; -static int hf_80211n_mac_phy_dbm_ant1signal = -1; -static int hf_80211n_mac_phy_dbm_ant1noise = -1; -static int hf_80211n_mac_phy_dbm_ant2signal = -1; -static int hf_80211n_mac_phy_dbm_ant2noise = -1; -static int hf_80211n_mac_phy_dbm_ant3signal = -1; -static int hf_80211n_mac_phy_dbm_ant3noise = -1; -static int hf_80211n_mac_phy_evm0 = -1; -static int hf_80211n_mac_phy_evm1 = -1; -static int hf_80211n_mac_phy_evm2 = -1; -static int hf_80211n_mac_phy_evm3 = -1; +static int hf_80211n_mac_phy_mcs; +static int hf_80211n_mac_phy_num_streams; +static int hf_80211n_mac_phy_rssi_combined; +static int hf_80211n_mac_phy_rssi_ant0_ctl; +static int hf_80211n_mac_phy_rssi_ant1_ctl; +static int hf_80211n_mac_phy_rssi_ant2_ctl; +static int hf_80211n_mac_phy_rssi_ant3_ctl; +static int hf_80211n_mac_phy_rssi_ant0_ext; +static int hf_80211n_mac_phy_rssi_ant1_ext; +static int hf_80211n_mac_phy_rssi_ant2_ext; +static int hf_80211n_mac_phy_rssi_ant3_ext; +static int hf_80211n_mac_phy_ext_chan_freq; +static int hf_80211n_mac_phy_ext_chan_flags; +static int hf_80211n_mac_phy_ext_chan_flags_turbo; +static int hf_80211n_mac_phy_ext_chan_flags_cck; +static int hf_80211n_mac_phy_ext_chan_flags_ofdm; +static int hf_80211n_mac_phy_ext_chan_flags_2ghz; +static int hf_80211n_mac_phy_ext_chan_flags_5ghz; +static int hf_80211n_mac_phy_ext_chan_flags_passive; +static int hf_80211n_mac_phy_ext_chan_flags_dynamic; +static int hf_80211n_mac_phy_ext_chan_flags_gfsk; +static int hf_80211n_mac_phy_dbm_ant0signal; +static int hf_80211n_mac_phy_dbm_ant0noise; +static int hf_80211n_mac_phy_dbm_ant1signal; +static int hf_80211n_mac_phy_dbm_ant1noise; +static int hf_80211n_mac_phy_dbm_ant2signal; +static int hf_80211n_mac_phy_dbm_ant2noise; +static int hf_80211n_mac_phy_dbm_ant3signal; +static int hf_80211n_mac_phy_dbm_ant3noise; +static int hf_80211n_mac_phy_evm0; +static int hf_80211n_mac_phy_evm1; +static int hf_80211n_mac_phy_evm2; +static int hf_80211n_mac_phy_evm3; /* 802.11n-Extensions A-MPDU fragments */ -static int hf_ampdu_reassembled_in = -1; -/* static int hf_ampdu_segments = -1; */ -static int hf_ampdu_segment = -1; -static int hf_ampdu_count = -1; +static int hf_ampdu_reassembled_in; +/* static int hf_ampdu_segments; */ +static int hf_ampdu_segment; +static int hf_ampdu_count; /* Spectrum-Map */ -static int hf_spectrum_map = -1; +static int hf_spectrum_map; /* Process-Info */ -static int hf_process_info = -1; +static int hf_process_info; /* Capture-Info */ -static int hf_capture_info = -1; +static int hf_capture_info; /* Aggregation Extension */ -static int hf_aggregation_extension_interface_id = -1; +static int hf_aggregation_extension_interface_id; /* 802.3 Extension */ -static int hf_8023_extension_flags = -1; -static int hf_8023_extension_flags_fcs_present = -1; -static int hf_8023_extension_errors = -1; -static int hf_8023_extension_errors_fcs = -1; -static int hf_8023_extension_errors_sequence = -1; -static int hf_8023_extension_errors_symbol = -1; -static int hf_8023_extension_errors_data = -1; +static int hf_8023_extension_flags; +static int hf_8023_extension_flags_fcs_present; +static int hf_8023_extension_errors; +static int hf_8023_extension_errors_fcs; +static int hf_8023_extension_errors_sequence; +static int hf_8023_extension_errors_symbol; +static int hf_8023_extension_errors_data; /* Generated from convert_proto_tree_add_text.pl */ -static int hf_ppi_antenna = -1; -static int hf_ppi_harris = -1; -static int hf_ppi_reserved = -1; -static int hf_ppi_vector = -1; -static int hf_ppi_fnet = -1; -static int hf_ppi_gps = -1; - -static gint ett_ppi_pph = -1; -static gint ett_ppi_flags = -1; -static gint ett_dot11_common = -1; -static gint ett_dot11_common_flags = -1; -static gint ett_dot11_common_channel_flags = -1; -static gint ett_dot11n_mac = -1; -static gint ett_dot11n_mac_flags = -1; -static gint ett_dot11n_mac_phy = -1; -static gint ett_dot11n_mac_phy_ext_channel_flags = -1; -static gint ett_ampdu_segments = -1; -static gint ett_ampdu = -1; -static gint ett_ampdu_segment = -1; -static gint ett_aggregation_extension = -1; -static gint ett_8023_extension = -1; -static gint ett_8023_extension_flags = -1; -static gint ett_8023_extension_errors = -1; +static int hf_ppi_antenna; +static int hf_ppi_harris; +static int hf_ppi_reserved; +static int hf_ppi_vector; +static int hf_ppi_fnet; +static int hf_ppi_gps; + +static int ett_ppi_pph; +static int ett_ppi_flags; +static int ett_dot11_common; +static int ett_dot11_common_flags; +static int ett_dot11_common_channel_flags; +static int ett_dot11n_mac; +static int ett_dot11n_mac_flags; +static int ett_dot11n_mac_phy; +static int ett_dot11n_mac_phy_ext_channel_flags; +static int ett_ampdu_segments; +static int ett_ampdu; +static int ett_ampdu_segment; +static int ett_aggregation_extension; +static int ett_8023_extension; +static int ett_8023_extension_flags; +static int ett_8023_extension_errors; /* Generated from convert_proto_tree_add_text.pl */ -static expert_field ei_ppi_invalid_length = EI_INIT; +static expert_field ei_ppi_invalid_length; static dissector_handle_t ppi_handle; @@ -353,18 +353,18 @@ static const value_string vs_ppi_field_type[] = { static reassembly_table ampdu_reassembly_table; /* Reassemble A-MPDUs? */ -static gboolean ppi_ampdu_reassemble = TRUE; +static bool ppi_ampdu_reassemble = true; -static gboolean -capture_ppi(const guchar *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_) +static bool +capture_ppi(const unsigned char *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_) { - guint32 dlt; - guint ppi_len; + uint32_t dlt; + unsigned ppi_len; ppi_len = pletoh16(pd+2); if(ppi_len < PPI_V0_HEADER_LEN || !BYTES_ARE_IN_FRAME(0, len, ppi_len)) - return FALSE; + return false; dlt = pletoh32(pd+4); @@ -372,9 +372,9 @@ capture_ppi(const guchar *pd, int offset _U_, int len, capture_packet_info_t *cp } static void -ptvcursor_add_invalid_check(ptvcursor_t *csr, int hf, gint len, guint64 invalid_val) { +ptvcursor_add_invalid_check(ptvcursor_t *csr, int hf, int len, uint64_t invalid_val) { proto_item *ti; - guint64 val = invalid_val; + uint64_t val = invalid_val; switch (len) { case 8: @@ -390,7 +390,7 @@ ptvcursor_add_invalid_check(ptvcursor_t *csr, int hf, gint len, guint64 invalid_ ptvcursor_current_offset(csr)); break; case 1: - val = tvb_get_guint8(ptvcursor_tvbuff(csr), + val = tvb_get_uint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); break; default: @@ -403,11 +403,11 @@ ptvcursor_add_invalid_check(ptvcursor_t *csr, int hf, gint len, guint64 invalid_ } static void -add_ppi_field_header(tvbuff_t *tvb, proto_tree *tree, int *offset) +add_ppi_field_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset) { ptvcursor_t *csr; - csr = ptvcursor_new(wmem_packet_scope(), tree, tvb, *offset); + csr = ptvcursor_new(pinfo->pool, tree, tvb, *offset); ptvcursor_add(csr, hf_ppi_field_type, 2, ENC_LITTLE_ENDIAN); ptvcursor_add(csr, hf_ppi_field_len, 2, ENC_LITTLE_ENDIAN); ptvcursor_free(csr); @@ -421,17 +421,17 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of proto_tree *ftree; proto_item *ti; ptvcursor_t *csr; - guint64 tsft_raw; - guint rate_raw; - guint rate_kbps; - guint32 common_flags; - guint16 common_frequency; - guint16 chan_flags; - gint8 dbm_value; - gchar *chan_str; + uint64_t tsft_raw; + unsigned rate_raw; + unsigned rate_kbps; + uint32_t common_flags; + uint16_t common_frequency; + uint16_t chan_flags; + int8_t dbm_value; + char *chan_str; ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_dot11_common, NULL, "802.11-Common"); - add_ppi_field_header(tvb, ftree, &offset); + add_ppi_field_header(tvb, pinfo, ftree, &offset); data_len -= 4; /* Subtract field header length */ if (data_len != PPI_80211_COMMON_LEN) { @@ -449,7 +449,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of tsft_raw = tvb_get_letoh64(tvb, offset); if (tsft_raw != 0) { - phdr->has_tsf_timestamp = TRUE; + phdr->has_tsf_timestamp = true; if (common_flags & DOT11_FLAG_TSF_TIMER_MS) phdr->tsf_timestamp = tsft_raw * 1000; else @@ -468,7 +468,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of rate_raw = tvb_get_letohs(tvb, ptvcursor_current_offset(csr)); if (rate_raw != 0) { - phdr->has_data_rate = TRUE; + phdr->has_data_rate = true; phdr->data_rate = rate_raw; } rate_kbps = rate_raw * 500; @@ -482,20 +482,20 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of common_frequency = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); if (common_frequency != 0) { - gint calc_channel; + int calc_channel; - phdr->has_frequency = TRUE; + phdr->has_frequency = true; phdr->frequency = common_frequency; calc_channel = ieee80211_mhz_to_chan(common_frequency); if (calc_channel != -1) { - phdr->has_channel = TRUE; + phdr->has_channel = true; phdr->channel = calc_channel; } } chan_str = ieee80211_mhz_to_str(common_frequency); proto_tree_add_uint_format_value(ptvcursor_tree(csr), hf_80211_common_chan_freq, ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr), 2, common_frequency, "%s", chan_str); - col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%s", chan_str); + col_add_str(pinfo->cinfo, COL_FREQ_CHAN, chan_str); g_free(chan_str); ptvcursor_advance(csr, 2); @@ -513,7 +513,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of case IEEE80211_CHAN_A: phdr->phy = PHDR_802_11_PHY_11A; - phdr->phy_info.info_11a.has_turbo_type = TRUE; + phdr->phy_info.info_11a.has_turbo_type = true; phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL; break; @@ -523,26 +523,26 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of case IEEE80211_CHAN_PUREG: phdr->phy = PHDR_802_11_PHY_11G; - phdr->phy_info.info_11g.has_mode = TRUE; + phdr->phy_info.info_11g.has_mode = true; phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL; break; case IEEE80211_CHAN_G: phdr->phy = PHDR_802_11_PHY_11G; - phdr->phy_info.info_11g.has_mode = TRUE; + phdr->phy_info.info_11g.has_mode = true; phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL; break; case IEEE80211_CHAN_108A: phdr->phy = PHDR_802_11_PHY_11A; - phdr->phy_info.info_11a.has_turbo_type = TRUE; + phdr->phy_info.info_11a.has_turbo_type = true; /* We assume non-STURBO is dynamic turbo */ phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO; break; case IEEE80211_CHAN_108PUREG: phdr->phy = PHDR_802_11_PHY_11G; - phdr->phy_info.info_11g.has_mode = TRUE; + phdr->phy_info.info_11g.has_mode = true; phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G; break; } @@ -560,17 +560,17 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of if (phdr->phy == PHDR_802_11_PHY_11_FHSS) { - phdr->phy_info.info_11_fhss.has_hop_set = TRUE; - phdr->phy_info.info_11_fhss.hop_set = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); + phdr->phy_info.info_11_fhss.has_hop_set = true; + phdr->phy_info.info_11_fhss.hop_set = tvb_get_uint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); } ptvcursor_add(csr, hf_80211_common_fhss_hopset, 1, ENC_LITTLE_ENDIAN); if (phdr->phy == PHDR_802_11_PHY_11_FHSS) { - phdr->phy_info.info_11_fhss.has_hop_pattern = TRUE; - phdr->phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); + phdr->phy_info.info_11_fhss.has_hop_pattern = true; + phdr->phy_info.info_11_fhss.hop_pattern = tvb_get_uint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); } ptvcursor_add(csr, hf_80211_common_fhss_pattern, 1, ENC_LITTLE_ENDIAN); - dbm_value = tvb_get_gint8(tvb, ptvcursor_current_offset(csr)); + dbm_value = tvb_get_int8(tvb, ptvcursor_current_offset(csr)); if (dbm_value != -128 && dbm_value != 0) { /* * XXX - the spec says -128 is invalid, presumably meaning "use @@ -579,12 +579,12 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of * used for "don't have it", so we check for it as well. */ col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm_value); - phdr->has_signal_dbm = TRUE; + phdr->has_signal_dbm = true; phdr->signal_dbm = dbm_value; } ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antsignal, 1, 0x80); /* -128 */ - dbm_value = tvb_get_gint8(tvb, ptvcursor_current_offset(csr)); + dbm_value = tvb_get_int8(tvb, ptvcursor_current_offset(csr)); if (dbm_value != -128 && dbm_value != 0) { /* * XXX - the spec says -128 is invalid, presumably meaning "use @@ -592,7 +592,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of * have 0, presumably meaning it's incorrectly being used for * "don't have it", so we check for it as well. */ - phdr->has_noise_dbm = TRUE; + phdr->has_noise_dbm = true; phdr->noise_dbm = dbm_value; } ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antnoise, 1, 0x80); @@ -601,17 +601,17 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of } static void -dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int data_len, gboolean add_subtree, guint32 *n_mac_flags, guint32 *ampdu_id, struct ieee_802_11_phdr *phdr) +dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len, bool add_subtree, uint32_t *n_mac_flags, uint32_t *ampdu_id, struct ieee_802_11_phdr *phdr) { proto_tree *ftree = tree; ptvcursor_t *csr; - guint32 flags; + uint32_t flags; phdr->phy = PHDR_802_11_PHY_11N; if (add_subtree) { ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_dot11n_mac, NULL, "802.11n MAC"); - add_ppi_field_header(tvb, ftree, &offset); + add_ppi_field_header(tvb, pinfo, ftree, &offset); data_len -= 4; /* Subtract field header length */ } @@ -624,9 +624,9 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int flags = tvb_get_letohl(tvb, ptvcursor_current_offset(csr)); *n_mac_flags = flags; - phdr->phy_info.info_11n.has_bandwidth = TRUE; - phdr->phy_info.info_11n.has_short_gi = TRUE; - phdr->phy_info.info_11n.has_greenfield = TRUE; + phdr->phy_info.info_11n.has_bandwidth = true; + phdr->phy_info.info_11n.has_short_gi = true; + phdr->phy_info.info_11n.has_greenfield = true; phdr->phy_info.info_11n.bandwidth = ((flags & DOT11N_FLAG_HT40) != 0); phdr->phy_info.info_11n.short_gi = ((flags & DOT11N_FLAG_SHORT_GI) != 0); phdr->phy_info.info_11n.greenfield = ((flags & DOT11N_FLAG_GREENFIELD) != 0); @@ -664,18 +664,18 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int } static void -dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len, guint32 *n_mac_flags, guint32 *ampdu_id, struct ieee_802_11_phdr *phdr) +dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len, uint32_t *n_mac_flags, uint32_t *ampdu_id, struct ieee_802_11_phdr *phdr) { proto_tree *ftree; proto_item *ti; ptvcursor_t *csr; - guint8 mcs; - guint8 ness; - guint16 ext_frequency; - gchar *chan_str; + uint8_t mcs; + uint8_t ness; + uint16_t ext_frequency; + char *chan_str; ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_dot11n_mac_phy, NULL, "802.11n MAC+PHY"); - add_ppi_field_header(tvb, ftree, &offset); + add_ppi_field_header(tvb, pinfo, ftree, &offset); data_len -= 4; /* Subtract field header length */ if (data_len != PPI_80211N_MAC_PHY_LEN) { @@ -684,23 +684,23 @@ dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } dissect_80211n_mac(tvb, pinfo, ftree, offset, PPI_80211N_MAC_LEN, - FALSE, n_mac_flags, ampdu_id, phdr); + false, n_mac_flags, ampdu_id, phdr); offset += PPI_80211N_MAC_PHY_OFF; csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); - mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr)); + mcs = tvb_get_uint8(tvb, ptvcursor_current_offset(csr)); if (mcs != 255) { - phdr->phy_info.info_11n.has_mcs_index = TRUE; + phdr->phy_info.info_11n.has_mcs_index = true; phdr->phy_info.info_11n.mcs_index = mcs; } ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_mcs, 1, 255); - ness = tvb_get_guint8(tvb, ptvcursor_current_offset(csr)); - phdr->phy_info.info_11n.has_ness = TRUE; + ness = tvb_get_uint8(tvb, ptvcursor_current_offset(csr)); + phdr->phy_info.info_11n.has_ness = true; phdr->phy_info.info_11n.ness = ness; ti = ptvcursor_add(csr, hf_80211n_mac_phy_num_streams, 1, ENC_LITTLE_ENDIAN); - if (tvb_get_guint8(tvb, ptvcursor_current_offset(csr) - 1) == 0) + if (tvb_get_uint8(tvb, ptvcursor_current_offset(csr) - 1) == 0) proto_item_append_text(ti, " (unknown)"); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_combined, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant0_ctl, 1, 255); @@ -748,13 +748,13 @@ dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } static void -dissect_aggregation_extension(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int data_len) +dissect_aggregation_extension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len) { proto_tree *ftree; ptvcursor_t *csr; ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_aggregation_extension, NULL, "Aggregation Extension"); - add_ppi_field_header(tvb, ftree, &offset); + add_ppi_field_header(tvb, pinfo, ftree, &offset); data_len -= 4; /* Subtract field header length */ if (data_len != PPI_AGGREGATION_EXTENSION_LEN) { @@ -769,13 +769,13 @@ dissect_aggregation_extension(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree } static void -dissect_8023_extension(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int data_len) +dissect_8023_extension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len) { proto_tree *ftree; ptvcursor_t *csr; ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_8023_extension, NULL, "802.3 Extension"); - add_ppi_field_header(tvb, ftree, &offset); + add_ppi_field_header(tvb, pinfo, ftree, &offset); data_len -= 4; /* Subtract field header length */ if (data_len != PPI_8023_EXTENSION_LEN) { @@ -813,26 +813,26 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_item *ti = NULL; tvbuff_t *next_tvb; int offset = 0; - guint version, flags; - gint tot_len, data_len; - guint data_type; - guint32 dlt; - guint32 n_ext_flags = 0; - guint32 ampdu_id = 0; + unsigned version, flags; + int tot_len, data_len; + unsigned data_type; + uint32_t dlt; + uint32_t n_ext_flags = 0; + uint32_t ampdu_id = 0; fragment_head *fd_head = NULL; fragment_item *ft_fdh = NULL; - gint mpdu_count = 0; - gchar *mpdu_str; - gboolean first_mpdu = TRUE; - guint last_frame = 0; - gint len_remain, /*pad_len = 0,*/ ampdu_len = 0; + int mpdu_count = 0; + char *mpdu_str; + bool first_mpdu = true; + unsigned last_frame = 0; + int len_remain, /*pad_len = 0,*/ ampdu_len = 0; struct ieee_802_11_phdr phdr; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPI"); col_clear(pinfo->cinfo, COL_INFO); - version = tvb_get_guint8(tvb, offset); - flags = tvb_get_guint8(tvb, offset + 1); + version = tvb_get_uint8(tvb, offset); + flags = tvb_get_uint8(tvb, offset + 1); tot_len = tvb_get_letohs(tvb, offset+2); dlt = tvb_get_letohl(tvb, offset+4); @@ -868,8 +868,8 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) /* We don't have any 802.11 metadata yet. */ memset(&phdr, 0, sizeof(phdr)); phdr.fcs_len = -1; - phdr.decrypted = FALSE; - phdr.datapad = FALSE; + phdr.decrypted = false; + phdr.datapad = false; phdr.phy = PHDR_802_11_PHY_UNKNOWN; while (tot_len > 0) { @@ -885,7 +885,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) case PPI_80211N_MAC: dissect_80211n_mac(tvb, pinfo, ppi_tree, offset, data_len, - TRUE, &n_ext_flags, &du_id, &phdr); + true, &n_ext_flags, &du_id, &phdr); break; case PPI_80211N_MAC_PHY: @@ -920,7 +920,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } else /* we found a suitable dissector */ { - /* skip over the ppi_fieldheader, and pass it off to the dedicated GPS dissetor */ + /* skip over the ppi_fieldheader, and pass it off to the dedicated GPS dissector */ next_tvb = tvb_new_subset_length_caplen(tvb, offset + 4, data_len - 4 , -1); call_dissector(ppi_gps_handle, next_tvb, pinfo, ppi_tree); } @@ -933,7 +933,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } else /* we found a suitable dissector */ { - /* skip over the ppi_fieldheader, and pass it off to the dedicated VECTOR dissetor */ + /* skip over the ppi_fieldheader, and pass it off to the dedicated VECTOR dissector */ next_tvb = tvb_new_subset_length_caplen(tvb, offset + 4, data_len - 4 , -1); call_dissector(ppi_vector_handle, next_tvb, pinfo, ppi_tree); } @@ -946,7 +946,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } else /* we found a suitable dissector */ { - /* skip over the ppi_fieldheader, and pass it off to the dedicated SENSOR dissetor */ + /* skip over the ppi_fieldheader, and pass it off to the dedicated SENSOR dissector */ next_tvb = tvb_new_subset_length_caplen(tvb, offset + 4, data_len - 4 , -1); call_dissector(ppi_sensor_handle, next_tvb, pinfo, ppi_tree); } @@ -959,7 +959,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } else /* we found a suitable dissector */ { - /* skip over the ppi_fieldheader, and pass it off to the dedicated ANTENNA dissetor */ + /* skip over the ppi_fieldheader, and pass it off to the dedicated ANTENNA dissector */ next_tvb = tvb_new_subset_length_caplen(tvb, offset + 4, data_len - 4 , -1); call_dissector(ppi_antenna_handle, next_tvb, pinfo, ppi_tree); } @@ -972,7 +972,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } else /* we found a suitable dissector */ { - /* skip over the ppi_fieldheader, and pass it off to the dedicated FNET dissetor */ + /* skip over the ppi_fieldheader, and pass it off to the dedicated FNET dissector */ next_tvb = tvb_new_subset_length_caplen(tvb, offset + 4, data_len - 4 , -1); call_dissector(ppi_fnet_handle, next_tvb, pinfo, ppi_tree); } @@ -1093,7 +1093,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * the packet had a long or short preamble. */ if (phdr.phy == PHDR_802_11_PHY_11B) - phdr.phy_info.info_11b.has_short_preamble = FALSE; + phdr.phy_info.info_11b.has_short_preamble = false; if (ppi_ampdu_reassemble && DOT11N_IS_AGGREGATE(n_ext_flags)) { len_remain = tvb_captured_length_remaining(tvb, offset); @@ -1102,7 +1102,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) pad_len = PADDING4(len_remain); } #endif - pinfo->fragmented = TRUE; + pinfo->fragmented = true; /* Make sure we aren't going to go past AGGREGATE_MAX * and caclulate our full A-MPDU length */ @@ -1125,8 +1125,8 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * the reassembly code to track MPDU sizes and frame numbers. */ /*??fd_head = */fragment_add_seq_next(&du_reassembly_table, - tvb, offset, pinfo, ampdu_id, NULL, len_remain, TRUE); - pinfo->fragmented = TRUE; + tvb, offset, pinfo, ampdu_id, NULL, len_remain, true); + pinfo->fragmented = true; /* Do reassembly? */ fd_head = fragment_get(&du_reassembly_table, pinfo, ampdu_id, NULL); @@ -1144,7 +1144,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) last_frame = ft_fdh->frame; if (!first_mpdu) proto_item_append_text(ti, ","); - first_mpdu = FALSE; + first_mpdu = false; proto_item_append_text(ti, " #%u(%u)", ft_fdh->frame, ft_fdh->len); proto_tree_add_uint_format(seg_tree, hf_ampdu_segment, @@ -1182,7 +1182,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } } proto_tree_add_uint(seg_tree, hf_ampdu_count, tvb, 0, 0, mpdu_count); - pinfo->fragmented=FALSE; + pinfo->fragmented=false; } else { next_tvb = tvb_new_subset_remaining(tvb, offset); col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE 802.11n"); @@ -1212,7 +1212,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) return tvb_captured_length(tvb); } -/* Establish our beachead */ +/* Establish our beachhead */ void proto_register_ppi(void) @@ -1480,7 +1480,7 @@ proto_register_ppi(void) { "Capture information", "ppi.cap-info", FT_BYTES, BASE_NONE, NULL, 0x0, "PPI Capture information", HFILL } }, - /* Aggregtion Extension */ + /* Aggregation Extension */ { &hf_aggregation_extension_interface_id, { "Interface ID", "ppi.aggregation_extension.interface_id", FT_UINT32, BASE_DEC, NULL, 0x0, "Zero-based index of the physical interface the packet was captured from", HFILL } }, @@ -1521,7 +1521,7 @@ proto_register_ppi(void) { &hf_ppi_reserved, { "Reserved", "ppi.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_ppi_pph, &ett_ppi_flags, &ett_dot11_common, |