diff options
author | Michael Mann <mmann78@netscape.net> | 2014-10-07 07:51:52 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-10-07 21:14:28 +0000 |
commit | a9e6c2c917559c5083d9f5ff256233792566d3dc (patch) | |
tree | 5cb8cc9a54cd53afc746182d7755046738583050 /epan/dissectors/packet-ansi_683.c | |
parent | 12800157d6b813768cd5adfef4ce3c5c2eec81c5 (diff) |
Overhaul the filterability of packet-ansi_683.c
It's (ab)use of proto_tree_add_text was "hidden" behind a single FT_NONE hf item, that effectively had the same behavior of proto_tree_add_text, but wouldn't show up in checkAPIs.pl. Replaced the (over 200+) proto_tree_add_none_format calls with proto_tree_add_text and then ran convert_proto_tree_add_text.pl on the dissector. That started the cleanup, and I did more while in the neighborhood.
Change-Id: I89e09cf23e8998bcc9197f9a4043e1fc2850fc8c
Reviewed-on: https://code.wireshark.org/review/4521
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ansi_683.c')
-rw-r--r-- | epan/dissectors/packet-ansi_683.c | 3370 |
1 files changed, 1066 insertions, 2304 deletions
diff --git a/epan/dissectors/packet-ansi_683.c b/epan/dissectors/packet-ansi_683.c index 5cb664e217..aaa7e04740 100644 --- a/epan/dissectors/packet-ansi_683.c +++ b/epan/dissectors/packet-ansi_683.c @@ -33,6 +33,7 @@ #include <string.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/to_str.h> void proto_register_ansi_683(void); @@ -40,7 +41,6 @@ void proto_reg_handoff_ansi_683(void); static const char *ansi_proto_name = "ANSI IS-683 (OTA (Mobile))"; -static const char *ansi_proto_name_short = "IS-683"; #define ANSI_683_FORWARD 0 #define ANSI_683_REVERSE 1 @@ -71,15 +71,150 @@ static gint ett_segment = -1; /* Initialize the protocol and registered fields */ static int proto_ansi_683 = -1; -static int hf_ansi_683_none = -1; static int hf_ansi_683_for_msg_type = -1; static int hf_ansi_683_rev_msg_type = -1; static int hf_ansi_683_length = -1; - -static char bigbuf[1024]; +static int hf_ansi_683_reserved8 = -1; +static int hf_ansi_683_reserved16_f = -1; +static int hf_ansi_683_reserved24_f = -1; +static int hf_ansi_683_reserved_bytes = -1; + +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_ansi_683_spasm_protection_for_the_active_nam_000010 = -1; +static int hf_ansi_683_imsi_t_11_12 = -1; +static int hf_ansi_683_otapa_spasm_validation_signature_indicator_800000 = -1; +static int hf_ansi_683_accolc_3c = -1; +static int hf_ansi_683_otapa_spasm_validation_signature = -1; +static int hf_ansi_683_mcc_m_0ffc = -1; +static int hf_ansi_683_home_sid = -1; +static int hf_ansi_683_sid_nid_pairs_3fff = -1; +static int hf_ansi_683_identifiers_present8 = -1; +static int hf_ansi_683_authentication_data_input_parameter = -1; +static int hf_ansi_683_feature_protocol_version = -1; +static int hf_ansi_683_parameter_p = -1; +static int hf_ansi_683_key_id_reserved = -1; +static int hf_ansi_683_local_control_status_0010 = -1; +static int hf_ansi_683_mob_term_for_nid_0002 = -1; +static int hf_ansi_683_mob_term_for_nid_40 = -1; +static int hf_ansi_683_power_class = -1; +static int hf_ansi_683_mobile_station_fw_rev = -1; +static int hf_ansi_683_fresh_incl8 = -1; +static int hf_ansi_683_random_number_smck_generation = -1; +static int hf_ansi_683_key_id_ims_root_key = -1; +static int hf_ansi_683_num_sid_nid_01fe = -1; +static int hf_ansi_683_n_digits = -1; +static int hf_ansi_683_stored_sid_nid_3fc0 = -1; +static int hf_ansi_683_mob_term_for_sid_0004 = -1; +static int hf_ansi_683_capability_data = -1; +static int hf_ansi_683_mobile_station_calculation_result = -1; +static int hf_ansi_683_maximum_segment_size = -1; +static int hf_ansi_683_otasp_mobile_protocol_revision = -1; +static int hf_ansi_683_otasp_protocol_revision = -1; +static int hf_ansi_683_start_secure_mode = -1; +static int hf_ansi_683_security = -1; +static int hf_ansi_683_imsi_t_10 = -1; +static int hf_ansi_683_meid = -1; +static int hf_ansi_683_nam_lock_indicator = -1; +static int hf_ansi_683_start_otapa_session = -1; +static int hf_ansi_683_band_class_1_cdma = -1; +static int hf_ansi_683_segment_offset = -1; +static int hf_ansi_683_identifiers_present16 = -1; +static int hf_ansi_683_user_zone_id = -1; +static int hf_ansi_683_mcc_m_01ff80 = -1; +static int hf_ansi_683_max_sid_nid_3fc0 = -1; +static int hf_ansi_683_segment_size = -1; +static int hf_ansi_683_imsi_m_class8000 = -1; +static int hf_ansi_683_local_control_status_02 = -1; +static int hf_ansi_683_transmission = -1; +static int hf_ansi_683_max_sid_nid_01fe = -1; +static int hf_ansi_683_spasm_random_challenge = -1; +static int hf_ansi_683_extended_scm_indicator = -1; +static int hf_ansi_683_a_key_protocol_revision = -1; +static int hf_ansi_683_cdma_analog_mode = -1; +static int hf_ansi_683_mob_term_home_08 = -1; +static int hf_ansi_683_imsi_m_11_12_3f80 = -1; +static int hf_ansi_683_user_zone_sid = -1; +static int hf_ansi_683_fresh_incl16 = -1; +static int hf_ansi_683_sid_nid_pairs_01ff = -1; +static int hf_ansi_683_imsi_t_addr_num = -1; +static int hf_ansi_683_slotted_mode = -1; +static int hf_ansi_683_imsi_m_class10 = -1; +static int hf_ansi_683_secure_mode_result_code = -1; +static int hf_ansi_683_ismi_m_addr_num_e = -1; +static int hf_ansi_683_mob_term_for_nid_4000 = -1; +static int hf_ansi_683_station_class_mark = -1; +static int hf_ansi_683_otapa_spasm_validation_signature_indicator_80 = -1; +static int hf_ansi_683_mob_term_for_sid_8000 = -1; +static int hf_ansi_683_imsi_m_11_12_7f = -1; +static int hf_ansi_683_sspr_configuration_result_code = -1; +static int hf_ansi_683_mob_p_rev_1fe0 = -1; +static int hf_ansi_683_puzl_configuration_result_code = -1; +static int hf_ansi_683_key_id_wlan_root_key = -1; +static int hf_ansi_683_firstchp = -1; +static int hf_ansi_683_key_id_bcmcs_root_key = -1; +static int hf_ansi_683_band_class_0_cdma = -1; +static int hf_ansi_683_fresh = -1; +static int hf_ansi_683_extended_address_indicator = -1; +static int hf_ansi_683_mob_term_home_01 = -1; +static int hf_ansi_683_imsi_t_class = -1; +static int hf_ansi_683_system_tag_download_result_code = -1; +static int hf_ansi_683_band_class_0_analog = -1; +static int hf_ansi_683_service_key_generation_result_code = -1; +static int hf_ansi_683_sspr_download_result_code = -1; +static int hf_ansi_683_band_class_6_cdma = -1; +static int hf_ansi_683_data_commit_result_code = -1; +static int hf_ansi_683_mob_p_rev_ff = -1; +static int hf_ansi_683_number_of_capability_records = -1; +static int hf_ansi_683_system_tag_result_code = -1; +static int hf_ansi_683_mcc_t = -1; +static int hf_ansi_683_call_history_parameter = -1; +static int hf_ansi_683_randc = -1; +static int hf_ansi_683_mob_term_for_sid_80 = -1; +static int hf_ansi_683_parameter_g = -1; +static int hf_ansi_683_num_features = -1; +static int hf_ansi_683_cdma_analog_slotted = -1; +static int hf_ansi_683_spasm_protection_for_the_active_nam_40 = -1; +static int hf_ansi_683_25mhz_bandwidth = -1; +static int hf_ansi_683_base_station_calculation_result = -1; +static int hf_ansi_683_key_exchange_result_code = -1; +static int hf_ansi_683_mobile_station_manuf_model_number = -1; +static int hf_ansi_683_random_challenge_value = -1; +static int hf_ansi_683_imsi_m_10 = -1; +static int hf_ansi_683_stored_sid_nid_01fe = -1; +static int hf_ansi_683_number_of_parameter_blocks = -1; +static int hf_ansi_683_imsi_m_addr_num_7000 = -1; +static int hf_ansi_683_block_data = -1; +static int hf_ansi_683_feature_id = -1; +static int hf_ansi_683_num_sid_nid_3fc0 = -1; +static int hf_ansi_683_more_additional_fields = -1; +static int hf_ansi_683_band_class_3_cdma = -1; +static int hf_ansi_683_authr = -1; +static int hf_ansi_683_accolc_01e0 = -1; +static int hf_ansi_683_result_code = -1; +static int hf_ansi_683_cap_info_record_type = -1; +static int hf_ansi_683_param_block_val = -1; +static int hf_ansi_683_rev_param_block_sspr = -1; +static int hf_ansi_683_for_param_block_sspr = -1; +static int hf_ansi_683_rev_param_block_nam = -1; +static int hf_ansi_683_for_param_block_nam = -1; +static int hf_ansi_683_rev_param_block_puzl = -1; +static int hf_ansi_683_for_param_block_puzl = -1; +static int hf_ansi_683_rev_param_block_3gpd = -1; +static int hf_ansi_683_for_param_block_3gpd = -1; +static int hf_ansi_683_rev_param_block_mmd = -1; +static int hf_ansi_683_for_param_block_mmd = -1; +static int hf_ansi_683_rev_param_block_systag = -1; +static int hf_ansi_683_for_param_block_systag = -1; +static int hf_ansi_683_rev_param_block_mms = -1; +static int hf_ansi_683_for_param_block_mms = -1; +static int hf_ansi_683_mobile_directory_number = -1; +static int hf_ansi_683_service_programming_code = -1; + +static expert_field ei_ansi_683_extraneous_data = EI_INIT; +static expert_field ei_ansi_683_short_data = EI_INIT; +static expert_field ei_ansi_683_data_length = EI_INIT; static const char dtmf_digits[16] = {'?','1','2','3','4','5','6','7','8','9','0','?','?','?','?','?'}; -static const char bcd_digits[16] = {'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'}; /* FUNCTIONS */ @@ -88,64 +223,42 @@ static const char bcd_digits[16] = {'0','1','2','3','4','5','6','7','8','9','?' #define EXTRANEOUS_DATA_CHECK(edc_len, edc_max_len) \ if ((edc_len) > (edc_max_len)) \ { \ - proto_tree_add_none_format(tree, hf_ansi_683_none, tvb, \ - offset, (edc_len) - (edc_max_len), "Extraneous Data"); \ + proto_tree_add_expert(tree, pinfo, &ei_ansi_683_extraneous_data, tvb, \ + offset, (edc_len) - (edc_max_len)); \ } #define SHORT_DATA_CHECK(sdc_len, sdc_min_len) \ if ((sdc_len) < (sdc_min_len)) \ { \ - proto_tree_add_none_format(tree, hf_ansi_683_none, tvb, \ - offset, (sdc_len), "Short Data (?)"); \ + proto_tree_add_expert(tree, pinfo, &ei_ansi_683_short_data, tvb, \ + offset, (sdc_len)); \ return; \ } #define EXACT_DATA_CHECK(edc_len, edc_eq_len) \ if ((edc_len) != (edc_eq_len)) \ { \ - proto_tree_add_none_format(tree, hf_ansi_683_none, tvb, \ - offset, (edc_len), "Unexpected Data Length"); \ + proto_tree_add_expert(tree, pinfo, &ei_ansi_683_data_length, tvb, \ + offset, (edc_len)); \ return; \ } static guint32 fresh_handler(tvbuff_t *tvb, proto_tree *tree, guint len _U_, guint32 offset) { - guint32 value; guint8 oct; oct = tvb_get_guint8(tvb, offset); if (oct & 0x80) { - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : FRESH_INCL : TRUE", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x7fff, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : FRESH", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_fresh_incl16, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_fresh, tvb, offset, 2, ENC_BIG_ENDIAN); return(2); } - other_decode_bitfield_value(bigbuf, oct, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : FRESH_INCL : FALSE", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x7f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_fresh_incl8, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 7, ENC_NA); return(1); } @@ -153,98 +266,82 @@ fresh_handler(tvbuff_t *tvb, proto_tree *tree, guint len _U_, guint32 offset) /* * Table 3.5.1.2-1 Result Codes */ -static const gchar * -rev_res_code_type(guint8 res_code) -{ - const gchar *str; - - switch (res_code) - { - case 0: str = "Accepted - Operation successful"; break; - case 1: str = "Rejected - Unknown reason"; break; - case 2: str = "Rejected - Data size mismatch"; break; - case 3: str = "Rejected - Protocol version mismatch"; break; - case 4: str = "Rejected - Invalid parameter"; break; - case 5: str = "Rejected - SID/NID length mismatch"; break; - case 6: str = "Rejected - Message not expected in this mode"; break; - case 7: str = "Rejected - BLOCK_ID value not supported"; break; - case 8: str = "Rejected - Preferred roaming list length mismatch"; break; - case 9: str = "Rejected - CRC error"; break; - case 10: str = "Rejected - Mobile station locked"; break; - case 11: str = "Rejected - Invalid SPC"; break; - case 12: str = "Rejected - SPC change denied by the user"; break; - case 13: str = "Rejected - Invalid SPASM"; break; - case 14: str = "Rejected - BLOCK_ID not expected in this mode"; break; - case 15: str = "Rejected - User Zone already in PUZL"; break; - case 16: str = " Rejected - User Zone not in PUZL"; break; - case 17: str = " Rejected - No entries in PUZL"; break; - case 18: str = "Rejected - Operation Mode mismatch"; break; - case 19: str = "Rejected - SimpleIP MAX_NUM_NAI mismatch"; break; - case 20: str = "Rejected - SimpleIP MAX_NAI_LENGTH mismatch"; break; - case 21: str = "Rejected - MobileIP MAX_NUM_NAI mismatch"; break; - case 22: str = "Rejected - MobileIP MAX_NAI_LENGTH mismatch"; break; - case 23: str = "Rejected - SimpleIP PAP MAX_SS_LENGTH mismatch"; break; - case 24: str = "Rejected - SimpleIP CHAP MAX_SS_LENGTH mismatch"; break; - case 25: str = "Rejected - MobileIP MAX_MNAAA_SS_LENGTH mismatch"; break; - case 26: str = "Rejected - MobileIP MAX_MN-HA_SS_LENGTH mismatch"; break; - case 27: str = "Rejected - MobileIP MN-AAA_AUTH_ALGORITHM mismatch"; break; - case 28: str = "Rejected - MobileIP MN-HA_AUTH_ALGORITHM mismatch"; break; - case 29: str = "Rejected - SimpleIP ACT_NAI_ENTRY_INDEX mismatch"; break; - case 30: str = "Rejected - MobileIP ACT_NAI_ENTRY_INDEX mismatch"; break; - case 31: str = "Rejected - SimpleIP PAP NAI_ENTRY_INDEX mismatch"; break; - case 32: str = "Rejected - SimpleIP CHAP NAI_ENTRY_INDEX mismatch"; break; - case 33: str = "Rejected - MobileIP NAI_ENTRY_INDEX mismatch"; break; - case 34: str = "Rejected - Unexpected PRL_BLOCK_ID change"; break; - case 35: str = "Rejected - PRL format mismatch"; break; - case 36: str = "Rejected - HRPD Access Authentication MAX_NAI_LENGTH mismatch"; break; - case 37: str = "Rejected - HRPD Access Authentication CHAP MAX_SS_LENGTH mismatch"; break; - case 38: str = " Rejected - MMD MAX_NUM_IMPU mismatch"; break; - case 39: str = " Rejected - MMD MAX_IMPU_LENGTH mismatch"; break; - case 40: str = " Rejected - MMD MAX_NUM_P-CSCF mismatch"; break; - case 41: str = " Rejected - MMD MAX_P-CSCF_LENGTH mismatch"; break; - case 42: str = " Rejected - Unexpected System Tag BLOCK_ID Change"; break; - case 43: str = " Rejected - System Tag Format mismatch"; break; - case 44: str = " Rejected - NUM_MMS_URI mismatch"; break; - case 45: str = " Rejected - MMS_URI _LENGTH mismatch"; break; - case 46: str = " Rejected - Invalid MMS_URI"; break; - default: - if ((res_code >= 47) && (res_code <= 127)) { str = "Reserved for future standardization"; break; } - else if ((res_code >= 128) && (res_code <= 254)) { str = "Available for manufacturer-specific Result Code definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} +static const range_string result_codes_rvals[] = { + { 0, 0, "Accepted - Operation successful" }, + { 1, 1, "Rejected - Unknown reason" }, + { 2, 2, "Rejected - Data size mismatch" }, + { 3, 3, "Rejected - Protocol version mismatch" }, + { 4, 4, "Rejected - Invalid parameter" }, + { 5, 5, "Rejected - SID/NID length mismatch" }, + { 6, 6, "Rejected - Message not expected in this mode" }, + { 7, 7, "Rejected - BLOCK_ID value not supported" }, + { 8, 8, "Rejected - Preferred roaming list length mismatch" }, + { 9, 9, "Rejected - CRC error" }, + { 10, 10, "Rejected - Mobile station locked" }, + { 11, 11, "Rejected - Invalid SPC" }, + { 12, 12, "Rejected - SPC change denied by the user" }, + { 13, 13, "Rejected - Invalid SPASM" }, + { 14, 14, "Rejected - BLOCK_ID not expected in this mode" }, + { 15, 15, "Rejected - User Zone already in PUZL" }, + { 16, 16, "Rejected - User Zone not in PUZL" }, + { 17, 17, "Rejected - No entries in PUZL" }, + { 18, 18, "Rejected - Operation Mode mismatch" }, + { 19, 19, "Rejected - SimpleIP MAX_NUM_NAI mismatch" }, + { 20, 20, "Rejected - SimpleIP MAX_NAI_LENGTH mismatch" }, + { 21, 21, "Rejected - MobileIP MAX_NUM_NAI mismatch" }, + { 22, 22, "Rejected - MobileIP MAX_NAI_LENGTH mismatch" }, + { 23, 23, "Rejected - SimpleIP PAP MAX_SS_LENGTH mismatch" }, + { 24, 24, "Rejected - SimpleIP CHAP MAX_SS_LENGTH mismatch" }, + { 25, 25, "Rejected - MobileIP MAX_MNAAA_SS_LENGTH mismatch" }, + { 26, 26, "Rejected - MobileIP MAX_MN-HA_SS_LENGTH mismatch" }, + { 27, 27, "Rejected - MobileIP MN-AAA_AUTH_ALGORITHM mismatch" }, + { 28, 28, "Rejected - MobileIP MN-HA_AUTH_ALGORITHM mismatch" }, + { 29, 29, "Rejected - SimpleIP ACT_NAI_ENTRY_INDEX mismatch" }, + { 30, 30, "Rejected - MobileIP ACT_NAI_ENTRY_INDEX mismatch" }, + { 31, 31, "Rejected - SimpleIP PAP NAI_ENTRY_INDEX mismatch" }, + { 32, 32, "Rejected - SimpleIP CHAP NAI_ENTRY_INDEX mismatch" }, + { 33, 33, "Rejected - MobileIP NAI_ENTRY_INDEX mismatch" }, + { 34, 34, "Rejected - Unexpected PRL_BLOCK_ID change" }, + { 35, 35, "Rejected - PRL format mismatch" }, + { 36, 36, "Rejected - HRPD Access Authentication MAX_NAI_LENGTH mismatch" }, + { 37, 37, "Rejected - HRPD Access Authentication CHAP MAX_SS_LENGTH mismatch" }, + { 38, 38, "Rejected - MMD MAX_NUM_IMPU mismatch" }, + { 39, 39, "Rejected - MMD MAX_IMPU_LENGTH mismatch" }, + { 40, 40, "Rejected - MMD MAX_NUM_P-CSCF mismatch" }, + { 41, 41, "Rejected - MMD MAX_P-CSCF_LENGTH mismatch" }, + { 42, 42, "Rejected - Unexpected System Tag BLOCK_ID Change" }, + { 43, 43, "Rejected - System Tag Format mismatch" }, + { 44, 44, "Rejected - NUM_MMS_URI mismatch" }, + { 45, 45, "Rejected - MMS_URI _LENGTH mismatch" }, + { 46, 46, "Rejected - Invalid MMS_URI" }, + { 47, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific Result Code definitions" }, + { 255, 255, "Reserved" }, + + { 0x00, 0x00, NULL }, +}; /* * Table 3.5.1.7-1 Feature Identifier */ -static const gchar * -rev_feat_id_type(guint8 feat_id) -{ - const gchar *str; - - switch (feat_id) - { - case 0: str = "NAM Download (DATA_P_REV)"; break; - case 1: str = "Key Exchange (A_KEY_P_REV)"; break; - case 2: str = "System Selection for Preferred Roaming (SSPR_P_REV)"; break; - case 3: str = "Service Programming Lock (SPL_P_REV)"; break; - case 4: str = "Over-The-Air Parameter Administration (OTAPA_P_REV)"; break; - case 5: str = "Preferred User Zone List (PUZL_P_REV)"; break; - case 6: str = "3G Packet Data (3GPD)"; break; - case 7: str = "Secure MODE (SECURE_MODE_P_REV)"; break; - case 8: str = "Multimedia Domain (MMD)"; break; - case 9: str = "System Tag Download (TAG_P_REV)"; break; - case 10: str = "Multimedia Messaging Service (MMS)"; break; - default: - if ((feat_id >= 11) && (feat_id <= 191)) { str = "Reserved for future standardization"; break; } - else if ((feat_id >= 192) && (feat_id <= 254)) { str = "Available for manufacturer-specific features"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} +static const range_string feat_id_type_rvals[] = { + { 0, 0, "NAM Download (DATA_P_REV)" }, + { 1, 1, "Key Exchange (A_KEY_P_REV)" }, + { 2, 2, "System Selection for Preferred Roaming (SSPR_P_REV)" }, + { 3, 3, "Service Programming Lock (SPL_P_REV)" }, + { 4, 4, "Over-The-Air Parameter Administration (OTAPA_P_REV)" }, + { 5, 5, "Preferred User Zone List (PUZL_P_REV)" }, + { 6, 6, "3G Packet Data (3GPD)" }, + { 7, 7, "Secure MODE (SECURE_MODE_P_REV)" }, + { 8, 8, "Multimedia Domain (MMD)" }, + { 9, 9, "System Tag Download (TAG_P_REV)" }, + { 10, 10, "Multimedia Messaging Service (MMS)" }, + { 11, 191, "Reserved for future standardization" }, + { 192, 254, "Available for manufacturer-specific features" }, + { 255, 255, "Reserved" }, + + { 0x00, 0x00, NULL }, +}; #define REV_TYPE_CAP_INFO_OP_MODE 0 #define REV_TYPE_CAP_INFO_CDMA_BAND 1 @@ -256,25 +353,17 @@ rev_feat_id_type(guint8 feat_id) /* * Table 3.5.1.17.1-1 Capability Information Record Types */ -static const gchar * -rev_cap_info_record_type(guint8 rec_type) -{ - const gchar *str; +static const range_string rev_cap_info_record_type_rvals[] = { + { REV_TYPE_CAP_INFO_OP_MODE, REV_TYPE_CAP_INFO_OP_MODE, "Operating Mode Information" }, + { REV_TYPE_CAP_INFO_CDMA_BAND, REV_TYPE_CAP_INFO_CDMA_BAND, "CDMA Band Class Information" }, + { REV_TYPE_CAP_INFO_MEID, REV_TYPE_CAP_INFO_MEID, "MEID" }, + { REV_TYPE_CAP_INFO_ICCID, REV_TYPE_CAP_INFO_ICCID, "ICCID" }, + { REV_TYPE_CAP_INFO_EXT_UIM_ID, REV_TYPE_CAP_INFO_EXT_UIM_ID, "EXT_UIM_ID" }, + { REV_TYPE_CAP_INFO_MEID_ME, REV_TYPE_CAP_INFO_MEID_ME, "MEID_ME" }, + { 6, 255, "Reserved" }, - switch (rec_type) - { - case 0: str = "Operating Mode Information"; break; - case 1: str = "CDMA Band Class Information"; break; - case 2: str = "MEID"; break; - case 3: str = "ICCID"; break; - case 4: str = "EXT_UIM_ID"; break; - case 5: str = "MEID_ME"; break; - default: - str = "Reserved"; break; - } - - return(str); -} + { 0x00, 0x00, NULL }, +}; #define FOR_BLOCK_VAL_VERIFY_SPC 0 #define FOR_BLOCK_VAL_CHANGE_SPC 1 @@ -283,24 +372,16 @@ rev_cap_info_record_type(guint8 rec_type) /* * Table 4.5.4-1 Validation Parameter Block Types */ -static const gchar * -for_param_block_val(guint8 block_type) -{ - const gchar *str; +static const range_string for_param_block_rvals[] = { + { FOR_BLOCK_VAL_VERIFY_SPC, FOR_BLOCK_VAL_VERIFY_SPC, "Verify SPC" }, + { FOR_BLOCK_VAL_CHANGE_SPC, FOR_BLOCK_VAL_CHANGE_SPC, "Change SPC" }, + { FOR_BLOCK_VAL_VALDATE_SPASM, FOR_BLOCK_VAL_VALDATE_SPASM, "Validate SPASM" }, + { 3, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - switch (block_type) - { - case 0: str = "Verify SPC"; break; - case 1: str = "Change SPC"; break; - case 2: str = "Validate SPASM"; break; - default: - if ((block_type >= 3) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} + { 0x00, 0x00, NULL }, +}; #define REV_BLOCK_SSPR_PRL_DIM 0 #define REV_BLOCK_SSPR_PRL 1 @@ -309,24 +390,16 @@ for_param_block_val(guint8 block_type) /* * Table 3.5.3-1 SSPR Parameter Block Types */ -static const gchar * -rev_param_block_sspr(guint8 block_type) -{ - const gchar *str; +static const range_string rev_param_block_sspr_rvals[] = { + { REV_BLOCK_SSPR_PRL_DIM, REV_BLOCK_SSPR_PRL_DIM, "Preferred Roaming List Dimensions" }, + { REV_BLOCK_SSPR_PRL, REV_BLOCK_SSPR_PRL, "Preferred Roaming List" }, + { REV_BLOCK_SSPR_EXT_PRL_DIM, REV_BLOCK_SSPR_EXT_PRL_DIM, "Extended Preferred Roaming List Dimensions" }, + { 3, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - switch (block_type) - { - case 0: str = "Preferred Roaming List Dimensions"; break; - case 1: str = "Preferred Roaming List"; break; - case 2: str = "Extended Preferred Roaming List Dimensions"; break; - default: - if ((block_type >= 3) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} + { 0x00, 0x00, NULL }, +}; #define FOR_BLOCK_SSPR_PRL 0 #define FOR_BLOCK_SSPR_EXT_PRL 1 @@ -334,23 +407,15 @@ rev_param_block_sspr(guint8 block_type) /* * Table 4.5.3-1 SSPR Parameter Block Types */ -static const gchar * -for_param_block_sspr(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "Preferred Roaming List"; break; - case 1: str = "Extended Preferred Roaming List with SSPR_P_REV greater than 00000001"; break; - default: - if ((block_type >= 2) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } +static const range_string for_param_block_sspr_rvals[] = { + { FOR_BLOCK_SSPR_PRL, FOR_BLOCK_SSPR_PRL, "Preferred Roaming List" }, + { FOR_BLOCK_SSPR_EXT_PRL, FOR_BLOCK_SSPR_EXT_PRL, "Extended Preferred Roaming List with SSPR_P_REV greater than 00000001" }, + { 2, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - return(str); -} + { 0x00, 0x00, NULL }, +}; #define REV_BLOCK_NAM_CDMA_ANALOG 0 #define REV_BLOCK_NAM_MDN 1 @@ -360,25 +425,18 @@ for_param_block_sspr(guint8 block_type) /* * Table 3.5.2-1 NAM Parameter Block Types */ -static const gchar * -rev_param_block_nam(guint8 block_type) -{ - const gchar *str; +static const range_string rev_param_block_nam_rvals[] = { + { REV_BLOCK_NAM_CDMA_ANALOG, REV_BLOCK_NAM_CDMA_ANALOG, "CDMA/Analog NAM" }, + { REV_BLOCK_NAM_MDN, REV_BLOCK_NAM_MDN, "Mobile Directory Number" }, + { REV_BLOCK_NAM_CDMA, REV_BLOCK_NAM_CDMA, "CDMA NAM" }, + { REV_BLOCK_NAM_IMSI_T, REV_BLOCK_NAM_IMSI_T, "IMSI_T" }, + { 4, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - switch (block_type) - { - case 0: str = "CDMA/Analog NAM"; break; - case 1: str = "Mobile Directory Number"; break; - case 2: str = "CDMA NAM"; break; - case 3: str = "IMSI_T"; break; - default: - if ((block_type >= 4) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } + { 0x00, 0x00, NULL }, +}; - return(str); -} #define FOR_BLOCK_NAM_CDMA_ANALOG 0 #define FOR_BLOCK_NAM_MDN 1 @@ -388,48 +446,32 @@ rev_param_block_nam(guint8 block_type) /* * Table 4.5.2-1 NAM Parameter Block Types */ -static const gchar * -for_param_block_nam(guint8 block_type) -{ - const gchar *str; +static const range_string for_param_block_nam_rvals[] = { + { FOR_BLOCK_NAM_CDMA_ANALOG, FOR_BLOCK_NAM_CDMA_ANALOG, "CDMA/Analog NAM Download" }, + { FOR_BLOCK_NAM_MDN, FOR_BLOCK_NAM_MDN, "Mobile Directory Number" }, + { FOR_BLOCK_NAM_CDMA, FOR_BLOCK_NAM_CDMA, "CDMA NAM Download" }, + { FOR_BLOCK_NAM_IMSI_T, FOR_BLOCK_NAM_IMSI_T, "IMSI_T" }, + { 4, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - switch (block_type) - { - case 0: str = "CDMA/Analog NAM Download"; break; - case 1: str = "Mobile Directory Number"; break; - case 2: str = "CDMA NAM Download"; break; - case 3: str = "IMSI_T"; break; - default: - if ((block_type >= 4) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} + { 0x00, 0x00, NULL }, +}; /* * Table 3.5.6-1 PUZL Parameter Block Types */ -static const gchar * -rev_param_block_puzl(guint8 block_type) -{ - const gchar *str; +static const range_string rev_param_block_puzl_rvals[] = { + { 0, 0, "PUZL Dimensions" }, + { 1, 1, "PUZL Priorities" }, + { 2, 2, "User Zone" }, + { 3, 3, "Preferred User Zone List" }, + { 4, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - switch (block_type) - { - case 0: str = "PUZL Dimensions"; break; - case 1: str = "PUZL Priorities"; break; - case 2: str = "User Zone"; break; - case 3: str = "Preferred User Zone List"; break; - default: - if ((block_type >= 4) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} + { 0x00, 0x00, NULL }, +}; #define FOR_BLOCK_PUZL_UZ_INS 0 #define FOR_BLOCK_PUZL_UZ_UPD 1 @@ -440,26 +482,18 @@ rev_param_block_puzl(guint8 block_type) /* * Table 4.5.6-1 PUZL Parameter Block Types */ -static const gchar * -for_param_block_puzl(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "User Zone Insert"; break; - case 1: str = "User Zone Update"; break; - case 2: str = "User Zone Delete"; break; - case 3: str = "User Zone Priority Change"; break; - case 4: str = "PUZL Flags"; break; - default: - if ((block_type >= 5) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } - - return(str); -} +static const range_string for_param_block_puzl_rvals[] = { + { FOR_BLOCK_PUZL_UZ_INS, FOR_BLOCK_PUZL_UZ_INS, "User Zone Insert" }, + { FOR_BLOCK_PUZL_UZ_UPD, FOR_BLOCK_PUZL_UZ_UPD, "User Zone Update" }, + { FOR_BLOCK_PUZL_UZ_DEL, FOR_BLOCK_PUZL_UZ_DEL, "User Zone Delete" }, + { FOR_BLOCK_PUZL_UZ_PRI_CHANGE, FOR_BLOCK_PUZL_UZ_PRI_CHANGE, "User Zone Priority Change" }, + { FOR_BLOCK_PUZL_FLAGS, FOR_BLOCK_PUZL_FLAGS, "PUZL Flags" }, + { 5, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, + + { 0x00, 0x00, NULL }, +}; #define REV_BLOCK_3GPD_OP_CAP 0 #define REV_BLOCK_3GPD_OP_MODE 1 @@ -479,33 +513,23 @@ for_param_block_puzl(guint8 block_type) /* * Table 3.5.8-1 3GPD Parameter Block Types */ -static const gchar * -rev_param_block_3gpd(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "3GPD Operation Capability Parameters"; break; - case 1: str = "3GPD Operation Mode Parameters"; break; - case 2: str = "SimpleIP Capability Parameters"; break; - case 3: str = "MobileIP Capability Parameters"; break; - case 4: str = "SimpleIP User Profile Parameters"; break; - case 5: str = "Mobile IP User Profile Parameters"; break; - case 6: str = "SimpleIP Status Parameters"; break; - case 7: str = "MobileIP Status Parameters"; break; - case 8: str = "SimpleIP PAP SS Parameters"; break; - case 9: str = "SimpleIP CHAP SS Parameters"; break; - case 10: str = "MobileIP SS Parameters"; break; - case 11: str = "HRPD Access Authentication Capability Parameters"; break; - case 12: str = "HRPD Access Authentication User Profile Parameters"; break; - case 13: str = "HRPD Access Authentication CHAP SS Parameters"; break; - default: - str = "Reserved"; break; - } - - return(str); -} +static const value_string rev_param_block_3gpd_vals[] = { + { REV_BLOCK_3GPD_OP_CAP, "3GPD Operation Capability Parameters" }, + { REV_BLOCK_3GPD_OP_MODE, "3GPD Operation Mode Parameters" }, + { REV_BLOCK_3GPD_SIP_CAP, "SimpleIP Capability Parameters" }, + { REV_BLOCK_3GPD_MIP_CAP, "MobileIP Capability Parameters" }, + { REV_BLOCK_3GPD_SIP_USER_PRO, "SimpleIP User Profile Parameters" }, + { REV_BLOCK_3GPD_MIP_USER_PRO, "Mobile IP User Profile Parameters" }, + { REV_BLOCK_3GPD_SIP_STATUS, "SimpleIP Status Parameters" }, + { REV_BLOCK_3GPD_MIP_STATUS, "MobileIP Status Parameters" }, + { REV_BLOCK_3GPD_SIP_PAP_SS, "SimpleIP PAP SS Parameters" }, + { REV_BLOCK_3GPD_SIP_CHAP_SS, "SimpleIP CHAP SS Parameters" }, + { REV_BLOCK_3GPD_MIP_SS, "MobileIP SS Parameters" }, + { REV_BLOCK_3GPD_HRPD_ACC_AUTH_CAP, "HRPD Access Authentication Capability Parameters" }, + { REV_BLOCK_3GPD_HRPD_ACC_AUTH_USER, "HRPD Access Authentication User Profile Parameters" }, + { REV_BLOCK_3GPD_HRPD_ACC_AUTH_CHAP_SS, "HRPD Access Authentication CHAP SS Parameters" }, + { 0, NULL } +}; #define FOR_BLOCK_3GPD_OP_MODE 0 #define FOR_BLOCK_3GPD_SIP_USER_PRO 1 @@ -521,69 +545,36 @@ rev_param_block_3gpd(guint8 block_type) /* * Table 4.5.7-1 3GPD Parameter Block Types */ -static const gchar * -for_param_block_3gpd(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "3GPD Operation Mode Parameters"; break; - case 1: str = "SimpleIP User Profile Parameters"; break; - case 2: str = "Mobile IP User Profile Parameters"; break; - case 6: str = "SimpleIP Status Parameters"; break; - case 7: str = "MobileIP Status Parameters"; break; - case 8: str = "SimpleIP PAP SS Parameters"; break; - case 9: str = "SimpleIP CHAP SS Parameters"; break; - case 10: str = "MobileIP SS Parameters"; break; - case 11: str = "HRPD Access Authentication User Profile Parameters"; break; - case 12: str = "HRPD Access Authentication CHAP SS Parameters"; break; - default: - str = "Reserved"; break; - } +static const value_string for_param_block_3gpd_vals[] = { + { FOR_BLOCK_3GPD_OP_MODE, "3GPD Operation Mode Parameters" }, + { FOR_BLOCK_3GPD_SIP_USER_PRO, "SimpleIP User Profile Parameters" }, + { FOR_BLOCK_3GPD_MIP_USER_PRO, "Mobile IP User Profile Parameters" }, + { FOR_BLOCK_3GPD_SIP_STATUS, "SimpleIP Status Parameters" }, + { FOR_BLOCK_3GPD_MIP_STATUS, "MobileIP Status Parameters" }, + { FOR_BLOCK_3GPD_SIP_PAP_SS, "SimpleIP PAP SS Parameters" }, + { FOR_BLOCK_3GPD_SIP_CHAP_SS, "SimpleIP CHAP SS Parameters" }, + { FOR_BLOCK_3GPD_MIP_SS, "MobileIP SS Parameters" }, + { FOR_BLOCK_3GPD_HRPD_ACC_AUTH_USER, "HRPD Access Authentication User Profile Parameters" }, + { FOR_BLOCK_3GPD_HRPD_ACC_AUTH_CHAP_SS, "HRPD Access Authentication CHAP SS Parameters" }, + { 0, NULL } +}; - return(str); -} #define REV_BLOCK_MMD_APP 0 /* * Table 3.5.9-1 MMD Parameter Block Types */ -static const gchar * -rev_param_block_mmd(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "MMD Application Parameters"; break; - default: - str = "Reserved"; break; - } - - return(str); -} - -#define FOR_BLOCK_MMD_APP 0 +static const value_string param_block_mmd_vals[] = { + { 0, "MMD Application Parameters" }, + { 0, NULL } +}; /* * Table 4.5.8-1 MMD Parameter Block Types */ -static const gchar * -for_param_block_mmd(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "MMD Application Parameters"; break; - default: - str = "Reserved"; break; - } +#define FOR_BLOCK_MMD_APP 0 - return(str); -} #define REV_BLOCK_SYSTAG_HOME_SYSTAG 0 #define REV_BLOCK_SYSTAG_GROUP_TAG_LIST_DIM 1 @@ -596,49 +587,31 @@ for_param_block_mmd(guint8 block_type) /* * Table 3.5.10-1 System Tag Parameter Block Types */ -static const gchar * -rev_param_block_systag(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "Home System Tag"; break; - case 1: str = "Group Tag List Dimensions"; break; - case 2: str = "Group Tag List"; break; - case 3: str = "Specific Tag List Dimensions"; break; - case 4: str = "Specific Tag List"; break; - case 5: str = "Call Prompt List Dimensions"; break; - case 6: str = "Call Prompt List"; break; - default: - str = "Reserved"; break; - } - - return(str); -} +static const value_string rev_param_block_systag_vals[] = { + { REV_BLOCK_SYSTAG_HOME_SYSTAG, "Home System Tag" }, + { REV_BLOCK_SYSTAG_GROUP_TAG_LIST_DIM, "Group Tag List Dimensions" }, + { REV_BLOCK_SYSTAG_GROUP_TAG_LIST, "Group Tag List" }, + { REV_BLOCK_SYSTAG_SPEC_TAG_LIST_DIM, "Specific Tag List Dimensions" }, + { REV_BLOCK_SYSTAG_SPEC_TAG_LIST, "Specific Tag List" }, + { REV_BLOCK_SYSTAG_CALL_PROMPT_LIST_DIM, "Call Prompt List Dimensions" }, + { REV_BLOCK_SYSTAG_CALL_PROMPT_LIST, "Call Prompt List" }, + { 0, NULL } +}; /* * Table 4.5.9-1 System Tag Parameter Block Types */ -static const gchar * -for_param_block_systag(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "Home System Tag"; break; - case 1: str = "Group Tag List"; break; - case 2: str = "Specific Tag List"; break; - case 3: str = "Call Prompt List"; break; - default: - if ((block_type >= 4) && (block_type <= 127)) { str = "Reserved for future standardization"; break; } - else if ((block_type >= 128) && (block_type <= 254)) { str = "Available for manufacturer-specific parameter block definitions"; break; } - else { str = "Reserved"; break; } - } +static const range_string for_param_block_systag_rvals[] = { + { 0, 0, "Home System Tag" }, + { 1, 1, "Group Tag List" }, + { 2, 2, "Specific Tag List" }, + { 3, 3, "Call Prompt List" }, + { 4, 127, "Reserved for future standardization" }, + { 128, 254, "Available for manufacturer-specific parameter block definitions" }, + { 255, 255, "Reserved" }, - return(str); -} + { 0x00, 0x00, NULL }, +}; #define REV_BLOCK_MMS_URI 0 #define REV_BLOCK_MMS_URI_CAP 1 @@ -646,96 +619,66 @@ for_param_block_systag(guint8 block_type) /* * Table 3.5.12-1 MMS Parameter Block Types */ -static const gchar * -rev_param_block_mms(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "MMS URI Parameters"; break; - case 1: str = "MMS URI Capability Parameters"; break; - default: - str = "Reserved"; break; - } +static const range_string rev_param_block_mms_rvals[] = { + { REV_BLOCK_MMS_URI, REV_BLOCK_MMS_URI, "MMS URI Parameters" }, + { REV_BLOCK_MMS_URI_CAP, REV_BLOCK_MMS_URI_CAP, "MMS URI Capability Parameters" }, + { 2, 255, "Reserved" }, - return(str); -} + { 0x00, 0x00, NULL }, +}; #define FOR_BLOCK_MMS_URI 0 /* * Table 4.5.10-1 MMS Parameter Block Types */ -static const gchar * -for_param_block_mms(guint8 block_type) -{ - const gchar *str; - - switch (block_type) - { - case 0: str = "MMS URI Parameters"; break; - default: - str = "Reserved"; break; - } +static const range_string for_param_block_mms_rvals[] = { + { FOR_BLOCK_MMS_URI, FOR_BLOCK_MMS_URI, "MMS URI Parameters" }, + { 1, 255, "Reserved" }, - return(str); -} + { 0x00, 0x00, NULL }, +}; /* PARAMETER BLOCK DISSECTION */ /* * 3.5.2.1 */ +static const value_string power_class_vals[] = { + { 0x00, "Class I" }, + { 0x01, "Class II" }, + { 0x02, "Class III" }, + { 0x03, "Reserved" }, + { 0, NULL } +}; + +static const true_false_string tfs_extended_scm_indicator = { "Band Classes 1,4", "Other bands" }; +static const true_false_string tfs_cdma_analog_mode = { "Dual Mode", "CDMA Only" }; +static const true_false_string tfs_configured_not_configured = { "Configured", "Not configured" }; +static const true_false_string tfs_discontinuous_continous = { "Discontinuous", "Continuous" }; + static void -rev_param_block_nam_cdma_analog(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +rev_param_block_nam_cdma_analog(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value; - guint32 count; proto_tree *subtree; proto_item *item; - const gchar *str = NULL; saved_offset = offset; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0xffe0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : First paging channel (FIRSTCHP) used in the home system (%u)", - bigbuf, - (value & 0xffe0) >> 5); + proto_tree_add_item(tree, hf_ansi_683_firstchp, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntoh24(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x1fffc0, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Home system identification (HOME_SID) (%u)", - bigbuf, - (value & 0x1fffc0) >> 6); - - other_decode_bitfield_value(bigbuf, value, 0x20, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : Extended address indicator (EX)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_home_sid, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_extended_address_indicator, tvb, offset + 2, 1, ENC_NA); offset += 2; value = tvb_get_ntohs(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x1fe0, 16); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Station class mark (SCM) (%u)", - bigbuf, - (value & 0x1fe0) >> 5); + item = proto_tree_add_item(tree, hf_ansi_683_station_class_mark, tvb, offset, 2, ENC_BIG_ENDIAN); /* * following SCM decode is from: @@ -744,192 +687,58 @@ rev_param_block_nam_cdma_analog(tvbuff_t *tvb, proto_tree *tree, guint len, guin */ subtree = proto_item_add_subtree(item, ett_scm); - other_decode_bitfield_value(bigbuf, value, 0x1000, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Extended SCM Indicator: %s", - bigbuf, - (value & 0x1000) ? "Band Classes 1,4" : "Other bands"); - - other_decode_bitfield_value(bigbuf, value, 0x0800, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : %s", - bigbuf, - (value & 0x0800) ? "Dual Mode" : "CDMA Only"); - - other_decode_bitfield_value(bigbuf, value, 0x0400, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : %s", - bigbuf, - (value & 0x0400) ? "Slotted" : "Non-Slotted"); + proto_tree_add_item(subtree, hf_ansi_683_extended_scm_indicator, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_ansi_683_cdma_analog_mode, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_ansi_683_cdma_analog_slotted, tvb, offset, 2, ENC_BIG_ENDIAN); if (value & 0x0200) - { - str = ""; proto_item_append_text(item, "%s", " (MEID configured)"); - } - else - { - str = "not "; - } - - other_decode_bitfield_value(bigbuf, value, 0x0200, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : MEID %sconfigured", - bigbuf, - str); - - other_decode_bitfield_value(bigbuf, value, 0x0100, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : 25 MHz Bandwidth", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0080, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : %s Transmission", - bigbuf, - (value & 0x0080) ? "Discontinuous" : "Continuous"); - - switch ((value & 0x0060) >> 5) - { - case 0x00: str = "Class I"; break; - case 0x01: str = "Class II"; break; - case 0x02: str = "Class III"; break; - case 0x03: str = "Reserved"; break; - } - other_decode_bitfield_value(bigbuf, value, 0x0060, 16); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Power Class for Band Class 0 Analog Operation: %s", - bigbuf, - str); + proto_tree_add_item(subtree, hf_ansi_683_meid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_ansi_683_25mhz_bandwidth, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_ansi_683_transmission, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_ansi_683_power_class, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; value = tvb_get_ntohs(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x1fe0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Mobile station protocol revision number (MOB_P_REV) (%u)", - bigbuf, - (value & 0x1fe0) >> 5); - - other_decode_bitfield_value(bigbuf, value, 0x10, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 1, 1, - "%s : IMSI_M Class assignment of the mobile station (IMSI_M_CLASS), Class %u", - bigbuf, - (value & 0x10) >> 4); - - other_decode_bitfield_value(bigbuf, value, 0x0e, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 1, 1, - "%s : Number of IMSI_M address digits (IMSI_M_ADDR_NUM) (%u), %u digits in NMSI", - bigbuf, - (value & 0x0e) >> 1, - (value & 0x10) ? ((value & 0x0e) >> 1) + 4 : 0); + proto_tree_add_item(tree, hf_ansi_683_mob_p_rev_1fe0, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_class10, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_uint_format_value(tree, hf_ansi_683_ismi_m_addr_num_e, tvb, offset + 1, 1, value, + "%u, %u digits in NMSI", (value & 0x0e) >> 1, + (value & 0x10) ? ((value & 0x0e) >> 1) + 4 : 0); offset++; value = tvb_get_ntoh24(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x01ff80, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Mobile country code (MCC_M)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x7f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : 11th and 12th digits of the IMSI_M (IMSI__M_11_12)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_mcc_m_01ff80, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_11_12_7f, tvb, offset, 3, ENC_NA); offset += 3; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 5, - "The least significant 10 digits of the IMSI_M (IMSI_M_S) (34 bits)"); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_10, tvb, offset, 5, ENC_NA); offset += 4; - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3c, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Access overload class (ACCOLC) (%u)", - bigbuf, - (value & 0x3c) >> 2); - - other_decode_bitfield_value(bigbuf, value, 0x02, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Local control status (LOCAL_CONTROL)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x01, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Termination indicator for the home system (MOB_TERM_HOME)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_accolc_3c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_local_control_status_02, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_mob_term_home_01, tvb, offset, 1, ENC_NA); offset++; - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Termination indicator for SID roaming (MOB_TERM_FOR_SID)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x40, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Termination indicator for NID roaming (MOB_TERM_FOR_NID)", - bigbuf); - - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3fc0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Maximum stored SID/NID pairs (MAX_SID_NID) (%u)", - bigbuf, - (value & 0x3fc0) >> 6); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_sid_80, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_nid_40, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_max_sid_nid_3fc0, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - count = (value & 0x3fc0) >> 6; - - other_decode_bitfield_value(bigbuf, value, 0x3fc0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of stored SID/NID pairs (STORED_SID_NID) (%u)", - bigbuf, - count); - - other_decode_bitfield_value(bigbuf, value, 0x003f, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : SID/NID pairs (MSB)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_stored_sid_nid_3fc0, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_sid_nid_pairs_3fff, tvb, offset+1, 2, ENC_BIG_ENDIAN); offset += 2; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, len - (offset - saved_offset), - "SID/NID pairs, Reserved"); + proto_tree_add_item(tree, hf_ansi_683_reserved_bytes, + tvb, offset, len - (offset - saved_offset), ENC_NA); } /* @@ -937,10 +746,11 @@ rev_param_block_nam_cdma_analog(tvbuff_t *tvb, proto_tree *tree, guint len, guin * 4.5.2.2 */ static void -param_block_nam_mdn(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +param_block_nam_mdn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value, count, i; + char str[17]; saved_offset = offset; @@ -948,39 +758,28 @@ param_block_nam_mdn(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) count = (value & 0xf0) >> 4; - other_decode_bitfield_value(bigbuf, value, 0xf0, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Number of digits (N_DIGITS) (%u)", - bigbuf, - count); + proto_tree_add_item(tree, hf_ansi_683_n_digits, tvb, offset, 1, ENC_NA); for (i=0; i < count; i++) { - bigbuf[i] = dtmf_digits[(value & 0x0f)]; + str[i] = dtmf_digits[(value & 0x0f)]; if ((i + 1) < count) { offset++; value = tvb_get_guint8(tvb, offset); - bigbuf[i+1] = dtmf_digits[(value & 0xf0) >> 4]; + str[i+1] = dtmf_digits[(value & 0xf0) >> 4]; i++; } } - bigbuf[i] = '\0'; + str[i] = '\0'; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, saved_offset, len, - "Mobile directory number, %s", - bigbuf); + proto_tree_add_string(tree, hf_ansi_683_mobile_directory_number, + tvb, saved_offset, len, str); if (!(count & 0x01)) { - other_decode_bitfield_value(bigbuf, value, 0x0f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 4, ENC_NA); } } @@ -988,156 +787,56 @@ param_block_nam_mdn(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.2.3 */ static void -rev_param_block_nam_cdma(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +rev_param_block_nam_cdma(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value; - guint32 count; saved_offset = offset; value = tvb_get_guint8(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0xc0, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x20, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Slotted Mode", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x1f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, (offset<<3)+6, 2, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_slotted_mode, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 5, ENC_NA); offset++; - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0xff, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Mobile station protocol revision number (MOB_P_REV) (%u)", - bigbuf, - value); - + proto_tree_add_item(tree, hf_ansi_683_mob_p_rev_ff, tvb, offset, 1, ENC_NA); offset++; value = tvb_get_ntohs(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : IMSI_M Class assignment of the mobile station (IMSI_M_CLASS), Class %u", - bigbuf, - (value & 0x8000) >> 15); - - other_decode_bitfield_value(bigbuf, value, 0x7000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of IMSI_M address digits (IMSI_M_ADDR_NUM) (%u), %u digits in NMSI", - bigbuf, - (value & 0x7000) >> 12, - (value & 0x8000) ? ((value & 0x7000) >> 12) + 4 : 0); - - other_decode_bitfield_value(bigbuf, value, 0x0ffc, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Mobile country code (MCC_M)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_class8000, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_uint_format_value(tree, hf_ansi_683_imsi_m_addr_num_7000, tvb, offset, 2, value, + "%u, %u digits in NMSI", (value & 0x7000) >> 12, + (value & 0x8000) ? ((value & 0x7000) >> 12) + 4 : 0); + proto_tree_add_item(tree, hf_ansi_683_mcc_m_0ffc, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3f80, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : 11th and 12th digits of the IMSI_M (IMSI__M_11_12)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_imsi_m_11_12_3f80, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 5, - "The least significant 10 digits of the IMSI_M (IMSI_M_S) (34 bits)"); - + proto_tree_add_item(tree, hf_ansi_683_imsi_m_10, tvb, offset, 5, ENC_NA); offset += 4; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x01e0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Access overload class (ACCOLC) (%u)", - bigbuf, - (value & 0x01e0) >> 5); - - other_decode_bitfield_value(bigbuf, value, 0x0010, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Local control status (LOCAL_CONTROL)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0008, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for the home system (MOB_TERM_HOME)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0004, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for SID roaming (MOB_TERM_FOR_SID)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0002, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for NID roaming (MOB_TERM_FOR_NID)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_accolc_01e0, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_local_control_status_0010, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_home_08, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_sid_0004, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_nid_0002, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x01fe, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Maximum stored SID/NID pairs (MAX_SID_NID) (%u)", - bigbuf, - (value & 0x01fe) >> 1); - + proto_tree_add_item(tree, hf_ansi_683_max_sid_nid_01fe, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - count = (value & 0x01fe) >> 1; - - other_decode_bitfield_value(bigbuf, value, 0x01fe, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of stored SID/NID pairs (STORED_SID_NID) (%u)", - bigbuf, - count); - - other_decode_bitfield_value(bigbuf, value, 0x0001, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : SID/NID pairs (MSB)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_stored_sid_nid_01fe, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_sid_nid_pairs_01ff, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, len - (offset - saved_offset), - "SID/NID pairs, Reserved"); + proto_tree_add_item(tree, hf_ansi_683_reserved_bytes, + tvb, offset, len - (offset - saved_offset), ENC_NA); } /* @@ -1151,190 +850,69 @@ param_block_nam_imsi_t(tvbuff_t *tvb, proto_tree *tree, guint len _U_, guint32 o value = tvb_get_guint8(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : IMSI_T Class assignment of the mobile station (IMSI_T_CLASS), Class %u", - bigbuf, - (value & 0x80) >> 7); - - other_decode_bitfield_value(bigbuf, value, 0x70, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Number of IMSI_T address digits (IMSI_T_ADDR_NUM ) (%u), %u digits in NMSI", - bigbuf, - (value & 0x70) >> 4, - (value & 0x80) ? ((value & 0x70) >> 4) + 4 : 0); - - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x0ffc, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Mobile country code (MCC_T)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_imsi_t_class, tvb, offset, 1, ENC_NA); + proto_tree_add_uint_format_value(tree, hf_ansi_683_imsi_t_addr_num, tvb, offset, 1, value, + "%u, %u digits in NMSI", (value & 0x70) >> 4, + (value & 0x80) ? ((value & 0x70) >> 4) + 4 : 0); + proto_tree_add_item(tree, hf_ansi_683_mcc_t, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x03f8, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : 11th and 12th digits of the IMSI_T (IMSI__T_11_12)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_imsi_t_11_12, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 5, - "The least significant 10 digits of the IMSI_T (IMSI_T_S) (34 bits)"); - + proto_tree_add_item(tree, hf_ansi_683_imsi_t_10, tvb, offset, 5, ENC_NA); offset += 4; - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x01, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 1, ENC_NA); } /* * 4.5.2.1 */ static void -for_param_block_nam_cdma_analog(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +for_param_block_nam_cdma_analog(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value; - guint32 count; saved_offset = offset; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0xffe0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : First paging channel (FIRSTCHP) used in the home system (%u)", - bigbuf, - (value & 0xffe0) >> 5); - + proto_tree_add_item(tree, hf_ansi_683_firstchp, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; value = tvb_get_ntoh24(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x1fffc0, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Home system identification (HOME_SID) (%u)", - bigbuf, - (value & 0x1fffc0) >> 6); - - other_decode_bitfield_value(bigbuf, value, 0x20, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : Extended address indicator (EX)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x10, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : IMSI_M Class assignment of the mobile station (IMSI_M_CLASS), Class %u", - bigbuf, - (value & 0x10) >> 4); - - other_decode_bitfield_value(bigbuf, value, 0x0e, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : Number of IMSI_M address digits (IMSI_M_ADDR_NUM) (%u), %u digits in NMSI", - bigbuf, - (value & 0x0e) >> 1, - (value & 0x10) ? ((value & 0x0e) >> 1) + 4 : 0); + proto_tree_add_item(tree, hf_ansi_683_home_sid, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_extended_address_indicator, tvb, offset + 2, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_class10, tvb, offset + 2, 1, ENC_NA); + proto_tree_add_uint_format_value(tree, hf_ansi_683_ismi_m_addr_num_e, tvb, offset + 2, 1, value, + "%u, %u digits in NMSI", (value & 0x0e) >> 1, + (value & 0x10) ? ((value & 0x0e) >> 1) + 4 : 0); offset += 2; - value = tvb_get_ntoh24(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x01ff80, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Mobile country code (MCC_M)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x7f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 2, 1, - "%s : 11th and 12th digits of the IMSI_M (IMSI__M_11_12)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_mcc_m_01ff80, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_11_12_7f, tvb, offset + 2, 1, ENC_NA); offset += 3; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 5, - "The least significant 10 digits of the IMSI_M (IMSI_M_S) (34 bits)"); - + proto_tree_add_item(tree, hf_ansi_683_imsi_m_10, tvb, offset, 5, ENC_NA); offset += 4; - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3c, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Access overload class (ACCOLC) (%u)", - bigbuf, - (value & 0x3c) >> 2); - - other_decode_bitfield_value(bigbuf, value, 0x02, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Local control status (LOCAL_CONTROL)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x01, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Termination indicator for the home system (MOB_TERM_HOME)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_accolc_3c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_local_control_status_02, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_mob_term_home_01, tvb, offset, 1, ENC_NA); offset++; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for SID roaming (MOB_TERM_FOR_SID)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x4000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for NID roaming (MOB_TERM_FOR_NID)", - bigbuf); - - count = (value & 0x3fc0) >> 6; - - other_decode_bitfield_value(bigbuf, value, 0x3fc0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of SID/NID pairs (N_SID_NID) (%u)", - bigbuf, - count); - - other_decode_bitfield_value(bigbuf, value, 0x003f, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : SID/NID pairs (MSB)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_sid_8000, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_nid_4000, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_num_sid_nid_3fc0, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_sid_nid_pairs_3fff, tvb, offset+1, 2, ENC_BIG_ENDIAN); offset += 2; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, len - (offset - saved_offset), - "SID/NID pairs, Reserved"); + proto_tree_add_item(tree, hf_ansi_683_reserved_bytes, + tvb, offset, len - (offset - saved_offset), ENC_NA); } /* @@ -1346,112 +924,42 @@ for_param_block_nam_cdma_analog(tvbuff_t *tvb, proto_tree *tree, guint len, guin * 4.5.2.3 */ static void -for_param_block_nam_cdma(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +for_param_block_nam_cdma(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value; - guint32 count; saved_offset = offset; value = tvb_get_ntohs(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : IMSI_M Class assignment of the mobile station (IMSI_M_CLASS), Class %u", - bigbuf, - (value & 0x8000) >> 15); - - other_decode_bitfield_value(bigbuf, value, 0x7000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of IMSI_M address digits (IMSI_M_ADDR_NUM) (%u), %u digits in NMSI", - bigbuf, - (value & 0x7000) >> 12, - (value & 0x8000) ? ((value & 0x7000) >> 12) + 4 : 0); - - other_decode_bitfield_value(bigbuf, value, 0x0ffc, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Mobile country code (MCC_M)", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_imsi_m_class8000, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_uint_format_value(tree, hf_ansi_683_imsi_m_addr_num_7000, tvb, offset, 2, value, + "%u, %u digits in NMSI", (value & 0x7000) >> 12, + (value & 0x8000) ? ((value & 0x7000) >> 12) + 4 : 0); + proto_tree_add_item(tree, hf_ansi_683_mcc_m_0ffc, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3f80, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : 11th and 12th digits of the IMSI_M (IMSI__M_11_12)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_imsi_m_11_12_3f80, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 5, - "The least significant 10 digits of the IMSI_M (IMSI_M_S) (34 bits)"); - + proto_tree_add_item(tree, hf_ansi_683_imsi_m_10, tvb, offset, 5, ENC_NA); offset += 4; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x01e0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Access overload class (ACCOLC) (%u)", - bigbuf, - (value & 0x01e0) >> 5); - - other_decode_bitfield_value(bigbuf, value, 0x0010, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Local control status (LOCAL_CONTROL)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0008, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for the home system (MOB_TERM_HOME)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0004, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for SID roaming (MOB_TERM_FOR_SID)", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x0002, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Termination indicator for NID roaming (MOB_TERM_FOR_NID)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_accolc_01e0, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_local_control_status_0010, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_home_08, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_sid_0004, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_mob_term_for_nid_0002, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; - value = tvb_get_ntohs(tvb, offset); - - count = (value & 0x01fe) >> 1; - - other_decode_bitfield_value(bigbuf, value, 0x01fe, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Number of SID/NID pairs (N_SID_NID) (%u)", - bigbuf, - count); - - other_decode_bitfield_value(bigbuf, value, 0x0001, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : SID/NID pairs (MSB)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_num_sid_nid_01fe, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_sid_nid_pairs_01ff, tvb, offset+1, 2, ENC_BIG_ENDIAN); offset += 2; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, len - (offset - saved_offset), - "SID/NID pairs, Reserved"); + proto_tree_add_item(tree, hf_ansi_683_reserved_bytes, + tvb, offset, len - (offset - saved_offset), ENC_NA); } /* @@ -1464,98 +972,36 @@ for_param_block_nam_cdma(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 off * 4.5.4.2 */ static void -for_param_block_val_spc(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +for_param_block_val_spc(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint32 saved_offset; - guint32 value; - EXACT_DATA_CHECK(len, 3); - saved_offset = offset; - - value = tvb_get_guint8(tvb, offset++); - bigbuf[0] = bcd_digits[(value & 0x0f)]; - bigbuf[1] = bcd_digits[(value & 0xf0) >> 4]; - - value = tvb_get_guint8(tvb, offset++); - bigbuf[2] = bcd_digits[(value & 0x0f)]; - bigbuf[3] = bcd_digits[(value & 0xf0) >> 4]; - - value = tvb_get_guint8(tvb, offset++); - bigbuf[4] = bcd_digits[(value & 0x0f)]; - bigbuf[5] = bcd_digits[(value & 0xf0) >> 4]; - bigbuf[6] = '\0'; - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, saved_offset, len, - "Service programming code: %s", - bigbuf); + proto_tree_add_string(tree, hf_ansi_683_service_programming_code, + tvb, offset, len, tvb_bcd_dig_to_wmem_packet_str(tvb, offset, 3, NULL, FALSE)); } /* * 4.5.4.3 */ +static const true_false_string tfs_activate_do_not_activate = { "Activate", "Do not activate" }; + static void -for_param_block_val_spasm(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +for_param_block_val_spasm(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint32 value; - if (len == 1) { - value = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : OTAPA SPASM validation signature %sincluded indicator", - bigbuf, - (value & 0x80) ? "" : "not "); - - other_decode_bitfield_value(bigbuf, value, 0x40, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : %s SPASM protection for the active NAM", - bigbuf, - (value & 0x40) ? "Activate" : "Do not activate"); - - other_decode_bitfield_value(bigbuf, value, 0x3f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_otapa_spasm_validation_signature_indicator_80, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_spasm_protection_for_the_active_nam_40, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 6, ENC_NA); } else { EXACT_DATA_CHECK(len, 3); - value = tvb_get_ntoh24(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x800000, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : OTAPA SPASM validation signature %sincluded indicator", - bigbuf, - (value & 0x800000) ? "" : "not "); - - other_decode_bitfield_value(bigbuf, value, 0x7fffe0, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : OTAPA SPASM validation signature (0x%x)", - bigbuf, - (value & 0x7fffe0) >> 5); - - other_decode_bitfield_value(bigbuf, value, 0x000010, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : %s SPASM protection for the active NAM", - bigbuf, - (value & 0x000010) ? "Activate" : "Do not activate"); - - other_decode_bitfield_value(bigbuf, value, 0x00000f, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Reserved", - bigbuf); + proto_tree_add_item(tree, hf_ansi_683_otapa_spasm_validation_signature_indicator_800000, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_otapa_spasm_validation_signature, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_spasm_protection_for_the_active_nam_000010, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_reserved24_f, tvb, offset, 3, ENC_BIG_ENDIAN); } } @@ -1565,10 +1011,9 @@ for_param_block_val_spasm(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 of * 4.5.1.1 */ static void -msg_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, num_blocks; - const gchar *str = NULL; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -1577,10 +1022,7 @@ msg_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -1589,15 +1031,9 @@ msg_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) for (i=0; i < num_blocks; i++) { oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_nam(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); + proto_tree_add_uint_format(tree, hf_ansi_683_rev_param_block_nam, tvb, offset, 1, + oct, "NAM Parameter Block Type #%u: %s (%u)", i+1, + rval_to_str_const(oct, rev_param_block_nam_rvals, "Reserved"), oct); offset++; } @@ -1609,10 +1045,9 @@ msg_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.2 */ static void -msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; proto_tree *subtree; proto_item *item; guint32 i, saved_offset; @@ -1623,10 +1058,7 @@ msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -1634,17 +1066,12 @@ msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_nam(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_nam_block, &item, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_for_nam_block); + proto_tree_add_uint(subtree, hf_ansi_683_for_param_block_nam, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -1655,25 +1082,25 @@ msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { switch (block_id) { case FOR_BLOCK_NAM_CDMA_ANALOG: - for_param_block_nam_cdma_analog(tvb, subtree, block_len, offset); + for_param_block_nam_cdma_analog(tvb, pinfo, subtree, block_len, offset); break; case FOR_BLOCK_NAM_MDN: - param_block_nam_mdn(tvb, subtree, block_len, offset); + param_block_nam_mdn(tvb, pinfo, subtree, block_len, offset); break; case FOR_BLOCK_NAM_CDMA: - for_param_block_nam_cdma(tvb, subtree, block_len, offset); + for_param_block_nam_cdma(tvb, pinfo, subtree, block_len, offset); break; case FOR_BLOCK_NAM_IMSI_T: @@ -1681,8 +1108,7 @@ msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) break; default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -1702,14 +1128,20 @@ msg_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) /* * 4.5.1.3 */ +static const value_string akey_protocol_revision_vals[] = { + { 0x02, "2G A-key generation" }, + { 0x03, "2G A-key and 3G Root Key generation" }, + { 0x04, "3G Root Key generation" }, + { 0x05, "Enhanced 3G Root Key generation" }, + { 0, NULL }, +}; + static void -msg_ms_key_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_ms_key_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 akey_prev, param_len; proto_tree *subtree; - proto_item *item; guint32 saved_offset; - const gchar *str = NULL; SHORT_DATA_CHECK(len, 1); @@ -1717,31 +1149,16 @@ msg_ms_key_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) akey_prev = tvb_get_guint8(tvb, offset); - switch (akey_prev) - { - case 0x02: str = "2G A-key generation"; break; - case 0x03: str = "2G A-key and 3G Root Key generation"; break; - case 0x04: str = "3G Root Key generation"; break; - case 0x05: str = "Enhanced 3G Root Key generation"; break; - default: str = "Unknown"; break; - } - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "A-Key Protocol Revision (%u): %s", - akey_prev, - str); + proto_tree_add_item(tree, hf_ansi_683_a_key_protocol_revision, tvb, offset, 1, ENC_NA); offset++; if (akey_prev < 0x03) { param_len = tvb_get_guint8(tvb, offset); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, + subtree = proto_tree_add_subtree(tree, tvb, offset, param_len + 1, - "Key exchange parameter P"); - subtree = proto_item_add_subtree(item, ett_key_p); + ett_key_p, NULL, "Key exchange parameter P"); proto_tree_add_uint(subtree, hf_ansi_683_length, tvb, offset, 1, param_len); @@ -1749,19 +1166,15 @@ msg_ms_key_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (param_len > 0) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, param_len, - "Parameter P"); + proto_tree_add_item(subtree, hf_ansi_683_parameter_p, tvb, offset, param_len, ENC_NA); offset += param_len; } param_len = tvb_get_guint8(tvb, offset); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, + subtree = proto_tree_add_subtree(tree, tvb, offset, param_len + 1, - "Key exchange parameter G"); - subtree = proto_item_add_subtree(item, ett_key_g); + ett_key_g, NULL, "Key exchange parameter G"); proto_tree_add_uint(subtree, hf_ansi_683_length, tvb, offset, 1, param_len); @@ -1769,9 +1182,7 @@ msg_ms_key_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (param_len > 0) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, param_len, - "Parameter G"); + proto_tree_add_item(subtree, hf_ansi_683_parameter_g, tvb, offset, param_len, ENC_NA); offset += param_len; } } @@ -1783,7 +1194,7 @@ msg_ms_key_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.4 */ static void -msg_key_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_key_gen_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 param_len; guint32 saved_offset; @@ -1802,9 +1213,7 @@ msg_key_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (param_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, param_len, - "Base Station Calculation Result"); + proto_tree_add_item(tree, hf_ansi_683_base_station_calculation_result, tvb, offset, param_len, ENC_NA); offset += param_len; } @@ -1815,14 +1224,12 @@ msg_key_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.5 */ static void -msg_reauth_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_reauth_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { EXACT_DATA_CHECK(len, 4); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 4, - "Random Challenge value"); + proto_tree_add_item(tree, hf_ansi_683_random_challenge_value, tvb, offset, 4, ENC_NA); } /* @@ -1834,11 +1241,10 @@ msg_reauth_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.7 */ static void -msg_protocap_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_protocap_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint32 i, saved_offset; guint8 oct, num_cap; - const gchar *str = NULL; if (len == 0) { @@ -1851,18 +1257,13 @@ msg_protocap_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) saved_offset = offset; - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "OTASP protocol revision"); + proto_tree_add_item(tree, hf_ansi_683_otasp_protocol_revision, tvb, offset, 1, ENC_NA); offset++; num_cap = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of Capability Records (%u)", - num_cap); + proto_tree_add_item(tree, hf_ansi_683_number_of_capability_records, tvb, offset, 1, ENC_NA); offset++; @@ -1871,16 +1272,8 @@ msg_protocap_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) for (i=0; i < num_cap; i++) { oct = tvb_get_guint8(tvb, offset); - - str = rev_cap_info_record_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - + proto_tree_add_uint_format(tree, hf_ansi_683_cap_info_record_type, tvb, offset, 1, oct, + "Record Type #%u: %s (%u)", i+1, rval_to_str_const(oct, rev_cap_info_record_type_rvals, "Reserved"), oct); offset++; } @@ -1891,12 +1284,10 @@ msg_protocap_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.8 */ static void -msg_sspr_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_sspr_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct; - const gchar *str = NULL; guint32 saved_offset; - guint32 value; proto_tree *subtree; proto_item *item; @@ -1905,16 +1296,7 @@ msg_sspr_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) saved_offset = offset; oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_sspr(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + item = proto_tree_add_item(tree, hf_ansi_683_rev_param_block_sspr, tvb, offset, 1, ENC_NA); offset++; if (oct == REV_BLOCK_SSPR_PRL) @@ -1923,25 +1305,14 @@ msg_sspr_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if ((len - (offset - saved_offset)) < 3) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "Segment offset (%u)", - value); + proto_tree_add_item(subtree, hf_ansi_683_segment_offset, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "Maximum segment size (%u)", - oct); + proto_tree_add_item(subtree, hf_ansi_683_maximum_segment_size, tvb, offset, 1, ENC_NA); offset++; } @@ -1952,10 +1323,9 @@ msg_sspr_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.9 */ static void -msg_sspr_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_sspr_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; proto_tree *subtree; proto_item *item; @@ -1964,17 +1334,7 @@ msg_sspr_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = for_param_block_sspr(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + item = proto_tree_add_item(tree, hf_ansi_683_for_param_block_sspr, tvb, offset, 1, ENC_NA); subtree = proto_item_add_subtree(item, ett_for_sspr_block); offset++; @@ -1986,15 +1346,13 @@ msg_sspr_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } if (block_len > 0) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -2011,10 +1369,9 @@ msg_sspr_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 4.5.1.10 */ static void -msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_validate_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; proto_tree *subtree; proto_item *item; guint32 i, saved_offset; @@ -2025,10 +1382,7 @@ msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2038,17 +1392,11 @@ msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_val(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_val_block, &item, + "Block #%u", i+1); - subtree = proto_item_add_subtree(item, ett_for_val_block); + proto_tree_add_item(subtree, hf_ansi_683_param_block_val, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2060,10 +1408,10 @@ msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -2071,16 +1419,15 @@ msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { case FOR_BLOCK_VAL_VERIFY_SPC: case FOR_BLOCK_VAL_CHANGE_SPC: - for_param_block_val_spc(tvb, subtree, block_len, offset); + for_param_block_val_spc(tvb, pinfo, subtree, block_len, offset); break; case FOR_BLOCK_VAL_VALDATE_SPASM: - for_param_block_val_spasm(tvb, subtree, block_len, offset); + for_param_block_val_spasm(tvb, pinfo, subtree, block_len, offset); break; default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2094,39 +1441,24 @@ msg_validate_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) /* * 4.5.1.11 */ +static const true_false_string tfs_start_stop = { "Start", "Stop" }; + static void -msg_otapa_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_otapa_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - EXACT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - other_decode_bitfield_value(bigbuf, oct, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : %s OTAPA session", - bigbuf, - (oct & 0x80) ? "Start" : "Stop"); - - other_decode_bitfield_value(bigbuf, oct, 0x7f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); - - offset++; + proto_tree_add_item(tree, hf_ansi_683_start_otapa_session, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 7, ENC_NA); } /* * 4.5.1.12 */ static void -msg_puzl_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_puzl_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; proto_tree *subtree; proto_item *item; @@ -2135,25 +1467,14 @@ msg_puzl_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_puzl(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + item = proto_tree_add_item(tree, hf_ansi_683_rev_param_block_puzl, tvb, offset, 1, ENC_NA); block_len = len - (offset - saved_offset); if (block_len > 0) { subtree = proto_item_add_subtree(item, ett_rev_puzl_block); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -2164,12 +1485,11 @@ msg_puzl_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.13 */ static void -msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_puzl_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2178,10 +1498,7 @@ msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2189,17 +1506,12 @@ msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_puzl(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_puzl_block, &item, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_for_puzl_block); + proto_tree_add_uint(subtree, hf_ansi_683_for_param_block_puzl, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2210,10 +1522,10 @@ msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -2225,8 +1537,7 @@ msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset case FOR_BLOCK_PUZL_UZ_PRI_CHANGE: case FOR_BLOCK_PUZL_FLAGS: default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2247,10 +1558,9 @@ msg_puzl_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 4.5.1.14 */ static void -msg_3gpd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_3gpd_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, num_blocks; - const gchar *str = NULL; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2259,10 +1569,7 @@ msg_3gpd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2272,14 +1579,10 @@ msg_3gpd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_param_block_3gpd(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); + proto_tree_add_uint_format(tree, hf_ansi_683_rev_param_block_3gpd, + tvb, offset, 1, oct, + "3GPD Parameter Block %u: %s (%u)", + i+1, val_to_str_const(oct, rev_param_block_3gpd_vals, "Reserved"), oct); offset++; } @@ -2291,12 +1594,11 @@ msg_3gpd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.15 */ static void -msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_3gpd_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2305,10 +1607,7 @@ msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2316,17 +1615,10 @@ msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_3gpd(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_for_3gpd_block); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_3gpd_block, &item, + "Block #%u", i+1); + proto_tree_add_uint(subtree, hf_ansi_683_for_param_block_3gpd, tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2337,10 +1629,10 @@ msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -2357,8 +1649,7 @@ msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset case FOR_BLOCK_3GPD_HRPD_ACC_AUTH_USER: case FOR_BLOCK_3GPD_HRPD_ACC_AUTH_CHAP_SS: default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2379,7 +1670,7 @@ msg_3gpd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 4.5.1.16 */ static void -msg_secure_mode_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_secure_mode_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct; const gchar *str = NULL; @@ -2391,12 +1682,7 @@ msg_secure_mode_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) oct = tvb_get_guint8(tvb, offset); - other_decode_bitfield_value(bigbuf, oct, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : %s Secure Mode", - bigbuf, - (oct & 0x80) ? "Start" : "Stop"); + proto_tree_add_item(tree, hf_ansi_683_start_secure_mode, tvb, offset, 1, ENC_NA); if (oct & 0x80) { @@ -2412,28 +1698,17 @@ msg_secure_mode_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) str = "Key in use indicator"; } - other_decode_bitfield_value(bigbuf, oct, 0x78, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : %s", - bigbuf, - str); - - other_decode_bitfield_value(bigbuf, oct, 0x07, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); + proto_tree_add_uint_format_value(tree, hf_ansi_683_security, + tvb, offset, 1, oct, "%s", str); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 3, ENC_NA); offset++; if (oct & 0x80) { SHORT_DATA_CHECK(len, 8); - proto_tree_add_text(tree, - tvb, offset, 8, - "Random Number used for SMCK generation"); + proto_tree_add_item(tree, hf_ansi_683_random_number_smck_generation, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } @@ -2450,10 +1725,9 @@ msg_secure_mode_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.18 */ static void -msg_mmd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mmd_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, num_blocks; - const gchar *str = NULL; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2462,10 +1736,7 @@ msg_mmd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2475,14 +1746,10 @@ msg_mmd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_param_block_mmd(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); + proto_tree_add_uint_format(tree, hf_ansi_683_rev_param_block_mmd, + tvb, offset, 1, oct, + "MMD Parameter Block #%u: %s (%u)", + i+1, val_to_str_const(oct, param_block_mmd_vals, "Reserved"), oct); offset++; } @@ -2494,12 +1761,11 @@ msg_mmd_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.19 */ static void -msg_mmd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mmd_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2508,10 +1774,7 @@ msg_mmd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2519,17 +1782,12 @@ msg_mmd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_mmd(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_mmd_block, &item, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_for_mmd_block); + proto_tree_add_uint(subtree, hf_ansi_683_for_param_block_mmd, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2540,19 +1798,19 @@ msg_mmd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); + if (block_len > 0) { switch (block_id) { case FOR_BLOCK_MMD_APP: default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2573,12 +1831,9 @@ msg_mmd_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.20 */ static void -msg_systag_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_systag_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - const gchar *str = NULL; guint32 saved_offset; - guint32 value; proto_tree *subtree; proto_item *item; @@ -2586,17 +1841,8 @@ msg_systag_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_systag(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + item = proto_tree_add_item(tree, hf_ansi_683_rev_param_block_systag, + tvb, offset, 1, ENC_NA); offset++; /* @@ -2615,20 +1861,10 @@ msg_systag_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset subtree = proto_item_add_subtree(item, ett_segment); - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 2, - "Segment offset (%u)", - value); + proto_tree_add_item(subtree, hf_ansi_683_segment_offset, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "Maximum segment size (%u)", - oct); + proto_tree_add_item(subtree, hf_ansi_683_maximum_segment_size, tvb, offset, 1, ENC_NA); offset++; } @@ -2639,26 +1875,16 @@ msg_systag_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 4.5.1.21 */ static void -msg_systag_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_systag_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; SHORT_DATA_CHECK(len, 2); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = for_param_block_systag(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_for_param_block_systag, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2671,8 +1897,7 @@ msg_systag_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offs if (block_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(tree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -2684,7 +1909,7 @@ msg_systag_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offs * 4.5.1.22 */ static void -msg_srvckey_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_srvckey_gen_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; guint32 value; @@ -2695,35 +1920,13 @@ msg_srvckey_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) value = tvb_get_ntohs(tvb, offset); - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Key ID: IMS Root Key", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x4000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Key ID: BCMCS Root Key", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x2000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Key ID: WLAN Root Key", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x1ff0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Key ID: Reserved", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x000f, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Reserved", - bigbuf); + proto_tree_add_boolean_format_value(tree, hf_ansi_683_key_id_ims_root_key, tvb, offset, 2, value, "IMS Root Key"); + proto_tree_add_boolean_format_value(tree, hf_ansi_683_key_id_bcmcs_root_key, tvb, offset, 2, value, "BCMCS Root Key"); + proto_tree_add_boolean_format_value(tree, hf_ansi_683_key_id_wlan_root_key, tvb, offset, 2, value, "WLAN Root Key"); + proto_tree_add_uint_format_value(tree, hf_ansi_683_key_id_reserved, tvb, offset, 2, value, "Reserved"); + + proto_tree_add_item(tree, hf_ansi_683_reserved16_f, + tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -2734,10 +1937,9 @@ msg_srvckey_gen_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.23 */ static void -msg_mms_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mms_config_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, num_blocks; - const gchar *str = NULL; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2746,10 +1948,7 @@ msg_mms_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2759,15 +1958,10 @@ msg_mms_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_param_block_mms(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - + proto_tree_add_uint_format(tree, hf_ansi_683_rev_param_block_mms, + tvb, offset, 1, oct, + "MMS Parameter Block #%u: %s (%u)", + i+1, rval_to_str_const(oct, rev_param_block_mms_rvals, "Reserved"), oct); offset++; } @@ -2778,12 +1972,11 @@ msg_mms_config_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 4.5.1.24 */ static void -msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mms_download_req(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 block_id, num_blocks, block_len; - const gchar *str = NULL; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; guint32 i, saved_offset; SHORT_DATA_CHECK(len, 1); @@ -2792,10 +1985,7 @@ msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2803,17 +1993,11 @@ msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_mms(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_mms_block, &item, + "Block #%u", i+1); - subtree = proto_item_add_subtree(item, ett_for_mms_block); + proto_tree_add_uint(subtree, hf_ansi_683_for_param_block_mms, tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2824,10 +2008,10 @@ msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -2835,8 +2019,7 @@ msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { case FOR_BLOCK_MMS_URI: default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2859,13 +2042,12 @@ msg_mms_download_req(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.1 */ static void -msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, block_id, num_blocks, block_len; - const gchar *str = NULL; guint32 i, saved_offset; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; SHORT_DATA_CHECK(len, 1); @@ -2873,10 +2055,7 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2886,17 +2065,11 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = rev_param_block_nam(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_rev_nam_block); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_rev_nam_block, &item, + "Block #%u", i+1); + proto_tree_add_uint(subtree, hf_ansi_683_rev_param_block_nam, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -2907,25 +2080,25 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { switch (block_id) { case REV_BLOCK_NAM_CDMA_ANALOG: - rev_param_block_nam_cdma_analog(tvb, subtree, block_len, offset); + rev_param_block_nam_cdma_analog(tvb, pinfo, subtree, block_len, offset); break; case REV_BLOCK_NAM_MDN: - param_block_nam_mdn(tvb, subtree, block_len, offset); + param_block_nam_mdn(tvb, pinfo, subtree, block_len, offset); break; case REV_BLOCK_NAM_CDMA: - rev_param_block_nam_cdma(tvb, subtree, block_len, offset); + rev_param_block_nam_cdma(tvb, pinfo, subtree, block_len, offset); break; case REV_BLOCK_NAM_IMSI_T: @@ -2933,8 +2106,7 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) break; default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -2948,14 +2120,9 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); + proto_tree_add_uint_format(tree, hf_ansi_683_result_code, + tvb, offset, 1, oct, "Block #%u result code: %s (%u)", + i+1, rval_to_str_const(oct, result_codes_rvals, "Reserved"), oct); offset++; } @@ -2973,13 +2140,11 @@ msg_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.2 */ static void -msg_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, num_blocks; - const gchar *str = NULL; + guint8 num_blocks; guint32 i, saved_offset; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -2987,10 +2152,7 @@ msg_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -2998,31 +2160,14 @@ msg_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) for (i=0; i < num_blocks; i++) { - oct = tvb_get_guint8(tvb, offset); - - str = for_param_block_nam(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - - subtree = proto_item_add_subtree(item, ett_for_nam_block); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 2, ett_for_nam_block, NULL, + "Block #%u", i+1); + proto_tree_add_item(subtree, hf_ansi_683_for_param_block_nam, + tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -3033,50 +2178,27 @@ msg_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.3 */ static void -msg_ms_key_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_ms_key_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - const gchar *str = NULL; - EXACT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Key exchange result code, %s (%u)", - str, - oct); - - offset++; + proto_tree_add_item(tree, hf_ansi_683_key_exchange_result_code, tvb, offset, 1, ENC_NA); } /* * 3.5.1.4 */ static void -msg_key_gen_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_key_gen_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, result_len; - const gchar *str = NULL; + guint8 result_len; guint32 saved_offset; SHORT_DATA_CHECK(len, 2); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Key exchange result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_key_exchange_result_code, tvb, offset, 1, ENC_NA); offset++; result_len = tvb_get_guint8(tvb, offset); @@ -3089,8 +2211,7 @@ msg_key_gen_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (result_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, result_len, "Mobile station calculation result"); + proto_tree_add_item(tree, hf_ansi_683_mobile_station_calculation_result, tvb, offset, result_len, ENC_NA); offset += result_len; } @@ -3101,85 +2222,39 @@ msg_key_gen_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.5 */ static void -msg_reauth_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_reauth_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint32 value; - EXACT_DATA_CHECK(len, 7); - value = tvb_get_ntoh24(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0xffffc0, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Authentication signature data (AUTHR) (%u)", - bigbuf, - (value & 0xffffc0) >> 6); - + proto_tree_add_item(tree, hf_ansi_683_authr, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 2; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x3fc0, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Random challenge value (RANDC) (%u)", - bigbuf, - (value & 0x3fc0) >> 6); - - other_decode_bitfield_value(bigbuf, value, 0x3f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset + 1, 1, - "%s : Call history parameter (COUNT) (%u)", - bigbuf, - value & 0x3f); - + proto_tree_add_item(tree, hf_ansi_683_randc, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_call_history_parameter, tvb, offset + 1, 1, ENC_NA); offset += 2; - value = tvb_get_ntoh24(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0xffffff, 24); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 3, - "%s : Authentication Data input parameter (AUTH_DATA) (%u)", - bigbuf, - value); + proto_tree_add_item(tree, hf_ansi_683_authentication_data_input_parameter, tvb, offset, 3, ENC_BIG_ENDIAN); } /* * 3.5.1.6 */ static void -msg_commit_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_commit_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - const gchar *str = NULL; - EXACT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Data commit result code, %s (%u)", - str, - oct); - - offset++; + proto_tree_add_item(tree, hf_ansi_683_data_commit_result_code, tvb, offset, 1, ENC_NA); } /* * 3.5.1.7 */ static void -msg_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_protocap_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, num_feat, add_len; - const gchar *str = NULL; guint32 i, saved_offset; - guint32 value; proto_tree *subtree; proto_item *item; @@ -3187,30 +2262,19 @@ msg_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) saved_offset = offset; - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "Mobile station firmware revision number (%u)", - value); + proto_tree_add_item(tree, hf_ansi_683_mobile_station_fw_rev, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; oct = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Mobile station manufacturer's model number (%u)", - oct); + proto_tree_add_item(tree, hf_ansi_683_mobile_station_manuf_model_number, tvb, offset, 1, ENC_NA); offset++; num_feat = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of features (%u)", - num_feat); + proto_tree_add_item(tree, hf_ansi_683_num_features, tvb, offset, 1, ENC_NA); offset++; @@ -3220,25 +2284,17 @@ msg_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_feat_id_type(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: Feature ID, %s (%u)", - i+1, - str, - oct); + item = proto_tree_add_uint_format(tree, hf_ansi_683_feature_id, + tvb, offset, 1, oct, + "Feature ID #%u: %s (%u)", + i+1, rval_to_str_const(oct, feat_id_type_rvals, "Reserved"), oct); subtree = proto_item_add_subtree(item, ett_rev_feat); offset++; oct = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "Feature protocol version (%u)", - oct); + proto_tree_add_item(subtree, hf_ansi_683_feature_protocol_version, tvb, offset, 1, ENC_NA); offset++; } @@ -3255,56 +2311,21 @@ msg_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, + subtree = proto_tree_add_subtree(tree, + tvb, offset, 1, ett_band_cap, NULL, "Band/Mode Capability Information"); - subtree = proto_item_add_subtree(item, ett_band_cap); - - other_decode_bitfield_value(bigbuf, oct, 0x80, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Band Class 0 Analog", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x40, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Band Class 0 CDMA", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x20, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Band Class 1 CDMA", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x10, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Band Class 3 CDMA", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x08, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Band Class 6 CDMA", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x07, 8); - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); - + proto_tree_add_item(subtree, hf_ansi_683_band_class_0_analog, tvb, offset, 1, ENC_NA); + proto_tree_add_item(subtree, hf_ansi_683_band_class_0_cdma, tvb, offset, 1, ENC_NA); + proto_tree_add_item(subtree, hf_ansi_683_band_class_1_cdma, tvb, offset, 1, ENC_NA); + proto_tree_add_item(subtree, hf_ansi_683_band_class_3_cdma, tvb, offset, 1, ENC_NA); + proto_tree_add_item(subtree, hf_ansi_683_band_class_6_cdma, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(subtree, hf_ansi_683_reserved8, tvb, offset<<3, 3, ENC_NA); offset++; if (add_len > 1) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, add_len - 1, - "More Additional Fields"); + proto_tree_add_item(tree, hf_ansi_683_more_additional_fields, tvb, offset, add_len - 1, ENC_NA); offset += (add_len - 1); } } @@ -3316,38 +2337,19 @@ msg_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.8 */ static void -msg_sspr_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_sspr_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; SHORT_DATA_CHECK(len, 3); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_sspr(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_rev_param_block_sspr, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "SSPR Configuration result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_sspr_configuration_result_code, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -3360,8 +2362,7 @@ msg_sspr_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(tree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -3378,56 +2379,28 @@ msg_sspr_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.9 */ static void -msg_sspr_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_sspr_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id; - const gchar *str = NULL; - guint32 value; + guint8 block_id; EXACT_DATA_CHECK(len, 5); block_id = tvb_get_guint8(tvb, offset); - str = for_param_block_sspr(block_id); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - block_id); - + proto_tree_add_item(tree, hf_ansi_683_for_param_block_sspr, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "SSPR Download result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_sspr_download_result_code, tvb, offset, 1, ENC_NA); offset++; switch (block_id) { case FOR_BLOCK_SSPR_PRL: case FOR_BLOCK_SSPR_EXT_PRL: - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "Segment offset (%u)", - value); + proto_tree_add_item(tree, hf_ansi_683_segment_offset, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Maximum segment size (%u)", - oct); + proto_tree_add_item(tree, hf_ansi_683_maximum_segment_size, tvb, offset, 1, ENC_NA); offset++; break; } @@ -3437,13 +2410,11 @@ msg_sspr_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 3.5.1.10 */ static void -msg_validate_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_validate_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id, num_blocks; - const gchar *str = NULL; + guint8 num_blocks; guint32 i, saved_offset; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -3451,10 +2422,7 @@ msg_validate_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -3462,31 +2430,14 @@ msg_validate_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) for (i=0; i < num_blocks; i++) { - block_id = tvb_get_guint8(tvb, offset); - - str = for_param_block_val(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 2, ett_for_val_block, NULL, + "Block ID #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_for_val_block); + proto_tree_add_item(subtree, hf_ansi_683_param_block_val, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -3497,10 +2448,9 @@ msg_validate_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.11 */ static void -msg_otapa_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_otapa_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct; - const gchar *str = NULL; guint32 saved_offset; SHORT_DATA_CHECK(len, 2); @@ -3509,39 +2459,24 @@ msg_otapa_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) oct = tvb_get_guint8(tvb, offset); - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%d)", - str, - oct); + proto_tree_add_uint_format(tree, hf_ansi_683_result_code, + tvb, offset, 1, oct, "OTAPA result code: %s (%u)", + rval_to_str_const(oct, result_codes_rvals, "Reserved"), oct); offset++; oct = tvb_get_guint8(tvb, offset); - other_decode_bitfield_value(bigbuf, oct, 0xfe, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x01, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : NAM_LOCK indicator", - bigbuf); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, (offset<<3)+1, 7, ENC_NA); + proto_tree_add_item(tree, hf_ansi_683_nam_lock_indicator, tvb, offset, 1, ENC_NA); offset++; if (oct & 0x01) { SHORT_DATA_CHECK((len - (offset - saved_offset)), 4); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 4, - "SPASM random challenge"); + proto_tree_add_item(tree, hf_ansi_683_spasm_random_challenge, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } @@ -3552,38 +2487,19 @@ msg_otapa_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.12 */ static void -msg_puzl_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_puzl_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; SHORT_DATA_CHECK(len, 3); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_puzl(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_rev_param_block_puzl, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "PUZL Configuration result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_puzl_configuration_result_code, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -3596,8 +2512,7 @@ msg_puzl_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(tree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -3614,14 +2529,12 @@ msg_puzl_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.13 */ static void -msg_puzl_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_puzl_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id, num_blocks; - const gchar *str = NULL; - guint32 i, saved_offset; - proto_tree *subtree; + guint8 oct, num_blocks; + guint32 i, saved_offset, block_offset; proto_item *item; - guint32 value, temp_value; + proto_tree *subtree; SHORT_DATA_CHECK(len, 1); @@ -3629,10 +2542,7 @@ msg_puzl_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -3641,31 +2551,16 @@ msg_puzl_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset for (i=0; i < num_blocks; i++) { - block_id = tvb_get_guint8(tvb, offset); - - str = for_param_block_puzl(block_id); + block_offset = offset; - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_puzl_block, &item, + "Block #%u", i+1); - subtree = proto_item_add_subtree(item, ett_for_puzl_block); + proto_tree_add_item(subtree, hf_ansi_683_for_param_block_puzl, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; oct = tvb_get_guint8(tvb, offset); @@ -3674,57 +2569,21 @@ msg_puzl_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset { SHORT_DATA_CHECK(len, 4); - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : Identifiers present", - bigbuf); - - other_decode_bitfield_value(bigbuf, value, 0x7fff, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : User Zone ID (MSB)", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_identifiers_present16, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_ansi_683_user_zone_id, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 2; - temp_value = (value & 0x7fff) << 1; - value = tvb_get_ntohs(tvb, offset); - - other_decode_bitfield_value(bigbuf, value, 0x8000, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : User Zone ID (%u)", - bigbuf, - temp_value + ((value & 0x8000) >> 15)); - - other_decode_bitfield_value(bigbuf, value, 0x7fff, 16); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "%s : User Zone SID (%u)", - bigbuf, - (value & 0x7fff)); - + proto_tree_add_item(tree, hf_ansi_683_user_zone_sid, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } else { - other_decode_bitfield_value(bigbuf, oct, 0x80, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Identifiers not present", - bigbuf); - - other_decode_bitfield_value(bigbuf, oct, 0x7f, 8); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s : Reserved", - bigbuf); - + proto_tree_add_item(tree, hf_ansi_683_identifiers_present8, tvb, offset, 1, ENC_NA); + proto_tree_add_bits_item(tree, hf_ansi_683_reserved8, tvb, offset<<3, 7, ENC_NA); offset++; } + + proto_item_set_len(item, offset - block_offset); } EXTRANEOUS_DATA_CHECK(len, offset - saved_offset); @@ -3734,13 +2593,12 @@ msg_puzl_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 3.5.1.14 */ static void -msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_3gpd_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id, num_blocks, block_len; - const gchar *str = NULL; + guint8 block_id, num_blocks, block_len; guint32 i, saved_offset; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; SHORT_DATA_CHECK(len, 1); @@ -3748,10 +2606,7 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -3762,17 +2617,12 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = rev_param_block_3gpd(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_rev_3gpd_block, &item, + "Block #%u", i+1); - subtree = proto_item_add_subtree(item, ett_rev_3gpd_block); + proto_tree_add_uint(subtree, hf_ansi_683_rev_param_block_3gpd, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -3783,10 +2633,10 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -3807,8 +2657,7 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) case REV_BLOCK_3GPD_HRPD_ACC_AUTH_USER: case REV_BLOCK_3GPD_HRPD_ACC_AUTH_CHAP_SS: default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -3817,16 +2666,7 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) SHORT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -3843,13 +2683,11 @@ msg_3gpd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.15 */ static void -msg_3gpd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_3gpd_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, num_blocks; - const gchar *str = NULL; + guint8 num_blocks; guint32 i, saved_offset; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -3857,10 +2695,7 @@ msg_3gpd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -3868,31 +2703,13 @@ msg_3gpd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset for (i=0; i < num_blocks; i++) { - oct = tvb_get_guint8(tvb, offset); - - str = for_param_block_3gpd(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - - subtree = proto_item_add_subtree(item, ett_for_3gpd_block); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 2, ett_for_3gpd_block, NULL, + "Block #%u", i+1); + proto_tree_add_item(subtree, hf_ansi_683_for_param_block_3gpd, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -3903,38 +2720,23 @@ msg_3gpd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 3.5.1.16 */ static void -msg_secure_mode_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_secure_mode_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - const gchar *str = NULL; - EXACT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Secure Mode result code, %s (%u)", - str, - oct); - - offset++; + proto_tree_add_item(tree, hf_ansi_683_secure_mode_result_code, tvb, offset, 1, ENC_NA); } /* * 3.5.1.17 */ static void -msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_ext_protocap_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { guint8 oct, block_id, num_recs, block_len; - const gchar *str = NULL; guint32 i, saved_offset; - guint32 value; proto_tree *subtree; - proto_item *item; + proto_item *item, *len_item; SHORT_DATA_CHECK(len, 6); @@ -3942,38 +2744,18 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) oct = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "OTASP Mobile Protocol Revision (%u)", - oct); + proto_tree_add_item(tree, hf_ansi_683_otasp_mobile_protocol_revision, tvb, offset, 1, ENC_NA); offset++; - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "Mobile station firmware revision number (%u)", - value); - + proto_tree_add_item(tree, hf_ansi_683_mobile_station_fw_rev, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Mobile station manufacturer's model number (%u)", - oct); - + proto_tree_add_item(tree, hf_ansi_683_mobile_station_manuf_model_number, tvb, offset, 1, ENC_NA); offset++; num_recs = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of features (%u)", - num_recs); - + proto_tree_add_item(tree, hf_ansi_683_num_features, tvb, offset, 1, ENC_NA); offset++; SHORT_DATA_CHECK((len - (offset - saved_offset)), (guint32)(num_recs * 2)); @@ -3982,25 +2764,15 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { oct = tvb_get_guint8(tvb, offset); - str = rev_feat_id_type(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: Feature ID, %s (%u)", - i+1, - str, - oct); + item = proto_tree_add_uint_format(tree, hf_ansi_683_feature_id, + tvb, offset, 1, oct, + "Feature ID #%u: %s (%u)", + i+1, rval_to_str_const(oct, feat_id_type_rvals, "Reserved"), oct); subtree = proto_item_add_subtree(item, ett_rev_feat); offset++; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "Feature protocol version (%u)", - oct); + proto_tree_add_item(subtree, hf_ansi_683_feature_protocol_version, tvb, offset, 1, ENC_NA); offset++; } @@ -4009,10 +2781,7 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_recs = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of Capability Records (%u)", - num_recs); + proto_tree_add_item(tree, hf_ansi_683_number_of_capability_records, tvb, offset, 1, ENC_NA); offset++; @@ -4023,31 +2792,24 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = rev_cap_info_record_type(block_id); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_rev_cap); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_rev_cap, &item, + "Block ID #%u", i+1); + proto_tree_add_item(subtree, hf_ansi_683_cap_info_record_type, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(subtree, hf_ansi_683_length, + len_item = proto_tree_add_uint(subtree, hf_ansi_683_length, tvb, offset, 1, block_len); offset++; if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + expert_add_info(pinfo, len_item, &ei_ansi_683_short_data); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -4064,8 +2826,7 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) #endif default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Capability Data"); + proto_tree_add_item(subtree, hf_ansi_683_capability_data, tvb, offset, block_len, ENC_NA); break; } @@ -4080,13 +2841,12 @@ msg_ext_protocap_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.18 */ static void -msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mmd_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id, num_blocks, block_len; - const gchar *str = NULL; + guint8 block_id, num_blocks, block_len; guint32 i, saved_offset; - proto_tree *subtree; proto_item *item; + proto_tree *subtree; SHORT_DATA_CHECK(len, 1); @@ -4094,10 +2854,7 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -4108,17 +2865,12 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = rev_param_block_mmd(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_rev_mmd_block, &item, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_rev_mmd_block); + proto_tree_add_uint(subtree, hf_ansi_683_rev_param_block_mmd, + tvb, offset, 1, block_id); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -4129,11 +2881,12 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); + if (block_len > 0) { switch (block_id) @@ -4145,8 +2898,7 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) #endif default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -4155,16 +2907,7 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) SHORT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -4181,13 +2924,11 @@ msg_mmd_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.19 */ static void -msg_mmd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mmd_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, num_blocks; - const gchar *str = NULL; + guint8 num_blocks; guint32 i, saved_offset; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -4195,42 +2936,21 @@ msg_mmd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); - + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; SHORT_DATA_CHECK((len - (offset - saved_offset)), (guint32)(num_blocks * 2)); for (i=0; i < num_blocks; i++) { - oct = tvb_get_guint8(tvb, offset); - - str = for_param_block_mmd(oct); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 2, ett_for_mmd_block, NULL, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - - subtree = proto_item_add_subtree(item, ett_for_mmd_block); + proto_tree_add_item(subtree, hf_ansi_683_for_param_block_mmd, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -4241,38 +2961,19 @@ msg_mmd_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.20 */ static void -msg_systag_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_systag_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_len; - const gchar *str = NULL; + guint8 block_len; guint32 saved_offset; SHORT_DATA_CHECK(len, 3); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - - str = rev_param_block_systag(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_rev_param_block_systag, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "System Tag result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_system_tag_result_code, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -4285,8 +2986,7 @@ msg_systag_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset if (block_len > 0) { - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(tree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); offset += block_len; } @@ -4297,39 +2997,20 @@ msg_systag_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset * 3.5.1.21 */ static void -msg_systag_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_systag_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id; - const gchar *str = NULL; + guint8 block_id; guint32 saved_offset; - guint32 value; SHORT_DATA_CHECK(len, 2); saved_offset = offset; block_id = tvb_get_guint8(tvb, offset); - - str = for_param_block_systag(block_id); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - block_id); - + proto_tree_add_item(tree, hf_ansi_683_for_param_block_systag, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "System Tag Download result code, %s (%u)", - str, - oct); - + proto_tree_add_item(tree, hf_ansi_683_system_tag_download_result_code, tvb, offset, 1, ENC_NA); offset++; switch (block_id) @@ -4339,20 +3020,10 @@ msg_systag_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offs case 0x03: /* Call Prompt List Parameter */ SHORT_DATA_CHECK(len, 3); - value = tvb_get_ntohs(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 2, - "Segment offset (%u)", - value); + proto_tree_add_item(tree, hf_ansi_683_segment_offset, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - oct = tvb_get_guint8(tvb, offset); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Segment size (%u)", - oct); + proto_tree_add_item(tree, hf_ansi_683_segment_size, tvb, offset, 1, ENC_NA); offset++; break; @@ -4367,37 +3038,23 @@ msg_systag_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offs * 3.5.1.22 */ static void -msg_srvckey_gen_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_srvckey_gen_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct; - const gchar *str = NULL; - EXACT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Service Key Generation result code, %s (%u)", - str, - oct); - - offset++; + proto_tree_add_item(tree, hf_ansi_683_service_key_generation_result_code, tvb, offset, 1, ENC_NA); } /* * 3.5.1.23 */ static void -msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mms_config_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, block_id, num_blocks, block_len; - const gchar *str = NULL; + guint8 block_id, num_blocks, block_len; guint32 i, saved_offset; + proto_tree *item; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -4405,10 +3062,7 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -4419,17 +3073,11 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) { block_id = tvb_get_guint8(tvb, offset); - str = rev_param_block_mms(block_id); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_rev_mms_block, &item, + "Block #%u", i+1); - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - block_id); - - subtree = proto_item_add_subtree(item, ett_rev_mms_block); + proto_tree_add_item(subtree, hf_ansi_683_rev_param_block_mms, tvb, offset, 1, ENC_NA); offset++; block_len = tvb_get_guint8(tvb, offset); @@ -4440,10 +3088,10 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) if (block_len > (len - (offset - saved_offset))) { - proto_tree_add_none_format(subtree, hf_ansi_683_none, tvb, - offset, len - (offset - saved_offset), "Short Data (?)"); + proto_tree_add_expert(subtree, pinfo, &ei_ansi_683_short_data, tvb, offset, len - (offset - saved_offset)); return; } + proto_item_set_len(item, block_len+1); if (block_len > 0) { @@ -4460,8 +3108,7 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) #endif default: - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, block_len, "Block Data"); + proto_tree_add_item(subtree, hf_ansi_683_block_data, tvb, offset, block_len, ENC_NA); break; } @@ -4470,16 +3117,7 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) SHORT_DATA_CHECK(len, 1); - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -4496,13 +3134,11 @@ msg_mms_config_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) * 3.5.1.24 */ static void -msg_mms_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) +msg_mms_download_rsp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) { - guint8 oct, num_blocks; - const gchar *str = NULL; + guint8 num_blocks; guint32 i, saved_offset; proto_tree *subtree; - proto_item *item; SHORT_DATA_CHECK(len, 1); @@ -4510,10 +3146,7 @@ msg_mms_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) num_blocks = tvb_get_guint8(tvb, offset); - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "Number of parameter blocks (%u)", - num_blocks); + proto_tree_add_item(tree, hf_ansi_683_number_of_parameter_blocks, tvb, offset, 1, ENC_NA); offset++; @@ -4521,31 +3154,14 @@ msg_mms_download_rsp(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) for (i=0; i < num_blocks; i++) { - oct = tvb_get_guint8(tvb, offset); + subtree = proto_tree_add_subtree_format(tree, + tvb, offset, 1, ett_for_mms_block, NULL, + "Block #%u", i+1); - str = for_param_block_mms(oct); - - item = - proto_tree_add_none_format(tree, hf_ansi_683_none, - tvb, offset, 1, - "[%u]: %s (%u)", - i+1, - str, - oct); - - subtree = proto_item_add_subtree(item, ett_for_mms_block); + proto_tree_add_item(subtree, hf_ansi_683_for_param_block_mms, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - - str = rev_res_code_type(oct); - - proto_tree_add_none_format(subtree, hf_ansi_683_none, - tvb, offset, 1, - "%s (%u)", - str, - oct); - + proto_tree_add_item(subtree, hf_ansi_683_result_code, tvb, offset, 1, ENC_NA); offset++; } @@ -4580,7 +3196,7 @@ static const value_string for_msg_type_strings[] = { { 0, NULL } }; #define NUM_FOR_MSGS (sizeof(for_msg_type_strings)/sizeof(value_string)) -static void (*ansi_683_for_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) = { +static void (*ansi_683_for_msg_fcn[])(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) = { msg_config_req, /* Configuration Request */ msg_download_req, /* Download Request */ msg_ms_key_req, /* MS Key Request */ @@ -4636,7 +3252,7 @@ static const value_string rev_msg_type_strings[] = { { 0, NULL } }; #define NUM_REV_MSGS (sizeof(rev_msg_type_strings)/sizeof(value_string)) -static void (*ansi_683_rev_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset) = { +static void (*ansi_683_rev_msg_fcn[])(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint len, guint32 offset) = { msg_config_rsp, /* Configuration Response */ msg_download_rsp, /* Download Response */ msg_ms_key_rsp, /* MS Key Response */ @@ -4666,7 +3282,7 @@ static void (*ansi_683_rev_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint len static void -dissect_ansi_683_for_message(tvbuff_t *tvb, proto_tree *ansi_683_tree) +dissect_ansi_683_for_message(tvbuff_t *tvb, packet_info* pinfo, proto_tree *ansi_683_tree) { guint8 msg_type; gint idx; @@ -4691,12 +3307,12 @@ dissect_ansi_683_for_message(tvbuff_t *tvb, proto_tree *ansi_683_tree) if (ansi_683_for_msg_fcn[idx] != NULL) { - (*ansi_683_for_msg_fcn[idx])(tvb, ansi_683_tree, tvb_length(tvb) - 1, 1); + (*ansi_683_for_msg_fcn[idx])(tvb, pinfo, ansi_683_tree, tvb_length(tvb) - 1, 1); } } static void -dissect_ansi_683_rev_message(tvbuff_t *tvb, proto_tree *ansi_683_tree) +dissect_ansi_683_rev_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ansi_683_tree) { guint8 msg_type; gint idx; @@ -4719,42 +3335,36 @@ dissect_ansi_683_rev_message(tvbuff_t *tvb, proto_tree *ansi_683_tree) proto_tree_add_uint(ansi_683_tree, hf_ansi_683_rev_msg_type, tvb, 0, 1, msg_type); - (*ansi_683_rev_msg_fcn[idx])(tvb, ansi_683_tree, tvb_length(tvb) - 1, 1); + (*ansi_683_rev_msg_fcn[idx])(tvb, pinfo, ansi_683_tree, tvb_length(tvb) - 1, 1); } static void dissect_ansi_683(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ansi_683_item; - proto_tree *ansi_683_tree = NULL; + proto_tree *ansi_683_tree; - col_set_str(pinfo->cinfo, COL_PROTOCOL, ansi_proto_name_short); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "IS-683"); - /* In the interest of speed, if "tree" is NULL, don't do any work not - * necessary to generate protocol tree items. - */ - if (tree) - { - /* - * create the ansi_683 protocol tree - */ - ansi_683_item = - proto_tree_add_protocol_format(tree, proto_ansi_683, tvb, 0, -1, - "%s %s Link", - ansi_proto_name, - (pinfo->match_uint == ANSI_683_FORWARD) ? "Forward" : "Reverse"); + /* + * create the ansi_683 protocol tree + */ + ansi_683_item = + proto_tree_add_protocol_format(tree, proto_ansi_683, tvb, 0, -1, + "%s %s Link", + ansi_proto_name, + (pinfo->match_uint == ANSI_683_FORWARD) ? "Forward" : "Reverse"); - ansi_683_tree = - proto_item_add_subtree(ansi_683_item, ett_ansi_683); + ansi_683_tree = + proto_item_add_subtree(ansi_683_item, ett_ansi_683); - if (pinfo->match_uint == ANSI_683_FORWARD) - { - dissect_ansi_683_for_message(tvb, ansi_683_tree); - } - else - { - dissect_ansi_683_rev_message(tvb, ansi_683_tree); - } + if (pinfo->match_uint == ANSI_683_FORWARD) + { + dissect_ansi_683_for_message(tvb, pinfo, ansi_683_tree); + } + else + { + dissect_ansi_683_rev_message(tvb, pinfo, ansi_683_tree); } } @@ -4782,40 +3392,190 @@ proto_register_ansi_683(void) FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, - { &hf_ansi_683_none, - { "Sub tree", "ansi_683.none", - FT_NONE, BASE_NONE, 0, 0, + { &hf_ansi_683_reserved8, + { "Reserved", "ansi_683.reserved", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_ansi_683_reserved16_f, + { "Reserved", "ansi_683.reserved", + FT_UINT16, BASE_HEX, NULL, 0x000f, NULL, HFILL } }, + { &hf_ansi_683_reserved24_f, + { "Reserved", "ansi_683.reserved", + FT_UINT24, BASE_HEX, NULL, 0x00000f, + NULL, HFILL } + }, + { &hf_ansi_683_reserved_bytes, + { "Reserved", "ansi_683.reserved_bytes", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_ansi_683_fresh_incl16, { "FRESH_INCL", "ansi_683.fresh_incl", FT_BOOLEAN, 16, TFS(&tfs_true_false), 0x8000, NULL, HFILL }}, + { &hf_ansi_683_fresh, { "FRESH", "ansi_683.fresh", FT_UINT16, BASE_DEC, NULL, 0x7fff, NULL, HFILL }}, + { &hf_ansi_683_fresh_incl8, { "FRESH_INCL", "ansi_683.fresh_incl", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x80, NULL, HFILL }}, + { &hf_ansi_683_firstchp, { "First paging channel (FIRSTCHP) used in the home system", "ansi_683.firstchp", FT_UINT16, BASE_DEC, NULL, 0xffe0, NULL, HFILL }}, + { &hf_ansi_683_home_sid, { "Home system identification (HOME_SID)", "ansi_683.home_sid", FT_UINT24, BASE_DEC, NULL, 0x1fffc0, NULL, HFILL }}, + { &hf_ansi_683_extended_address_indicator, { "Extended address indicator (EX)", "ansi_683.extended_address_indicator", FT_UINT8, BASE_DEC, NULL, 0x20, NULL, HFILL }}, + { &hf_ansi_683_station_class_mark, { "Station class mark (SCM)", "ansi_683.station_class_mark", FT_UINT16, BASE_DEC, NULL, 0x1fe0, NULL, HFILL }}, + { &hf_ansi_683_extended_scm_indicator, { "Extended SCM Indicator", "ansi_683.extended_scm_indicator", FT_BOOLEAN, 16, TFS(&tfs_extended_scm_indicator), 0x1000, NULL, HFILL }}, + { &hf_ansi_683_cdma_analog_mode, { "Mode", "ansi_683.cdma_analog_mode", FT_BOOLEAN, 16, TFS(&tfs_cdma_analog_mode), 0x0800, NULL, HFILL }}, + { &hf_ansi_683_cdma_analog_slotted, { "Slotted", "ansi_683.cdma_analog_slotted", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0400, NULL, HFILL }}, + { &hf_ansi_683_meid, { "MEID", "ansi_683.meid", FT_BOOLEAN, 16, TFS(&tfs_configured_not_configured), 0x0200, NULL, HFILL }}, + { &hf_ansi_683_25mhz_bandwidth, { "25 MHz Bandwidth", "ansi_683.25mhz_bandwidth", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL }}, + { &hf_ansi_683_transmission, { "Transmission", "ansi_683.transmission", FT_BOOLEAN, 16, TFS(&tfs_discontinuous_continous), 0x0080, NULL, HFILL }}, + { &hf_ansi_683_power_class, { "Power Class for Band Class 0 Analog Operation", "ansi_683.power_class", FT_UINT16, BASE_DEC, VALS(power_class_vals), 0x0060, NULL, HFILL }}, + { &hf_ansi_683_mob_p_rev_1fe0, { "Mobile station protocol revision number (MOB_P_REV)", "ansi_683.mob_p_rev", FT_UINT16, BASE_DEC, NULL, 0x1fe0, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_class10, { "IMSI_M Class assignment of the mobile station (IMSI_M_CLASS)", "ansi_683.imsi_m_class", FT_UINT16, BASE_DEC, NULL, 0x10, NULL, HFILL }}, + { &hf_ansi_683_ismi_m_addr_num_e, { "Number of IMSI_M address digits (IMSI_M_ADDR_NUM)", "ansi_683.ismi_m_addr_num", FT_UINT16, BASE_DEC, NULL, 0x0e, NULL, HFILL }}, + { &hf_ansi_683_mcc_m_01ff80, { "Mobile country code (MCC_M)", "ansi_683.mcc_m", FT_UINT24, BASE_DEC, NULL, 0x01ff80, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_11_12_7f, { "11th and 12th digits of the IMSI_M (IMSI__M_11_12)", "ansi_683.imsi_m_11_12", FT_UINT24, BASE_HEX, NULL, 0x00007f, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_10, { "The least significant 10 digits of the IMSI_M (IMSI_M_S) (34 bits)", "ansi_683.imsi_m_10", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_accolc_3c, { "Access overload class (ACCOLC)", "ansi_683.accolc", FT_UINT8, BASE_DEC, NULL, 0x3c, NULL, HFILL }}, + { &hf_ansi_683_local_control_status_02, { "Local control status (LOCAL_CONTROL)", "ansi_683.local_control_status", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }}, + { &hf_ansi_683_mob_term_home_01, { "Termination indicator for the home system (MOB_TERM_HOME)", "ansi_683.mob_term_home", FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_sid_80, { "Termination indicator for SID roaming (MOB_TERM_FOR_SID)", "ansi_683.mob_term_for_sid", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_nid_40, { "Termination indicator for NID roaming (MOB_TERM_FOR_NID)", "ansi_683.mob_term_for_nid", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL }}, + { &hf_ansi_683_max_sid_nid_3fc0, { "Maximum stored SID/NID pairs (MAX_SID_NID)", "ansi_683.max_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x3fc0, NULL, HFILL }}, + { &hf_ansi_683_stored_sid_nid_3fc0, { "Number of stored SID/NID pairs (STORED_SID_NID)", "ansi_683.stored_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x3fc0, NULL, HFILL }}, + { &hf_ansi_683_sid_nid_pairs_3fff, { "SID/NID pairs", "ansi_683.sid_nid_pairs", FT_UINT16, BASE_DEC, NULL, 0x3fff, NULL, HFILL }}, + { &hf_ansi_683_n_digits, { "Number of digits (N_DIGITS)", "ansi_683n_digits", FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }}, + { &hf_ansi_683_slotted_mode, { "Slotted Mode", "ansi_683.slotted_mode", FT_UINT8, BASE_DEC, NULL, 0x20, NULL, HFILL }}, + { &hf_ansi_683_mob_p_rev_ff, { "Mobile station protocol revision number (MOB_P_REV)", "ansi_683.mob_p_rev", FT_UINT8, BASE_DEC, NULL, 0xFF, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_class8000, { "IMSI_M Class assignment of the mobile station (IMSI_M_CLASS)", "ansi_683.imsi_m_class", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_addr_num_7000, { "Number of IMSI_M address digits (IMSI_M_ADDR_NUM)", "ansi_683.imsi_m_addr_num", FT_UINT16, BASE_DEC, NULL, 0x7000, NULL, HFILL }}, + { &hf_ansi_683_mcc_m_0ffc, { "Mobile country code (MCC_M)", "ansi_683.mcc_m", FT_UINT16, BASE_DEC, NULL, 0x0ffc, NULL, HFILL }}, + { &hf_ansi_683_imsi_m_11_12_3f80, { "11th and 12th digits of the IMSI_M (IMSI__M_11_12)", "ansi_683.imsi_m_11_12", FT_UINT16, BASE_DEC, NULL, 0x3f80, NULL, HFILL }}, + { &hf_ansi_683_accolc_01e0, { "Access overload class (ACCOLC)", "ansi_683.accolc", FT_UINT16, BASE_DEC, NULL, 0x01e0, NULL, HFILL }}, + { &hf_ansi_683_local_control_status_0010, { "Local control status (LOCAL_CONTROL)", "ansi_683.local_control_status", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL }}, + { &hf_ansi_683_mob_term_home_08, { "Termination indicator for the home system (MOB_TERM_HOME)", "ansi_683.mob_term_home", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_sid_0004, { "Termination indicator for SID roaming (MOB_TERM_FOR_SID)", "ansi_683.mob_term_for_sid", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_nid_0002, { "Termination indicator for NID roaming (MOB_TERM_FOR_NID)", "ansi_683.mob_term_for_nid", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL }}, + { &hf_ansi_683_max_sid_nid_01fe, { "Maximum stored SID/NID pairs (MAX_SID_NID)", "ansi_683.max_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x01fe, NULL, HFILL }}, + { &hf_ansi_683_stored_sid_nid_01fe, { "Number of stored SID/NID pairs (STORED_SID_NID)", "ansi_683.stored_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x01fe, NULL, HFILL }}, + { &hf_ansi_683_sid_nid_pairs_01ff, { "SID/NID pairs", "ansi_683.sid_nid_pairs", FT_UINT16, BASE_DEC, NULL, 0x01ff, NULL, HFILL }}, + { &hf_ansi_683_imsi_t_class, { "IMSI_T Class assignment of the mobile station (IMSI_T_CLASS)", "ansi_683.imsi_t_class", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }}, + { &hf_ansi_683_imsi_t_addr_num, { "Number of IMSI_T address digits (IMSI_T_ADDR_NUM )", "ansi_683.imsi_t_addr_num", FT_UINT8, BASE_DEC, NULL, 0x70, NULL, HFILL }}, + { &hf_ansi_683_mcc_t, { "Mobile country code (MCC_T)", "ansi_683.mcc_t", FT_UINT16, BASE_NONE, NULL, 0x0ffc, NULL, HFILL }}, + { &hf_ansi_683_imsi_t_11_12, { "11th and 12th digits of the IMSI_T (IMSI__T_11_12)", "ansi_683.imsi_t_11_12", FT_UINT16, BASE_DEC, NULL, 0x03f8, NULL, HFILL }}, + { &hf_ansi_683_imsi_t_10, { "The least significant 10 digits of the IMSI_T (IMSI_T_S) (34 bits)", "ansi_683.imsi_t_10", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_sid_8000, { "Termination indicator for SID roaming (MOB_TERM_FOR_SID)", "ansi_683.mob_term_for_sid", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }}, + { &hf_ansi_683_mob_term_for_nid_4000, { "Termination indicator for NID roaming (MOB_TERM_FOR_NID)", "ansi_683.mob_term_for_nid", FT_UINT16, BASE_DEC, NULL, 0x4000, NULL, HFILL }}, + { &hf_ansi_683_num_sid_nid_3fc0, { "Number of SID/NID pairs (N_SID_NID)", "ansi_683.num_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x3fc0, NULL, HFILL }}, + { &hf_ansi_683_num_sid_nid_01fe, { "Number of SID/NID pairs (N_SID_NID)", "ansi_683.num_sid_nid", FT_UINT16, BASE_DEC, NULL, 0x01fe, NULL, HFILL }}, + { &hf_ansi_683_otapa_spasm_validation_signature_indicator_80, { "OTAPA SPASM validation signature indicator", "ansi_683.otapa_spasm_validation_signature_indicator", FT_BOOLEAN, 8, TFS(&tfs_included_not_included), 0x80, NULL, HFILL }}, + { &hf_ansi_683_spasm_protection_for_the_active_nam_40, { "SPASM protection for the active NAM", "ansi_683.spasm_protection_for_the_active_nam", FT_BOOLEAN, 8, TFS(&tfs_activate_do_not_activate), 0x40, NULL, HFILL }}, + { &hf_ansi_683_otapa_spasm_validation_signature_indicator_800000, { "OTAPA SPASM validation signature indicator", "ansi_683.otapa_spasm_validation_signature_indicator", FT_BOOLEAN, 24, TFS(&tfs_included_not_included), 0x800000, NULL, HFILL }}, + { &hf_ansi_683_otapa_spasm_validation_signature, { "OTAPA SPASM validation signature", "ansi_683.otapa_spasm_validation_signature", FT_UINT24, BASE_HEX, NULL, 0x7fffe0, NULL, HFILL }}, + { &hf_ansi_683_spasm_protection_for_the_active_nam_000010, { "SPASM protection for the active NAM", "ansi_683.spasm_protection_for_the_active_nam", FT_BOOLEAN, 24, TFS(&tfs_activate_do_not_activate), 0x000010, NULL, HFILL }}, + { &hf_ansi_683_number_of_parameter_blocks, { "Number of parameter blocks", "ansi_683.number_of_parameter_blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_block_data, { "Block Data", "ansi_683.block_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_a_key_protocol_revision, { "A-Key Protocol Revision", "ansi_683.a_key_protocol_revision", FT_UINT8, BASE_DEC, VALS(akey_protocol_revision_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_parameter_p, { "Parameter P", "ansi_683.parameter_p", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_parameter_g, { "Parameter G", "ansi_683.parameter_g", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_base_station_calculation_result, { "Base Station Calculation Result", "ansi_683.base_station_calculation_result", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_random_challenge_value, { "Random Challenge value", "ansi_683.random_challenge_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_otasp_protocol_revision, { "OTASP protocol revision", "ansi_683.otasp_protocol_revision", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_number_of_capability_records, { "Number of Capability Records", "ansi_683.number_of_capability_records", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_segment_offset, { "Segment offset", "ansi_683.segment_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_maximum_segment_size, { "Maximum segment size", "ansi_683.maximum_segment_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_start_otapa_session, { "OTAPA session", "ansi_683.otapa_session", FT_BOOLEAN, 8, TFS(&tfs_start_stop), 0x80, NULL, HFILL }}, + { &hf_ansi_683_start_secure_mode, { "Secure Mode", "ansi_683.secure_mode", FT_BOOLEAN, 8, TFS(&tfs_start_stop), 0x80, NULL, HFILL }}, + { &hf_ansi_683_security, { "Security", "ansi_683.security", FT_UINT8, BASE_DEC, NULL, 0x78, NULL, HFILL }}, + { &hf_ansi_683_random_number_smck_generation, { "Random Number used for SMCK generation", "ansi_683.random_number_smck_generation", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_key_id_ims_root_key, { "Key ID", "ansi_683.key_id.ims_root_key", FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }}, + { &hf_ansi_683_key_id_bcmcs_root_key, { "Key ID", "ansi_683.key_id.bcmcs_root_key", FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }}, + { &hf_ansi_683_key_id_wlan_root_key, { "Key ID", "ansi_683.key_id.wlan_root_key", FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL }}, + { &hf_ansi_683_key_id_reserved, { "Key ID", "ansi_683.key_id.reserved", FT_UINT16, BASE_HEX, NULL, 0x1ff0, NULL, HFILL }}, + { &hf_ansi_683_key_exchange_result_code, { "Key exchange result code", "ansi_683.key_exchange_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_mobile_station_calculation_result, { "Mobile station calculation result", "ansi_683.mobile_station_calculation_result", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_authr, { "Authentication signature data (AUTHR)", "ansi_683.authr", FT_UINT24, BASE_DEC, NULL, 0xffffc0, NULL, HFILL }}, + { &hf_ansi_683_randc, { "Random challenge value (RANDC)", "ansi_683.randc", FT_UINT16, BASE_DEC, NULL, 0x3fc0, NULL, HFILL }}, + { &hf_ansi_683_call_history_parameter, { "Call history parameter (COUNT)", "ansi_683.call_history_parameter", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }}, + { &hf_ansi_683_authentication_data_input_parameter, { "Authentication Data input parameter (AUTH_DATA)", "ansi_683.authentication_data_input_parameter", FT_UINT24, BASE_DEC, NULL, 0xffffff, NULL, HFILL }}, + { &hf_ansi_683_data_commit_result_code, { "Data commit result code", "ansi_683.data_commit_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_mobile_station_fw_rev, { "Mobile station firmware revision number", "ansi_683.mobile_station_fw_rev", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_mobile_station_manuf_model_number, { "Mobile station manufacturer's model number", "ansi_683.mobile_station_manuf_model_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_num_features, { "Number of features", "ansi_683.num_features", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_feature_id, { "Feature ID", "ansi_683.feature_id", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(feat_id_type_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_feature_protocol_version, { "Feature protocol version", "ansi_683.feature_protocol_version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_band_class_0_analog, { "Band Class 0 Analog", "ansi_683.band_class_0_analog", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, + { &hf_ansi_683_band_class_0_cdma, { "Band Class 0 CDMA", "ansi_683.band_class_0_cdma", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }}, + { &hf_ansi_683_band_class_1_cdma, { "Band Class 1 CDMA", "ansi_683.band_class_1_cdma", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }}, + { &hf_ansi_683_band_class_3_cdma, { "Band Class 3 CDMA", "ansi_683.band_class_3_cdma", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }}, + { &hf_ansi_683_band_class_6_cdma, { "Band Class 6 CDMA", "ansi_683.band_class_6_cdma", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }}, + { &hf_ansi_683_more_additional_fields, { "More Additional Fields", "ansi_683.more_additional_fields", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_sspr_configuration_result_code, { "SSPR Configuration result code", "ansi_683.sspr_configuration_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_sspr_download_result_code, { "SSPR Download result code", "ansi_683.sspr_download_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_nam_lock_indicator, { "NAM_LOCK indicator", "ansi_683.nam_lock_indicator", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }}, + { &hf_ansi_683_spasm_random_challenge, { "SPASM random challenge", "ansi_683.spasm_random_challenge", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_puzl_configuration_result_code, { "PUZL Configuration result code", "ansi_683.puzl_configuration_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_identifiers_present16, { "Identifiers", "ansi_683.identifiers.present", FT_BOOLEAN, 16, TFS(&tfs_present_not_present), 0x8000, NULL, HFILL }}, + { &hf_ansi_683_user_zone_id, { "User Zone ID", "ansi_683.user_zone_id", FT_UINT24, BASE_DEC, NULL, 0x7fff80, NULL, HFILL }}, + { &hf_ansi_683_user_zone_sid, { "User Zone SID", "ansi_683.user_zone_sid", FT_UINT16, BASE_DEC, NULL, 0x7fff, NULL, HFILL }}, + { &hf_ansi_683_identifiers_present8, { "Identifiers", "ansi_683.identifiers.present", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80, NULL, HFILL }}, + { &hf_ansi_683_secure_mode_result_code, { "Secure Mode result code", "ansi_683.secure_mode_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_otasp_mobile_protocol_revision, { "OTASP Mobile Protocol Revision", "ansi_683.otasp_mobile_protocol_revision", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_capability_data, { "Capability Data", "ansi_683.capability_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_system_tag_result_code, { "System Tag result code", "ansi_683.system_tag_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_system_tag_download_result_code, { "System Tag Download result code", "ansi_683.system_tag_download_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_segment_size, { "Segment size", "ansi_683.segment_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_service_key_generation_result_code, { "Service Key Generation result code", "ansi_683.service_key_generation_result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_result_code, { "Result Code", "ansi_683.result_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(result_codes_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_cap_info_record_type, { "Capability Record Type", "ansi_683.cap_info_record_type", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(rev_cap_info_record_type_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_param_block_val, { "Parameter Block Value", "ansi_683.param_block_val", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_sspr, { "Parameter Block SSPR", "ansi_683.param_block_sspr", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(rev_param_block_sspr_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_sspr, { "Parameter Block SSPR", "ansi_683.param_block_sspr", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_sspr_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_nam, { "NAM Parameter Block Type", "ansi_683.param_block_nam", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(rev_param_block_nam_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_nam, { "NAM Parameter Block Type", "ansi_683.param_block_nam", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_nam_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_puzl, { "PUZL Parameter Block Type", "ansi_683.param_block_puzl", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(rev_param_block_puzl_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_puzl, { "PUZL Parameter Block Type", "ansi_683.param_block_puzl", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_puzl_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_3gpd, { "3GPD Parameter Block Type", "ansi_683.param_block_3gpd", FT_UINT8, BASE_DEC, VALS(rev_param_block_3gpd_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_3gpd, { "3GPD Parameter Block Type", "ansi_683.param_block_3gpd", FT_UINT8, BASE_DEC, VALS(for_param_block_3gpd_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_mmd, { "MMD Parameter Block Type", "ansi_683.param_block_mmd", FT_UINT8, BASE_DEC, VALS(param_block_mmd_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_mmd, { "MMD Parameter Block Type", "ansi_683.param_block_mmd", FT_UINT8, BASE_DEC, VALS(param_block_mmd_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_systag, { "System Tag Parameter Block Type", "ansi_683.param_block_systag", FT_UINT8, BASE_DEC, VALS(rev_param_block_systag_vals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_systag, { "System Tag Parameter Block Type", "ansi_683.param_block_systag", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_systag_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_rev_param_block_mms, { "MMS Parameter Block Type", "ansi_683.param_block_mms", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(rev_param_block_mms_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_for_param_block_mms, { "MMS Parameter Block Type", "ansi_683.param_block_mms", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(for_param_block_mms_rvals), 0x0, NULL, HFILL }}, + { &hf_ansi_683_mobile_directory_number, { "Modbile directory number", "ansi_683.mobile_directory_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ansi_683_service_programming_code, { "Service programming code", "ansi_683.service_programming_code", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + }; + + static gint *ett[] = { + &ett_ansi_683, + &ett_for_nam_block, + &ett_rev_nam_block, + &ett_key_p, + &ett_key_g, + &ett_rev_feat, + &ett_for_val_block, + &ett_for_sspr_block, + &ett_band_cap, + &ett_rev_sspr_block, + &ett_scm, + &ett_for_puzl_block, + &ett_rev_puzl_block, + &ett_for_3gpd_block, + &ett_rev_3gpd_block, + &ett_for_mmd_block, + &ett_rev_mmd_block, + &ett_for_mms_block, + &ett_rev_mms_block, + &ett_rev_cap, + &ett_segment, + }; + + static ei_register_info ei[] = { + { &ei_ansi_683_extraneous_data, { "ansi_683.extraneous_data", PI_PROTOCOL, PI_WARN, "Extraneous Data", EXPFILL }}, + { &ei_ansi_683_short_data, { "ansi_683.short_data", PI_MALFORMED, PI_ERROR, "Short Data (?)", EXPFILL }}, + { &ei_ansi_683_data_length, { "ansi_683.data_length.invalid", PI_PROTOCOL, PI_WARN, "Unexpected Data Length", EXPFILL }}, }; - /* Setup protocol subtree array */ -#define NUM_INDIVIDUAL_PARAMS 21 - static gint *ett[NUM_INDIVIDUAL_PARAMS]; - - memset((void *) ett, 0, sizeof(ett)); - - ett[0] = &ett_ansi_683; - ett[1] = &ett_for_nam_block; - ett[2] = &ett_rev_nam_block; - ett[3] = &ett_key_p; - ett[4] = &ett_key_g; - ett[5] = &ett_rev_feat; - ett[6] = &ett_for_val_block; - ett[7] = &ett_for_sspr_block; - ett[8] = &ett_band_cap; - ett[9] = &ett_rev_sspr_block; - ett[10] = &ett_scm; - ett[11] = &ett_for_puzl_block; - ett[12] = &ett_rev_puzl_block; - ett[13] = &ett_for_3gpd_block; - ett[14] = &ett_rev_3gpd_block; - ett[15] = &ett_for_mmd_block; - ett[16] = &ett_rev_mmd_block; - ett[17] = &ett_for_mms_block; - ett[18] = &ett_rev_mms_block; - ett[19] = &ett_rev_cap; - ett[20] = &ett_segment; + expert_module_t* expert_ansi_683; /* Register the protocol name and description */ proto_ansi_683 = @@ -4824,6 +3584,8 @@ proto_register_ansi_683(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_ansi_683, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ansi_683 = expert_register_protocol(proto_ansi_683); + expert_register_field_array(expert_ansi_683, ei, array_length(ei)); } |