diff options
Diffstat (limited to 'epan/dissectors/packet-iso14443.c')
-rw-r--r-- | epan/dissectors/packet-iso14443.c | 468 |
1 files changed, 234 insertions, 234 deletions
diff --git a/epan/dissectors/packet-iso14443.c b/epan/dissectors/packet-iso14443.c index 32108849..031150c5 100644 --- a/epan/dissectors/packet-iso14443.c +++ b/epan/dissectors/packet-iso14443.c @@ -80,11 +80,11 @@ typedef enum _iso14443_cmd_t { CMD_TYPE_UNKNOWN } iso14443_cmd_t; -static wmem_tree_t *transactions = NULL; +static wmem_tree_t *transactions; typedef struct _iso14443_transaction_t { - guint32 rqst_frame; - guint32 resp_frame; + uint32_t rqst_frame; + uint32_t resp_frame; iso14443_cmd_t cmd; } iso14443_transaction_t; @@ -118,7 +118,7 @@ static const value_string iso14443_bitrates[] = { code_to_len[x] is the length encoded by x this conversion is used for type A's FSCI and FSDI and for type B's maximum frame size */ -static const guint16 code_to_len[] = { +static const uint16_t code_to_len[] = { 16, 24, 32, 40, 48, 64, 96, 128, 256, 512, 1024, 2048, 4096 }; #define LEN_CODE_MAX array_length(code_to_len) @@ -166,7 +166,7 @@ static const true_false_string tfs_nak_ack = { "NAK", "ACK" }; void proto_register_iso14443(void); void proto_reg_handoff_iso14443(void); -static int proto_iso14443 = -1; +static int proto_iso14443; static dissector_handle_t iso14443_handle; @@ -174,133 +174,133 @@ static dissector_table_t iso14443_cmd_type_table; static dissector_table_t iso14443_subdissector_table; -static int ett_iso14443 = -1; -static int ett_iso14443_hdr = -1; -static int ett_iso14443_msg = -1; -static int ett_iso14443_app_data = -1; -static int ett_iso14443_prot_inf = -1; -static int ett_iso14443_bit_rate = -1; -static int ett_iso14443_prot_type = -1; -static int ett_iso14443_ats_t0 = -1; -static int ett_iso14443_ats_ta1 = -1; -static int ett_iso14443_ats_tb1 = -1; -static int ett_iso14443_ats_tc1 = -1; -static int ett_iso14443_attr_p1 = -1; -static int ett_iso14443_attr_p2 = -1; -static int ett_iso14443_attr_p3 = -1; -static int ett_iso14443_attr_p4 = -1; -static int ett_iso14443_pcb = -1; -static int ett_iso14443_inf = -1; -static int ett_iso14443_frag = -1; -static int ett_iso14443_frags = -1; - -static int hf_iso14443_hdr_ver = -1; -static int hf_iso14443_event = -1; -static int hf_iso14443_len_field = -1; -static int hf_iso14443_resp_to = -1; -static int hf_iso14443_resp_in = -1; -static int hf_iso14443_short_frame = -1; -static int hf_iso14443_atqa_rfu1 = -1; -static int hf_iso14443_atqa_rfu2 = -1; -static int hf_iso14443_propr_coding = -1; -static int hf_iso14443_uid_bits = -1; -static int hf_iso14443_uid_size = -1; -static int hf_iso14443_max_frame_size = -1; -static int hf_iso14443_bit_frame_anticoll = -1; -static int hf_iso14443_apf = -1; -static int hf_iso14443_afi = -1; -static int hf_iso14443_ext_atqb = -1; +static int ett_iso14443; +static int ett_iso14443_hdr; +static int ett_iso14443_msg; +static int ett_iso14443_app_data; +static int ett_iso14443_prot_inf; +static int ett_iso14443_bit_rate; +static int ett_iso14443_prot_type; +static int ett_iso14443_ats_t0; +static int ett_iso14443_ats_ta1; +static int ett_iso14443_ats_tb1; +static int ett_iso14443_ats_tc1; +static int ett_iso14443_attr_p1; +static int ett_iso14443_attr_p2; +static int ett_iso14443_attr_p3; +static int ett_iso14443_attr_p4; +static int ett_iso14443_pcb; +static int ett_iso14443_inf; +static int ett_iso14443_frag; +static int ett_iso14443_frags; + +static int hf_iso14443_hdr_ver; +static int hf_iso14443_event; +static int hf_iso14443_len_field; +static int hf_iso14443_resp_to; +static int hf_iso14443_resp_in; +static int hf_iso14443_short_frame; +static int hf_iso14443_atqa_rfu1; +static int hf_iso14443_atqa_rfu2; +static int hf_iso14443_propr_coding; +static int hf_iso14443_uid_bits; +static int hf_iso14443_uid_size; +static int hf_iso14443_max_frame_size; +static int hf_iso14443_bit_frame_anticoll; +static int hf_iso14443_apf; +static int hf_iso14443_afi; +static int hf_iso14443_ext_atqb; /* if this is present but unset, we have a REQB */ -static int hf_iso14443_wupb = -1; -static int hf_iso14443_n = -1; -static int hf_iso14443_atqb_start = -1; -static int hf_iso14443_app_data = -1; -static int hf_iso14443_num_afi_apps = -1; -static int hf_iso14443_total_num_apps = -1; -static int hf_iso14443_prot_inf = -1; -static int hf_iso14443_bit_rate_cap = -1; -static int hf_iso14443_same_bit_rate = -1; -static int hf_iso14443_picc_pcd_847 = -1; -static int hf_iso14443_picc_pcd_424 = -1; -static int hf_iso14443_picc_pcd_212 = -1; -static int hf_iso14443_pcd_picc_847 = -1; -static int hf_iso14443_pcd_picc_424 = -1; -static int hf_iso14443_pcd_picc_212 = -1; -static int hf_iso14443_max_frame_size_code = -1; -static int hf_iso14443_prot_type = -1; -static int hf_iso14443_min_tr2 = -1; -static int hf_iso14443_4_compl_atqb = -1; -static int hf_iso14443_fwi = -1; -static int hf_iso14443_sfgi = -1; -static int hf_iso14443_adc = -1; -static int hf_iso14443_nad_supported = -1; -static int hf_iso14443_cid_supported = -1; -static int hf_iso14443_hlta = -1; -static int hf_iso14443_sel = -1; -static int hf_iso14443_nvb = -1; -static int hf_iso14443_4_compl_sak = -1; -static int hf_iso14443_uid_complete = -1; -static int hf_iso14443_ct = -1; -static int hf_iso14443_uid_cln = -1; -static int hf_iso14443_bcc = -1; -static int hf_iso14443_rats_start = -1; -static int hf_iso14443_fsdi = -1; -static int hf_iso14443_fsd = -1; -static int hf_iso14443_cid = -1; -static int hf_iso14443_tl = -1; -static int hf_iso14443_t0 = -1; -static int hf_iso14443_tc1_transmitted = -1; -static int hf_iso14443_tb1_transmitted = -1; -static int hf_iso14443_ta1_transmitted = -1; -static int hf_iso14443_fsci = -1; -static int hf_iso14443_fsc = -1; -static int hf_iso14443_tc1 = -1; -static int hf_iso14443_tb1 = -1; -static int hf_iso14443_ta1 = -1; -static int hf_iso14443_same_d = -1; -static int hf_iso14443_ds8 = -1; -static int hf_iso14443_ds4 = -1; -static int hf_iso14443_ds2 = -1; -static int hf_iso14443_dr8 = -1; -static int hf_iso14443_dr4 = -1; -static int hf_iso14443_dr2 = -1; -static int hf_iso14443_hist_bytes = -1; -static int hf_iso14443_attrib_start = -1; -static int hf_iso14443_pupi = -1; -static int hf_iso14443_param1 = -1; -static int hf_iso14443_min_tr0 = -1; -static int hf_iso14443_min_tr1 = -1; -static int hf_iso14443_eof = -1; -static int hf_iso14443_sof = -1; -static int hf_iso14443_param2 = -1; -static int hf_iso14443_bitrate_picc_pcd = -1; -static int hf_iso14443_bitrate_pcd_picc = -1; -static int hf_iso14443_param3 = -1; -static int hf_iso14443_param4 = -1; -static int hf_iso14443_mbli = -1; -static int hf_iso14443_pcb = -1; -static int hf_iso14443_block_type = -1; -static int hf_iso14443_i_blk_chaining = -1; -static int hf_iso14443_cid_following = -1; -static int hf_iso14443_nad_following = -1; -static int hf_iso14443_nak = -1; -static int hf_iso14443_blk_num = -1; -static int hf_iso14443_s_blk_cmd = -1; -static int hf_iso14443_pwr_lvl_ind = -1; -static int hf_iso14443_wtxm = -1; -static int hf_iso14443_inf = -1; -static int hf_iso14443_frags = -1; -static int hf_iso14443_frag = -1; -static int hf_iso14443_frag_overlap = -1; -static int hf_iso14443_frag_overlap_conflicts = -1; -static int hf_iso14443_frag_multiple_tails = -1; -static int hf_iso14443_frag_too_long_frag = -1; -static int hf_iso14443_frag_err = -1; -static int hf_iso14443_frag_cnt = -1; -static int hf_iso14443_reass_in = -1; -static int hf_iso14443_reass_len = -1; -static int hf_iso14443_crc = -1; -static int hf_iso14443_crc_status = -1; +static int hf_iso14443_wupb; +static int hf_iso14443_n; +static int hf_iso14443_atqb_start; +static int hf_iso14443_app_data; +static int hf_iso14443_num_afi_apps; +static int hf_iso14443_total_num_apps; +static int hf_iso14443_prot_inf; +static int hf_iso14443_bit_rate_cap; +static int hf_iso14443_same_bit_rate; +static int hf_iso14443_picc_pcd_847; +static int hf_iso14443_picc_pcd_424; +static int hf_iso14443_picc_pcd_212; +static int hf_iso14443_pcd_picc_847; +static int hf_iso14443_pcd_picc_424; +static int hf_iso14443_pcd_picc_212; +static int hf_iso14443_max_frame_size_code; +static int hf_iso14443_prot_type; +static int hf_iso14443_min_tr2; +static int hf_iso14443_4_compl_atqb; +static int hf_iso14443_fwi; +static int hf_iso14443_sfgi; +static int hf_iso14443_adc; +static int hf_iso14443_nad_supported; +static int hf_iso14443_cid_supported; +static int hf_iso14443_hlta; +static int hf_iso14443_sel; +static int hf_iso14443_nvb; +static int hf_iso14443_4_compl_sak; +static int hf_iso14443_uid_complete; +static int hf_iso14443_ct; +static int hf_iso14443_uid_cln; +static int hf_iso14443_bcc; +static int hf_iso14443_rats_start; +static int hf_iso14443_fsdi; +static int hf_iso14443_fsd; +static int hf_iso14443_cid; +static int hf_iso14443_tl; +static int hf_iso14443_t0; +static int hf_iso14443_tc1_transmitted; +static int hf_iso14443_tb1_transmitted; +static int hf_iso14443_ta1_transmitted; +static int hf_iso14443_fsci; +static int hf_iso14443_fsc; +static int hf_iso14443_tc1; +static int hf_iso14443_tb1; +static int hf_iso14443_ta1; +static int hf_iso14443_same_d; +static int hf_iso14443_ds8; +static int hf_iso14443_ds4; +static int hf_iso14443_ds2; +static int hf_iso14443_dr8; +static int hf_iso14443_dr4; +static int hf_iso14443_dr2; +static int hf_iso14443_hist_bytes; +static int hf_iso14443_attrib_start; +static int hf_iso14443_pupi; +static int hf_iso14443_param1; +static int hf_iso14443_min_tr0; +static int hf_iso14443_min_tr1; +static int hf_iso14443_eof; +static int hf_iso14443_sof; +static int hf_iso14443_param2; +static int hf_iso14443_bitrate_picc_pcd; +static int hf_iso14443_bitrate_pcd_picc; +static int hf_iso14443_param3; +static int hf_iso14443_param4; +static int hf_iso14443_mbli; +static int hf_iso14443_pcb; +static int hf_iso14443_block_type; +static int hf_iso14443_i_blk_chaining; +static int hf_iso14443_cid_following; +static int hf_iso14443_nad_following; +static int hf_iso14443_nak; +static int hf_iso14443_blk_num; +static int hf_iso14443_s_blk_cmd; +static int hf_iso14443_pwr_lvl_ind; +static int hf_iso14443_wtxm; +static int hf_iso14443_inf; +static int hf_iso14443_frags; +static int hf_iso14443_frag; +static int hf_iso14443_frag_overlap; +static int hf_iso14443_frag_overlap_conflicts; +static int hf_iso14443_frag_multiple_tails; +static int hf_iso14443_frag_too_long_frag; +static int hf_iso14443_frag_err; +static int hf_iso14443_frag_cnt; +static int hf_iso14443_reass_in; +static int hf_iso14443_reass_len; +static int hf_iso14443_crc; +static int hf_iso14443_crc_status; static int * const bit_rate_fields[] = { &hf_iso14443_same_bit_rate, @@ -324,9 +324,9 @@ static int * const ats_ta1_fields[] = { NULL }; -static expert_field ei_iso14443_unknown_cmd = EI_INIT; -static expert_field ei_iso14443_wrong_crc = EI_INIT; -static expert_field ei_iso14443_uid_inval_size = EI_INIT; +static expert_field ei_iso14443_unknown_cmd; +static expert_field ei_iso14443_wrong_crc; +static expert_field ei_iso14443_uid_inval_size; static reassembly_table i_block_reassembly_table; @@ -355,13 +355,13 @@ dissect_iso14443_cmd_type_wupa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; - guint8 uid_bits, uid_size = 0; + int offset = 0; + uint8_t uid_bits, uid_size = 0; if (pinfo->p2p_dir == P2P_DIR_SENT) { - const gchar *sf_str; + const char *sf_str; sf_str = try_val_to_str( - tvb_get_guint8(tvb, 0), iso14443_short_frame); + tvb_get_uint8(tvb, 0), iso14443_short_frame); proto_tree_add_item(tree, hf_iso14443_short_frame, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -371,7 +371,7 @@ dissect_iso14443_cmd_type_wupa(tvbuff_t *tvb, packet_info *pinfo, } } else if (pinfo->p2p_dir == P2P_DIR_RECV) { - guint16 atqa; + uint16_t atqa; proto_item *pi_uid; atqa = tvb_get_letohs(tvb, offset); @@ -415,18 +415,18 @@ dissect_iso14443_cmd_type_wupa(tvbuff_t *tvb, packet_info *pinfo, } -static int dissect_iso14443_atqb(tvbuff_t *tvb, gint offset, - packet_info *pinfo, proto_tree *tree, gboolean crc_dropped) +static int dissect_iso14443_atqb(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, bool crc_dropped) { proto_item *ti = proto_tree_get_parent(tree); proto_item *app_data_it, *prot_inf_it, *prot_type_it; proto_tree *app_data_tree, *prot_inf_tree, *prot_type_tree; - gint app_data_offset, rem_len; - gboolean nad_supported, cid_supported; - guint8 max_frame_size_code, fwi; + int app_data_offset, rem_len; + bool nad_supported, cid_supported; + uint8_t max_frame_size_code, fwi; proto_item *pi; - gboolean iso14443_adc; - guint8 prot_inf_len = 0; + bool iso14443_adc; + uint8_t prot_inf_len = 0; col_set_str(pinfo->cinfo, COL_INFO, "ATQB"); proto_item_append_text(ti, ": ATQB"); @@ -460,13 +460,13 @@ static int dissect_iso14443_atqb(tvbuff_t *tvb, gint offset, prot_inf_tree = proto_item_add_subtree( prot_inf_it, ett_iso14443_prot_inf); /* bit rate info are applicable only if b4 is 0 */ - if (!(tvb_get_guint8(tvb, offset) & 0x08)) { + if (!(tvb_get_uint8(tvb, offset) & 0x08)) { proto_tree_add_bitmask_with_flags(prot_inf_tree, tvb, offset, hf_iso14443_bit_rate_cap, ett_iso14443_bit_rate, bit_rate_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND); } offset++; - max_frame_size_code = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4; + max_frame_size_code = (tvb_get_uint8(tvb, offset) & 0xF0) >> 4; proto_tree_add_uint_bits_format_value(prot_inf_tree, hf_iso14443_max_frame_size_code, tvb, offset*8, 4, max_frame_size_code, ENC_BIG_ENDIAN, "%d", @@ -485,10 +485,10 @@ static int dissect_iso14443_atqb(tvbuff_t *tvb, gint offset, proto_tree_add_item(prot_type_tree, hf_iso14443_4_compl_atqb, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - fwi = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4; + fwi = (tvb_get_uint8(tvb, offset) & 0xF0) >> 4; proto_tree_add_uint_bits_format_value(prot_inf_tree, hf_iso14443_fwi, tvb, offset*8, 4, fwi, ENC_BIG_ENDIAN, "%d", fwi); - iso14443_adc = tvb_get_guint8(tvb, offset) & 0x04; + iso14443_adc = tvb_get_uint8(tvb, offset) & 0x04; proto_tree_add_item(prot_inf_tree, hf_iso14443_adc, tvb, offset, 1, ENC_BIG_ENDIAN); if (iso14443_adc) { @@ -505,11 +505,11 @@ static int dissect_iso14443_atqb(tvbuff_t *tvb, gint offset, tvb, app_data_offset, 1, ENC_BIG_ENDIAN); } - nad_supported = tvb_get_guint8(tvb, offset) & 0x02; + nad_supported = tvb_get_uint8(tvb, offset) & 0x02; proto_tree_add_boolean_bits_format_value(prot_inf_tree, hf_iso14443_nad_supported, tvb, 8*offset+6, 1, nad_supported, ENC_BIG_ENDIAN, "%s", tfs_get_string(nad_supported, &tfs_supported_not_supported)); - cid_supported = tvb_get_guint8(tvb, offset) & 0x01; + cid_supported = tvb_get_uint8(tvb, offset) & 0x01; proto_tree_add_boolean_bits_format_value(prot_inf_tree, hf_iso14443_cid_supported, tvb, 8*offset+7, 1, cid_supported, ENC_BIG_ENDIAN, "%s", tfs_get_string(cid_supported, &tfs_supported_not_supported)); @@ -536,9 +536,9 @@ dissect_iso14443_cmd_type_wupb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { proto_item *ti = proto_tree_get_parent(tree); - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); - gint offset = 0; - guint8 param; + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); + int offset = 0; + uint8_t param; const char *msg_type; if (pinfo->p2p_dir == P2P_DIR_SENT) { @@ -549,7 +549,7 @@ dissect_iso14443_cmd_type_wupb(tvbuff_t *tvb, packet_info *pinfo, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - param = tvb_get_guint8(tvb, offset); + param = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_iso14443_ext_atqb, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_iso14443_wupb, @@ -558,8 +558,8 @@ dissect_iso14443_cmd_type_wupb(tvbuff_t *tvb, packet_info *pinfo, col_set_str(pinfo->cinfo, COL_INFO, msg_type); proto_item_append_text(ti, ": %s", msg_type); proto_tree_add_uint_bits_format_value(tree, hf_iso14443_n, - tvb, offset*8+5, 3, pow2(guint32, param&0x07), - ENC_BIG_ENDIAN, "%u", pow2(guint32, param&0x07)); + tvb, offset*8+5, 3, pow2(uint32_t, param&0x07), + ENC_BIG_ENDIAN, "%u", pow2(uint32_t, param&0x07)); offset++; if (!crc_dropped) { @@ -582,9 +582,9 @@ static int dissect_iso14443_cmd_type_hlta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; + int offset = 0; col_set_str(pinfo->cinfo, COL_INFO, "HLTA"); proto_item_append_text(ti, ": HLTA"); @@ -605,11 +605,11 @@ dissect_iso14443_cmd_type_hlta(tvbuff_t *tvb, packet_info *pinfo, static int dissect_iso14443_uid_part( - tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree) + tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - guint8 uid_len = 4; + uint8_t uid_len = 4; - if (tvb_get_guint8(tvb, offset) == CT_BYTE) { + if (tvb_get_uint8(tvb, offset) == CT_BYTE) { proto_tree_add_item(tree, hf_iso14443_ct, tvb, offset, 1, ENC_NA); offset++; uid_len = 3; @@ -628,9 +628,9 @@ static int dissect_iso14443_cmd_type_uid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; + int offset = 0; if (pinfo->p2p_dir == P2P_DIR_SENT) { proto_tree_add_item(tree, hf_iso14443_sel, @@ -684,31 +684,31 @@ dissect_iso14443_cmd_type_uid(tvbuff_t *tvb, packet_info *pinfo, } -static int dissect_iso14443_ats(tvbuff_t *tvb, gint offset, - packet_info *pinfo, proto_tree *tree, gboolean crc_dropped) +static int dissect_iso14443_ats(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, bool crc_dropped) { proto_item *ti = proto_tree_get_parent(tree); conversation_t *conv; - guint8 tl, t0 = 0, fsci, fwi, sfgi; + uint8_t tl, t0 = 0, fsci, fwi, sfgi; proto_item *t0_it, *tb1_it, *tc1_it, *pi; proto_tree *t0_tree, *tb1_tree, *tc1_tree; - gint offset_tl, hist_len; - gboolean nad_supported, cid_supported; + int offset_tl, hist_len; + bool nad_supported, cid_supported; col_set_str(pinfo->cinfo, COL_INFO, "ATS"); proto_item_append_text(ti, ": ATS"); conv = conversation_new_by_id(pinfo->num, CONVERSATION_ISO14443, ISO14443_CIRCUIT_ID); - conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((guint)ISO14443_A)); + conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((unsigned)ISO14443_A)); offset_tl = offset; - tl = tvb_get_guint8(tvb, offset); + tl = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_iso14443_tl, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* the length in TL includes the TL byte itself */ if (tl >= 2) { - t0 = tvb_get_guint8(tvb, offset); + t0 = tvb_get_uint8(tvb, offset); t0_it = proto_tree_add_item(tree, hf_iso14443_t0, tvb, offset, 1, ENC_BIG_ENDIAN); t0_tree = proto_item_add_subtree(t0_it, ett_iso14443_ats_t0); @@ -738,10 +738,10 @@ static int dissect_iso14443_ats(tvbuff_t *tvb, gint offset, tb1_it = proto_tree_add_item(tree, hf_iso14443_tb1, tvb, offset, 1, ENC_BIG_ENDIAN); tb1_tree = proto_item_add_subtree(tb1_it, ett_iso14443_ats_tb1); - fwi = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4; + fwi = (tvb_get_uint8(tvb, offset) & 0xF0) >> 4; proto_tree_add_uint_bits_format_value(tb1_tree, hf_iso14443_fwi, tvb, offset*8, 4, fwi, ENC_BIG_ENDIAN, "%d", fwi); - sfgi = tvb_get_guint8(tvb, offset) & 0x0F; + sfgi = tvb_get_uint8(tvb, offset) & 0x0F; proto_tree_add_uint_bits_format_value(tb1_tree, hf_iso14443_sfgi, tvb, offset*8+4, 4, sfgi, ENC_BIG_ENDIAN, "%d", sfgi); offset++; @@ -751,11 +751,11 @@ static int dissect_iso14443_ats(tvbuff_t *tvb, gint offset, tvb, offset, 1, ENC_BIG_ENDIAN); tc1_tree = proto_item_add_subtree(tc1_it, ett_iso14443_ats_tc1); - cid_supported = tvb_get_guint8(tvb, offset) & 0x02; + cid_supported = tvb_get_uint8(tvb, offset) & 0x02; proto_tree_add_boolean_bits_format_value(tc1_tree, hf_iso14443_cid_supported, tvb, 8*offset+6, 1, cid_supported, ENC_BIG_ENDIAN, "%s", tfs_get_string(cid_supported, &tfs_supported_not_supported)); - nad_supported = tvb_get_guint8(tvb, offset) & 0x01; + nad_supported = tvb_get_uint8(tvb, offset) & 0x01; proto_tree_add_boolean_bits_format_value(tc1_tree, hf_iso14443_nad_supported, tvb, 8*offset+7, 1, nad_supported, ENC_BIG_ENDIAN, "%s", tfs_get_string(nad_supported, &tfs_supported_not_supported)); @@ -783,10 +783,10 @@ static int dissect_iso14443_cmd_type_ats(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; - guint8 fsdi, cid; + int offset = 0; + uint8_t fsdi, cid; proto_item *pi; if (pinfo->p2p_dir == P2P_DIR_SENT) { @@ -796,7 +796,7 @@ dissect_iso14443_cmd_type_ats(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(tree, hf_iso14443_rats_start, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - fsdi = tvb_get_guint8(tvb, offset) >> 4; + fsdi = tvb_get_uint8(tvb, offset) >> 4; proto_tree_add_uint_bits_format_value(tree, hf_iso14443_fsdi, tvb, offset*8, 4, fsdi, ENC_BIG_ENDIAN, "%d", fsdi); if (fsdi < LEN_CODE_MAX) { @@ -804,7 +804,7 @@ dissect_iso14443_cmd_type_ats(tvbuff_t *tvb, packet_info *pinfo, tvb, offset, 1, code_to_len[fsdi]); proto_item_set_generated(pi); } - cid = tvb_get_guint8(tvb, offset) & 0x0F; + cid = tvb_get_uint8(tvb, offset) & 0x0F; proto_tree_add_uint_bits_format_value(tree, hf_iso14443_cid, tvb, offset*8+4, 4, cid, ENC_BIG_ENDIAN, "%d", cid); offset++; @@ -824,14 +824,14 @@ dissect_iso14443_cmd_type_ats(tvbuff_t *tvb, packet_info *pinfo, } -static int dissect_iso14443_attrib(tvbuff_t *tvb, gint offset, - packet_info *pinfo, proto_tree *tree, gboolean crc_dropped) +static int dissect_iso14443_attrib(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, bool crc_dropped) { proto_item *ti = proto_tree_get_parent(tree); proto_item *p1_it, *p2_it, *p3_it, *p4_it, *pi; proto_tree *p1_tree, *p2_tree, *p3_tree, *p4_tree; - guint8 max_frame_size_code, cid; - gint hl_inf_len; + uint8_t max_frame_size_code, cid; + int hl_inf_len; col_set_str(pinfo->cinfo, COL_INFO, "Attrib"); proto_item_append_text(ti, ": Attrib"); @@ -863,7 +863,7 @@ static int dissect_iso14443_attrib(tvbuff_t *tvb, gint offset, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(p2_tree, hf_iso14443_bitrate_pcd_picc, tvb, offset, 1, ENC_BIG_ENDIAN); - max_frame_size_code = tvb_get_guint8(tvb, offset) & 0x0F; + max_frame_size_code = tvb_get_uint8(tvb, offset) & 0x0F; proto_tree_add_uint_bits_format_value(p2_tree, hf_iso14443_max_frame_size_code, tvb, offset*8+4, 4, max_frame_size_code, ENC_BIG_ENDIAN, "%d", @@ -887,7 +887,7 @@ static int dissect_iso14443_attrib(tvbuff_t *tvb, gint offset, p4_it = proto_tree_add_item(tree, hf_iso14443_param4, tvb, offset, 1, ENC_BIG_ENDIAN); p4_tree = proto_item_add_subtree(p4_it, ett_iso14443_attr_p4); - cid = tvb_get_guint8(tvb, offset) & 0x0F; + cid = tvb_get_uint8(tvb, offset) & 0x0F; proto_tree_add_uint_bits_format_value(p4_tree, hf_iso14443_cid, tvb, offset*8+4, 4, cid, ENC_BIG_ENDIAN, "%d", cid); offset++; @@ -914,11 +914,11 @@ static int dissect_iso14443_cmd_type_attrib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; - guint8 mbli, cid; - gint hl_resp_len; + int offset = 0; + uint8_t mbli, cid; + int hl_resp_len; conversation_t *conv; if (pinfo->p2p_dir == P2P_DIR_SENT) { @@ -930,12 +930,12 @@ dissect_iso14443_cmd_type_attrib(tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text(ti, ": Response to Attrib"); conv = conversation_new_by_id(pinfo->num, CONVERSATION_ISO14443, ISO14443_CIRCUIT_ID); - conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((guint)ISO14443_B)); + conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((unsigned)ISO14443_B)); - mbli = tvb_get_guint8(tvb, offset) >> 4; + mbli = tvb_get_uint8(tvb, offset) >> 4; proto_tree_add_uint_bits_format_value(tree, hf_iso14443_mbli, tvb, offset*8, 4, mbli, ENC_BIG_ENDIAN, "%d", mbli); - cid = tvb_get_guint8(tvb, offset) & 0x0F; + cid = tvb_get_uint8(tvb, offset) & 0x0F; proto_tree_add_uint_bits_format_value(tree, hf_iso14443_cid, tvb, offset*8+4, 4, cid, ENC_BIG_ENDIAN, "%d", cid); offset++; @@ -964,18 +964,18 @@ static int dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gboolean crc_dropped = (gboolean)GPOINTER_TO_UINT(data); + bool crc_dropped = (bool)GPOINTER_TO_UINT(data); proto_item *ti = proto_tree_get_parent(tree); - gint offset = 0; - guint8 pcb, block_type; - const gchar *bt_str; + int offset = 0; + uint8_t pcb, block_type; + const char *bt_str; proto_item *pcb_ti, *inf_ti; proto_tree *pcb_tree, *inf_tree; - gboolean has_cid, has_nad = FALSE; - guint8 s_cmd = S_CMD_NONE; - guint8 inf_len; + bool has_cid, has_nad = false; + uint8_t s_cmd = S_CMD_NONE; + uint8_t inf_len; - pcb = tvb_get_guint8(tvb, offset); + pcb = tvb_get_uint8(tvb, offset); block_type = (pcb & 0xC0) >> 6; bt_str = try_val_to_str(block_type, iso14443_block_type); if (bt_str) { @@ -1092,7 +1092,7 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, if (payload_tvb) { if (!dissector_try_payload_new(iso14443_subdissector_table, - payload_tvb, pinfo, tree, TRUE, NULL)) { + payload_tvb, pinfo, tree, true, NULL)) { call_data_dissector(payload_tvb, pinfo, tree); } } @@ -1104,8 +1104,8 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, if (!crc_dropped) { iso14443_type_t t = ISO14443_UNKNOWN; conversation_t *conv; - guint32 computed_checksum = 0; - guint flags = PROTO_CHECKSUM_NO_FLAGS; + uint32_t computed_checksum = 0; + unsigned flags = PROTO_CHECKSUM_NO_FLAGS; conv = find_conversation_by_id(pinfo->num, CONVERSATION_ISO14443, ISO14443_CIRCUIT_ID); if (conv) @@ -1131,8 +1131,8 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, } -static gint -iso14443_set_addrs(guint8 event, packet_info *pinfo) +static int +iso14443_set_addrs(uint8_t event, packet_info *pinfo) { if (!IS_DATA_TRANSFER(event)) return -1; @@ -1163,23 +1163,23 @@ iso14443_set_addrs(guint8 event, packet_info *pinfo) } -static inline gboolean -iso14443_block_pcb(guint8 byte) +static inline bool +iso14443_block_pcb(uint8_t byte) { if ((byte & 0xE2) == 0x02) { /* I-block */ - return TRUE; + return true; } else if ((byte & 0xE6) == 0xA2) { /* R-block */ - return TRUE; + return true; } else if ((byte & 0xC7) == 0xC2) { /* S-block */ - return TRUE; + return true; } - return FALSE; + return false; } @@ -1190,7 +1190,7 @@ iso14443_get_transaction(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) wmem_tree_key_t key[3]; iso14443_transaction_t *iso14443_trans = NULL; /* Is the current message a Waiting-Time-Extension request or response? */ - gboolean wtx = (tvb_get_guint8(tvb, 0) & 0xF7) == 0xF2; + uint32_t wtx = (tvb_get_uint8(tvb, 0) & 0xF7) == 0xF2; /* When going backwards from the current message, we want to link wtx messages only to other wtx messages (and non-wtx messages to non-wtx, @@ -1250,9 +1250,9 @@ iso14443_get_transaction(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static iso14443_cmd_t iso14443_get_cmd_type( tvbuff_t *tvb, packet_info *pinfo, iso14443_transaction_t *trans) { - guint8 first_byte; + uint8_t first_byte; - first_byte = tvb_get_guint8(tvb, 0); + first_byte = tvb_get_uint8(tvb, 0); if (pinfo->p2p_dir == P2P_DIR_SENT) { if (tvb_reported_length(tvb) == 1) { @@ -1294,19 +1294,19 @@ static iso14443_cmd_t iso14443_get_cmd_type( } -static gint +static int dissect_iso14443_msg(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, guint8 event) + proto_tree *tree, uint8_t event) { - gboolean crc_dropped = FALSE; + bool crc_dropped = false; iso14443_transaction_t *iso14443_trans; iso14443_cmd_t cmd; proto_tree *msg_tree; - gint ret; + int ret; if (event == ISO14443_EVT_DATA_PICC_TO_PCD_CRC_DROPPED || event == ISO14443_EVT_DATA_PCD_TO_PICC_CRC_DROPPED) { - crc_dropped = TRUE; + crc_dropped = true; } iso14443_trans = iso14443_get_transaction(tvb, pinfo, tree); @@ -1321,7 +1321,7 @@ dissect_iso14443_msg(tvbuff_t *tvb, packet_info *pinfo, tree, tvb, 0, -1, ett_iso14443_msg, NULL, "Message"); ret = dissector_try_uint_new(iso14443_cmd_type_table, cmd, - tvb, pinfo, msg_tree, FALSE, GUINT_TO_POINTER((guint)crc_dropped)); + tvb, pinfo, msg_tree, false, GUINT_TO_POINTER((unsigned)crc_dropped)); if (ret == 0) { proto_tree_add_expert(tree, pinfo, &ei_iso14443_unknown_cmd, tvb, 0, tvb_captured_length(tvb)); @@ -1335,12 +1335,12 @@ dissect_iso14443_msg(tvbuff_t *tvb, packet_info *pinfo, static int dissect_iso14443(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - gint packet_len; - gint offset = 0, offset_ver, offset_evt, offset_len_field; - gint ret; - guint8 version, event; - const gchar *event_str; - guint16 len_field; + int packet_len; + int offset = 0, offset_ver, offset_evt, offset_len_field; + int ret; + uint8_t version, event; + const char *event_str; + uint16_t len_field; proto_item *tree_ti; proto_tree *iso14443_tree, *hdr_tree; tvbuff_t *payload_tvb; @@ -1350,12 +1350,12 @@ static int dissect_iso14443(tvbuff_t *tvb, return 0; offset_ver = offset; - version = tvb_get_guint8(tvb, offset++); + version = tvb_get_uint8(tvb, offset++); if (version != 0) return 0; offset_evt = offset; - event = tvb_get_guint8(tvb, offset++); + event = tvb_get_uint8(tvb, offset++); event_str = try_val_to_str(event, iso14443_event); if (!event_str) return 0; @@ -1567,11 +1567,11 @@ proto_register_iso14443(void) TFS(&tfs_iso_propr), 0x04, NULL, HFILL } }, { &hf_iso14443_nad_supported, - { "NAD", "iso14443.nad_supported", FT_BOOLEAN, 8, + { "NAD", "iso14443.nad_supported", FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0, NULL, HFILL } }, { &hf_iso14443_cid_supported, - { "CID", "iso14443.cid_supported", FT_BOOLEAN, 8, + { "CID", "iso14443.cid_supported", FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0, NULL, HFILL } }, { &hf_iso14443_hlta, @@ -1842,7 +1842,7 @@ proto_register_iso14443(void) } }; - static gint *ett[] = { + static int *ett[] = { &ett_iso14443, &ett_iso14443_hdr, &ett_iso14443_msg, |