diff options
Diffstat (limited to 'epan/dissectors/packet-zbee-nwk.c')
-rw-r--r-- | epan/dissectors/packet-zbee-nwk.c | 620 |
1 files changed, 310 insertions, 310 deletions
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c index f30e45f2..eda398f1 100644 --- a/epan/dissectors/packet-zbee-nwk.c +++ b/epan/dissectors/packet-zbee-nwk.c @@ -43,31 +43,31 @@ static void dissect_zbee_nwk_cmd (tvbuff_t *tvb, packet_info *pinfo, p static int dissect_zbee_beacon (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); static int dissect_zbip_beacon (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); static int dissect_zbee_ie (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); -static void dissect_ieee802154_zigbee_rejoin(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset); -static void dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset); +static void dissect_ieee802154_zigbee_rejoin(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned *offset); +static void dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned *offset); /* Command Dissector Helpers */ -static guint dissect_zbee_nwk_route_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); -static guint dissect_zbee_nwk_route_rep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version); -static guint dissect_zbee_nwk_status (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_leave (tvbuff_t *tvb, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_route_rec (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); -static guint dissect_zbee_nwk_rejoin_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); -static guint dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); -static guint dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_report (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_update (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_ed_timeout_request(tvbuff_t *tvb, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset); -static guint dissect_zbee_nwk_commissioning_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); -static guint dissect_zbee_nwk_commissioning_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - zbee_nwk_packet * packet, guint offset); +static unsigned dissect_zbee_nwk_route_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); +static unsigned dissect_zbee_nwk_route_rep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, uint8_t version); +static unsigned dissect_zbee_nwk_status (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_leave (tvbuff_t *tvb, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_route_rec (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); +static unsigned dissect_zbee_nwk_rejoin_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); +static unsigned dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); +static unsigned dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_report (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_update (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_ed_timeout_request(tvbuff_t *tvb, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset); +static unsigned dissect_zbee_nwk_commissioning_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); +static unsigned dissect_zbee_nwk_commissioning_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + zbee_nwk_packet * packet, unsigned offset); static void proto_init_zbee_nwk (void); static void proto_cleanup_zbee_nwk(void); void proto_register_zbee_nwk(void); @@ -76,149 +76,149 @@ void proto_reg_handoff_zbee_nwk(void); /********************/ /* Global Variables */ /********************/ -static int proto_zbee_nwk = -1; -static int proto_zbee_beacon = -1; -static int proto_zbip_beacon = -1; -static int proto_zbee_ie = -1; -static int hf_zbee_nwk_fcf = -1; -static int hf_zbee_nwk_frame_type = -1; -static int hf_zbee_nwk_proto_version = -1; -static int hf_zbee_nwk_discover_route = -1; -static int hf_zbee_nwk_multicast = -1; -static int hf_zbee_nwk_security = -1; -static int hf_zbee_nwk_source_route = -1; -static int hf_zbee_nwk_ext_dst = -1; -static int hf_zbee_nwk_ext_src = -1; -static int hf_zbee_nwk_end_device_initiator = -1; -static int hf_zbee_nwk_dst = -1; -static int hf_zbee_nwk_src = -1; -static int hf_zbee_nwk_addr = -1; -static int hf_zbee_nwk_radius = -1; -static int hf_zbee_nwk_seqno = -1; -static int hf_zbee_nwk_mcast = -1; -static int hf_zbee_nwk_mcast_mode = -1; -static int hf_zbee_nwk_mcast_radius = -1; -static int hf_zbee_nwk_mcast_max_radius = -1; -static int hf_zbee_nwk_dst64 = -1; -static int hf_zbee_nwk_src64 = -1; -static int hf_zbee_nwk_addr64 = -1; -static int hf_zbee_nwk_src64_origin = -1; -static int hf_zbee_nwk_relay_count = -1; -static int hf_zbee_nwk_relay_index = -1; -static int hf_zbee_nwk_relay = -1; - -static int hf_zbee_nwk_cmd_id = -1; -static int hf_zbee_nwk_cmd_addr = -1; -static int hf_zbee_nwk_cmd_route_id = -1; -static int hf_zbee_nwk_cmd_route_dest = -1; -static int hf_zbee_nwk_cmd_route_orig = -1; -static int hf_zbee_nwk_cmd_route_resp = -1; -static int hf_zbee_nwk_cmd_route_dest_ext = -1; -static int hf_zbee_nwk_cmd_route_orig_ext = -1; -static int hf_zbee_nwk_cmd_route_resp_ext = -1; -static int hf_zbee_nwk_cmd_route_cost = -1; -static int hf_zbee_nwk_cmd_route_options = -1; -static int hf_zbee_nwk_cmd_route_opt_repair = -1; -static int hf_zbee_nwk_cmd_route_opt_multicast = -1; -static int hf_zbee_nwk_cmd_route_opt_dest_ext = -1; -static int hf_zbee_nwk_cmd_route_opt_resp_ext = -1; -static int hf_zbee_nwk_cmd_route_opt_orig_ext = -1; -static int hf_zbee_nwk_cmd_route_opt_many_to_one = -1; -static int hf_zbee_nwk_cmd_nwk_status = -1; -static int hf_zbee_nwk_cmd_nwk_status_command_id = -1; -static int hf_zbee_nwk_cmd_leave_rejoin = -1; -static int hf_zbee_nwk_cmd_leave_request = -1; -static int hf_zbee_nwk_cmd_leave_children = -1; -static int hf_zbee_nwk_cmd_relay_count = -1; -static int hf_zbee_nwk_cmd_relay_device = -1; -static int hf_zbee_nwk_cmd_cinfo = -1; -static int hf_zbee_nwk_cmd_cinfo_alt_coord = -1; -static int hf_zbee_nwk_cmd_cinfo_type = -1; -static int hf_zbee_nwk_cmd_cinfo_power = -1; -static int hf_zbee_nwk_cmd_cinfo_idle_rx = -1; -static int hf_zbee_nwk_cmd_cinfo_security = -1; -static int hf_zbee_nwk_cmd_cinfo_alloc = -1; -static int hf_zbee_nwk_cmd_rejoin_status = -1; -static int hf_zbee_nwk_cmd_link_last = -1; -static int hf_zbee_nwk_cmd_link_first = -1; -static int hf_zbee_nwk_cmd_link_count = -1; -static int hf_zbee_nwk_cmd_link_address = -1; -static int hf_zbee_nwk_cmd_link_incoming_cost = -1; -static int hf_zbee_nwk_cmd_link_outgoing_cost = -1; -static int hf_zbee_nwk_cmd_report_type = -1; -static int hf_zbee_nwk_cmd_report_count = -1; -static int hf_zbee_nwk_cmd_update_type = -1; -static int hf_zbee_nwk_cmd_update_count = -1; -static int hf_zbee_nwk_cmd_update_id = -1; -static int hf_zbee_nwk_panid = -1; -static int hf_zbee_zboss_nwk_cmd_key = -1; -static int hf_zbee_nwk_cmd_epid = -1; -static int hf_zbee_nwk_cmd_end_device_timeout_request_enum = -1; -static int hf_zbee_nwk_cmd_end_device_configuration = -1; -static int hf_zbee_nwk_cmd_end_device_timeout_resp_status = -1; -static int hf_zbee_nwk_cmd_end_device_timeout_resp_parent_info = -1; -static int hf_zbee_nwk_cmd_prnt_info_mac_data_poll_keepalive_supported = -1; -static int hf_zbee_nwk_cmd_prnt_info_ed_to_req_keepalive_supported = -1; -static int hf_zbee_nwk_cmd_prnt_info_power_negotiation_supported = -1; -static int hf_zbee_nwk_cmd_link_pwr_list_count = -1; -static int hf_zbee_nwk_cmd_link_pwr_type = -1; -static int hf_zbee_nwk_cmd_link_pwr_device_address = -1; -static int hf_zbee_nwk_cmd_link_pwr_power_delta = -1; -static int hf_zbee_nwk_cmd_association_type = -1; +static int proto_zbee_nwk; +static int proto_zbee_beacon; +static int proto_zbip_beacon; +static int proto_zbee_ie; +static int hf_zbee_nwk_fcf; +static int hf_zbee_nwk_frame_type; +static int hf_zbee_nwk_proto_version; +static int hf_zbee_nwk_discover_route; +static int hf_zbee_nwk_multicast; +static int hf_zbee_nwk_security; +static int hf_zbee_nwk_source_route; +static int hf_zbee_nwk_ext_dst; +static int hf_zbee_nwk_ext_src; +static int hf_zbee_nwk_end_device_initiator; +static int hf_zbee_nwk_dst; +static int hf_zbee_nwk_src; +static int hf_zbee_nwk_addr; +static int hf_zbee_nwk_radius; +static int hf_zbee_nwk_seqno; +static int hf_zbee_nwk_mcast; +static int hf_zbee_nwk_mcast_mode; +static int hf_zbee_nwk_mcast_radius; +static int hf_zbee_nwk_mcast_max_radius; +static int hf_zbee_nwk_dst64; +static int hf_zbee_nwk_src64; +static int hf_zbee_nwk_addr64; +static int hf_zbee_nwk_src64_origin; +static int hf_zbee_nwk_relay_count; +static int hf_zbee_nwk_relay_index; +static int hf_zbee_nwk_relay; + +static int hf_zbee_nwk_cmd_id; +static int hf_zbee_nwk_cmd_addr; +static int hf_zbee_nwk_cmd_route_id; +static int hf_zbee_nwk_cmd_route_dest; +static int hf_zbee_nwk_cmd_route_orig; +static int hf_zbee_nwk_cmd_route_resp; +static int hf_zbee_nwk_cmd_route_dest_ext; +static int hf_zbee_nwk_cmd_route_orig_ext; +static int hf_zbee_nwk_cmd_route_resp_ext; +static int hf_zbee_nwk_cmd_route_cost; +static int hf_zbee_nwk_cmd_route_options; +static int hf_zbee_nwk_cmd_route_opt_repair; +static int hf_zbee_nwk_cmd_route_opt_multicast; +static int hf_zbee_nwk_cmd_route_opt_dest_ext; +static int hf_zbee_nwk_cmd_route_opt_resp_ext; +static int hf_zbee_nwk_cmd_route_opt_orig_ext; +static int hf_zbee_nwk_cmd_route_opt_many_to_one; +static int hf_zbee_nwk_cmd_nwk_status; +static int hf_zbee_nwk_cmd_nwk_status_command_id; +static int hf_zbee_nwk_cmd_leave_rejoin; +static int hf_zbee_nwk_cmd_leave_request; +static int hf_zbee_nwk_cmd_leave_children; +static int hf_zbee_nwk_cmd_relay_count; +static int hf_zbee_nwk_cmd_relay_device; +static int hf_zbee_nwk_cmd_cinfo; +static int hf_zbee_nwk_cmd_cinfo_alt_coord; +static int hf_zbee_nwk_cmd_cinfo_type; +static int hf_zbee_nwk_cmd_cinfo_power; +static int hf_zbee_nwk_cmd_cinfo_idle_rx; +static int hf_zbee_nwk_cmd_cinfo_security; +static int hf_zbee_nwk_cmd_cinfo_alloc; +static int hf_zbee_nwk_cmd_rejoin_status; +static int hf_zbee_nwk_cmd_link_last; +static int hf_zbee_nwk_cmd_link_first; +static int hf_zbee_nwk_cmd_link_count; +static int hf_zbee_nwk_cmd_link_address; +static int hf_zbee_nwk_cmd_link_incoming_cost; +static int hf_zbee_nwk_cmd_link_outgoing_cost; +static int hf_zbee_nwk_cmd_report_type; +static int hf_zbee_nwk_cmd_report_count; +static int hf_zbee_nwk_cmd_update_type; +static int hf_zbee_nwk_cmd_update_count; +static int hf_zbee_nwk_cmd_update_id; +static int hf_zbee_nwk_panid; +static int hf_zbee_zboss_nwk_cmd_key; +static int hf_zbee_nwk_cmd_epid; +static int hf_zbee_nwk_cmd_end_device_timeout_request_enum; +static int hf_zbee_nwk_cmd_end_device_configuration; +static int hf_zbee_nwk_cmd_end_device_timeout_resp_status; +static int hf_zbee_nwk_cmd_end_device_timeout_resp_parent_info; +static int hf_zbee_nwk_cmd_prnt_info_mac_data_poll_keepalive_supported; +static int hf_zbee_nwk_cmd_prnt_info_ed_to_req_keepalive_supported; +static int hf_zbee_nwk_cmd_prnt_info_power_negotiation_supported; +static int hf_zbee_nwk_cmd_link_pwr_list_count; +static int hf_zbee_nwk_cmd_link_pwr_type; +static int hf_zbee_nwk_cmd_link_pwr_device_address; +static int hf_zbee_nwk_cmd_link_pwr_power_delta; +static int hf_zbee_nwk_cmd_association_type; /* ZigBee Beacons */ -static int hf_zbee_beacon_protocol = -1; -static int hf_zbee_beacon_stack_profile = -1; -static int hf_zbee_beacon_version = -1; -static int hf_zbee_beacon_router_capacity = -1; -static int hf_zbee_beacon_depth = -1; -static int hf_zbee_beacon_end_device_capacity = -1; -static int hf_zbee_beacon_epid = -1; -static int hf_zbee_beacon_tx_offset = -1; -static int hf_zbee_beacon_update_id = -1; - -static int hf_zbip_beacon_allow_join = -1; -static int hf_zbip_beacon_router_capacity = -1; -static int hf_zbip_beacon_host_capacity = -1; -static int hf_zbip_beacon_unsecure = -1; -static int hf_zbip_beacon_network_id = -1; +static int hf_zbee_beacon_protocol; +static int hf_zbee_beacon_stack_profile; +static int hf_zbee_beacon_version; +static int hf_zbee_beacon_router_capacity; +static int hf_zbee_beacon_depth; +static int hf_zbee_beacon_end_device_capacity; +static int hf_zbee_beacon_epid; +static int hf_zbee_beacon_tx_offset; +static int hf_zbee_beacon_update_id; + +static int hf_zbip_beacon_allow_join; +static int hf_zbip_beacon_router_capacity; +static int hf_zbip_beacon_host_capacity; +static int hf_zbip_beacon_unsecure; +static int hf_zbip_beacon_network_id; /* IEEE 802.15.4 IEs (Information Elements) */ -static int hf_ieee802154_zigbee_ie = -1; -static int hf_ieee802154_zigbee_ie_id = -1; -static int hf_ieee802154_zigbee_ie_length = -1; -static int hf_ieee802154_zigbee_ie_tx_power = -1; -static int hf_ieee802154_zigbee_ie_source_addr = -1; - -static int hf_ieee802154_zigbee_rejoin_epid = -1; -static int hf_ieee802154_zigbee_rejoin_source_addr = -1; - -static gint ett_zbee_nwk = -1; -static gint ett_zbee_nwk_beacon = -1; -static gint ett_zbee_nwk_fcf = -1; -static gint ett_zbee_nwk_fcf_ext = -1; -static gint ett_zbee_nwk_mcast = -1; -static gint ett_zbee_nwk_route = -1; -static gint ett_zbee_nwk_cmd = -1; -static gint ett_zbee_nwk_cmd_options = -1; -static gint ett_zbee_nwk_cmd_cinfo = -1; -static gint ett_zbee_nwk_cmd_link = -1; -static gint ett_zbee_nwk_cmd_ed_to_rsp_prnt_info = -1; -static gint ett_zbee_nwk_cmd_link_pwr_struct = -1; -static gint ett_zbee_nwk_zigbee_ie_fields = -1; -static gint ett_zbee_nwk_ie_rejoin = -1; -static gint ett_zbee_nwk_header = -1; -static gint ett_zbee_nwk_header_ie = -1; -static gint ett_zbee_nwk_beacon_bitfield = -1; - -static expert_field ei_zbee_nwk_missing_payload = EI_INIT; +static int hf_ieee802154_zigbee_ie; +static int hf_ieee802154_zigbee_ie_id; +static int hf_ieee802154_zigbee_ie_length; +static int hf_ieee802154_zigbee_ie_tx_power; +static int hf_ieee802154_zigbee_ie_source_addr; + +static int hf_ieee802154_zigbee_rejoin_epid; +static int hf_ieee802154_zigbee_rejoin_source_addr; + +static int ett_zbee_nwk; +static int ett_zbee_nwk_beacon; +static int ett_zbee_nwk_fcf; +static int ett_zbee_nwk_fcf_ext; +static int ett_zbee_nwk_mcast; +static int ett_zbee_nwk_route; +static int ett_zbee_nwk_cmd; +static int ett_zbee_nwk_cmd_options; +static int ett_zbee_nwk_cmd_cinfo; +static int ett_zbee_nwk_cmd_link; +static int ett_zbee_nwk_cmd_ed_to_rsp_prnt_info; +static int ett_zbee_nwk_cmd_link_pwr_struct; +static int ett_zbee_nwk_zigbee_ie_fields; +static int ett_zbee_nwk_ie_rejoin; +static int ett_zbee_nwk_header; +static int ett_zbee_nwk_header_ie; +static int ett_zbee_nwk_beacon_bitfield; + +static expert_field ei_zbee_nwk_missing_payload; static dissector_handle_t aps_handle; static dissector_handle_t zbee_gp_handle; static int zbee_nwk_address_type = -1; -static int zbee_nwk_tap = -1; +static int zbee_nwk_tap; /********************/ /* Field Names */ @@ -376,13 +376,13 @@ static const value_string zbee_nwk_commissioning_types[] = { * Hash Tables and Lists *------------------------------------- */ -ieee802154_map_tab_t zbee_nwk_map = { NULL, NULL }; -GHashTable *zbee_table_nwk_keyring = NULL; -GHashTable *zbee_table_link_keyring = NULL; +ieee802154_map_tab_t zbee_nwk_map; +GHashTable *zbee_table_nwk_keyring; +GHashTable *zbee_table_link_keyring; -static int zbee_nwk_address_to_str(const address* addr, gchar *buf, int buf_len) +static int zbee_nwk_address_to_str(const address* addr, char *buf, int buf_len) { - guint16 zbee_nwk_addr = pletoh16(addr->data); + uint16_t zbee_nwk_addr = pletoh16(addr->data); if ((zbee_nwk_addr == ZBEE_BCAST_ALL) || (zbee_nwk_addr == ZBEE_BCAST_ACTIVE) || (zbee_nwk_addr == ZBEE_BCAST_ROUTERS)) { return (int)g_strlcpy(buf, "Broadcast", buf_len) + 1; @@ -399,15 +399,15 @@ static int zbee_nwk_address_str_len(const address* addr _U_) static int zbee_nwk_address_len(void) { - return sizeof(guint16); + return sizeof(uint16_t); } /** *Extracts an integer sub-field from an int with a given mask * */ -guint -zbee_get_bit_field(guint input, guint mask) +unsigned +zbee_get_bit_field(unsigned input, unsigned mask) { /* Sanity Check, don't want infinite loops. */ if (mask == 0) return 0; @@ -427,37 +427,37 @@ zbee_get_bit_field(guint input, guint mask) *@param tree pointer to data tree Wireshark uses to display packet. *@return Boolean value, whether it handles the packet or not. */ -static gboolean +static bool dissect_zbee_nwk_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { ieee802154_packet *packet = (ieee802154_packet *)data; - guint16 fcf; - guint ver; - guint type; + uint16_t fcf; + unsigned ver; + unsigned type; /* All ZigBee frames must always have a 16-bit source and destination address. */ - if (packet == NULL) return FALSE; + if (packet == NULL) return false; /* If the frame type and version are not sane, then it's probably not ZigBee. */ fcf = tvb_get_letohs(tvb, 0); ver = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_VERSION); type = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_FRAME_TYPE); - if ((ver < ZBEE_VERSION_2004) || (ver > ZBEE_VERSION_2007)) return FALSE; - if (!try_val_to_str(type, zbee_nwk_frame_types)) return FALSE; + if ((ver < ZBEE_VERSION_2004) || (ver > ZBEE_VERSION_2007)) return false; + if (!try_val_to_str(type, zbee_nwk_frame_types)) return false; /* All interpan frames should originate from an extended address. */ if (type == ZBEE_NWK_FCF_INTERPAN) { - if (packet->src_addr_mode != IEEE802154_FCF_ADDR_EXT) return FALSE; + if (packet->src_addr_mode != IEEE802154_FCF_ADDR_EXT) return false; } /* All other ZigBee frames must have 16-bit source and destination addresses. */ else { - if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE; - if (packet->dst_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE; + if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return false; + if (packet->dst_addr_mode != IEEE802154_FCF_ADDR_SHORT) return false; } /* Assume it's ZigBee */ dissect_zbee_nwk(tvb, pinfo, tree, packet); - return TRUE; + return true; } /* dissect_zbee_heur */ /** @@ -481,17 +481,17 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void zbee_nwk_packet packet; ieee802154_packet *ieee_packet; - guint offset = 0; - gchar *src_addr, *dst_addr; + unsigned offset = 0; + char *src_addr, *dst_addr; - guint16 fcf; + uint16_t fcf; ieee802154_short_addr addr16; ieee802154_map_rec *map_rec; ieee802154_hints_t *ieee_hints; zbee_nwk_hints_t *nwk_hints; - gboolean unicast_src; + bool unicast_src; static int * const fcf_flags_2007[] = { &hf_zbee_nwk_frame_type, @@ -600,22 +600,22 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void || (packet.src == ZBEE_BCAST_ACTIVE) || (packet.src == ZBEE_BCAST_ROUTERS)){ /* Source Broadcast doesn't make much sense. */ - unicast_src = FALSE; + unicast_src = false; } else { - unicast_src = TRUE; + unicast_src = true; } proto_item_append_text(proto_root, ", Src: %s", src_addr); col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", src_addr); /* Get and display the radius. */ - packet.radius = tvb_get_guint8(tvb, offset); + packet.radius = tvb_get_uint8(tvb, offset); proto_tree_add_uint(nwk_tree, hf_zbee_nwk_radius, tvb, offset, 1, packet.radius); offset += 1; /* Get and display the sequence number. */ - packet.seqno = tvb_get_guint8(tvb, offset); + packet.seqno = tvb_get_uint8(tvb, offset); proto_tree_add_uint(nwk_tree, hf_zbee_nwk_seqno, tvb, offset, 1, packet.seqno); offset += 1; @@ -716,7 +716,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void NULL }; - guint8 mcast_control = tvb_get_guint8(tvb, offset); + uint8_t mcast_control = tvb_get_uint8(tvb, offset); packet.mcast_mode = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_MODE); packet.mcast_radius = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_RADIUS); packet.mcast_max_radius = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_MAX_RADIUS); @@ -728,15 +728,15 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* Add the Source Route field. (ZigBee 2006 and later). */ if ((packet.version >= ZBEE_VERSION_2007) && packet.route) { proto_tree *field_tree; - guint8 relay_count; - guint16 relay_addr; - guint i; + uint8_t relay_count; + uint16_t relay_addr; + unsigned i; /* Create a subtree for the source route field. */ field_tree = proto_tree_add_subtree(nwk_tree, tvb, offset, 1, ett_zbee_nwk_route, &ti, "Source Route"); /* Get and display the relay count. */ - relay_count = tvb_get_guint8(tvb, offset); + relay_count = tvb_get_uint8(tvb, offset); proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_count, tvb, offset, 1, relay_count); proto_item_append_text(ti, ", Length: %d", relay_count); offset += 1; @@ -808,10 +808,10 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void static int dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - guint8 fcf0; - guint8 proto_version; + uint8_t fcf0; + uint8_t proto_version; - fcf0 = tvb_get_guint8(tvb, 0); + fcf0 = tvb_get_uint8(tvb, 0); proto_version = (fcf0 & ZBEE_NWK_FCF_VERSION) >> 2; if (proto_version == ZBEE_VERSION_GREEN_POWER) { call_dissector(zbee_gp_handle, tvb, pinfo, tree); @@ -834,8 +834,8 @@ static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_tree *cmd_tree; proto_item *cmd_root; - guint offset=0; - guint8 cmd_id = tvb_get_guint8(tvb, offset); + unsigned offset=0; + uint8_t cmd_id = tvb_get_uint8(tvb, offset); /* Create a subtree for this command. */ cmd_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd, &cmd_root, "Command Frame: %s", @@ -958,11 +958,11 @@ static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree * *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset) +static unsigned +dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, unsigned offset) { - guint8 route_options; - guint16 dest_addr; + uint8_t route_options; + uint16_t dest_addr; static int * const nwk_route_command_options_2007[] = { &hf_zbee_nwk_cmd_route_opt_multicast, @@ -977,7 +977,7 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, }; /* Get and display the route options field. */ - route_options = tvb_get_guint8(tvb, offset); + route_options = tvb_get_uint8(tvb, offset); if (packet->version >= ZBEE_VERSION_2007) { proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options_2007, ENC_NA); } else { @@ -1007,7 +1007,7 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Update the info column. */ if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MANY_MASK) { col_clear(pinfo->cinfo, COL_INFO); - col_append_fstr(pinfo->cinfo, COL_INFO, "Many-to-One Route Request"); + col_append_str(pinfo->cinfo, COL_INFO, "Many-to-One Route Request"); } col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: 0x%04x, Src: 0x%04x", dest_addr, packet->src); @@ -1024,12 +1024,12 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version) +static unsigned +dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, uint8_t version) { - guint8 route_options; - guint16 orig_addr; - guint16 resp_addr; + uint8_t route_options; + uint16_t orig_addr; + uint16_t resp_addr; static int * const nwk_route_command_options_2007[] = { &hf_zbee_nwk_cmd_route_opt_multicast, @@ -1044,7 +1044,7 @@ dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, }; /* Get and display the route options field. */ - route_options = tvb_get_guint8(tvb, offset); + route_options = tvb_get_uint8(tvb, offset); if (version >= ZBEE_VERSION_2007) { proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options_2007, ENC_NA); } else { @@ -1098,15 +1098,15 @@ dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset) { - guint8 status_code; - guint8 command_id; - guint16 addr; + uint8_t status_code; + uint8_t command_id; + uint16_t addr; /* Get and display the status code. */ - status_code = tvb_get_guint8(tvb, offset); + status_code = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_nwk_status, tvb, offset, 1, status_code); offset += 1; @@ -1119,7 +1119,7 @@ dissect_zbee_nwk_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui col_append_fstr(pinfo->cinfo, COL_INFO, ", 0x%04x: %s", addr, val_to_str_const(status_code, zbee_nwk_status_codes, "Unknown Status Code")); if (status_code == ZBEE_NWK_STATUS_UNKNOWN_COMMAND) { - command_id = tvb_get_guint8(tvb, offset); + command_id = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_nwk_status_command_id, tvb, offset, 1, command_id); col_append_fstr(pinfo->cinfo, COL_INFO, ", Unknown Command ID 0x%02x (%s)", command_id, val_to_str_const(command_id, zbee_nwk_cmd_names, "Unknown ID")); @@ -1138,8 +1138,8 @@ dissect_zbee_nwk_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_leave(tvbuff_t *tvb, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_leave(tvbuff_t *tvb, proto_tree *tree, unsigned offset) { static int * const leave_options[] = { &hf_zbee_nwk_cmd_leave_rejoin, @@ -1166,15 +1166,15 @@ dissect_zbee_nwk_leave(tvbuff_t *tvb, proto_tree *tree, guint offset) *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_route_rec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset) +static unsigned +dissect_zbee_nwk_route_rec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, unsigned offset) { - guint8 relay_count; - guint16 relay_addr; - guint i; + uint8_t relay_count; + uint16_t relay_addr; + unsigned i; /* Get and display the relay count. */ - relay_count = tvb_get_guint8(tvb, offset); + relay_count = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_relay_count, tvb, offset, 1, relay_count); offset += 1; @@ -1204,8 +1204,8 @@ dissect_zbee_nwk_route_rec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_rejoin_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset) +static unsigned +dissect_zbee_nwk_rejoin_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, unsigned offset) { static int * const capabilities[] = { &hf_zbee_nwk_cmd_cinfo_alt_coord, @@ -1237,19 +1237,19 @@ dissect_zbee_nwk_rejoin_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet _U_, guint offset) +static unsigned +dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet _U_, unsigned offset) { - guint8 status; - guint16 new_address; + uint8_t status; + uint16_t new_address; /* Get and display the short address. */ - new_address = tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN); + new_address = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_zbee_nwk_cmd_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* Get and display the rejoin status. */ - status = tvb_get_guint8(tvb, offset); + status = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_rejoin_status, tvb, offset, 1, status); offset += 1; @@ -1273,10 +1273,10 @@ dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, unsigned offset) { - guint8 options; + uint8_t options; int i, link_count; proto_tree *subtree; static int * const link_options[] = { @@ -1287,7 +1287,7 @@ dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset) }; /* Get and Display the link status options. */ - options = tvb_get_guint8(tvb, offset); + options = tvb_get_uint8(tvb, offset); link_count = options & ZBEE_NWK_CMD_LINK_OPTION_COUNT_MASK; proto_tree_add_bitmask_list(tree, tvb, offset, 1, link_options, ENC_NA); offset += 1; @@ -1314,8 +1314,8 @@ dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset) *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_ed_timeout_request(tvbuff_t *tvb, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_ed_timeout_request(tvbuff_t *tvb, proto_tree *tree, unsigned offset) { /* See 3.4.11 End Device Timeout Request Command */ @@ -1338,8 +1338,8 @@ dissect_zbee_nwk_ed_timeout_request(tvbuff_t *tvb, proto_tree *tree, guint offse *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset) { static int * const end_device_parent_info[] = { &hf_zbee_nwk_cmd_prnt_info_mac_data_poll_keepalive_supported, @@ -1347,7 +1347,7 @@ dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tr &hf_zbee_nwk_cmd_prnt_info_power_negotiation_supported, NULL }; - guint status = tvb_get_guint8(tvb, offset); + unsigned status = tvb_get_uint8(tvb, offset); /* 3.4.12 End Device Timeout Response Command */ /* status */ @@ -1372,21 +1372,21 @@ dissect_zbee_nwk_ed_timeout_response(tvbuff_t *tvb, packet_info *pinfo, proto_tr *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset) { int i; int count; - gint delta; - guint8 type; - guint16 addr; + int delta; + uint8_t type; + uint16_t addr; proto_tree *subtree; - type = tvb_get_guint8(tvb, offset) & ZBEE_NWK_CMD_NWK_LINK_PWR_DELTA_TYPE_MASK; + type = tvb_get_uint8(tvb, offset) & ZBEE_NWK_CMD_NWK_LINK_PWR_DELTA_TYPE_MASK; proto_tree_add_item(tree, hf_zbee_nwk_cmd_link_pwr_type, tvb, offset, 1, ENC_NA); offset++; - count = tvb_get_guint8(tvb, offset); + count = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_zbee_nwk_cmd_link_pwr_list_count, tvb, offset, 1, ENC_NA); offset++; @@ -1394,10 +1394,10 @@ dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre for (i=0; i<count; i++) { subtree = proto_tree_add_subtree(tree, tvb, count, 3, ett_zbee_nwk_cmd_link_pwr_struct, NULL, "Power Delta Structure"); - addr = tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN); + addr = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); proto_tree_add_item(subtree, hf_zbee_nwk_cmd_link_pwr_device_address, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - delta = (char)tvb_get_guint8(tvb, offset); + delta = (char)tvb_get_uint8(tvb, offset); proto_tree_add_item(subtree, hf_zbee_nwk_cmd_link_pwr_power_delta, tvb, offset, 1, ENC_NA); offset++; proto_item_append_text(subtree, ": Device Address 0x%04X, Power Delta %d dBm", addr, delta); @@ -1413,8 +1413,8 @@ dissect_zbee_nwk_link_pwr_delta(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_commissioning_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset) +static unsigned +dissect_zbee_nwk_commissioning_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, unsigned offset) { /* See 3.4.14 Network Commissioning Request Command */ @@ -1449,19 +1449,19 @@ dissect_zbee_nwk_commissioning_request(tvbuff_t *tvb, packet_info *pinfo, proto_ *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_commissioning_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet _U_, guint offset) +static unsigned +dissect_zbee_nwk_commissioning_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet _U_, unsigned offset) { - guint8 status; - guint16 new_address; + uint8_t status; + uint16_t new_address; /* Get and display the short address. */ - new_address = tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN); + new_address = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_zbee_nwk_cmd_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* Get and display the rejoin status. */ - status = tvb_get_guint8(tvb, offset); + status = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_rejoin_status, tvb, offset, 1, status); offset += 1; @@ -1485,16 +1485,16 @@ dissect_zbee_nwk_commissioning_response(tvbuff_t *tvb, packet_info *pinfo, proto *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset) { - guint8 options; - guint8 report_type; + uint8_t options; + uint8_t report_type; int report_count; int i; /* Get and display the command options field. */ - options = tvb_get_guint8(tvb, offset); + options = tvb_get_uint8(tvb, offset); report_count = options & ZBEE_NWK_CMD_NWK_REPORT_COUNT_MASK; report_type = options & ZBEE_NWK_CMD_NWK_REPORT_ID_MASK; proto_tree_add_uint(tree, hf_zbee_nwk_cmd_report_type, tvb, offset, 1, report_type); @@ -1515,10 +1515,10 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui } /* for */ } if (report_type == ZBEE_NWK_CMD_NWK_REPORT_ID_ZBOSS_KEY_TRACE) { - guint8 key[ZBEE_APS_CMD_KEY_LENGTH]; + uint8_t key[ZBEE_APS_CMD_KEY_LENGTH]; for (i=0; i<ZBEE_APS_CMD_KEY_LENGTH ; i++) { - key[i] = tvb_get_guint8(tvb, offset+i); + key[i] = tvb_get_uint8(tvb, offset+i); } /* for */ proto_tree_add_item(tree, hf_zbee_zboss_nwk_cmd_key, tvb, offset, ZBEE_APS_CMD_KEY_LENGTH, ENC_NA); offset += ZBEE_APS_CMD_KEY_LENGTH; @@ -1541,17 +1541,17 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui *@param offset into the tvb to begin dissection. *@return offset after command dissection. */ -static guint -dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) +static unsigned +dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset) { - guint8 options; - guint8 update_type; - guint8 update_id; + uint8_t options; + uint8_t update_type; + uint8_t update_id; int update_count; int i; /* Get and display the command options field. */ - options = tvb_get_guint8(tvb, offset); + options = tvb_get_uint8(tvb, offset); update_count = options & ZBEE_NWK_CMD_NWK_UPDATE_COUNT_MASK; update_type = options & ZBEE_NWK_CMD_NWK_UPDATE_ID_MASK; proto_tree_add_uint(tree, hf_zbee_nwk_cmd_update_type, tvb, offset, 1, update_type); @@ -1563,7 +1563,7 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui offset += 8; /* Get and display the updateID. */ - update_id = tvb_get_guint8(tvb, offset); + update_id = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_update_id, tvb, offset, 1, update_id); offset += 1; @@ -1592,20 +1592,20 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui *@param tree pointer to data tree Wireshark uses to display packet. *@return Boolean value, whether it handles the packet or not. */ -static gboolean +static bool dissect_zbee_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { ieee802154_packet *packet = (ieee802154_packet *)data; /* All ZigBee frames must always have a 16-bit source address. */ - if (!packet) return FALSE; - if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE; - if (tvb_captured_length(tvb) == 0) return FALSE; + if (!packet) return false; + if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return false; + if (tvb_captured_length(tvb) == 0) return false; /* ZigBee beacons begin with a protocol identifier. */ - if (tvb_get_guint8(tvb, 0) != ZBEE_NWK_BEACON_PROTOCOL_ID) return FALSE; + if (tvb_get_uint8(tvb, 0) != ZBEE_NWK_BEACON_PROTOCOL_ID) return false; dissect_zbee_beacon(tvb, pinfo, tree, packet); - return TRUE; + return true; } /* dissect_zbee_beacon_heur */ /** @@ -1620,9 +1620,9 @@ static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr proto_item *beacon_root; proto_tree *beacon_tree; - guint offset = 0; - guint8 version; - guint32 profile; + unsigned offset = 0; + uint8_t version; + uint32_t profile; static int * const beacon_fields[] = { &hf_zbee_beacon_stack_profile, @@ -1647,8 +1647,8 @@ static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr ENC_LITTLE_ENDIAN, BMT_NO_INT|BMT_NO_TFS); /* Get and display the stack profile and protocol version. */ - version = (guint8)((tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) & ZBEE_NWK_BEACON_PROTOCOL_VERSION) >> 4); - profile = (guint32)(tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) & ZBEE_NWK_BEACON_STACK_PROFILE); + version = (uint8_t)((tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN) & ZBEE_NWK_BEACON_PROTOCOL_VERSION) >> 4); + profile = (uint32_t)(tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN) & ZBEE_NWK_BEACON_STACK_PROFILE); proto_item_append_text(beacon_root, ", %s", val_to_str_const(profile, zbee_nwk_stack_profiles, "Unknown Profile")); offset += 2; @@ -1656,9 +1656,9 @@ static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* In ZigBee 2006 and later, the beacon contains an extended PAN ID. */ proto_tree_add_item(beacon_tree, hf_zbee_beacon_epid, tvb, offset, 8, ENC_LITTLE_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, ", EPID: %s", eui64_to_display(pinfo->pool, - tvb_get_guint64(tvb, offset, ENC_LITTLE_ENDIAN))); + tvb_get_uint64(tvb, offset, ENC_LITTLE_ENDIAN))); proto_item_append_text(beacon_root, ", EPID: %s", eui64_to_display(pinfo->pool, - tvb_get_guint64(tvb, offset, ENC_LITTLE_ENDIAN))); + tvb_get_uint64(tvb, offset, ENC_LITTLE_ENDIAN))); offset += 8; /* @@ -1698,20 +1698,20 @@ static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr *@param tree pointer to data tree Wireshark uses to display packet. *@return Boolean value, whether it handles the packet or not. */ -static gboolean +static bool dissect_zbip_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { ieee802154_packet *packet = (ieee802154_packet *)data; /* All ZigBee frames must always have a 16-bit source address. */ - if (!packet) return FALSE; - if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE; - if (tvb_captured_length(tvb) == 0) return FALSE; + if (!packet) return false; + if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return false; + if (tvb_captured_length(tvb) == 0) return false; /* ZigBee beacons begin with a protocol identifier. */ - if (tvb_get_guint8(tvb, 0) != ZBEE_IP_BEACON_PROTOCOL_ID) return FALSE; + if (tvb_get_uint8(tvb, 0) != ZBEE_IP_BEACON_PROTOCOL_ID) return false; dissect_zbip_beacon(tvb, pinfo, tree, packet); - return TRUE; + return true; } /* dissect_zbip_beacon_heur */ /** @@ -1727,8 +1727,8 @@ static int dissect_zbip_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr proto_item *beacon_root; proto_tree *beacon_tree; - guint offset = 0; - guint8 proto_id; + unsigned offset = 0; + uint8_t proto_id; char *ssid; /* Reject the packet if data is NULL */ @@ -1745,7 +1745,7 @@ static int dissect_zbip_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr col_append_fstr(pinfo->cinfo, COL_INFO, "Beacon, Src: 0x%04x", packet->src16); /* Get and display the protocol id, must be 0x02 on all ZigBee beacons. */ - proto_id = tvb_get_guint8(tvb, offset); + proto_id = tvb_get_uint8(tvb, offset); proto_tree_add_uint(beacon_tree, hf_zbee_beacon_protocol, tvb, offset, 1, proto_id); offset += 1; @@ -1794,11 +1794,11 @@ dissect_zbee_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { proto_tree *subtree; tvbuff_t *ie_tvb; - guint16 zigbee_ie; - guint16 id; - guint16 length; - guint pie_length; - guint offset = 0; + uint16_t zigbee_ie; + uint16_t id; + uint16_t length; + unsigned pie_length; + unsigned offset = 0; static int * const fields[] = { &hf_ieee802154_zigbee_ie_id, @@ -1806,7 +1806,7 @@ dissect_zbee_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) NULL }; - pie_length = *(gint *)data; + pie_length = *(int *)data; do { zigbee_ie = tvb_get_letohs(tvb, offset); @@ -1859,11 +1859,11 @@ dissect_zbee_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) *@param offset offset into the tvbuff to begin dissection. */ static void -dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned *offset) { - gint32 txpower; + int32_t txpower; - txpower = (char)tvb_get_guint8(tvb, *offset); /* tx power is a signed byte */ + txpower = (char)tvb_get_uint8(tvb, *offset); /* tx power is a signed byte */ proto_tree_add_item_ret_int(tree, hf_ieee802154_zigbee_ie_tx_power, tvb, *offset, 1, ENC_NA, &txpower); proto_item_append_text(tree, ", TX Power %d dBm", txpower); @@ -1880,7 +1880,7 @@ dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t *@param offset offset into the tvbuff to begin dissection. */ static void -dissect_ieee802154_zigbee_rejoin(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +dissect_ieee802154_zigbee_rejoin(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned *offset) { proto_tree *subtree; @@ -1888,12 +1888,12 @@ dissect_ieee802154_zigbee_rejoin(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr proto_tree_add_item(subtree, hf_ieee802154_zigbee_rejoin_epid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); proto_item_append_text(tree, ", EPID %s", eui64_to_display(pinfo->pool, - tvb_get_guint64(tvb, *offset, ENC_LITTLE_ENDIAN))); + tvb_get_uint64(tvb, *offset, ENC_LITTLE_ENDIAN))); *offset += 8; proto_tree_add_item(subtree, hf_ieee802154_zigbee_rejoin_source_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); proto_item_append_text(tree, ", Src: 0x%04x", - tvb_get_guint16(tvb, *offset, ENC_LITTLE_ENDIAN)); + tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN)); *offset += 2; } /* dissect_ieee802154_zigbee_rejoin */ @@ -1948,20 +1948,20 @@ static tap_packet_status zbee_nwk_endpoint_packet(void *pit, packet_info *pinfo, /* Take two "add" passes per packet, adding for each direction, ensures that all packets are counted properly (even if address is sending to itself) XXX - this could probably be done more efficiently inside endpoint_table */ - add_endpoint_table_data(hash, &pinfo->net_src, 0, TRUE, 1, + add_endpoint_table_data(hash, &pinfo->net_src, 0, true, 1, pinfo->fd->pkt_len, &zbee_nwk_endpoint_dissector_info, ENDPOINT_NONE); - add_endpoint_table_data(hash, &pinfo->net_dst, 0, FALSE, 1, + add_endpoint_table_data(hash, &pinfo->net_dst, 0, false, 1, pinfo->fd->pkt_len, &zbee_nwk_endpoint_dissector_info, ENDPOINT_NONE); return TAP_PACKET_REDRAW; } -static gboolean zbee_nwk_filter_valid(packet_info *pinfo, void *user_data _U_) +static bool zbee_nwk_filter_valid(packet_info *pinfo, void *user_data _U_) { return proto_is_frame_protocol(pinfo->layers, "zbee_nwk"); } -static gchar* zbee_nwk_build_filter(packet_info *pinfo, void *user_data _U_) +static char* zbee_nwk_build_filter(packet_info *pinfo, void *user_data _U_) { return ws_strdup_printf("zbee_nwk.addr eq %s and zbee_nwk.addr eq %s", address_to_str(pinfo->pool, &pinfo->net_src), @@ -2413,7 +2413,7 @@ void proto_register_zbee_nwk(void) }; /* NWK Layer subtrees */ - static gint *ett[] = { + static int *ett[] = { &ett_zbee_nwk, &ett_zbee_nwk_beacon, &ett_zbee_nwk_fcf, @@ -2467,7 +2467,7 @@ void proto_register_zbee_nwk(void) zbee_nwk_tap = register_tap(ZBEE_PROTOABBREV_NWK); - register_conversation_table(proto_zbee_nwk, TRUE, zbee_nwk_conversation_packet, zbee_nwk_endpoint_packet); + register_conversation_table(proto_zbee_nwk, true, zbee_nwk_conversation_packet, zbee_nwk_endpoint_packet); register_conversation_filter(ZBEE_PROTOABBREV_NWK, "ZigBee Network Layer", zbee_nwk_filter_valid, zbee_nwk_build_filter, NULL); } /* proto_register_zbee_nwk */ @@ -2488,12 +2488,12 @@ void proto_reg_handoff_zbee_nwk(void) heur_dissector_add(IEEE802154_PROTOABBREV_WPAN, dissect_zbee_nwk_heur, "ZigBee Network Layer over IEEE 802.15.4", "zbee_nwk_wpan", proto_zbee_nwk, HEURISTIC_ENABLE); } /* proto_reg_handoff_zbee */ -static void free_keyring_key(gpointer key) +static void free_keyring_key(void *key) { g_free(key); } -static void free_keyring_val(gpointer a) +static void free_keyring_val(void *a) { GSList **slist = (GSList **)a; g_slist_free_full(*slist, g_free); |