Coverage Report

Created: 2026-05-14 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-gsm_sim.c
Line
Count
Source
1
/* packet-gsm_sim.c
2
 * Routines for packet dissection of GSM SIM APDUs (GSM TS 11.11)
3
 *
4
 *  GSM TS 11.11 / 3GPP TS 51.011
5
 *  3GPP TS 31.102
6
 * Copyright 2010-2011 by Harald Welte <laforge@gnumonks.org>
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/tfs.h>
19
#include <epan/unit_strings.h>
20
#include <epan/expert.h>
21
#include <epan/reassemble.h>
22
23
#include <wiretap/wtap.h>
24
25
#include "packet-gsmtap.h"
26
#include "packet-sgp22.h"
27
#include "packet-sgp32.h"
28
29
void proto_register_gsm_sim(void);
30
void proto_reg_handoff_gsm_sim(void);
31
32
static int proto_gsm_sim;
33
34
/* ISO 7816-4 APDU */
35
static int hf_apdu_cla_coding;
36
static int hf_apdu_cla_coding_ext;
37
static int hf_apdu_cla_secure_messaging_ind;
38
static int hf_apdu_cla_secure_messaging_ind_ext;
39
static int hf_apdu_cla_log_chan;
40
static int hf_apdu_cla_log_chan_ext;
41
static int hf_apdu_ins;
42
static int hf_apdu_p1;
43
static int hf_apdu_p2;
44
static int hf_apdu_p3;
45
static int hf_apdu_lc;
46
static int hf_apdu_lc_ext;
47
static int hf_apdu_le;
48
static int hf_apdu_le_ext;
49
static int hf_apdu_data;
50
static int hf_apdu_sw;
51
static int hf_apdu_unknown;
52
53
static int hf_file_id;
54
static int hf_aid;
55
static int hf_bin_offset;
56
static int hf_referencing;
57
static int hf_sfi;
58
static int hf_record_nr;
59
static int hf_record_id;
60
static int hf_record_file;
61
static int hf_record_mode;
62
static int hf_auth_rand_len;
63
static int hf_auth_rand;
64
static int hf_auth_autn_len;
65
static int hf_auth_autn;
66
static int hf_auth_reference;
67
static int hf_auth_rfu;
68
static int hf_auth_context;
69
static int hf_auth_challenge;
70
static int hf_auth_response;
71
static int hf_auth_status;
72
static int hf_auth_res_len;
73
static int hf_auth_res;
74
static int hf_auth_ck_len;
75
static int hf_auth_ck;
76
static int hf_auth_ik_len;
77
static int hf_auth_ik;
78
static int hf_auth_kc_len;
79
static int hf_auth_kc;
80
static int hf_auth_auts_len;
81
static int hf_auth_auts;
82
static int hf_auth_gsm_rand;
83
static int hf_auth_gsm_sres_len;
84
static int hf_auth_gsm_sres;
85
static int hf_auth_gsm_kc_len;
86
static int hf_auth_gsm_kc;
87
static int hf_chan_op;
88
static int hf_chan_nr;
89
90
static int hf_select_type;
91
static int hf_select_session_control;
92
static int hf_select_unused_p2;
93
static int hf_select_return_data;
94
static int hf_select_selection;
95
96
static int hf_status_application_status;
97
static int hf_status_return_data;
98
99
static int hf_template_tag;
100
static int hf_template_len;
101
102
/* FCP template */
103
static int hf_fcp;
104
static int hf_fcp_tag;
105
static int hf_fcp_len;
106
static int hf_fcp_value;
107
static int hf_fcp_file_size;
108
static int hf_fcp_file_id;
109
static int hf_fcp_df_name;
110
static int hf_fcp_file_rfu_byte;
111
static int hf_fcp_file_rfu;
112
static int hf_fcp_file_accessibility;
113
static int hf_fcp_file_type;
114
static int hf_fcp_file_type_ext;
115
static int hf_fcp_ef_structure;
116
static int hf_fcp_ef_structure_ext;
117
static int hf_fcp_data_coding_byte;
118
static int hf_fcp_lifecycle_status;
119
static int hf_fcp_security_attr_compact;
120
static int hf_fcp_security_attr_expanded;
121
static int hf_fcp_security_attr_referenced;
122
static int hf_fcp_pin_status_do;
123
static int hf_fcp_total_file_size;
124
static int hf_fcp_sfi;
125
static int hf_fcp_record_len;
126
static int hf_fcp_num_records;
127
static int hf_fcp_prop;
128
static int hf_fcp_prop_tag;
129
static int hf_fcp_prop_len;
130
static int hf_fcp_prop_value;
131
static int hf_fcp_prop_uicc_clock_stop_allowed;
132
static int hf_fcp_prop_uicc_clock_stop_rfu;
133
static int hf_fcp_prop_uicc_clock_stop_0;
134
static int hf_fcp_prop_uicc_clock_stop_1;
135
static int hf_fcp_prop_uicc_supply_voltage_a;
136
static int hf_fcp_prop_uicc_supply_voltage_b;
137
static int hf_fcp_prop_uicc_supply_voltage_c;
138
static int hf_fcp_prop_uicc_supply_voltage_d;
139
static int hf_fcp_prop_app_supply_voltage_class;
140
static int hf_fcp_prop_app_power_consumption;
141
static int hf_fcp_prop_app_frequency;
142
static int hf_fcp_prop_min_app_clock_freq;
143
static int hf_fcp_prop_avail_memory;
144
static int hf_fcp_prop_file_details_der_encoding;
145
static int hf_fcp_prop_file_details_rfu;
146
static int hf_fcp_prop_reserved_file_size;
147
static int hf_fcp_prop_max_file_size;
148
static int hf_fcp_prop_supported_sys_cmds_terminal_capability;
149
static int hf_fcp_prop_supported_sys_cmds_rfu;
150
static int hf_fcp_prop_uicc_env_conditions_temp_class;
151
static int hf_fcp_prop_uicc_env_conditions_high_humidity;
152
static int hf_fcp_prop_uicc_env_conditions_rfu;
153
static int hf_fcp_prop_platform_to_platform_cat_secured_apdu;
154
static int hf_fcp_prop_test_config_state;
155
static int hf_fcp_prop_test_config_criterion_type;
156
157
static int hf_search_ef_identifier;
158
static int hf_search_mode;
159
static int hf_search_enhanced_type;
160
static int hf_search_enhanced_mode;
161
static int hf_search_enhanced_offset;
162
static int hf_search_enhanced_value;
163
164
static int hf_suspend_uicc_op;
165
static int hf_suspend_uicc_min_time_unit;
166
static int hf_suspend_uicc_min_time_length;
167
static int hf_suspend_uicc_max_time_unit;
168
static int hf_suspend_uicc_max_time_length;
169
static int hf_suspend_uicc_resume_token;
170
171
static int hf_store_data_block;
172
static int hf_store_data_encryption;
173
static int hf_store_data_structure;
174
static int hf_store_data_rfu;
175
static int hf_store_data_iso_case;
176
static int hf_store_data_block_nr;
177
178
/* Chapter 5.2 TS 11.14 and TS 31.111 */
179
static int hf_tprof_b1;
180
static int hf_tprof_b2;
181
static int hf_tprof_b3;
182
static int hf_tprof_b4;
183
static int hf_tprof_b5;
184
static int hf_tprof_b6;
185
static int hf_tprof_b7;
186
static int hf_tprof_b8;
187
static int hf_tprof_b9;
188
static int hf_tprof_b10;
189
static int hf_tprof_b11;
190
static int hf_tprof_b12;
191
static int hf_tprof_b13;
192
static int hf_tprof_b14;
193
static int hf_tprof_b15;
194
static int hf_tprof_b16;
195
static int hf_tprof_b17;
196
static int hf_tprof_b18;
197
static int hf_tprof_b19;
198
static int hf_tprof_b20;
199
static int hf_tprof_b21;
200
static int hf_tprof_b22;
201
static int hf_tprof_b23;
202
static int hf_tprof_b24;
203
static int hf_tprof_b25;
204
static int hf_tprof_b26;
205
static int hf_tprof_b27;
206
static int hf_tprof_b28;
207
static int hf_tprof_b29;
208
static int hf_tprof_b30;
209
static int hf_tprof_b31;
210
static int hf_tprof_b32;
211
static int hf_tprof_b33;
212
static int hf_tprof_b34;
213
static int hf_tprof_b35;
214
static int hf_tprof_b36;
215
static int hf_tprof_b37;
216
static int hf_tprof_b38;
217
static int hf_tprof_b39;
218
static int hf_tprof_unknown_byte;
219
/* First byte */
220
static int hf_tp_prof_dld;
221
static int hf_tp_sms_data_dld;
222
static int hf_tp_cb_data_dld;
223
static int hf_tp_menu_sel;
224
static int hf_tp_sms_data_dld_support;
225
static int hf_tp_timer_exp;
226
static int hf_tp_cc_sim_support;
227
static int hf_tp_cc_sim_support2;
228
/* Second byte (Other) */
229
static int hf_tp_cmd_res;
230
static int hf_tp_cc_sim;
231
static int hf_tp_cc_sim_support3;
232
static int hf_tp_mo_sms_sim;
233
static int hf_tp_cc_sim_support4;
234
static int hf_tp_ucs2_entry;
235
static int hf_tp_ucs2_display;
236
static int hf_tp_display_ext;
237
/* 3rd byte (Proactive SIM) */
238
static int hf_tp_pa_display_text;
239
static int hf_tp_pa_get_inkey;
240
static int hf_tp_pa_get_input;
241
static int hf_tp_pa_more_time;
242
static int hf_tp_pa_play_tone;
243
static int hf_tp_pa_poll_intv;
244
static int hf_tp_pa_polling_off;
245
static int hf_tp_pa_refresh;
246
/* 4th byte (Proactive SIM) */
247
static int hf_tp_pa_select_item;
248
static int hf_tp_pa_send_sms;
249
static int hf_tp_pa_send_ss;
250
static int hf_tp_pa_send_ussd;
251
static int hf_tp_pa_set_up_call;
252
static int hf_tp_pa_set_up_menu;
253
static int hf_tp_pa_prov_loci;
254
static int hf_tp_pa_prov_loci_nmr;
255
/* 5th byte (Event drive information) */
256
static int hf_tp_pa_evt_list;
257
static int hf_tp_ev_mt_call;
258
static int hf_tp_ev_call_connected;
259
static int hf_tp_ev_call_disconnected;
260
static int hf_tp_ev_location_status;
261
static int hf_tp_ev_user_activity;
262
static int hf_tp_ev_idle_screen;
263
static int hf_tp_ev_cardreader_status;
264
/* 6th byte (Event drive information extension) */
265
static int hf_tp_ev_lang_sel;
266
static int hf_tp_ev_brows_term;
267
static int hf_tp_ev_data_avail;
268
static int hf_tp_ev_chan_status;
269
static int hf_tp_ev_access_techno_change;
270
static int hf_tp_ev_disp_params_changed;
271
static int hf_tp_ev_local_conn;
272
static int hf_tp_ev_nwk_search_mode_change;
273
/* 7th byte (Multiple card proactive commands) */
274
static int hf_tp_pa_power_on;
275
static int hf_tp_pa_power_off;
276
static int hf_tp_pa_perform_card_apdu;
277
static int hf_tp_pa_get_reader_status;
278
static int hf_tp_pa_get_reader_status_id;
279
static int hf_tp_rfu;
280
/* 8th byte (Proactive SIM) */
281
static int hf_tp_pa_timer_start_stop;
282
static int hf_tp_pa_timer_get_current;
283
static int hf_tp_pa_prov_loci_date_tz;
284
static int hf_tp_pa_get_inkey_binary;
285
static int hf_tp_pa_set_up_idle_mode_text;
286
static int hf_tp_pa_run_at_command;
287
static int hf_tp_pa_2nd_alpha_setup_call;
288
static int hf_tp_pa_2nd_cc_sim_support;
289
/* 9th byte */
290
static int hf_tp_display_text;
291
static int hf_tp_send_dtmf_cmd;
292
static int hf_tp_pa_prov_loci_nmr2;
293
static int hf_tp_pa_prov_loci_lang;
294
static int hf_tp_pa_prov_loci_ta;
295
static int hf_tp_pa_lang_notif;
296
static int hf_tp_pa_launch_browser;
297
static int hf_tp_pa_prov_loci_access_techno;
298
/* 10th byte */
299
static int hf_tp_soft_key_support_select_item;
300
static int hf_tp_soft_key_support_set_up_menu;
301
static int hf_tp_rfu2;
302
/* 11th byte */
303
static int hf_tp_soft_key_info_max_nb;
304
/* 12th byte (Proactive SIM) */
305
static int hf_tp_pa_open_chan;
306
static int hf_tp_pa_close_chan;
307
static int hf_tp_pa_recv_data;
308
static int hf_tp_pa_send_data;
309
static int hf_tp_pa_get_chan_status;
310
static int hf_tp_pa_serv_search;
311
static int hf_tp_pa_get_serv_info;
312
static int hf_tp_pa_decl_serv;
313
/* 13th byte (Proactive SIM) */
314
static int hf_tp_bip_csd;
315
static int hf_tp_bip_gprs;
316
static int hf_tp_bip_bluetooth;
317
static int hf_tp_bip_irda;
318
static int hf_tp_bip_rs232;
319
static int hf_tp_num_chans;
320
/* 14th byte (Screen height) */
321
static int hf_tp_char_height;
322
static int hf_tp_nd;
323
static int hf_tp_nk;
324
static int hf_tp_sizing_supp;
325
/* 15th byte (Screen width) */
326
static int hf_tp_char_width;
327
static int hf_tp_var_fonts;
328
/* 16th byte (Screen effects) */
329
static int hf_tp_display_resize;
330
static int hf_tp_text_wrapping;
331
static int hf_tp_text_scrolling;
332
static int hf_tp_text_attributes;
333
static int hf_tp_rfu3;
334
static int hf_tp_width_red_menu;
335
/* 17th byte (Proactive SIM) */
336
static int hf_tp_bip_tcp_remote;
337
static int hf_tp_bip_udp_remote;
338
static int hf_tp_bip_tcp_server;
339
static int hf_tp_bip_tcp_local;
340
static int hf_tp_bip_udp_local;
341
static int hf_tp_bip_direct_com;
342
static int hf_tp_bip_eutran;
343
static int hf_tp_bip_hsdpa;
344
/* 18th byte */
345
static int hf_tp_pa_display_text_var_time_out;
346
static int hf_tp_pa_get_inkey_help;
347
static int hf_tp_bip_usb;
348
static int hf_tp_pa_get_inkey_var_time_out;
349
static int hf_tp_pa_prov_loci_esn;
350
static int hf_tp_cc_gprs;
351
static int hf_tp_pa_prov_loci_imeisv;
352
static int hf_tp_pa_prov_loci_search_mode_change;
353
/* 19th byte (TIA/EIA-136) */
354
static int hf_tp_tia_eia_version;
355
static int hf_tp_rfu4;
356
/* 20th byte (TIA/EIA/IS-820-A) */
357
static int hf_tp_tia_iea_is820a_reserved;
358
/* 21th byte (Extended Launch Browser Capability) */
359
static int hf_tp_ext_launch_browser_wml;
360
static int hf_tp_ext_launch_browser_xhtml;
361
static int hf_tp_ext_launch_browser_html;
362
static int hf_tp_ext_launch_browser_chtml;
363
static int hf_tp_rfu5;
364
/* 22th byte */
365
static int hf_tp_utran_ps_ext_params;
366
static int hf_tp_pa_prov_loci_batt_state;
367
static int hf_tp_pa_play_tone_melody;
368
static int hf_tp_mm_call_set_up_call;
369
static int hf_tp_toolkit_initiated_gba;
370
static int hf_tp_pa_retrieve_mm_msg;
371
static int hf_tp_pa_submit_mm_msg;
372
static int hf_tp_pa_display_mm_msg;
373
/* 23th byte */
374
static int hf_tp_pa_set_frames;
375
static int hf_tp_pa_get_frames_status;
376
static int hf_tp_mms_notif_download;
377
static int hf_tp_alpha_id_refresh_cmd;
378
static int hf_tp_geo_loc_report;
379
static int hf_tp_pa_prov_loci_meid;
380
static int hf_tp_pa_prov_loci_nmr_utran_eutran;
381
static int hf_tp_ussd_data_download;
382
/* 24th byte (Class "i") */
383
static int hf_tp_class_i_max_nb_frames;
384
static int hf_tp_rfu6;
385
/* 25th byte (Event driven information extensions) */
386
static int hf_tp_evt_browsing_status;
387
static int hf_tp_evt_mms_transfer_status;
388
static int hf_tp_evt_frame_info_changed;
389
static int hf_tp_evt_iwlan_access_status;
390
static int hf_tp_evt_nw_reject_geran_utran;
391
static int hf_tp_evt_hci_connectivity;
392
static int hf_tp_evt_nw_reject_eutran;
393
static int hf_tp_evt_mult_access_techno_change;
394
/* 26th byte (Event driven information extensions) */
395
static int hf_tp_evt_csg_cell_select;
396
static int hf_tp_evt_contactless_state_req;
397
static int hf_tp_rfu7;
398
/* 27th byte (Event driven information extensions) */
399
static int hf_tp_rfu8;
400
/* 28th byte (Text attributes) */
401
static int hf_tp_text_align_left;
402
static int hf_tp_text_align_centre;
403
static int hf_tp_text_align_right;
404
static int hf_tp_text_font_size_normal;
405
static int hf_tp_text_font_size_large;
406
static int hf_tp_text_font_size_small;
407
static int hf_tp_rfu9;
408
/* 29th byte (Text attributes) */
409
static int hf_tp_text_style_normal;
410
static int hf_tp_text_style_bold;
411
static int hf_tp_text_style_italic;
412
static int hf_tp_text_style_underlined;
413
static int hf_tp_text_style_strikethrough;
414
static int hf_tp_text_style_text_fg_colour;
415
static int hf_tp_text_style_text_bg_colour;
416
static int hf_tp_rfu10;
417
/* 30th byte */
418
static int hf_tp_bip_iwlan;
419
static int hf_tp_pa_prov_loci_wsid;
420
static int hf_tp_term_app;
421
static int hf_tp_steering_roaming_refresh;
422
static int hf_tp_pa_activate;
423
static int hf_tp_pa_geo_loc_req;
424
static int hf_tp_pa_prov_loci_broadcast_nw_info;
425
static int hf_tp_steering_roaming_iwlan_refresh;
426
/* 31th byte */
427
static int hf_tp_pa_contactless_state_changed;
428
static int hf_tp_csg_cell_discovery;
429
static int hf_tp_cnf_params_support_open_chan_server_mode;
430
static int hf_tp_com_ctrl_ims;
431
static int hf_tp_cat_over_modem_itf;
432
static int hf_tp_evt_incoming_data_ims;
433
static int hf_tp_evt_ims_registration;
434
static int hf_tp_pa_prof_env_cont;
435
/* 32th byte */
436
static int hf_tp_bip_ims;
437
static int hf_tp_pa_prov_loci_henb_ip_addr;
438
static int hf_tp_pa_prov_loci_henb_surround_macro;
439
static int hf_tp_launch_params_support_open_chan_server_mode;
440
static int hf_tp_direct_com_support_open_chan_server_mode;
441
static int hf_tp_pa_sec_prof_env_cont;
442
static int hf_tp_cat_serv_list_ecat_client;
443
static int hf_tp_support_refresh_enforcement_policy;
444
/* 33th byte */
445
static int hf_tp_support_dns_addr_req;
446
static int hf_tp_support_nw_access_name_reuse;
447
static int hf_tp_ev_poll_intv_nego;
448
static int hf_tp_prose_usage_info_reporting;
449
static int hf_tp_pa_prov_loci_rat;
450
static int hf_tp_evt_wlan_access_status;
451
static int hf_tp_wlan_bearer;
452
static int hf_tp_pa_prov_loci_wlan_id;
453
/* 34th byte */
454
static int hf_tp_uri_send_short_msg;
455
static int hf_tp_ims_uri_setup_call;
456
static int hf_tp_media_type_voice_setup_call;
457
static int hf_tp_media_type_video_setup_call;
458
static int hf_tp_pa_prov_loci_eutran_timing_advance_info;
459
static int hf_tp_refresh_euicc_profile_state_change;
460
static int hf_tp_ext_rej_cause_code_nw_reject_eutran;
461
static int hf_tp_deprecated_b34;
462
/* 35th byte */
463
static int hf_tp_pa_get_input_var_timeout;
464
static int hf_tp_data_conn_status_change_pdp;
465
static int hf_tp_data_conn_status_change_pdn;
466
static int hf_tp_refresh_app_update;
467
static int hf_tp_pa_lsi_proactive_session_request;
468
static int hf_tp_pa_lsi_uicc_platform_reset;
469
static int hf_tp_rfu11;
470
/* 36th byte */
471
static int hf_tp_data_conn_status_change_pdu;
472
static int hf_tp_evt_nw_reject_ng_ran;
473
static int hf_tp_non_ip_data_delivery;
474
static int hf_tp_prov_loci_slice_info;
475
static int hf_tp_refresh_sor_cmci_param;
476
static int hf_tp_evt_nw_reject_satellite_ng_ran;
477
static int hf_tp_cag_feature;
478
static int hf_tp_evt_slices_status_change;
479
/* 37th byte */
480
static int hf_tp_prov_loci_rejected_slice_info;
481
static int hf_tp_ext_info_pli;
482
static int hf_tp_chaining_pli_env_cmds;
483
static int hf_tp_5g_prose_usage_info_reporting;
484
static int hf_tp_rfu12;
485
/* 38th byte */
486
static int hf_tp_rfu13;
487
/* 39th byte */
488
static int hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info;
489
static int hf_tp_rfu14;
490
491
/* Terminal Capability */
492
static int hf_tc;
493
static int hf_tc_tag;
494
static int hf_tc_len;
495
static int hf_tc_value;
496
static int hf_tc_actual_used_supply_voltage_class;
497
static int hf_tc_max_available_power_supply;
498
static int hf_tc_actual_used_clock_frequency;
499
static int hf_tc_additional_interfaces_uicc_clf;
500
static int hf_tc_additional_interfaces_rfu;
501
static int hf_tc_sgp22_luid;
502
static int hf_tc_sgp22_lpdd;
503
static int hf_tc_sgp22_ldsd;
504
static int hf_tc_sgp22_luie;
505
static int hf_tc_sgp22_rfu;
506
static int hf_tc_sgp32_ipad;
507
static int hf_tc_sgp32_rfu;
508
509
static int hf_cat_ber_tag;
510
511
static int hf_related_to;
512
static int hf_response_in;
513
static int hf_response_to;
514
static int hf_response_time;
515
516
static int ett_sim;
517
static int ett_tprof_b1;
518
static int ett_tprof_b2;
519
static int ett_tprof_b3;
520
static int ett_tprof_b4;
521
static int ett_tprof_b5;
522
static int ett_tprof_b6;
523
static int ett_tprof_b7;
524
static int ett_tprof_b8;
525
static int ett_tprof_b9;
526
static int ett_tprof_b10;
527
static int ett_tprof_b11;
528
static int ett_tprof_b12;
529
static int ett_tprof_b13;
530
static int ett_tprof_b14;
531
static int ett_tprof_b15;
532
static int ett_tprof_b16;
533
static int ett_tprof_b17;
534
static int ett_tprof_b18;
535
static int ett_tprof_b19;
536
static int ett_tprof_b20;
537
static int ett_tprof_b21;
538
static int ett_tprof_b22;
539
static int ett_tprof_b23;
540
static int ett_tprof_b24;
541
static int ett_tprof_b25;
542
static int ett_tprof_b26;
543
static int ett_tprof_b27;
544
static int ett_tprof_b28;
545
static int ett_tprof_b29;
546
static int ett_tprof_b30;
547
static int ett_tprof_b31;
548
static int ett_tprof_b32;
549
static int ett_tprof_b33;
550
static int ett_tprof_b34;
551
static int ett_tprof_b35;
552
static int ett_tprof_b36;
553
static int ett_tprof_b37;
554
static int ett_tprof_b38;
555
static int ett_tprof_b39;
556
static int ett_terminal_capability;
557
static int ett_auth_challenge;
558
static int ett_auth_response;
559
static int ett_fcp;
560
static int ett_fcp_proprietary;
561
562
static expert_field ei_unknown_bytes;
563
564
static dissector_handle_t sub_handle_cap;
565
static dissector_handle_t sim_handle, sim_part_handle;
566
567
/* The response contains no channel number to compare to and the spec explicitly
568
 * prohibits interleaving of command/response pairs, regardless of logical channels.
569
 */
570
typedef struct gsm_sim_transaction {
571
  uint32_t cmd_frame;
572
  uint32_t rsp_frame;
573
  nstime_t cmd_time;
574
  uint8_t  cmd_ins;
575
  uint8_t  cmd_p1;
576
  uint8_t  cmd_p2;
577
578
  /* Related transaction used for GET RESPONSE and APDU reassembly. May point to self. */
579
  struct gsm_sim_transaction *related_trans;
580
} gsm_sim_transaction_t;
581
582
static wmem_tree_t *transactions;
583
static reassembly_table gsm_sim_reassembly_table;
584
585
static int hf_gsm_sim_fragments;
586
static int hf_gsm_sim_fragment;
587
static int hf_gsm_sim_fragment_overlap;
588
static int hf_gsm_sim_fragment_overlap_conflicts;
589
static int hf_gsm_sim_fragment_multiple_tails;
590
static int hf_gsm_sim_fragment_too_long_fragment;
591
static int hf_gsm_sim_fragment_error;
592
static int hf_gsm_sim_fragment_count;
593
static int hf_gsm_sim_reassembled_in;
594
static int hf_gsm_sim_reassembled_length;
595
596
static int ett_gsm_sim_fragment;
597
static int ett_gsm_sim_fragments;
598
599
static const fragment_items gsm_sim_frag_items = {
600
  /* Fragment subtrees */
601
  &ett_gsm_sim_fragment,
602
  &ett_gsm_sim_fragments,
603
  /* Fragment fields */
604
  &hf_gsm_sim_fragments,
605
  &hf_gsm_sim_fragment,
606
  &hf_gsm_sim_fragment_overlap,
607
  &hf_gsm_sim_fragment_overlap_conflicts,
608
  &hf_gsm_sim_fragment_multiple_tails,
609
  &hf_gsm_sim_fragment_too_long_fragment,
610
  &hf_gsm_sim_fragment_error,
611
  &hf_gsm_sim_fragment_count,
612
  /* Reassembled in field */
613
  &hf_gsm_sim_reassembled_in,
614
  /* Reassembled length field */
615
  &hf_gsm_sim_reassembled_length,
616
  /* Reassembled data field */
617
  NULL,
618
  /* Tag */
619
  "APDU fragments"
620
};
621
622
static int * const tprof_b1_fields[] = {
623
  &hf_tp_prof_dld,
624
  &hf_tp_sms_data_dld,
625
  &hf_tp_cb_data_dld,
626
  &hf_tp_menu_sel,
627
  &hf_tp_sms_data_dld_support,
628
  &hf_tp_timer_exp,
629
  &hf_tp_cc_sim_support,
630
  &hf_tp_cc_sim_support2,
631
  NULL
632
};
633
634
static int * const tprof_b2_fields[] = {
635
  &hf_tp_cmd_res,
636
  &hf_tp_cc_sim,
637
  &hf_tp_cc_sim_support3,
638
  &hf_tp_mo_sms_sim,
639
  &hf_tp_cc_sim_support4,
640
  &hf_tp_ucs2_entry,
641
  &hf_tp_ucs2_display,
642
  &hf_tp_display_ext,
643
  NULL
644
};
645
646
static int * const tprof_b3_fields[] = {
647
  &hf_tp_pa_display_text,
648
  &hf_tp_pa_get_inkey,
649
  &hf_tp_pa_get_input,
650
  &hf_tp_pa_more_time,
651
  &hf_tp_pa_play_tone,
652
  &hf_tp_pa_poll_intv,
653
  &hf_tp_pa_polling_off,
654
  &hf_tp_pa_refresh,
655
  NULL
656
};
657
658
static int * const tprof_b4_fields[] = {
659
  &hf_tp_pa_select_item,
660
  &hf_tp_pa_send_sms,
661
  &hf_tp_pa_send_ss,
662
  &hf_tp_pa_send_ussd,
663
  &hf_tp_pa_set_up_call,
664
  &hf_tp_pa_set_up_menu,
665
  &hf_tp_pa_prov_loci,
666
  &hf_tp_pa_prov_loci_nmr,
667
  NULL
668
};
669
670
static int * const tprof_b5_fields[] = {
671
  &hf_tp_pa_evt_list,
672
  &hf_tp_ev_mt_call,
673
  &hf_tp_ev_call_connected,
674
  &hf_tp_ev_call_disconnected,
675
  &hf_tp_ev_location_status,
676
  &hf_tp_ev_user_activity,
677
  &hf_tp_ev_idle_screen,
678
  &hf_tp_ev_cardreader_status,
679
  NULL
680
};
681
682
static int * const tprof_b6_fields[] = {
683
  &hf_tp_ev_lang_sel,
684
  &hf_tp_ev_brows_term,
685
  &hf_tp_ev_data_avail,
686
  &hf_tp_ev_chan_status,
687
  &hf_tp_ev_access_techno_change,
688
  &hf_tp_ev_disp_params_changed,
689
  &hf_tp_ev_local_conn,
690
  &hf_tp_ev_nwk_search_mode_change,
691
  NULL
692
};
693
694
static int * const tprof_b7_fields[] = {
695
  &hf_tp_pa_power_on,
696
  &hf_tp_pa_power_off,
697
  &hf_tp_pa_perform_card_apdu,
698
  &hf_tp_pa_get_reader_status,
699
  &hf_tp_pa_get_reader_status_id,
700
  &hf_tp_rfu,
701
  NULL
702
};
703
704
static int * const tprof_b8_fields[] = {
705
  &hf_tp_pa_timer_start_stop,
706
  &hf_tp_pa_timer_get_current,
707
  &hf_tp_pa_prov_loci_date_tz,
708
  &hf_tp_pa_get_inkey_binary,
709
  &hf_tp_pa_set_up_idle_mode_text,
710
  &hf_tp_pa_run_at_command,
711
  &hf_tp_pa_2nd_alpha_setup_call,
712
  &hf_tp_pa_2nd_cc_sim_support,
713
  NULL
714
};
715
716
static int * const tprof_b9_fields[] = {
717
  &hf_tp_display_text,
718
  &hf_tp_send_dtmf_cmd,
719
  &hf_tp_pa_prov_loci_nmr2,
720
  &hf_tp_pa_prov_loci_lang,
721
  &hf_tp_pa_prov_loci_ta,
722
  &hf_tp_pa_lang_notif,
723
  &hf_tp_pa_launch_browser,
724
  &hf_tp_pa_prov_loci_access_techno,
725
  NULL
726
};
727
728
static int * const tprof_b10_fields[] = {
729
  &hf_tp_soft_key_support_select_item,
730
  &hf_tp_soft_key_support_set_up_menu,
731
  &hf_tp_rfu2,
732
  NULL
733
};
734
735
static int * const tprof_b11_fields[] = {
736
  &hf_tp_soft_key_info_max_nb,
737
  NULL
738
};
739
740
static int * const tprof_b12_fields[] = {
741
  &hf_tp_pa_open_chan,
742
  &hf_tp_pa_close_chan,
743
  &hf_tp_pa_recv_data,
744
  &hf_tp_pa_send_data,
745
  &hf_tp_pa_get_chan_status,
746
  &hf_tp_pa_serv_search,
747
  &hf_tp_pa_get_serv_info,
748
  &hf_tp_pa_decl_serv,
749
  NULL
750
};
751
752
static int * const tprof_b13_fields[] = {
753
  &hf_tp_bip_csd,
754
  &hf_tp_bip_gprs,
755
  &hf_tp_bip_bluetooth,
756
  &hf_tp_bip_irda,
757
  &hf_tp_bip_rs232,
758
  &hf_tp_num_chans,
759
  NULL
760
};
761
762
static int * const tprof_b14_fields[] = {
763
  &hf_tp_char_height,
764
  &hf_tp_nd,
765
  &hf_tp_nk,
766
  &hf_tp_sizing_supp,
767
  NULL
768
};
769
770
static int * const tprof_b15_fields[] = {
771
  &hf_tp_char_width,
772
  &hf_tp_var_fonts,
773
  NULL
774
};
775
776
static int * const tprof_b16_fields[] = {
777
  &hf_tp_display_resize,
778
  &hf_tp_text_wrapping,
779
  &hf_tp_text_scrolling,
780
  &hf_tp_text_attributes,
781
  &hf_tp_rfu3,
782
  &hf_tp_width_red_menu,
783
  NULL
784
};
785
static int * const tprof_b17_fields[] = {
786
  &hf_tp_bip_tcp_remote,
787
  &hf_tp_bip_udp_remote,
788
  &hf_tp_bip_tcp_server,
789
  &hf_tp_bip_tcp_local,
790
  &hf_tp_bip_udp_local,
791
  &hf_tp_bip_direct_com,
792
  &hf_tp_bip_eutran,
793
  &hf_tp_bip_hsdpa,
794
  NULL
795
};
796
static int * const tprof_b18_fields[] = {
797
  &hf_tp_pa_display_text_var_time_out,
798
  &hf_tp_pa_get_inkey_help,
799
  &hf_tp_bip_usb,
800
  &hf_tp_pa_get_inkey_var_time_out,
801
  &hf_tp_pa_prov_loci_esn,
802
  &hf_tp_cc_gprs,
803
  &hf_tp_pa_prov_loci_imeisv,
804
  &hf_tp_pa_prov_loci_search_mode_change,
805
  NULL
806
};
807
static int * const tprof_b19_fields[] = {
808
  &hf_tp_tia_eia_version,
809
  &hf_tp_rfu4,
810
  NULL
811
};
812
813
static int * const tprof_b20_fields[] = {
814
  &hf_tp_tia_iea_is820a_reserved,
815
  NULL
816
};
817
818
static int * const tprof_b21_fields[] = {
819
  &hf_tp_ext_launch_browser_wml,
820
  &hf_tp_ext_launch_browser_xhtml,
821
  &hf_tp_ext_launch_browser_html,
822
  &hf_tp_ext_launch_browser_chtml,
823
  &hf_tp_rfu5,
824
  NULL
825
};
826
827
static int * const tprof_b22_fields[] = {
828
  &hf_tp_utran_ps_ext_params,
829
  &hf_tp_pa_prov_loci_batt_state,
830
  &hf_tp_pa_play_tone_melody,
831
  &hf_tp_mm_call_set_up_call,
832
  &hf_tp_toolkit_initiated_gba,
833
  &hf_tp_pa_retrieve_mm_msg,
834
  &hf_tp_pa_submit_mm_msg,
835
  &hf_tp_pa_display_mm_msg,
836
  NULL
837
};
838
839
static int * const tprof_b23_fields[] = {
840
  &hf_tp_pa_set_frames,
841
  &hf_tp_pa_get_frames_status,
842
  &hf_tp_mms_notif_download,
843
  &hf_tp_alpha_id_refresh_cmd,
844
  &hf_tp_geo_loc_report,
845
  &hf_tp_pa_prov_loci_meid,
846
  &hf_tp_pa_prov_loci_nmr_utran_eutran,
847
  &hf_tp_ussd_data_download,
848
  NULL
849
};
850
851
static int * const tprof_b24_fields[] = {
852
  &hf_tp_class_i_max_nb_frames,
853
  &hf_tp_rfu6,
854
  NULL
855
};
856
857
static int * const tprof_b25_fields[] = {
858
  &hf_tp_evt_browsing_status,
859
  &hf_tp_evt_mms_transfer_status,
860
  &hf_tp_evt_frame_info_changed,
861
  &hf_tp_evt_iwlan_access_status,
862
  &hf_tp_evt_nw_reject_geran_utran,
863
  &hf_tp_evt_hci_connectivity,
864
  &hf_tp_evt_nw_reject_eutran,
865
  &hf_tp_evt_mult_access_techno_change,
866
  NULL
867
};
868
869
static int * const tprof_b26_fields[] = {
870
  &hf_tp_evt_csg_cell_select,
871
  &hf_tp_evt_contactless_state_req,
872
  &hf_tp_rfu7,
873
  NULL
874
};
875
876
static int * const tprof_b27_fields[] = {
877
  &hf_tp_rfu8,
878
  NULL
879
};
880
881
static int * const tprof_b28_fields[] = {
882
  &hf_tp_text_align_left,
883
  &hf_tp_text_align_centre,
884
  &hf_tp_text_align_right,
885
  &hf_tp_text_font_size_normal,
886
  &hf_tp_text_font_size_large,
887
  &hf_tp_text_font_size_small,
888
  &hf_tp_rfu9,
889
  NULL
890
};
891
892
static int * const tprof_b29_fields[] = {
893
  &hf_tp_text_style_normal,
894
  &hf_tp_text_style_bold,
895
  &hf_tp_text_style_italic,
896
  &hf_tp_text_style_underlined,
897
  &hf_tp_text_style_strikethrough,
898
  &hf_tp_text_style_text_fg_colour,
899
  &hf_tp_text_style_text_bg_colour,
900
  &hf_tp_rfu10,
901
  NULL
902
};
903
904
static int * const tprof_b30_fields[] = {
905
  &hf_tp_bip_iwlan,
906
  &hf_tp_pa_prov_loci_wsid,
907
  &hf_tp_term_app,
908
  &hf_tp_steering_roaming_refresh,
909
  &hf_tp_pa_activate,
910
  &hf_tp_pa_geo_loc_req,
911
  &hf_tp_pa_prov_loci_broadcast_nw_info,
912
  &hf_tp_steering_roaming_iwlan_refresh,
913
  NULL
914
};
915
916
static int * const tprof_b31_fields[] = {
917
  &hf_tp_pa_contactless_state_changed,
918
  &hf_tp_csg_cell_discovery,
919
  &hf_tp_cnf_params_support_open_chan_server_mode,
920
  &hf_tp_com_ctrl_ims,
921
  &hf_tp_cat_over_modem_itf,
922
  &hf_tp_evt_incoming_data_ims,
923
  &hf_tp_evt_ims_registration,
924
  &hf_tp_pa_prof_env_cont,
925
  NULL
926
};
927
928
static int * const tprof_b32_fields[] = {
929
  &hf_tp_bip_ims,
930
  &hf_tp_pa_prov_loci_henb_ip_addr,
931
  &hf_tp_pa_prov_loci_henb_surround_macro,
932
  &hf_tp_launch_params_support_open_chan_server_mode,
933
  &hf_tp_direct_com_support_open_chan_server_mode,
934
  &hf_tp_pa_sec_prof_env_cont,
935
  &hf_tp_cat_serv_list_ecat_client,
936
  &hf_tp_support_refresh_enforcement_policy,
937
  NULL
938
};
939
940
static int * const tprof_b33_fields[] = {
941
  &hf_tp_support_dns_addr_req,
942
  &hf_tp_support_nw_access_name_reuse,
943
  &hf_tp_ev_poll_intv_nego,
944
  &hf_tp_prose_usage_info_reporting,
945
  &hf_tp_pa_prov_loci_rat,
946
  &hf_tp_evt_wlan_access_status,
947
  &hf_tp_wlan_bearer,
948
  &hf_tp_pa_prov_loci_wlan_id,
949
  NULL
950
};
951
952
static int * const tprof_b34_fields[] = {
953
  &hf_tp_uri_send_short_msg,
954
  &hf_tp_ims_uri_setup_call,
955
  &hf_tp_media_type_voice_setup_call,
956
  &hf_tp_media_type_video_setup_call,
957
  &hf_tp_pa_prov_loci_eutran_timing_advance_info,
958
  &hf_tp_refresh_euicc_profile_state_change,
959
  &hf_tp_ext_rej_cause_code_nw_reject_eutran,
960
  &hf_tp_deprecated_b34,
961
  NULL
962
};
963
964
static int * const tprof_b35_fields[] = {
965
  &hf_tp_pa_get_input_var_timeout,
966
  &hf_tp_data_conn_status_change_pdp,
967
  &hf_tp_data_conn_status_change_pdn,
968
  &hf_tp_refresh_app_update,
969
  &hf_tp_pa_lsi_proactive_session_request,
970
  &hf_tp_pa_lsi_uicc_platform_reset,
971
  &hf_tp_rfu11,
972
  NULL
973
};
974
975
static int * const tprof_b36_fields[] = {
976
  &hf_tp_data_conn_status_change_pdu,
977
  &hf_tp_evt_nw_reject_ng_ran,
978
  &hf_tp_non_ip_data_delivery,
979
  &hf_tp_prov_loci_slice_info,
980
  &hf_tp_refresh_sor_cmci_param,
981
  &hf_tp_evt_nw_reject_satellite_ng_ran,
982
  &hf_tp_cag_feature,
983
  &hf_tp_evt_slices_status_change,
984
  NULL
985
};
986
987
static int * const tprof_b37_fields[] = {
988
  &hf_tp_prov_loci_rejected_slice_info,
989
  &hf_tp_ext_info_pli,
990
  &hf_tp_chaining_pli_env_cmds,
991
  &hf_tp_5g_prose_usage_info_reporting,
992
  &hf_tp_rfu12,
993
  NULL
994
};
995
996
static int * const tprof_b38_fields[] = {
997
  &hf_tp_rfu13,
998
  NULL
999
};
1000
1001
static int * const tprof_b39_fields[] = {
1002
  &hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info,
1003
  &hf_tp_rfu14,
1004
  NULL
1005
};
1006
1007
/* According to Section 7.2 of ETSI TS 101 220 / Chapter 7.2 */
1008
/* BER-TLV tag CAT templates */
1009
static const value_string ber_tlv_cat_tag_vals[] = {
1010
  { 0xcf, "Reserved for proprietary use (terminal->UICC)" },
1011
  { 0xd0, "Proactive Command" },
1012
  { 0xd1, "GSM/3GPP/3GPP2 - SMS-PP Download" },
1013
  { 0xd2, "GSM/3GPP/3GPP2 - Cell Broadcast Download" },
1014
  { 0xd3, "Menu selection" },
1015
  { 0xd4, "Call Control" },
1016
  { 0xd5, "GSM/3GPP - MO Short Message control" },
1017
  { 0xd6, "Event Download" },
1018
  { 0xd7, "Timer Expiration" },
1019
  { 0xd8, "Reserved for intra-UICC communication" },
1020
  { 0xd9, "3GPP - USSD Download" },
1021
  { 0xda, "MMS Transfer status" },
1022
  { 0xdb, "MMS notification download" },
1023
  { 0xdc, "Terminal application" },
1024
  { 0xdd, "3GPP - Geographical Location Reporting" },
1025
  { 0xde, "Envelope Container" },
1026
  { 0xdf, "3GPP - ProSe Report tag" },
1027
  { 0, NULL }
1028
};
1029
1030
static const value_string template_tag_vals[] = {
1031
  { 0x62, "FCP template" },
1032
  { 0x6F, "FCI template" },
1033
  { 0xA9, "Terminal Capability" },
1034
  { 0, NULL }
1035
};
1036
1037
static const value_string supply_voltage_class_vals[] = {
1038
  { 0x01, "Class A (4.5 - 5.5 V)" },
1039
  { 0x02, "Class B (2.7 - 3.3 V)" },
1040
  { 0x04, "Class C (1.62 - 1.98 V)" },
1041
  { 0x08, "Class D (1.1 - 1.3 V)" },
1042
  { 0x10, "Class E (RFU)" },
1043
  { 0, NULL }
1044
};
1045
1046
/* FCP template tags (ETSI TS 102.221) */
1047
static const value_string fcp_tag_vals[] = {
1048
  { 0x80, "File size" },
1049
  { 0x81, "Total file size" },
1050
  { 0x82, "File Descriptor" },
1051
  { 0x83, "File Identifier" },
1052
  { 0x84, "DF name (AID)" },
1053
  { 0x88, "Short File Identifier (SFI)" },
1054
  { 0x8A, "Life Cycle Status Integer" },
1055
  { 0x8B, "Security attributes (referenced to expanded format)" },
1056
  { 0x8C, "Security attributes (compact format)" },
1057
  { 0xA5, "Proprietary information" },
1058
  { 0xAB, "Security attributes (expanded format)" },
1059
  { 0xC6, "PIN Status Template DO" },
1060
  { 0xE0, "ISD-R Proprietary Application Template"},
1061
  { 0xE1, "ISD-R Proprietary Application Template IoT"},
1062
  { 0, NULL }
1063
};
1064
1065
static const true_false_string fcp_file_accessibility_tfs = {
1066
  "Shareable file",
1067
  "Not shareable file"
1068
};
1069
1070
static const value_string fcp_file_type_vals[] = {
1071
  { 0x0, "Working EF" },
1072
  { 0x1, "Internal EF" },
1073
  { 0x2, "RFU" },
1074
  { 0x3, "RFU" },
1075
  { 0x4, "RFU" },
1076
  { 0x5, "RFU" },
1077
  { 0x6, "RFU" },
1078
  { 0, NULL }
1079
};
1080
1081
static const value_string fcp_file_type_ext_vals[] = {
1082
  { 0x38, "DF or ADF" },
1083
  { 0, NULL }
1084
};
1085
1086
static const value_string fcp_ef_structure_vals[] = {
1087
  { 0x00, "No information given" },
1088
  { 0x01, "Transparent structure" },
1089
  { 0x02, "Linear fixed structure" },
1090
  { 0x03, "RFU" },
1091
  { 0x04, "RFU" },
1092
  { 0x05, "RFU" },
1093
  { 0x06, "Cyclic structure" },
1094
  { 0x07, "RFU" },
1095
  { 0, NULL }
1096
};
1097
1098
static const value_string fcp_ef_structure_ext_vals[] = {
1099
  { 0x39, "BER-TLV structure" },
1100
  { 0, NULL }
1101
};
1102
1103
static const range_string fcp_lifecycle_status_vals[] = {
1104
  { 0x00, 0x00, "No information given" },
1105
  { 0x01, 0x01, "Creation state" },
1106
  { 0x02, 0x02, "RFU" },
1107
  { 0x03, 0x03, "Initialization state" },
1108
  { 0x04, 0x04, "Operational state - deactivated" },
1109
  { 0x05, 0x05, "Operational state - activated" },
1110
  { 0x06, 0x06, "Operational state - deactivated" },
1111
  { 0x07, 0x07, "Operational state - activated" },
1112
  { 0x08, 0x0B, "RFU" },
1113
  { 0x0C, 0x0F, "Termination state" },
1114
  { 0x10, 0xFF, "Proprietary" },
1115
  { 0, 0, NULL }
1116
};
1117
1118
static const value_string fcp_prop_tag_vals[] = {
1119
  { 0x80, "UICC characteristics" },
1120
  { 0x81, "Application power consumption" },
1121
  { 0x82, "Minimum application clock frequency" },
1122
  { 0x83, "Amount of available memory" },
1123
  { 0x84, "File details" },
1124
  { 0x85, "Reserved file size" },
1125
  { 0x86, "Maximum file size" },
1126
  { 0x87, "Supported system commands" },
1127
  { 0x88, "Specific UICC environmental conditions" },
1128
  { 0x89, "Platform to Platform CAT Secured APDU" },
1129
  { 0x8A, "Test configuration state" },
1130
  { 0x8B, "Test configuration criterion type" },
1131
  { 0, NULL }
1132
};
1133
1134
static const value_string fcp_uicc_clock_stop_0_vals[] = {
1135
  { 0x00, "Never" },
1136
  { 0x01, "Unless at high level" },
1137
  { 0x02, "Unless at low level"},
1138
  { 0x03, "RFU" },
1139
  { 0, NULL }
1140
};
1141
1142
static const value_string fcp_uicc_clock_stop_1_vals[] = {
1143
  { 0x00, "No preferred level" },
1144
  { 0x01, "High level preferred" },
1145
  { 0x02, "Low level preferred" },
1146
  { 0x03, "RFU" },
1147
  { 0, NULL }
1148
};
1149
1150
static const value_string fcp_uicc_env_conditions_temp_class_vals[] = {
1151
  { 0x00, "Standard temperature range" },
1152
  { 0x01, "Temperature class A" },
1153
  { 0x02, "Temperature class B" },
1154
  { 0x03, "Temperature class C" },
1155
  { 0x04, "RFU" },
1156
  { 0x05, "RFU" },
1157
  { 0x06, "RFU" },
1158
  { 0x07, "RFU" },
1159
  { 0, NULL }
1160
};
1161
1162
static const value_string terminal_capability_tag_vals[] = {
1163
  { 0x80, "Terminal power supply" },
1164
  { 0x81, "Extended logical channels terminal support" },
1165
  { 0x82, "Additional interfaces support" },
1166
  { 0x83, "RSP Device Capabilities (SGP.22)" },
1167
  { 0x84, "IoT Device Capabilities (SGP.32)" },
1168
  { 0, NULL }
1169
};
1170
1171
static const value_string chan_op_vals[] = {
1172
  { 0x00, "Open Channel" },
1173
  { 0x80, "Close Channel" },
1174
  { 0, NULL }
1175
};
1176
1177
static const value_string suspend_uicc_vals[] = {
1178
  { 0x00, "Suspend the UICC" },
1179
  { 0x01, "Resume the UICC" },
1180
  { 0, NULL }
1181
};
1182
1183
static const value_string suspend_time_unit_vals[] = {
1184
  { 0x00, "Seconds" },
1185
  { 0x01, "Minutes" },
1186
  { 0x02, "Hours" },
1187
  { 0x03, "Days" },
1188
  { 0x04, "10 Days" },
1189
  { 0, NULL }
1190
};
1191
1192
static const value_string apdu_le_vals[] = {
1193
  { 0x00, "Any number in the range 1 to 256" },
1194
  { 0, NULL }
1195
};
1196
1197
static const value_string apdu_le_vals_ext[] = {
1198
  { 0x00, "Any number in the range 1 to 65535" },
1199
  { 0, NULL }
1200
};
1201
1202
static const value_string apdu_cla_coding_vals[] = {
1203
  { 0x00, "ISO/IEC 7816-4" },
1204
  { 0x08, "ETSI TS 102.221" },
1205
  { 0x0a, "ISO/IEC 7816-4 unless stated otherwise" },
1206
  { 0, NULL }
1207
};
1208
1209
static const value_string apdu_cla_coding_ext_vals[] = {
1210
  { 0x01, "ISO/IEC 7816-4" },
1211
  { 0x03, "ETSI TS 102.221" },
1212
  { 0, NULL }
1213
};
1214
1215
static const value_string apdu_cla_secure_messaging_ind_vals[] = {
1216
  { 0x00, "No SM used between terminal and card" },
1217
  { 0x01, "Proprietary SM format" },
1218
  { 0x02, "Command header not authenticated" },
1219
  { 0x03, "Command header authenticated" },
1220
  { 0, NULL }
1221
};
1222
1223
static const true_false_string apdu_cla_secure_messaging_ind_ext_val = {
1224
  "Command header not authenticated",
1225
  "No SM used between terminal and card"
1226
};
1227
1228
static const true_false_string apdu_auth_reference_val = {
1229
  "Specific reference data (e.g. DF specific/application dependent KEY)",
1230
  "Global reference data (e.g. MF specific KEY)"
1231
};
1232
1233
static const value_string apdu_auth_context_vals[] = {
1234
  { 0x00, "GSM context" },
1235
  { 0x01, "3G/EPS/5G context" },
1236
  { 0x02, "VGCS/VBS context" },
1237
  { 0x04, "GBA context" },
1238
  { 0, NULL }
1239
};
1240
1241
static const value_string apdu_auth_status_vals[] = {
1242
  { 0xDB, "Successful 3G authentication" },
1243
  { 0xDC, "Synchronisation failure" },
1244
  { 0, NULL }
1245
};
1246
1247
/* Table 9 of GSM TS 11.11 */
1248
static const value_string apdu_ins_vals[] = {
1249
  { 0xA4, "SELECT" },
1250
  { 0xF2, "STATUS" },
1251
  { 0xB0, "READ BINARY" },
1252
  { 0xD6, "UPDATE BINARY" },
1253
  { 0xB2, "READ RECORD" },
1254
  { 0xDC, "UPDATE RECORD" },
1255
  { 0xA2, "SEARCH RECORD" },
1256
  { 0x32, "INCREASE" },
1257
  { 0x20, "VERIFY CHV" },
1258
  { 0x24, "CHANGE CHV" },
1259
  { 0x26, "DISABLE CHV" },
1260
  { 0x28, "ENABLE CHV" },
1261
  { 0x2C, "UNBLOCK CHV" },
1262
  { 0x04, "INVALIDATE / REHABILITATE" },
1263
  { 0x44, "REHABILITATE / ACTIVATE" },
1264
  { 0x88, "RUN GSM ALGORITHM / AUTHENTICATE" },
1265
  { 0xFA, "SLEEP" },
1266
  { 0xC0, "GET RESPONSE" },
1267
  { 0x10, "TERMINAL PROFILE" },
1268
  { 0xC2, "ENVELOPE" },
1269
  { 0x12, "FETCH" },
1270
  { 0x14, "TERMINAL RESPONSE" },
1271
  /* Only in TS 102 221 v9.2.0 */
1272
  { 0xCB, "RETRIEVE DATA" },
1273
  { 0xDB, "SET DATA" },
1274
  { 0x89, "RUN GSM ALGORITHM / AUTHENTICATE" },
1275
  { 0x84, "GET CHALLENGE" },
1276
  { 0xAA, "TERMINAL CAPABILITY" },
1277
  { 0x70, "MANAGE CHANNEL" },
1278
  { 0x73, "MANAGE SECURE CHANNEL" },
1279
  { 0x75, "TRANSACT DATA" },
1280
  { 0x76, "SUSPEND UICC" },
1281
  /* TS 102 221 v15.11.0 */
1282
  { 0x78, "GET IDENTITY" },
1283
  { 0x7A, "EXCHANGE CAPABILITIES" },
1284
  { 0x7C, "MANAGE LSI" },
1285
  /* GSMA SGP.02 v4.2 */
1286
  { 0xCA, "GET DATA" },
1287
  /* TS TS 102 222 */
1288
  { 0xE0, "CREATE FILE" },
1289
  { 0xE4, "DELETE FILE" },
1290
  { 0xE6, "TERMINATE DF" },
1291
  { 0xE8, "TERMINATE EF" },
1292
  { 0xFE, "TERMINATE CARD USAGE" },
1293
  /* GlobalPlatform Card Specification */
1294
  { 0xE2, "STORE DATA" },
1295
  { 0, NULL }
1296
};
1297
1298
/* Section 7.3.7 */
1299
1300
static const value_string search_ef_identifier_vals[] = {
1301
  { 0, "Currently selected EF" },
1302
  { 31, "Reserved for future use" },
1303
  { 0, NULL}
1304
};
1305
1306
static const value_string search_mode_vals[] = {
1307
  { 0x00, "Forward from first occurrence" },
1308
  { 0x01, "Backward from last occurrence" },
1309
  { 0x02, "Forward from next occurrence" },
1310
  { 0x03, "Backward from previous occurrence" },
1311
  { 0x04, "Forward from P1" },
1312
  { 0x05, "Backward from P1" },
1313
  { 0x06, "Enhanced search" },
1314
  { 0x07, "Proprietary search" },
1315
  { 0, NULL }
1316
};
1317
1318
static const value_string search_enhanced_type[] = {
1319
  { 0x00, "The subsequent byte is an offset (start from that position)" },
1320
  { 0x01, "The subsequent byte is a value (start after the first occurrence)" },
1321
  { 0, NULL }
1322
};
1323
1324
static const value_string search_enhanced_mode_vals[] = {
1325
  { 0x00, "Forward from first occurrence" },
1326
  { 0x01, "Backward from last occurrence" },
1327
  { 0x02, "Forward from next occurrence" },
1328
  { 0x03, "Backward from previous occurrence" },
1329
  { 0x04, "Forward from P1" },
1330
  { 0x05, "Backward from P1" },
1331
  { 0x06, "Forward from next record" },
1332
  { 0x07, "Backward from previous record" },
1333
  { 0, NULL }
1334
};
1335
1336
/* Section 10.7 */
1337
1338
1339
/* The FID space is not a global namespace, but a per-directory one. As such,
1340
 * we should have code that tracks the currently selected (sub-)directory, and
1341
 * decode the FID based on that knowledge.  As we don't do that yet, the
1342
 * current work-around is to simply merge all of them into one value_string
1343
 * array */
1344
1345
/* N.B. this combined value_string has lots of duplicate values... */
1346
1347
/* Files at the MF level */
1348
static const value_string mf_dfs[] = {
1349
  { 0x3f00, "MF" },
1350
  { 0x7f10, "DF.TELECOM" },
1351
  { 0x7f20, "DF.GSM" },
1352
  { 0x7f22, "DF.IS-41" },
1353
  { 0x7f23, "DF.FP-CTS" },
1354
  { 0x7f25, "DF.CDMA" },
1355
  { 0x7f31, "DF.iDEN" },
1356
  { 0x7f80, "DF.PDC" },
1357
  { 0x7f90, "DF.TETRA" },
1358
  { 0x7fff, "ADF" },
1359
#if 0
1360
  { 0, NULL }
1361
};
1362
static const value_string mf_efs[] = {
1363
#endif
1364
  { 0x2f00, "EF.DIR" },
1365
//  { 0x2f05, "EF.ELP" },
1366
  { 0x2f05, "EF.PL" },
1367
  { 0x2f06, "EF.ARR" },
1368
  { 0x2f08, "EF.UMPC" },
1369
  { 0x2fe2, "EF.ICCID" },
1370
#if 0
1371
  { 0, NULL }
1372
};
1373
1374
/* Elementary files at the DF.TELECOM level */
1375
static const value_string df_telecom_efs[] = {
1376
#endif
1377
  { 0x6f06, "EF.ARR" },
1378
  { 0x6f3a, "EF.ADN" },
1379
  { 0x6f3b, "EF.FDN" },
1380
  { 0x6f3c, "EF.SMS" },
1381
  { 0x6f3d, "EF.CCP" },
1382
  { 0x6f40, "EF.MSISDN" },
1383
  { 0x6f42, "EF.SMSP" },
1384
  { 0x6f43, "EF.SMSS" },
1385
  { 0x6f44, "EF.LND" },
1386
  { 0x6f47, "EF.SMSR" },
1387
  { 0x6f49, "EF.SDN" },
1388
  { 0x6f4a, "EF.EXT1" },
1389
  { 0x6f4b, "EF.EXT2" },
1390
  { 0x6f4c, "EF.EXT3" },
1391
  { 0x6f4d, "EF.BDN" },
1392
  { 0x6f4e, "EF.EXT4" },
1393
  { 0x6f4f, "EF.ECCP" },
1394
  { 0x6f54, "EF.SUME" },
1395
#if 0
1396
  { 0, NULL }
1397
};
1398
1399
/* Elementary Files at the DF.GSM level */
1400
static const value_string df_gsm_efs[] = {
1401
#endif
1402
  { 0x6f05, "EF.LP" },
1403
  { 0x6f07, "EF.IMSI" },
1404
  { 0x6f20, "EF.Kc" },
1405
  { 0x6f30, "EF.PLMNsel" },
1406
  { 0x6f31, "EF.HPPLMN" },
1407
  { 0x6f37, "EF.ACMax" },
1408
  { 0x6f38, "EF.SST" },
1409
  { 0x6f39, "EF.ACM" },
1410
  { 0x6f3e, "EF.GID1" },
1411
  { 0x6f3f, "EF.GID2" },
1412
  { 0x6f41, "EF.PUCT" },
1413
  { 0x6f45, "EF.CBMI" },
1414
  { 0x6f46, "EF.SPN" },
1415
  { 0x6f74, "EF.BCCH" },
1416
  { 0x6f78, "EF.ACC" },
1417
  { 0x6f7b, "EF.FPLMN" },
1418
  { 0x6f7e, "EF.LOCI" },
1419
  { 0x6fad, "EF.AD" },
1420
  { 0x6fae, "EF.PHASE" },
1421
  { 0x6fb1, "EF.VGCS" },
1422
  { 0x6fb2, "EF.VGCSS" },
1423
  { 0x6fb3, "EF.VBS" },
1424
  { 0x6fb4, "EF.VBSS" },
1425
  { 0x6fb5, "EF.eMLPP" },
1426
  { 0x6fb6, "EF.AAeM" },
1427
  { 0x6fb7, "EF.ECC" },
1428
  { 0x6f50, "EF.CBMIR" },
1429
  { 0x6f51, "EF.NIA" },
1430
  { 0x6f52, "EF.KcGPRS" },
1431
  { 0x6f53, "EF.LOCIGPRS" },
1432
  { 0x6f54, "EF.SUME" },
1433
  { 0x6f60, "EF.PLMNwAcT" },
1434
  { 0x6f61, "EF.OPLMNwAcT" },
1435
  { 0x6f62, "EF.HPLMNAcT" },
1436
  { 0x6f63, "EF.CPBCCH" },
1437
  { 0x6f64, "EF.INVSCAN" },
1438
#if 0
1439
  { 0, NULL }
1440
};
1441
1442
static const value_string df_gsm_dfs[] = {
1443
#endif
1444
  { 0x5f30, "DF.IRIDIUM" },
1445
  { 0x5f31, "DF.GLOBST" },
1446
  { 0x5f32, "DF.ICO" },
1447
  { 0x5f33, "DF.ACeS" },
1448
  { 0x5f3c, "DF.MExE" },
1449
  { 0x5f40, "DF.EIA/TIA-533/DF.WLAN" },
1450
  { 0x5f60, "DF.CTS" },
1451
  { 0x5f70, "DF.SoLSA" },
1452
#if 0
1453
  { 0, NULL }
1454
};
1455
1456
static const value_string adf_usim_dfs[] = {
1457
#endif
1458
  { 0x5f3a, "DF.PHONEBOOK" },
1459
  { 0x5f3b, "DF.GSM-ACCESS" },
1460
//  { 0x5f3c, "DF.MexE" },
1461
//  { 0x5f70, "DF.SoLSA" },
1462
//  { 0x5f40, "DF.WLAN" },
1463
  { 0x5f50, "DF.HNB" },
1464
  { 0x5f90, "DF.ProSe" },
1465
  { 0x5fa0, "DF.ACDC" },
1466
  { 0x5fb0, "DF.TV" },
1467
  { 0x5fc0, "DF.5GS" },
1468
#if 0
1469
  { 0, NULL }
1470
};
1471
1472
static const value_string adf_usim_efs[] = {
1473
#endif
1474
  { 0x6f00, "EF.5GAuthKeys" },
1475
  { 0x6f01, "EF.5GS3GPPAccessNASSecCtxt" },
1476
  { 0x6f02, "EF.5GSnon3GPPAccessNASSecCtxt" },
1477
  { 0x6f03, "EF.SCICI" },
1478
  { 0x6f04, "EF.UACAcessIdConfig" },
1479
  { 0x6f06, "EF.ARR" },
1480
  { 0x6f07, "EF.IMSI" },
1481
  { 0x6f08, "EF.Keys" },
1482
  { 0x6f09, "EF.KeysPS" },
1483
  { 0x6f2c, "EF.DCK" },
1484
  { 0x6f31, "EF.HPPLMN" },
1485
  { 0x6f32, "EF.CNL" },
1486
  { 0x6f37, "EF.ACMax" },
1487
  { 0x6f39, "EF.ACM" },
1488
  { 0x6f3b, "EF.FDN" },
1489
  { 0x6f3c, "EF.SMS" },
1490
  { 0x6f3e, "EF.GID1" },
1491
  { 0x6f3f, "EF.GID2" },
1492
  { 0x6f40, "EF.MSISDN" },
1493
  { 0x6f42, "EF.SMSP" },
1494
  { 0x6f43, "EF.SMSS" },
1495
  { 0x6f45, "EF.CBMI" },
1496
  { 0x6f46, "EF.SPN" },
1497
  { 0x6f47, "EF.SMSR" },
1498
  { 0x6f48, "EF.CBMID" },
1499
  { 0x6f4b, "EF.EXT2" },
1500
  { 0x6f4c, "EF.EXT3" },
1501
  { 0x6f4d, "EF.BDN" },
1502
  { 0x6f50, "EF.CBMIR" },
1503
  { 0x6f55, "EF.EXT4" },
1504
  { 0x6f56, "EF.EST" },
1505
  { 0x6f57, "EF.ACL" },
1506
  { 0x6f58, "EF.CMI" },
1507
  { 0x6f5b, "EF.START-HFN" },
1508
  { 0x6f5c, "EF.THRESHOLD" },
1509
  { 0x6f60, "EF.PLMNwAcT" },
1510
  { 0x6f61, "EF.OPLMNwAcT" },
1511
  { 0x6f62, "EF.HPLMNAcT" },
1512
  { 0x6f73, "EF.PSLOCI" },
1513
  { 0x6f78, "EF.ACC" },
1514
  { 0x6f7b, "EF.FPLMN" },
1515
  { 0x6f7e, "EF.LOCI" },
1516
  { 0x6f80, "EF.ICI" },
1517
  { 0x6f81, "EF.OCI" },
1518
  { 0x6f82, "EF.ICT" },
1519
  { 0x6f83, "EF.OCT" },
1520
  { 0x6fad, "EF.AD" },
1521
  { 0x6fb1, "EF.VGCS" },
1522
  { 0x6fb2, "EF.VGCSS" },
1523
  { 0x6fb3, "EF.VBS" },
1524
  { 0x6fb4, "EF.VBSS" },
1525
  { 0x6fb5, "EF.eMLPP" },
1526
  { 0x6fb6, "EF.AAeM" },
1527
  { 0x6fb7, "EF.ECC" },
1528
  { 0x6fc3, "EF.Hiddenkey" },
1529
  { 0x6fc4, "EF.NETPAR" },
1530
  { 0x6fc5, "EF.PNN" },
1531
  { 0x6fc6, "EF.OPL" },
1532
  { 0x6fc7, "EF.MBDN" },
1533
  { 0x6fc8, "EF.EXT6" },
1534
  { 0x6fc9, "EF.MBI" },
1535
  { 0x6fca, "EF.MWIS" },
1536
  { 0x6fcb, "EF.CFIS" },
1537
  { 0x6fcc, "EF.EXT7" },
1538
  { 0x6fcd, "EF.SPDI" },
1539
  { 0x6fce, "EF.MMSN" },
1540
  { 0x6fcf, "EF.EXT8" },
1541
  { 0x6fd0, "EF.MMSICP" },
1542
  { 0x6fd1, "EF.MMSUP" },
1543
  { 0x6fd2, "EF.MMSUCP" },
1544
  { 0x6fd3, "EF.NIA" },
1545
  { 0x6fd4, "EF.VGCSCA" },
1546
  { 0x6fd5, "EF.VBSCA" },
1547
  { 0x6fd6, "EF.GBAP" },
1548
  { 0x6fd7, "EF.MSK" },
1549
  { 0x6fd8, "EF.MUK" },
1550
  { 0x6fd9, "EF.EHPLMN" },
1551
  { 0x6fda, "EF.GBANL" },
1552
  { 0x6fdb, "EF.EHPLMNPI" },
1553
  { 0x6fdc, "EF.LRPLMNSI" },
1554
  { 0x6fdd, "EF.NAFKCA" },
1555
  { 0x6fde, "EF.SPNI" },
1556
  { 0x6fdf, "EF.PNNI" },
1557
  { 0x6fe2, "EF.NCP-IP" },
1558
  { 0x6fe3, "EF.EPSLOCI" },
1559
  { 0x6fe4, "EF.EPSNSC" },
1560
  { 0x6fe6, "EF.UFC" },
1561
  { 0x6fe7, "EF.UICCIARI" },
1562
  { 0x6fec, "EF.PWS" },
1563
  { 0x6fed, "EF.FDNURI" },
1564
  { 0x6fee, "EF.BDNURI" },
1565
  { 0x6fef, "EF.SDNURI" },
1566
  { 0x6ff0, "EF.IWL" },
1567
  { 0x6ff1, "EF.IPS" },
1568
  { 0x6ff2, "EF.IPD" },
1569
  { 0x6ff3, "EF.ePDGId" },
1570
  { 0x6ff4, "EF.ePDGSelection" },
1571
  { 0x6ff5, "EF.ePDGIdEm" },
1572
  { 0x6ff6, "EF.ePDGSelection" },
1573
  { 0x6ff7, "EF.FromPreferred" },
1574
  { 0x6ff9, "EF.3GPPPSDATAOFF" },
1575
  { 0x6ffa, "EF.3GPPPSDATAOFFservicelist" },
1576
  { 0x6ffb, "EF.TVCONFIG" },
1577
  { 0x6ffc, "EF.XCAPConfigData" },
1578
  { 0x6ffd, "EF.EARFCNList" },
1579
  { 0x6ffe, "EF.5GS3GPPLocationInformation" },
1580
  { 0x6fff, "EF.5GSnon3GPPLocationInformation" },
1581
#if 0
1582
  { 0, NULL }
1583
};
1584
1585
static const value_string adf_5gs_efs[] = {
1586
#endif
1587
  { 0x4f01, "EF.5GS3GPPLOCI" },
1588
  { 0x4f02, "EF.5GSN3GPPLOCI" },
1589
  { 0x4f03, "EF.5GS3GPPNSC" },
1590
  { 0x4f04, "EF.5GSN3GPPNSC" },
1591
  { 0x4f05, "EF.5GAUTHKEYS" },
1592
  { 0x4f06, "EF.UAC_AIC" },
1593
  { 0x4f07, "EF.SUCI_Calc_Info" },
1594
  { 0x4f08, "EF.OPL5G" },
1595
  { 0x4f09, "EF.EFSUPI_NAI/EF.PBC" },
1596
  { 0x4f0a, "EF.Routing_Indicator/EF.PBC1" },
1597
  { 0x4f0b, "EF.URSP" },
1598
  { 0x4f0c, "EF.TN3GPPSNN" },
1599
#if 0
1600
  { 0, NULL }
1601
};
1602
1603
static const value_string df_phonebook_efs[] = {
1604
#endif
1605
//  { 0x4f09, "EF.PBC" },
1606
//  { 0x4f0a, "EF.PBC1" },
1607
  { 0x4f11, "EF.ANRA" },
1608
  { 0x4f12, "EF.ANRA1" },
1609
  { 0x4f13, "EF.ANRB" },
1610
  { 0x4f14, "EF.ANRB1" },
1611
  { 0x4f15, "EF.ANRC" },
1612
  { 0x4f16, "EF.ANRC1" },
1613
  { 0x4f19, "EF.SNE" },
1614
  { 0x4f1a, "EF.SNE1" },
1615
  { 0x4f20, "EF.UID1" },
1616
  { 0x4f21, "EF.UID" },
1617
  { 0x4f22, "EF.FSC" },
1618
  { 0x4f23, "EF.CC" },
1619
  { 0x4f24, "EF.PUID" },
1620
  { 0x4f25, "EF.GRP1" },
1621
  { 0x4f26, "EF.GRP" },
1622
  { 0x4f30, "EF.PBR" },
1623
  { 0x4f3a, "EF.ADN" },
1624
  { 0x4f3b, "EF.ADN1" },
1625
  { 0x4f4a, "EF.EXT1" },
1626
  { 0x4f4b, "EF.AAS" },
1627
  { 0x4f4c, "EF.GAS" },
1628
  { 0x4f50, "EF.EMAIL" },
1629
  { 0x4f51, "EF.EMAIL1" },
1630
  { 0, NULL }
1631
};
1632
1633
/* Section 9.4 of TS 11.11 */
1634
static const value_string sw_vals[] = {
1635
  /* we only list the non-wildcard commands here */
1636
  { 0x9000, "Normal ending of the command" },
1637
  { 0x9300, "SIM Application Toolkit is busy" },
1638
  { 0x9240, "Memory problem" },
1639
  { 0x9400, "No EF selected" },
1640
  { 0x9402, "Out of range (invalid address)" },
1641
  { 0x9404, "File ID not found" },
1642
  { 0x9408, "File is inconsistent with the command" },
1643
  { 0x9802, "No CHV initialized" },
1644
  { 0x9804, "Access condition not fulfilled / authentication failed" },
1645
  { 0x9808, "In contradiction with CHV status" },
1646
  { 0x9810, "In contradiction with invalidation status" },
1647
  { 0x9840, "Unsuccessful CHV verification, no attempt left / CHV blocked" },
1648
  { 0x9850, "Application errors: Increase cannot be performed, max value reached" },
1649
  { 0x6b00, "Incorrect parameter P1 or P2" },
1650
  /* Section 10.2.1.3 of TS 102 221 */
1651
  { 0x6200, "Warning: No information given, state of volatile memory unchanged" },
1652
  { 0x6281, "Warning: Part of returned data may be corrupted" },
1653
  { 0x6282, "Warning: End of file/record reached before reading Le bytes" },
1654
  { 0x6283, "Warning: Selected file invalidated" },
1655
  { 0x6285, "Warning: Selected file in termination state" },
1656
  { 0x62f1, "Warning: More data available" },
1657
  { 0x62f2, "Warning: More data available and proactive command pending" },
1658
  { 0x62f3, "Warning: Response data available" },
1659
  { 0x63f1, "Warning: More data expected" },
1660
  { 0x63f2, "Warning: More data expected and proactive command pending" },
1661
  /* Section 10.2.1.4 of TS 102 221 */
1662
  { 0x6400, "Execution error: No information given, memory unchanged" },
1663
  { 0x6500, "Execution error: No information given, memory changed" },
1664
  { 0x6581, "Execution error: Memory problem" },
1665
  /* Section 10.2.1.5 of TS 102 221 */
1666
  { 0x6700, "Wrong length" },
1667
  { 0x6d00, "Instruction code not supported or invalid" },
1668
  { 0x6e00, "Class not supported" },
1669
  { 0x6f00, "Technical problem, no precise diagnosis" },
1670
  /* Section 10.2.1.5.1 of TS 102 221 */
1671
  { 0x6800, "Function in CLA not supported" },
1672
  { 0x6881, "Function in CLA not supported: Logical channel not supported" },
1673
  { 0x6882, "Function in CLA not supported: Secure messaging not supported" },
1674
  /* Section 10.2.1.5.2 of TS 102 221 */
1675
  { 0x6900, "Command not allowed" },
1676
  { 0x6981, "Command not allowed: Command incompatible with file structure" },
1677
  { 0x6982, "Command not allowed: Security status not satisfied" },
1678
  { 0x6983, "Command not allowed: Authentication/PIN method blocked" },
1679
  { 0x6984, "Command not allowed: Referenced data invalid" },
1680
  { 0x6985, "Command not allowed: Conditions of use not satisfied" },
1681
  { 0x6986, "Command not allowed: No EF selected" },
1682
  { 0x6989, "Command not allowed: Secure channel - security not satisfied" },
1683
  /* Section 10.2.1.5.3 of TS 102 221 */
1684
  { 0x6a80, "Wrong parameters: Incorrect parameters in the data field" },
1685
  { 0x6a81, "Wrong parameters: Function not supported" },
1686
  { 0x6a82, "Wrong parameters: File not found" },
1687
  { 0x6a83, "Wrong parameters: Record not found" },
1688
  { 0x6a84, "Wrong parameters: Not enough memory space" },
1689
  { 0x6a86, "Wrong parameters: Incorrect P1 to P2" },
1690
  { 0x6a87, "Wrong parameters: Lc inconsistent with P1 to P2" },
1691
  { 0x6a88, "Wrong parameters: Referenced data not found" },
1692
  /* Section 10.2.1.6 of TS 102 221 */
1693
  { 0x9862, "Application errors: Authentication error, application specific" },
1694
  { 0x9863, "Application errors: Security session or association expired" },
1695
  { 0x9864, "Application errors: Minimum UICC suspension time is too long" },
1696
  { 0, NULL }
1697
};
1698
1699
static const value_string select_type_vals[] = {
1700
  { 0x00, "Select DF, EF or MF by file id" },
1701
  { 0x01, "Select child DF of the current DF" },
1702
  { 0x03, "Select parent DF of the current DF" },
1703
  { 0x04, "Selection by DF name (selection by AID)" },
1704
  { 0x08, "Select by path from MF" },
1705
  { 0x09, "Select by path from current DF" },
1706
  { 0, NULL }
1707
};
1708
1709
static const value_string select_session_control_vals[] = {
1710
  { 0x00, "Activation/Reset" },
1711
  { 0x01, "Termination" },
1712
  { 0, NULL }
1713
};
1714
1715
static const value_string select_return_data_vals[] = {
1716
  { 0x01, "Response FCP template" },
1717
  { 0x03, "No data returned" },
1718
  { 0, NULL }
1719
};
1720
1721
static const value_string select_selection_vals[] = {
1722
  { 0x00, "First or only occurrence" },
1723
  { 0x01, "Last occurrence" },
1724
  { 0x02, "Next occurrence" },
1725
  { 0x03, "Previous occurrence" },
1726
  { 0, NULL }
1727
};
1728
1729
static const value_string status_application_status_vals[] = {
1730
  { 0x00, "No indication" },
1731
  { 0x01, "Current application is initialized in the terminal" },
1732
  { 0x02, "The terminal will initiate the termination of the current application" },
1733
  { 0, NULL }
1734
};
1735
1736
static const value_string status_return_data_vals[] = {
1737
  { 0x00, "Response parameters and data are identical to the response parameters and data of the SELECT command" },
1738
  { 0x01, "The DF name TLV-object of the currently selected application is returned" },
1739
  { 0x0C, "No data returned" },
1740
  { 0, NULL }
1741
};
1742
1743
static const value_string record_file_vals[] = {
1744
  { 0, "Currently selected EF" },
1745
  { 0, NULL}
1746
};
1747
1748
static const value_string record_mode_vals[] = {
1749
  { 0x02, "Next record" },
1750
  { 0x03, "Previous record" },
1751
  { 0x04, "Absolute/current mode, the record number is given in P1 with P1='00' denoting the current record" },
1752
  { 0, NULL }
1753
};
1754
1755
static const true_false_string store_data_iso_case_tfs = {
1756
  "ISO case 4 command (response data may be returned)",
1757
  "ISO case 3 command (no response data expected)"
1758
};
1759
1760
static const value_string store_data_structure_vals[] = {
1761
  { 0x00, "No general data structure information" },
1762
  { 0x01, "DGI format of the command data field" },
1763
  { 0x02, "BER-TLV format of the command data field" },
1764
  { 0x03, "RFU" },
1765
  { 0, NULL }
1766
};
1767
1768
static const value_string store_data_encryption_vals[] = {
1769
  { 0x00, "No general encryption information or non-encrypted data" },
1770
  { 0x01, "Application dependent encryption of the data" },
1771
  { 0x02, "RFU" },
1772
  { 0x03, "Encrypted data" },
1773
  { 0, NULL }
1774
};
1775
1776
static const true_false_string store_data_block_tfs = {
1777
  "Last block",
1778
  "More blocks"
1779
};
1780
1781
static const char *get_sw_string(wmem_allocator_t *scope, uint16_t sw)
1782
78
{
1783
78
  uint8_t sw1 = sw >> 8;
1784
78
  uint8_t sw2 = sw & 0xFF;
1785
1786
78
  switch (sw1) {
1787
1
  case 0x91:
1788
1
    return "Normal ending of command with info from proactive SIM";
1789
1
  case 0x9e:
1790
1
    return "Length of the response data given / SIM data download error";
1791
0
  case 0x9f:
1792
0
    return wmem_strdup_printf(scope, "Length of the response data, Length is %u", sw2 ? sw2 : 256);
1793
0
  case 0x92:
1794
0
    if ((sw & 0xf0) == 0x00)
1795
0
      return "Command successful but after internal retry routine";
1796
0
    break;
1797
4
  case 0x61:
1798
4
    return wmem_strdup_printf(scope, "Response ready, Response length is %u", sw2 ? sw2 : 256);
1799
0
  case 0x67:
1800
0
    if (sw2 == 0x00)
1801
0
      return "Wrong length"; /* TS 102.221 / Section 10.2.1.5 */
1802
0
    else
1803
0
      return "Incorrect parameter P3"; /* TS 51.011 / Section 9.4.6 */
1804
4
  case 0x6c:
1805
4
    return wmem_strdup_printf(scope, "Terminal should repeat command, Length for repeated command is %u", sw2 ? sw2 : 256);
1806
2
  case 0x6d:
1807
2
    return "Unknown instruction code";
1808
0
  case 0x6e:
1809
0
    return "Wrong instruction class";
1810
0
  case 0x6f:
1811
0
    return "Technical problem with no diagnostic";
1812
78
  }
1813
66
  return val_to_str(scope, sw, sw_vals, "Unknown status word: %04x");
1814
78
}
1815
1816
/* Parse BER-TLV tag */
1817
static int
1818
get_ber_tlv_tag(tvbuff_t *tvb, int offset, uint32_t *tag, uint8_t *tag_size)
1819
67
{
1820
67
  *tag = tvb_get_uint8(tvb, offset++);
1821
67
  *tag_size = 1;
1822
1823
67
  if ((*tag & 0x1F) == 0x1F) {
1824
    /* Extended tag */
1825
14
    *tag = 0;
1826
790
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
1827
789
      uint8_t tag_byte = tvb_get_uint8(tvb, offset++);
1828
789
      *tag = (*tag << 7) | (tag_byte & 0x7F);
1829
789
      (*tag_size)++;
1830
1831
789
      if ((tag_byte & 0x80) == 0) {
1832
13
        break; /* Last tag byte */
1833
13
      }
1834
789
    }
1835
14
  }
1836
1837
67
  return offset;
1838
67
}
1839
1840
/* Parse BER-TLV length */
1841
static int
1842
get_ber_tlv_len(tvbuff_t *tvb, int offset, uint32_t *len, uint8_t *len_size)
1843
59
{
1844
59
  *len = tvb_get_uint8(tvb, offset++);
1845
59
  *len_size = 1;
1846
1847
59
  if (*len & 0x80) {
1848
8
    int n = *len & 0x7F;
1849
457
    while (n--) {
1850
449
      *len = (*len << 8) | tvb_get_uint8(tvb, offset++);
1851
449
      (*len_size)++;
1852
449
    }
1853
8
  }
1854
1855
59
  return offset;
1856
59
}
1857
1858
static void
1859
power_consumption_frequency_cf(char *result, uint32_t frequency)
1860
0
{
1861
0
  if (frequency == 0xFF) {
1862
0
    snprintf(result, ITEM_LABEL_LENGTH, "No frequency");
1863
0
  } else {
1864
0
    double freq_mhz = frequency * 0.1;
1865
0
    snprintf(result, ITEM_LABEL_LENGTH, "%.1f MHz", freq_mhz);
1866
0
  }
1867
0
}
1868
1869
/* Dissect FCP proprietary information */
1870
static int
1871
dissect_fcp_proprietary_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
1872
0
{
1873
0
  proto_item *prop_ti;
1874
0
  proto_tree *prop_tree;
1875
0
  uint32_t tag, len;
1876
0
  uint8_t tag_size, len_size;
1877
0
  bool clock_stop_allowed;
1878
1879
0
  int start_offset;
1880
0
  int end_offset = offset + length;
1881
1882
0
  while (offset < end_offset) {
1883
0
    start_offset = offset;
1884
1885
0
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
1886
0
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
1887
1888
0
    prop_ti = proto_tree_add_bytes_format(tree, hf_fcp_prop, tvb, start_offset,
1889
0
        tag_size + len_size + len, NULL, "%s%s%s",
1890
0
        val_to_str(pinfo->pool, tag, fcp_prop_tag_vals, "Unknown tag '%02x'"),
1891
0
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
1892
0
    prop_tree = proto_item_add_subtree(prop_ti, ett_fcp_proprietary);
1893
1894
0
    proto_tree_add_item(prop_tree, hf_fcp_prop_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
1895
0
    proto_tree_add_uint(prop_tree, hf_fcp_prop_len, tvb, start_offset + tag_size, len_size, len);
1896
1897
0
    if (len == 0) {
1898
      /* No value field */
1899
0
      continue;
1900
0
    }
1901
1902
0
    switch (tag) {
1903
0
    case 0x80: /* UICC characteristics */
1904
0
      proto_tree_add_item_ret_boolean(prop_tree, hf_fcp_prop_uicc_clock_stop_allowed, tvb, offset, 1, ENC_NA, &clock_stop_allowed);
1905
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_rfu, tvb, offset, 1, ENC_NA);
1906
0
      if (clock_stop_allowed) {
1907
0
        proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_1, tvb, offset, 1, ENC_NA);
1908
0
      } else {
1909
0
        proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_0, tvb, offset, 1, ENC_NA);
1910
0
      }
1911
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_a, tvb, offset, 1, ENC_NA);
1912
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_b, tvb, offset, 1, ENC_NA);
1913
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_c, tvb, offset, 1, ENC_NA);
1914
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_d, tvb, offset, 1, ENC_NA);
1915
0
      break;
1916
0
    case 0x81: /* Application power consumption */
1917
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_supply_voltage_class, tvb, offset, 1, ENC_NA);
1918
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_power_consumption, tvb, offset+1, 1, ENC_NA);
1919
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_frequency, tvb, offset+2, 1, ENC_NA);
1920
0
      break;
1921
0
    case 0x82: /* Minimum application clock frequency */
1922
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_min_app_clock_freq, tvb, offset, 1, ENC_NA);
1923
0
      break;
1924
0
    case 0x83: /* Amount of available memory */
1925
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_avail_memory, tvb, offset, len, ENC_BIG_ENDIAN);
1926
0
      break;
1927
0
    case 0x84: /* File details */
1928
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_file_details_der_encoding, tvb, offset, 1, ENC_NA);
1929
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_file_details_rfu, tvb, offset, 1, ENC_NA);
1930
0
      break;
1931
0
    case 0x85: /* Reserved file size */
1932
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_reserved_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
1933
0
      break;
1934
0
    case 0x86: /* Maximum file size */
1935
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_max_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
1936
0
      break;
1937
0
    case 0x87: /* Supported system commands */
1938
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_supported_sys_cmds_terminal_capability, tvb, offset, 1, ENC_NA);
1939
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_supported_sys_cmds_rfu, tvb, offset, 1, ENC_NA);
1940
0
      break;
1941
0
    case 0x88: /* Specific UICC environmental conditions */
1942
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_temp_class, tvb, offset, 1, ENC_NA);
1943
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_high_humidity, tvb, offset, 1, ENC_NA);
1944
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_rfu, tvb, offset, 1, ENC_NA);
1945
0
      break;
1946
0
    case 0x89: /* Platform to Platform CAT Secured APDU */
1947
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_platform_to_platform_cat_secured_apdu, tvb, offset, len, ENC_NA);
1948
0
      break;
1949
0
    case 0x8A: /* Test configuration state */
1950
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_test_config_state, tvb, offset, len, ENC_NA);
1951
0
      break;
1952
0
    case 0x8B: /* Test configuration criterion type */
1953
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_test_config_criterion_type, tvb, offset, len, ENC_NA);
1954
0
      break;
1955
0
    default:
1956
      /* Unknown proprietary tag */
1957
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_value, tvb, offset, len, ENC_NA);
1958
0
      break;
1959
0
    }
1960
1961
0
    offset += len;
1962
0
  }
1963
1964
0
  return offset;
1965
0
}
1966
1967
/* Dissect FCP (File Control Parameters) template as defined in ETSI TS 102.221 */
1968
static int
1969
dissect_fcp_template(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
1970
17
{
1971
17
  proto_item *value_ti;
1972
17
  proto_tree *value_tree;
1973
17
  tvbuff_t *subtvb;
1974
17
  uint32_t tag, len;
1975
17
  uint8_t tag_size, len_size;
1976
17
  uint8_t byte;
1977
1978
17
  int start_offset = offset;
1979
17
  int end_offset = offset + length;
1980
1981
17
  offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
1982
  /* Check for FCP and FCI template tags */
1983
17
  if (tag != 0x62 && tag != 0x6F) {
1984
7
    return 0;
1985
7
  }
1986
10
  offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
1987
1988
10
  proto_tree_add_item(tree, hf_template_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
1989
10
  proto_tree_add_uint(tree, hf_template_len, tvb, start_offset + tag_size, len_size, len);
1990
1991
49
  while (offset < end_offset) {
1992
49
    start_offset = offset;
1993
1994
49
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
1995
49
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
1996
1997
49
    value_ti = proto_tree_add_bytes_format(tree, hf_fcp, tvb, start_offset,
1998
49
        tag_size + len_size + len, NULL, "%s%s%s",
1999
49
        val_to_str(pinfo->pool, tag, fcp_tag_vals, "Unknown tag '%02x'"),
2000
49
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
2001
49
    value_tree = proto_item_add_subtree(value_ti, ett_fcp);
2002
2003
49
    proto_tree_add_item(value_tree, hf_fcp_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2004
49
    proto_tree_add_uint(value_tree, hf_fcp_len, tvb, start_offset + tag_size, len_size, len);
2005
2006
49
    if (len == 0) {
2007
      /* No value field */
2008
13
      continue;
2009
13
    }
2010
2011
36
    switch (tag) {
2012
0
    case 0x80: /* File size */
2013
0
      proto_tree_add_item(value_tree, hf_fcp_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
2014
0
      break;
2015
0
    case 0x81: /* Total file size */
2016
0
      proto_tree_add_item(value_tree, hf_fcp_total_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
2017
0
      break;
2018
2
    case 0x82: /* File Descriptor */
2019
2
      byte = tvb_get_uint8(tvb, offset);
2020
2
      if (byte & 0x80) {
2021
0
        proto_tree_add_item(value_tree, hf_fcp_file_rfu_byte, tvb, offset, 1, ENC_NA);
2022
2
      } else {
2023
2
        proto_tree_add_item(value_tree, hf_fcp_file_rfu, tvb, offset, 1, ENC_NA);
2024
2
        proto_tree_add_item(value_tree, hf_fcp_file_accessibility, tvb, offset, 1, ENC_NA);
2025
2
        if ((byte & 0x3F) == 0x38) { /* DF or ADF */
2026
0
          proto_tree_add_item(value_tree, hf_fcp_file_type_ext, tvb, offset, 1, ENC_NA);
2027
2
        } else if ((byte & 0x3F) == 0x39) { /* BER-TLV structure */
2028
0
          proto_tree_add_item(value_tree, hf_fcp_ef_structure_ext, tvb, offset, 1, ENC_NA);
2029
2
        } else {
2030
2
          proto_tree_add_item(value_tree, hf_fcp_file_type, tvb, offset, 1, ENC_NA);
2031
2
          proto_tree_add_item(value_tree, hf_fcp_ef_structure, tvb, offset, 1, ENC_NA);
2032
2
        }
2033
2
      }
2034
2
      if (len >= 2) {
2035
2
        proto_tree_add_item(value_tree, hf_fcp_data_coding_byte, tvb, offset + 1, 1, ENC_NA);
2036
2
      }
2037
2
      if (len >= 5) {
2038
0
        proto_tree_add_item(value_tree, hf_fcp_record_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2039
0
        proto_tree_add_item(value_tree, hf_fcp_num_records, tvb, offset + 4, 1, ENC_NA);
2040
0
      }
2041
2
      break;
2042
0
    case 0x83: /* File Identifier */
2043
0
      proto_tree_add_item(value_tree, hf_fcp_file_id, tvb, offset, len, ENC_BIG_ENDIAN);
2044
0
      break;
2045
0
    case 0x84: /* DF name (AID) */
2046
0
      proto_tree_add_item(value_tree, hf_fcp_df_name, tvb, offset, len, ENC_NA);
2047
0
      break;
2048
0
    case 0x88: /* Short File Identifier (SFI) */
2049
0
      proto_tree_add_item(value_tree, hf_fcp_sfi, tvb, offset, len, ENC_NA);
2050
0
      break;
2051
0
    case 0x8A: /* Life Cycle Status Integer */
2052
0
      proto_tree_add_item(value_tree, hf_fcp_lifecycle_status, tvb, offset, len, ENC_NA);
2053
0
      break;
2054
0
    case 0x8B: /* Security attributes (referenced to expanded format) */
2055
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_referenced, tvb, offset, len, ENC_NA);
2056
0
      break;
2057
0
    case 0x8C: /* Security attributes (compact format) */
2058
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_compact, tvb, offset, len, ENC_NA);
2059
0
      break;
2060
0
    case 0xA5: /* Proprietary information */
2061
0
      dissect_fcp_proprietary_info(tvb, pinfo, value_tree, offset, len);
2062
0
      break;
2063
0
    case 0xAB: /* Security attributes (expanded format) */
2064
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_expanded, tvb, offset, len, ENC_NA);
2065
0
      break;
2066
0
    case 0xC6: /* PIN Status Template DO */
2067
0
      proto_tree_add_item(value_tree, hf_fcp_pin_status_do, tvb, offset, len, ENC_NA);
2068
0
      break;
2069
0
    case 0xE0: /* ISDRProprietaryApplicationTemplate (SGP.22) */
2070
0
      subtvb = tvb_new_subset_length(tvb, start_offset, tag_size + len_size + len);
2071
0
      dissect_sgp22_ISDRProprietaryApplicationTemplate_PDU(subtvb, pinfo, value_tree, NULL);
2072
0
      break;
2073
0
    case 0xE1: /* ISDRProprietaryApplicationTemplateIoT (SGP.32) */
2074
0
      subtvb = tvb_new_subset_length(tvb, start_offset, tag_size + len_size + len);
2075
0
      dissect_sgp32_ISDRProprietaryApplicationTemplateIoT_PDU(subtvb, pinfo, value_tree, NULL);
2076
0
      break;
2077
24
    default:
2078
      /* Unknown tag */
2079
24
      proto_tree_add_item(value_tree, hf_fcp_value, tvb, offset, len, ENC_NA);
2080
24
      break;
2081
36
    }
2082
2083
26
    offset += len;
2084
26
  }
2085
2086
0
  return offset;
2087
10
}
2088
2089
static int
2090
dissect_terminal_capability(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
2091
1
{
2092
1
  proto_item *value_ti;
2093
1
  proto_tree *value_tree;
2094
1
  uint32_t tag, len;
2095
1
  uint8_t tag_size, len_size;
2096
2097
1
  int start_offset = offset;
2098
1
  int end_offset = offset + length;
2099
2100
1
  offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2101
1
  if (tag != 0xA9) {
2102
1
    return 0;
2103
1
  }
2104
0
  offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2105
2106
0
  proto_tree_add_item(tree, hf_template_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2107
0
  proto_tree_add_uint(tree, hf_template_len, tvb, start_offset + tag_size, len_size, len);
2108
2109
0
  while (offset < end_offset) {
2110
0
    start_offset = offset;
2111
2112
0
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2113
0
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2114
2115
0
    value_ti = proto_tree_add_bytes_format(tree, hf_tc, tvb, start_offset,
2116
0
        tag_size + len_size + len, NULL, "%s%s%s",
2117
0
        val_to_str(pinfo->pool, tag, terminal_capability_tag_vals, "Unknown tag '%02x'"),
2118
0
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
2119
0
    value_tree = proto_item_add_subtree(value_ti, ett_terminal_capability);
2120
2121
0
    proto_tree_add_item(value_tree, hf_tc_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2122
0
    proto_tree_add_uint(value_tree, hf_tc_len, tvb, start_offset + tag_size, len_size, len);
2123
2124
0
    if (len == 0) {
2125
      /* No value field */
2126
0
      continue;
2127
0
    }
2128
2129
0
    switch (tag) {
2130
0
    case 0x80: /* Terminal power supply */
2131
0
      proto_tree_add_item(value_tree, hf_tc_actual_used_supply_voltage_class, tvb, offset, 1, ENC_NA);
2132
0
      proto_tree_add_item(value_tree, hf_tc_max_available_power_supply, tvb, offset+1, 1, ENC_NA);
2133
0
      proto_tree_add_item(value_tree, hf_tc_actual_used_clock_frequency, tvb, offset+2, 1, ENC_NA);
2134
0
      break;
2135
0
    case 0x81: /* Extended logical channels terminal support */
2136
0
      break;
2137
0
    case 0x82: /* Additional interfaces support */
2138
0
      proto_tree_add_item(value_tree, hf_tc_additional_interfaces_uicc_clf, tvb, offset, 1, ENC_NA);
2139
0
      proto_tree_add_item(value_tree, hf_tc_additional_interfaces_rfu, tvb, offset, 1, ENC_NA);
2140
0
      break;
2141
0
    case 0x83: /* RSP Device Capabilities (SGP.22) */
2142
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_luid, tvb, offset, 1, ENC_NA);
2143
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_lpdd, tvb, offset, 1, ENC_NA);
2144
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_ldsd, tvb, offset, 1, ENC_NA);
2145
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_luie, tvb, offset, 1, ENC_NA);
2146
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_rfu, tvb, offset, 1, ENC_NA);
2147
0
      break;
2148
0
    case 0x84: /* IoT Device Capabilities (SGP.32) */
2149
0
      proto_tree_add_item(value_tree, hf_tc_sgp32_ipad, tvb, offset, 1, ENC_NA);
2150
0
      proto_tree_add_item(value_tree, hf_tc_sgp32_rfu, tvb, offset, 1, ENC_NA);
2151
0
      break;
2152
0
    default:
2153
      /* Unknown tag */
2154
0
      proto_tree_add_item(value_tree, hf_tc_value, tvb, offset, len, ENC_NA);
2155
0
      break;
2156
0
    }
2157
2158
0
    offset += len;
2159
0
  }
2160
2161
0
  return offset;
2162
0
}
2163
2164
static int
2165
dissect_bertlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2166
13
{
2167
13
  unsigned int pos = 0;
2168
13
  proto_tree *top_tree = data ? (proto_tree *)data : tree;
2169
2170
55
  while (pos < tvb_reported_length(tvb)) {
2171
48
    uint8_t tag;
2172
48
    uint32_t len;
2173
48
    tvbuff_t *subtvb;
2174
2175
    /* FIXME: properly follow BER coding rules */
2176
48
    proto_tree_add_item_ret_uint8(tree, hf_cat_ber_tag, tvb, pos, 1, ENC_BIG_ENDIAN, &tag);
2177
48
    pos++;
2178
48
    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
2179
48
        val_to_str(pinfo->pool, tag, ber_tlv_cat_tag_vals, "%02x "));
2180
48
    len = tvb_get_uint8(tvb, pos++);
2181
48
    switch (len) {
2182
3
    case 0x81:
2183
3
      len = tvb_get_uint8(tvb, pos++);
2184
3
      break;
2185
1
    case 0x82:
2186
1
      len = tvb_get_ntohs(tvb, pos);
2187
1
      pos += 2;
2188
1
      break;
2189
1
    case 0x83:
2190
1
      len = tvb_get_ntoh24(tvb, pos);
2191
1
      pos += 3;
2192
1
      break;
2193
42
    default:
2194
42
      break;
2195
48
    }
2196
2197
47
    subtvb = tvb_new_subset_length(tvb, pos, len);
2198
47
    switch (tag) {
2199
0
    case 0xD0:  /* proactive command */
2200
0
    case 0xD1:  /* sms-pp download */
2201
0
    case 0xD6:  /* event download */
2202
5
    case 0xD7:  /* timer expiration */
2203
5
      call_dissector_with_data(sub_handle_cap, subtvb, pinfo, top_tree, GUINT_TO_POINTER((unsigned)tag));
2204
5
      break;
2205
47
    }
2206
2207
42
    pos += len;
2208
42
  }
2209
7
  return tvb_captured_length(tvb);
2210
13
}
2211
2212
2213
#define ADD_TP_BYTE(byte) \
2214
227
    if ((offset - start_offset) >= p3) break; \
2215
227
    proto_tree_add_bitmask(sim_tree, tvb, offset++, hf_tprof_b##byte, ett_tprof_b##byte, tprof_b##byte##_fields, ENC_BIG_ENDIAN);
2216
2217
340
#define P1_OFFS   0
2218
349
#define P2_OFFS   1
2219
288
#define P3_OFFS   2
2220
318
#define DATA_OFFS 3
2221
2222
static const value_string sfi_vals[] = {
2223
  { 0x01, "Emergency call codes" },
2224
  { 0x02, "Language indication" },
2225
  { 0x03, "Administrative data" },
2226
  { 0x04, "USIM service table" },
2227
  { 0x05, "Enabled services table" },
2228
  { 0x06, "Access control class" },
2229
  { 0x07, "IMSI" },
2230
  { 0x08, "Ciphering and integrity keys" },
2231
  { 0x09, "Ciphering and integrity keys for packet switched domain" },
2232
  { 0x0A, "User PLMN selector" },
2233
  { 0x0B, "Location information" },
2234
  { 0x0C, "Packet switched location information" },
2235
  { 0x0D, "Forbidden PLMNs" },
2236
  { 0x0E, "CBMID" },
2237
  { 0x0F, "Hyperframe number" },
2238
  { 0x10, "Maximum value of hyperframe number" },
2239
  { 0x11, "Operator PLMN selector" },
2240
  { 0x12, "Higher Priority PLMN search period" },
2241
  { 0x13, "Preferred HPLMN access technology" },
2242
  { 0x14, "Incoming call information" },
2243
  { 0x15, "Outgoing call information" },
2244
  { 0x16, "Capability configuration parameters 2" },
2245
  { 0x17, "Access Rule Reference" },
2246
  { 0x18, "EPS NAS Security Context" },
2247
  { 0x19, "PLMN Network Name" },
2248
  { 0x1A, "Operator Network List" },
2249
  { 0x1B, "Service Provider Display Information" },
2250
  { 0x1C, "Accumulated Call Meter" },
2251
  { 0x1D, "Equivalent HPLMN" },
2252
  { 0x1E, "EPS location information" },
2253
  { 0, NULL }
2254
};
2255
2256
static const value_string sfi_referencing_vals[] = {
2257
  { 0x04, "SFI referencing used" },
2258
  { 0, NULL }
2259
};
2260
2261
static int
2262
dissect_auth_challenge(uint8_t context, tvbuff_t *tvb, proto_tree *tree, int offset, int length)
2263
1
{
2264
1
  proto_item *ti;
2265
1
  proto_tree *sub_tree;
2266
1
  uint32_t len;
2267
2268
1
  ti = proto_tree_add_item(tree, hf_auth_challenge, tvb, offset, length, ENC_NA);
2269
1
  sub_tree = proto_item_add_subtree(ti, ett_auth_challenge);
2270
2271
1
  switch (context) {
2272
1
  case 0x00: /* GSM context */
2273
1
  case 0x01: /* 3G/EPS/5G context */
2274
1
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_rand_len, tvb, offset, 1, ENC_NA, &len);
2275
1
    offset += 1;
2276
1
    proto_tree_add_item(sub_tree, hf_auth_rand, tvb, offset, len, ENC_NA);
2277
1
    offset += len;
2278
1
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_autn_len, tvb, offset, 1, ENC_NA, &len);
2279
1
    offset += 1;
2280
1
    proto_tree_add_item(sub_tree, hf_auth_autn, tvb, offset, len, ENC_NA);
2281
1
    offset += len;
2282
1
    break;
2283
0
  default:
2284
    /* XXX - Dissect according to authentication context */
2285
0
    offset += length;
2286
0
    break;
2287
1
  }
2288
2289
1
  return offset;
2290
1
}
2291
2292
static int
2293
dissect_auth_response(uint8_t context, tvbuff_t *tvb, proto_tree *tree, int offset, int length)
2294
1
{
2295
1
  proto_item *ti;
2296
1
  proto_tree *sub_tree;
2297
1
  uint32_t status = 0;
2298
1
  uint32_t len;
2299
2300
1
  if (context == 0x01) {
2301
    /* 3G/EPS/5G context - put status outside the response tree */
2302
0
    proto_tree_add_item_ret_uint(tree, hf_auth_status, tvb, offset, 1, ENC_NA, &status);
2303
0
  }
2304
2305
1
  ti = proto_tree_add_item(tree, hf_auth_response, tvb, offset, length, ENC_NA);
2306
1
  sub_tree = proto_item_add_subtree(ti, ett_auth_response);
2307
2308
1
  switch (context) {
2309
1
  case 0x00: /* GSM context */
2310
1
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_gsm_sres_len, tvb, offset, 1, ENC_NA, &len);
2311
1
    offset += 1;
2312
1
    proto_tree_add_item(sub_tree, hf_auth_gsm_sres, tvb, offset, len, ENC_NA);
2313
1
    offset += len;
2314
1
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_gsm_kc_len, tvb, offset, 1, ENC_NA, &len);
2315
1
    offset += 1;
2316
1
    proto_tree_add_item(sub_tree, hf_auth_gsm_kc, tvb, offset, len, ENC_NA);
2317
1
    offset += len;
2318
1
    break;
2319
0
  case 0x01: /* 3G/EPS/5G context */
2320
0
    offset += 1; /* Skip status byte already added above */
2321
0
    if (status == 0xDB) {
2322
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_res_len, tvb, offset, 1, ENC_NA, &len);
2323
0
      offset += 1;
2324
0
      proto_tree_add_item(sub_tree, hf_auth_res, tvb, offset, len, ENC_NA);
2325
0
      offset += len;
2326
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_ck_len, tvb, offset, 1, ENC_NA, &len);
2327
0
      offset += 1;
2328
0
      proto_tree_add_item(sub_tree, hf_auth_ck, tvb, offset, len, ENC_NA);
2329
0
      offset += len;
2330
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_ik_len, tvb, offset, 1, ENC_NA, &len);
2331
0
      offset += 1;
2332
0
      proto_tree_add_item(sub_tree, hf_auth_ik, tvb, offset, len, ENC_NA);
2333
0
      offset += len;
2334
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_kc_len, tvb, offset, 1, ENC_NA, &len);
2335
0
      offset += 1;
2336
0
      proto_tree_add_item(sub_tree, hf_auth_kc, tvb, offset, len, ENC_NA);
2337
0
      offset += len;
2338
0
    } else if (status == 0xDC) {
2339
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_auts_len, tvb, offset, 1, ENC_NA, &len);
2340
0
      offset += 1;
2341
0
      proto_tree_add_item(sub_tree, hf_auth_auts, tvb, offset, len, ENC_NA);
2342
0
      offset += len;
2343
0
    }
2344
0
    break;
2345
0
  default:
2346
    /* XXX - Dissect according to authentication context */
2347
0
    offset += length;
2348
1
  }
2349
2350
1
  return offset;
2351
1
}
2352
2353
static void
2354
dissect_apdu_lc(proto_tree *tree, tvbuff_t *tvb, int offset, bool extended_len)
2355
285
{
2356
285
  if (extended_len) {
2357
14
    proto_tree_add_item(tree, hf_apdu_lc_ext, tvb, offset, 3, ENC_BIG_ENDIAN);
2358
271
  } else {
2359
271
    proto_tree_add_item(tree, hf_apdu_lc, tvb, offset, 1, ENC_BIG_ENDIAN);
2360
271
  }
2361
285
}
2362
2363
static void
2364
dissect_apdu_le(proto_tree *tree, tvbuff_t *tvb, int offset, bool extended_len, bool first)
2365
51
{
2366
51
  if (extended_len) {
2367
7
    proto_tree_add_item(tree, hf_apdu_le_ext, tvb, offset, first ? 3 : 2, ENC_BIG_ENDIAN);
2368
44
  } else {
2369
44
    proto_tree_add_item(tree, hf_apdu_le, tvb, offset, 1, ENC_BIG_ENDIAN);
2370
44
  }
2371
51
}
2372
2373
static void
2374
dissect_storage_data_command(tvbuff_t *tvb, int offset, int length, packet_info *pinfo,
2375
           proto_tree *tree, proto_tree *sim_tree, gsm_sim_transaction_t *gsm_sim_trans)
2376
4
{
2377
4
  bool last_block = gsm_sim_trans->cmd_p1 & 0x80; /* Block chaining bit */
2378
4
  uint32_t frag_number = gsm_sim_trans->cmd_p2;   /* Block number */
2379
4
  tvbuff_t *subtvb;
2380
2381
4
  if (frag_number == 0 && last_block) {
2382
    /* No reassembly needed. */
2383
1
    subtvb = tvb_new_subset_length(tvb, offset, length);
2384
3
  } else {
2385
3
    fragment_head *frag_msg;
2386
2387
    /* The APDU reassembly is using the first command frame number as id. */
2388
3
    frag_msg = fragment_add_seq_check(&gsm_sim_reassembly_table, tvb, offset, pinfo,
2389
3
              gsm_sim_trans->related_trans->cmd_frame, NULL,
2390
3
              frag_number, length, !last_block);
2391
3
    subtvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled APDU",
2392
3
              frag_msg, &gsm_sim_frag_items, NULL, sim_tree);
2393
3
  }
2394
2395
4
  if (subtvb && ((gsm_sim_trans->cmd_p1 & 0x78) == 0x10) && is_sgp32_request(subtvb)) {
2396
0
    dissect_sgp32_request(subtvb, pinfo, tree, NULL);
2397
0
  }
2398
4
}
2399
2400
static tvbuff_t *
2401
gsm_sim_apdu_reassemble(tvbuff_t *tvb, int offset, packet_info *pinfo, gsm_sim_transaction_t *gsm_sim_trans,
2402
      proto_tree *sim_tree, uint8_t *apdu_ins, uint8_t *apdu_p1, uint8_t *apdu_p2)
2403
63
{
2404
63
  unsigned tvb_len = tvb_reported_length(tvb);
2405
63
  unsigned apdu_len = tvb_len - offset - 2;
2406
63
  tvbuff_t *subtvb = NULL;
2407
63
  uint8_t sw1;
2408
2409
63
  if (!gsm_sim_trans || gsm_sim_trans->rsp_frame != pinfo->num) {
2410
    /* No transaction found, return the current tvb subset */
2411
0
    return tvb_new_subset_length(tvb, offset, apdu_len);
2412
0
  }
2413
2414
  /* Try reassembly if SW1 is "Response ready" or instruction is "GET RESPONSE" */
2415
63
  sw1 = tvb_get_uint8(tvb, tvb_len - 2);
2416
63
  if (sw1 == 0x61 || gsm_sim_trans->cmd_ins == 0xC0) {
2417
3
    fragment_head *frag_msg;
2418
2419
    /* The APDU reassembly is using the command frame number + 1 as id. */
2420
3
    frag_msg = fragment_add_seq_next(&gsm_sim_reassembly_table, tvb, offset, pinfo,
2421
3
             gsm_sim_trans->related_trans->cmd_frame + 1, NULL,
2422
3
             apdu_len, sw1 == 0x61);
2423
3
    subtvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled APDU",
2424
3
              frag_msg, &gsm_sim_frag_items, NULL, sim_tree);
2425
3
  }
2426
2427
63
  if (!subtvb) {
2428
53
    subtvb = tvb_new_subset_length(tvb, offset, apdu_len);
2429
53
  }
2430
2431
63
  if (gsm_sim_trans != gsm_sim_trans->related_trans) {
2432
    /* Use INS, P1 and P2 from the related command */
2433
1
    *apdu_ins = gsm_sim_trans->related_trans->cmd_ins;
2434
1
    *apdu_p1 = gsm_sim_trans->related_trans->cmd_p1;
2435
1
    *apdu_p2 = gsm_sim_trans->related_trans->cmd_p2;
2436
1
  }
2437
2438
63
  return subtvb;
2439
63
}
2440
2441
static int
2442
dissect_gsm_apdu(uint8_t ins, uint8_t p1, uint8_t p2, uint16_t p3, bool extended_len,
2443
     tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_tree *sim_tree,
2444
     gsm_sim_transaction_t *gsm_sim_trans)
2445
318
{
2446
318
  uint16_t g16;
2447
318
  tvbuff_t *subtvb;
2448
318
  int i, start_offset;
2449
318
  uint8_t first_byte = 0;
2450
318
  const int data_offs = DATA_OFFS + (extended_len ? 2 : 0);
2451
2452
318
  col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
2453
318
      val_to_str(pinfo->pool, ins, apdu_ins_vals, "%02x"));
2454
2455
318
  switch (ins) {
2456
13
  case 0xA4: /* SELECT */
2457
13
    proto_tree_add_item(sim_tree, hf_select_type, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2458
13
    if (p1 == 0x04) { /* Selection by DF name (selection by AID) */
2459
0
      proto_tree_add_item(sim_tree, hf_select_session_control, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2460
13
    } else {
2461
13
      proto_tree_add_item(sim_tree, hf_select_unused_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2462
13
    }
2463
13
    proto_tree_add_item(sim_tree, hf_select_return_data, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2464
13
    proto_tree_add_item(sim_tree, hf_select_selection, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2465
13
    break;
2466
4
  case 0xF2: /* STATUS */
2467
4
    proto_tree_add_item(sim_tree, hf_status_application_status, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2468
4
    proto_tree_add_item(sim_tree, hf_status_return_data, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2469
4
    if (p1 == 0x01) {
2470
0
      col_append_str(pinfo->cinfo, COL_INFO, "(initialized) ");
2471
4
    } else if (p1 == 0x02) {
2472
0
      col_append_str(pinfo->cinfo, COL_INFO, "(terminate) ");
2473
0
    }
2474
4
    break;
2475
0
  case 0xB0: /* READ BINARY */
2476
2
  case 0xD6: /* UPDATE BINARY */
2477
2
    if (p1 & 0x80) {
2478
2
      proto_tree_add_item(sim_tree, hf_referencing, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2479
2
      proto_tree_add_item(sim_tree, hf_sfi, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2480
2
      col_append_fstr(pinfo->cinfo, COL_INFO, "Offset=%u ", p2);
2481
2
      proto_tree_add_item(sim_tree, hf_bin_offset, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2482
2
    } else {
2483
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "Offset=%u ", p1 << 8 | p2);
2484
0
      proto_tree_add_item(sim_tree, hf_bin_offset, tvb, offset+P1_OFFS, 2, ENC_BIG_ENDIAN);
2485
0
    }
2486
2
    break;
2487
1
  case 0xB2: /* READ RECORD */
2488
1
  case 0xDC: /* UPDATE RECORD */
2489
1
    col_append_fstr(pinfo->cinfo, COL_INFO, "RecordNr=%u ", p1);
2490
1
    proto_tree_add_item(sim_tree, hf_record_nr, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2491
1
    proto_tree_add_item(sim_tree, hf_record_file, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2492
1
    proto_tree_add_item(sim_tree, hf_record_mode, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2493
1
    break;
2494
2
  case 0xA2: /* SEARCH RECORD */
2495
2
    first_byte = tvb_get_uint8(tvb, offset+data_offs);
2496
2
    if (((p2 & 0x04) == 0) || (((p2 & 0x07) == 0x06) && ((first_byte & 0x04) == 0))) {
2497
1
      proto_tree_add_item(sim_tree, hf_record_id, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2498
1
    } else {
2499
1
      proto_tree_add_item(sim_tree, hf_record_nr, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2500
1
    }
2501
2
    proto_tree_add_item(sim_tree, hf_search_ef_identifier, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2502
2
    proto_tree_add_item(sim_tree, hf_search_mode, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2503
2
    break;
2504
1
  case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2505
1
    proto_tree_add_item(sim_tree, hf_apdu_p1, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2506
1
    if (p2 != 0) {
2507
1
      proto_tree_add_item(sim_tree, hf_auth_reference, tvb, offset+P2_OFFS, 1, ENC_NA);
2508
1
      proto_tree_add_item(sim_tree, hf_auth_rfu, tvb, offset+P2_OFFS, 1, ENC_NA);
2509
1
      proto_tree_add_item(sim_tree, hf_auth_context, tvb, offset+P2_OFFS, 1, ENC_NA);
2510
1
    }
2511
1
    break;
2512
1
  case 0x70: /* MANAGE CHANNEL */
2513
1
    proto_tree_add_item(sim_tree, hf_chan_op, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2514
1
    col_append_fstr(pinfo->cinfo, COL_INFO, "Operation=%s ", val_to_str(pinfo->pool, p1, chan_op_vals, "%02x"));
2515
1
    proto_tree_add_item(sim_tree, hf_chan_nr, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2516
1
    if (p1 == 0 && p2 == 0) {
2517
      /* Logical channels are assigned by the card when P2 is 0. */
2518
0
      col_append_str(pinfo->cinfo, COL_INFO, "(assign channel) ");
2519
1
    } else {
2520
1
      col_append_fstr(pinfo->cinfo, COL_INFO, "(channel: %d) ", p2);
2521
1
    }
2522
1
    break;
2523
2
  case 0x76: /* SUSPEND UICC */
2524
2
    proto_tree_add_item(sim_tree, hf_suspend_uicc_op, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2525
2
    proto_tree_add_item(sim_tree, hf_apdu_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2526
2
    break;
2527
5
  case 0xE2: /* STORE DATA */
2528
5
    proto_tree_add_item(sim_tree, hf_store_data_block, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2529
5
    proto_tree_add_item(sim_tree, hf_store_data_encryption, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2530
5
    proto_tree_add_item(sim_tree, hf_store_data_structure, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2531
5
    proto_tree_add_item(sim_tree, hf_store_data_rfu, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2532
5
    proto_tree_add_item(sim_tree, hf_store_data_iso_case, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2533
5
    proto_tree_add_item(sim_tree, hf_store_data_block_nr, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2534
5
    if (p1 & 0x80) {
2535
3
      col_append_str(pinfo->cinfo, COL_INFO, "(last block) ");
2536
3
    } else {
2537
2
      col_append_str(pinfo->cinfo, COL_INFO, "(more blocks) ");
2538
2
    }
2539
5
    break;
2540
287
  default:
2541
    /* Generic P1 and P2 */
2542
287
    proto_tree_add_item(sim_tree, hf_apdu_p1, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2543
287
    proto_tree_add_item(sim_tree, hf_apdu_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2544
287
    break;
2545
318
  }
2546
2547
317
  switch (ins) {
2548
13
  case 0xA4: /* SELECT */
2549
13
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2550
13
    if (p3 < 2) {
2551
1
      offset += data_offs;
2552
1
      break;
2553
1
    }
2554
12
    switch (p1) {
2555
0
    case 0x03:  /* parent DF */
2556
0
      col_append_str(pinfo->cinfo, COL_INFO, "Parent DF ");
2557
0
      break;
2558
0
    case 0x04:  /* select by AID */
2559
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "Application %s ",
2560
0
          tvb_bytes_to_str(pinfo->pool, tvb, offset+data_offs, p3));
2561
0
      proto_tree_add_item(sim_tree, hf_aid, tvb, offset+data_offs, p3, ENC_NA);
2562
0
      break;
2563
2564
0
    case 0x09:  /* select by relative path */
2565
0
      col_append_str(pinfo->cinfo, COL_INFO, ".");
2566
      /* fallthrough */
2567
0
    case 0x08:  /* select by absolute path */
2568
0
      for (i = 0; i < p3; i += 2) {
2569
0
        g16 = tvb_get_ntohs(tvb, offset+data_offs+i);
2570
0
        col_append_fstr(pinfo->cinfo, COL_INFO, "/%s",
2571
0
            val_to_str(pinfo->pool, g16, mf_dfs, "%04x"));
2572
0
        proto_tree_add_item(sim_tree, hf_file_id, tvb, offset+data_offs+i, 2, ENC_BIG_ENDIAN);
2573
0
      }
2574
0
      col_append_str(pinfo->cinfo, COL_INFO, " ");
2575
0
      break;
2576
12
    default:
2577
12
      g16 = tvb_get_ntohs(tvb, offset+data_offs);
2578
12
      col_append_fstr(pinfo->cinfo, COL_INFO, "File %s ",
2579
12
          val_to_str(pinfo->pool, g16, mf_dfs, "%04x"));
2580
12
      proto_tree_add_item(sim_tree, hf_file_id, tvb, offset+data_offs, p3, ENC_BIG_ENDIAN);
2581
12
      break;
2582
12
    }
2583
12
    offset += data_offs + p3;
2584
12
    if (tvb_reported_length_remaining(tvb, offset)) {
2585
12
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2586
12
      offset += (extended_len ? 2 : 1);
2587
12
    }
2588
12
    break;
2589
4
  case 0xF2: /* STATUS */
2590
4
    if (tvb_reported_length_remaining(tvb, offset+P3_OFFS)) {
2591
4
      dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2592
4
    }
2593
4
    offset += data_offs;
2594
4
    break;
2595
0
  case 0xB0: /* READ BINARY */
2596
0
  case 0xB2: /* READ RECORD */
2597
11
  case 0x12: /* FETCH */
2598
12
  case 0x78: /* GET IDENTITY */
2599
13
  case 0xC0: /* GET RESPONSE */
2600
14
  case 0xCA: /* GET DATA */
2601
14
    dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2602
14
    offset += data_offs;
2603
14
    break;
2604
2
  case 0xD6: /* UPDATE BINARY */
2605
2
  case 0xDC: /* UPDATE RECORD */
2606
2
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2607
2
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2608
2
    offset += data_offs + p3;
2609
2
    break;
2610
2
  case 0xA2: /* SEARCH RECORD */
2611
2
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2612
2
    offset += data_offs;
2613
2
    if ((p2 & 0x07) == 0x06) { /* Enhanced search */
2614
0
      proto_tree_add_item(sim_tree, hf_search_enhanced_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2615
0
      proto_tree_add_item(sim_tree, hf_search_enhanced_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
2616
0
      offset++;
2617
0
      if ((first_byte & 0xF8) == 0) {
2618
0
        proto_tree_add_item(sim_tree, hf_search_enhanced_offset, tvb, offset++, 1, ENC_BIG_ENDIAN);
2619
0
      } else {
2620
0
        proto_tree_add_item(sim_tree, hf_search_enhanced_value, tvb, offset++, 1, ENC_BIG_ENDIAN);
2621
0
      }
2622
0
      p3 -= 2; /* Reduced by 2 bytes for the enhanced search indication */
2623
0
    }
2624
2
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, p3, ENC_NA);
2625
2
    offset += p3;
2626
2
    if (tvb_reported_length_remaining(tvb, offset)) {
2627
2
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2628
2
      offset += (extended_len ? 2 : 1);
2629
2
    }
2630
2
    break;
2631
1
  case 0x32: /* INCREASE */
2632
1
    offset += data_offs;
2633
1
    break;
2634
3
  case 0x20: /* VERIFY CHV */
2635
4
  case 0x24: /* CHANGE CHV */
2636
6
  case 0x26: /* DISABLE CHV */
2637
6
  case 0x28: /* ENABLE CHV */
2638
6
  case 0x2C: /* UNBLOCK CHV */
2639
6
    col_append_fstr(pinfo->cinfo, COL_INFO, "CHV=%u ", p2);
2640
6
    offset += data_offs;
2641
    /* FIXME: actual PIN/PUK code */
2642
6
    break;
2643
1
  case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2644
1
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2645
1
    offset += data_offs;
2646
2647
1
    if (p2 == 0) {
2648
      /* GSM ALGORITHM */
2649
0
      proto_tree_add_item(sim_tree, hf_auth_gsm_rand, tvb, offset, 16, ENC_NA);
2650
0
      offset += 16;
2651
1
    } else {
2652
1
      dissect_auth_challenge(p2 & 0x07, tvb, sim_tree, offset, p3);
2653
1
      offset += p3;
2654
1
    }
2655
1
    if (tvb_reported_length_remaining(tvb, offset)) {
2656
1
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2657
1
      offset += (extended_len ? 2 : 1);
2658
1
    }
2659
1
    break;
2660
8
  case 0x10: /* TERMINAL PROFILE */
2661
8
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2662
8
    offset += data_offs;
2663
8
    start_offset = offset;
2664
8
    ADD_TP_BYTE(1);
2665
7
    ADD_TP_BYTE(2);
2666
7
    ADD_TP_BYTE(3);
2667
7
    ADD_TP_BYTE(4);
2668
7
    ADD_TP_BYTE(5);
2669
7
    ADD_TP_BYTE(6);
2670
7
    ADD_TP_BYTE(7);
2671
7
    ADD_TP_BYTE(8);
2672
7
    ADD_TP_BYTE(9);
2673
7
    ADD_TP_BYTE(10);
2674
6
    ADD_TP_BYTE(11);
2675
6
    ADD_TP_BYTE(12);
2676
6
    ADD_TP_BYTE(13);
2677
6
    ADD_TP_BYTE(14);
2678
6
    ADD_TP_BYTE(15);
2679
6
    ADD_TP_BYTE(16);
2680
6
    ADD_TP_BYTE(17);
2681
6
    ADD_TP_BYTE(18);
2682
6
    ADD_TP_BYTE(19);
2683
6
    ADD_TP_BYTE(20);
2684
6
    ADD_TP_BYTE(21);
2685
5
    ADD_TP_BYTE(22);
2686
5
    ADD_TP_BYTE(23);
2687
5
    ADD_TP_BYTE(24);
2688
5
    ADD_TP_BYTE(25);
2689
5
    ADD_TP_BYTE(26);
2690
5
    ADD_TP_BYTE(27);
2691
5
    ADD_TP_BYTE(28);
2692
5
    ADD_TP_BYTE(29);
2693
5
    ADD_TP_BYTE(30);
2694
5
    ADD_TP_BYTE(31);
2695
5
    ADD_TP_BYTE(32);
2696
5
    ADD_TP_BYTE(33);
2697
5
    ADD_TP_BYTE(34);
2698
5
    ADD_TP_BYTE(35);
2699
5
    ADD_TP_BYTE(36);
2700
5
    ADD_TP_BYTE(37);
2701
5
    ADD_TP_BYTE(38);
2702
5
    ADD_TP_BYTE(39);
2703
90
    while ((offset - start_offset) < p3) {
2704
85
      proto_tree_add_item(sim_tree, hf_tprof_unknown_byte, tvb, offset++, 1, ENC_BIG_ENDIAN);
2705
85
    }
2706
5
    break;
2707
227
  case 0x14: /* TERMINAL RESPONSE */
2708
227
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2709
227
    subtvb = tvb_new_subset_length(tvb, offset+data_offs, p3);
2710
227
    call_dissector_with_data(sub_handle_cap, subtvb, pinfo, tree, GUINT_TO_POINTER(0x14));
2711
227
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2712
227
    offset += data_offs + p3;
2713
227
    break;
2714
1
  case 0xAA: /* TERMINAL CAPABILITY */
2715
1
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2716
1
    dissect_terminal_capability(tvb, pinfo, sim_tree, offset+data_offs, p3);
2717
1
    offset += data_offs + p3;
2718
1
    break;
2719
1
  case 0x70: /* MANAGE CHANNEL */
2720
1
    if (tvb_reported_length_remaining(tvb, offset+P3_OFFS)) {
2721
1
      dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2722
1
    }
2723
1
    offset += data_offs;
2724
1
    break;
2725
3
  case 0xC2: /* ENVELOPE */
2726
3
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2727
3
    subtvb = tvb_new_subset_length(tvb, offset+data_offs, p3);
2728
3
    dissect_bertlv(subtvb, pinfo, sim_tree, tree);
2729
3
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2730
3
    offset += data_offs + p3;
2731
3
    if (tvb_reported_length_remaining(tvb, offset)) {
2732
2
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2733
2
      offset += (extended_len ? 2 : 1);
2734
2
    }
2735
3
    break;
2736
2
  case 0x76: /* SUSPEND UICC */
2737
2
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2738
2
    if ((p1 & 0x01) == 0x00) {
2739
      /* Suspend the UICC */
2740
1
      col_append_str(pinfo->cinfo, COL_INFO, "(suspend) ");
2741
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_min_time_unit, tvb, offset+data_offs, 1, ENC_BIG_ENDIAN);
2742
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_min_time_length, tvb, offset+data_offs+1, 1, ENC_BIG_ENDIAN);
2743
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_unit, tvb, offset+data_offs+2, 1, ENC_BIG_ENDIAN);
2744
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_length, tvb, offset+data_offs+3, 1, ENC_BIG_ENDIAN);
2745
1
      dissect_apdu_le(sim_tree, tvb, offset+data_offs+4, extended_len, false);
2746
1
      offset += (extended_len ? 2 : 1);
2747
1
    } else {
2748
      /* Resume the UICC */
2749
1
      col_append_str(pinfo->cinfo, COL_INFO, "(resume) ");
2750
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_resume_token, tvb, offset+data_offs, p3, ENC_NA);
2751
1
    }
2752
2
    offset += data_offs + p3;
2753
2
    break;
2754
5
  case 0xE2: /* STORE DATA */
2755
5
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2756
5
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2757
5
    dissect_storage_data_command(tvb, offset+data_offs, p3, pinfo, tree, sim_tree, gsm_sim_trans);
2758
5
    offset += data_offs + p3;
2759
5
    if (p1 & 0x80) {
2760
      /* Le is mandatory for "Last block" and not present for "More blocks" */
2761
2
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2762
2
      offset += (extended_len ? 2 : 1);
2763
2
    }
2764
5
    break;
2765
0
  case 0x04: /* INVALIDATE */
2766
0
  case 0x44: /* REHABILITATE */
2767
0
  case 0xFA: /* SLEEP */
2768
    /* FIXME: parse command */
2769
27
  default:
2770
27
    return -1;
2771
317
  }
2772
2773
62
  return offset;
2774
317
}
2775
2776
static int
2777
dissect_rsp_apdu_tvb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_tree *sim_tree)
2778
65
{
2779
65
  uint16_t sw;
2780
65
  proto_item *ti = NULL;
2781
65
  unsigned tvb_len = tvb_reported_length(tvb);
2782
65
  gsm_sim_transaction_t *gsm_sim_trans = NULL;
2783
65
  wmem_tree_key_t key[4];
2784
65
  uint32_t interface_id = 0;
2785
65
  uint32_t layer_num = pinfo->curr_layer_num;
2786
65
  uint32_t frame_num = pinfo->num;
2787
65
  uint8_t ins = 0x00;
2788
65
  uint8_t p1 = 0x00;
2789
65
  uint8_t p2 = 0x00;
2790
65
  bool response_only = true;
2791
2792
  /* Structure of response APDU: [Data] SW1 SW2 */
2793
2794
65
  if (!sim_tree) {
2795
11
    ti = proto_tree_add_item(tree, proto_gsm_sim, tvb, 0, -1, ENC_NA);
2796
11
    sim_tree = proto_item_add_subtree(ti, ett_sim);
2797
11
  }
2798
2799
65
  if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
2800
0
    interface_id = pinfo->rec->rec_header.packet_header.interface_id;
2801
0
  }
2802
2803
65
  key[0].length = 1;
2804
65
  key[0].key = &interface_id;
2805
65
  key[1].length = 1;
2806
65
  key[1].key = &layer_num;
2807
65
  key[2].length = 1;
2808
65
  key[2].key = &frame_num;
2809
65
  key[3].length = 0;
2810
65
  key[3].key = NULL;
2811
2812
  /* Receive the largest key that is less than or equal to our frame number */
2813
65
  gsm_sim_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
2814
65
  if (!PINFO_FD_VISITED(pinfo) && gsm_sim_trans && gsm_sim_trans->rsp_frame == 0) {
2815
65
    if (gsm_sim_trans->cmd_ins == 0xC0) { /* GET RESPONSE */
2816
      /* Make a reference to the first APDU this GET RESPONSE is related to */
2817
1
      gsm_sim_transaction_t *prev_trans;
2818
1
      frame_num = gsm_sim_trans->cmd_frame - 1;
2819
1
      prev_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
2820
1
      if (prev_trans) {
2821
1
        gsm_sim_trans->related_trans = prev_trans->related_trans;
2822
1
      }
2823
1
    }
2824
65
    gsm_sim_trans->rsp_frame = pinfo->num;
2825
65
  }
2826
2827
65
  if ((tvb_len-offset) > 2) {
2828
63
    tvbuff_t *subtvb;
2829
63
    unsigned apdu_len;
2830
63
    uint8_t apdu_ins;
2831
2832
    /* Use INS, P1 and P2 from the command */
2833
63
    if (gsm_sim_trans && gsm_sim_trans->rsp_frame == pinfo->num) {
2834
63
      ins = gsm_sim_trans->cmd_ins;
2835
63
      p1 = gsm_sim_trans->cmd_p1;
2836
63
      p2 = gsm_sim_trans->cmd_p2;
2837
63
    }
2838
2839
63
    apdu_len = tvb_len - offset - 2;
2840
63
    apdu_ins = ins;
2841
2842
63
    subtvb = gsm_sim_apdu_reassemble(tvb, offset, pinfo, gsm_sim_trans, sim_tree, &apdu_ins, &p1, &p2);
2843
2844
63
    switch (apdu_ins) {
2845
10
    case 0x12: /* FETCH */
2846
10
      dissect_bertlv(subtvb, pinfo, sim_tree, tree);
2847
10
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2848
10
      response_only = false;
2849
10
      break;
2850
0
    case 0x70: /* MANAGE CHANNEL */
2851
0
      if (p1 == 0 && p2 == 0) {
2852
        /* Logical channels are assigned by the card when P2 is 0. */
2853
0
        proto_tree_add_item(sim_tree, hf_chan_nr, tvb, offset, apdu_len, ENC_BIG_ENDIAN);
2854
0
      }
2855
0
      break;
2856
1
    case 0x76: /* SUSPEND UICC */
2857
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
2858
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_length, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2859
1
      proto_tree_add_item(sim_tree, hf_suspend_uicc_resume_token, tvb, offset+2, apdu_len - 2, ENC_NA);
2860
1
      break;
2861
1
    case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2862
1
      if (p2 == 0) {
2863
        /* GSM ALGORITHM */
2864
0
        proto_tree_add_item(sim_tree, hf_auth_gsm_sres, tvb, offset, 4, ENC_NA);
2865
0
        proto_tree_add_item(sim_tree, hf_auth_gsm_kc, tvb, offset+4, 8, ENC_NA);
2866
1
      } else {
2867
1
        dissect_auth_response(p2 & 0x07, tvb, sim_tree, offset, apdu_len);
2868
1
      }
2869
1
      break;
2870
3
    case 0xE2: /* STORE DATA */
2871
3
      if (((p1 & 0x78) == 0x10) && is_sgp32_response(subtvb)) {
2872
0
        dissect_sgp32_response(subtvb, pinfo, tree, NULL);
2873
0
      }
2874
3
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2875
3
      break;
2876
4
    case 0xF2: /* STATUS */
2877
17
    case 0xA4: /* SELECT */
2878
17
      if (!dissect_fcp_template(tvb, pinfo, sim_tree, offset, apdu_len)) {
2879
7
        proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2880
7
      }
2881
17
      break;
2882
22
    default:
2883
22
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2884
22
      break;
2885
63
    }
2886
63
  }
2887
41
  offset = tvb_len - 2;
2888
2889
  /* obtain status word */
2890
41
  sw = tvb_get_ntohs(tvb, offset);
2891
41
  proto_tree_add_uint_format_value(sim_tree, hf_apdu_sw, tvb, offset, 2, sw,
2892
41
           "%04x %s", sw, get_sw_string(pinfo->pool, sw));
2893
  /* XXX - Add a PI_RESPONSE_CODE expert info for a non normal sw */
2894
2895
41
  offset += 2;
2896
2897
41
  if (ti) {
2898
    /* Always show status in info column when response only */
2899
1
    if (response_only && ins) {
2900
1
      col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "Response, %s, %s",
2901
1
             val_to_str(pinfo->pool, ins, apdu_ins_vals, "%02x"), get_sw_string(pinfo->pool, sw));
2902
1
    } else if (response_only) {
2903
0
      col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "Response, %s ", get_sw_string(pinfo->pool, sw));
2904
0
    }
2905
40
  } else {
2906
40
    switch (sw >> 8) {
2907
0
    case 0x90:
2908
1
    case 0x91:
2909
1
    case 0x92:
2910
2
    case 0x9e:
2911
2
    case 0x9f:
2912
2
      break;
2913
37
    default:
2914
37
      col_append_fstr(pinfo->cinfo, COL_INFO, ": %s ", get_sw_string(pinfo->pool, sw));
2915
37
      break;
2916
40
    }
2917
40
  }
2918
2919
40
  if (gsm_sim_trans && gsm_sim_trans->rsp_frame == pinfo->num) {
2920
40
    nstime_t ns;
2921
2922
40
    if (gsm_sim_trans != gsm_sim_trans->related_trans) {
2923
1
      ti = proto_tree_add_uint(sim_tree, hf_related_to, NULL, 0, 0,
2924
1
             gsm_sim_trans->related_trans->cmd_frame);
2925
1
      proto_item_set_generated(ti);
2926
1
    }
2927
2928
40
    if (gsm_sim_trans->cmd_frame != gsm_sim_trans->rsp_frame) {
2929
1
      ti = proto_tree_add_uint(sim_tree, hf_response_to, NULL, 0, 0, gsm_sim_trans->cmd_frame);
2930
1
      proto_item_set_generated(ti);
2931
2932
1
      nstime_delta(&ns, &pinfo->fd->abs_ts, &gsm_sim_trans->cmd_time);
2933
1
      ti = proto_tree_add_time(sim_tree, hf_response_time, NULL, 0, 0, &ns);
2934
1
      proto_item_set_generated(ti);
2935
1
    }
2936
40
  }
2937
2938
40
  return offset;
2939
41
}
2940
2941
static int
2942
dissect_cmd_apdu_tvb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bool isSIMtrace)
2943
318
{
2944
318
  uint8_t cla, ins, p1, p2;
2945
318
  uint16_t p3;
2946
318
  bool p3_present;
2947
318
  bool extended_len = false;
2948
318
  proto_item *ti;
2949
318
  proto_tree *sim_tree;
2950
318
  int rc = -1;
2951
318
  gsm_sim_transaction_t *gsm_sim_trans;
2952
318
  wmem_tree_key_t key[4];
2953
318
  uint32_t interface_id = 0;
2954
318
  uint32_t layer_num = pinfo->curr_layer_num;
2955
318
  uint32_t frame_num = pinfo->num;
2956
2957
  /* Structure of command APDU: CLA INS P1 P2 [Lc] [Data] [Le]
2958
   *
2959
   * Case 1: CLA INS P1 P2
2960
   * Case 2: CLA INS P1 P2 Le
2961
   * Case 3: CLA INS P1 P2 Lc Data
2962
   * Case 4: CLA INS P1 P2 Lc Data Le
2963
   */
2964
2965
318
  cla = tvb_get_uint8(tvb, offset);
2966
318
  ins = tvb_get_uint8(tvb, offset+1);
2967
318
  p1 = tvb_get_uint8(tvb, offset+2);
2968
318
  p2 = tvb_get_uint8(tvb, offset+3);
2969
2970
  /* If isSIMtrace is true, then the tvb contains the command followed by
2971
   * the response. The response consists of response data followed by the
2972
   * 2 octet status word. Slice off the status word first.
2973
   */
2974
318
  tvbuff_t *next_tvb = tvb;
2975
318
  if (isSIMtrace) {
2976
    /* We already retrieved ins, p1, p2, so tvb_len > 2 */
2977
159
    next_tvb = tvb_new_subset_length(tvb, 0, tvb_reported_length(tvb) - 2);
2978
159
  }
2979
2980
318
  if (tvb_reported_length_remaining(next_tvb, offset+4) >= 1) {
2981
317
    p3 = tvb_get_uint8(next_tvb, offset+4);
2982
317
    p3_present = true;
2983
2984
317
    if (p3 == 0 && !isSIMtrace && tvb_reported_length_remaining(next_tvb, offset+5) >= 2) {
2985
      /* Extended length */
2986
15
      p3 = tvb_get_uint16(next_tvb, offset+5, ENC_BIG_ENDIAN);
2987
15
      extended_len = true;
2988
15
    }
2989
317
  } else {
2990
    /* Parameter 3 not present. */
2991
1
    p3 = 0;
2992
1
    p3_present = false;
2993
1
  }
2994
2995
318
  if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
2996
0
    interface_id = pinfo->rec->rec_header.packet_header.interface_id;
2997
0
  }
2998
2999
318
  key[0].length = 1;
3000
318
  key[0].key = &interface_id;
3001
318
  key[1].length = 1;
3002
318
  key[1].key = &layer_num;
3003
318
  key[2].length = 1;
3004
318
  key[2].key = &frame_num;
3005
318
  key[3].length = 0;
3006
318
  key[3].key = NULL;
3007
3008
318
  if (PINFO_FD_VISITED(pinfo)) {
3009
0
    gsm_sim_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array(transactions, key);
3010
318
  } else {
3011
    /* This is the first time we see this packet, so create a new transaction */
3012
318
    gsm_sim_trans = wmem_new(wmem_file_scope(), gsm_sim_transaction_t);
3013
318
    gsm_sim_trans->cmd_frame = pinfo->num;
3014
318
    gsm_sim_trans->rsp_frame = 0;
3015
318
    gsm_sim_trans->cmd_time = pinfo->fd->abs_ts;
3016
318
    gsm_sim_trans->cmd_ins = ins;
3017
318
    gsm_sim_trans->cmd_p1 = p1;
3018
318
    gsm_sim_trans->cmd_p2 = p2;
3019
318
    gsm_sim_trans->related_trans = gsm_sim_trans; /* Default to self */
3020
3021
318
    wmem_tree_insert32_array(transactions, key, gsm_sim_trans);
3022
3023
318
    if (gsm_sim_trans->cmd_ins == 0xE2 && p2 != 0) { /* STORE DATA */
3024
      /* Make a reference to the first APDU this STORE DATA is related to */
3025
2
      gsm_sim_transaction_t *prev_trans;
3026
2
      frame_num = gsm_sim_trans->cmd_frame - 1;
3027
2
      prev_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
3028
2
      if (prev_trans) {
3029
2
        gsm_sim_trans->related_trans = prev_trans->related_trans;
3030
2
      }
3031
2
    }
3032
318
  }
3033
3034
318
  ti = proto_tree_add_item(tree, proto_gsm_sim, tvb, 0, -1, ENC_NA);
3035
318
  sim_tree = proto_item_add_subtree(ti, ett_sim);
3036
3037
318
  if ((cla & 0x50) == 0x40) {
3038
8
    proto_tree_add_item(sim_tree, hf_apdu_cla_coding_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3039
8
    proto_tree_add_item(sim_tree, hf_apdu_cla_secure_messaging_ind_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3040
8
    proto_tree_add_item(sim_tree, hf_apdu_cla_log_chan_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3041
310
  } else {
3042
310
    proto_tree_add_item(sim_tree, hf_apdu_cla_coding, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3043
310
    proto_tree_add_item(sim_tree, hf_apdu_cla_secure_messaging_ind, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3044
310
    proto_tree_add_item(sim_tree, hf_apdu_cla_log_chan, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3045
310
  }
3046
318
  proto_tree_add_item(sim_tree, hf_apdu_ins, next_tvb, offset+1, 1, ENC_BIG_ENDIAN);
3047
318
  offset += 2;
3048
3049
318
  if ((cla & 0x50) == 0x40) {
3050
8
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s ",
3051
8
        val_to_str(pinfo->pool, cla>>6, apdu_cla_coding_ext_vals, "%01x"));
3052
310
  } else {
3053
310
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s ",
3054
310
        val_to_str(pinfo->pool, cla>>4, apdu_cla_coding_vals, "%01x"));
3055
310
  }
3056
3057
318
  rc = dissect_gsm_apdu(ins, p1, p2, p3, extended_len, next_tvb, offset, pinfo, tree, sim_tree, gsm_sim_trans);
3058
3059
318
  if (rc == -1) {
3060
    /* default dissector */
3061
27
    offset += 2; /* P1 and P2 already handled */
3062
27
    if (p3_present) {
3063
27
      if (isSIMtrace) {
3064
        /* For SIMtrace it's not possible to know if the APDU contains
3065
         * command "Lc Data" or command "Le" with response "Data".
3066
         */
3067
6
        proto_tree_add_item(sim_tree, hf_apdu_p3, tvb, offset,
3068
6
                extended_len ? 3 : 1, ENC_BIG_ENDIAN);
3069
6
        offset += (extended_len ? 3 : 1);
3070
21
      } else if (tvb_reported_length_remaining(tvb, offset) <= (extended_len ? 3U : 1U)) {
3071
        /* Case 2 / 2E */
3072
0
        dissect_apdu_le(sim_tree, tvb, offset, extended_len, true);
3073
0
        offset += (extended_len ? 3 : 1);
3074
21
      } else {
3075
        /* Case 3 / 3E */
3076
21
        dissect_apdu_lc(sim_tree, tvb, offset, extended_len);
3077
21
        offset += (extended_len ? 3 : 1);
3078
21
        proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, p3, ENC_NA);
3079
21
        offset += p3;
3080
21
        if (tvb_reported_length_remaining(tvb, offset)) {
3081
          /* Case 4 / 4E */
3082
12
          dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
3083
12
          offset += (extended_len ? 2 : 1);
3084
12
        }
3085
21
      }
3086
27
    }
3087
291
  } else {
3088
291
    offset = rc;
3089
291
  }
3090
3091
318
  if (isSIMtrace) {
3092
54
    return dissect_rsp_apdu_tvb(tvb, offset, pinfo, tree, sim_tree);
3093
54
  }
3094
3095
264
  if (tvb_reported_length_remaining(tvb, offset)) {
3096
25
    ti = proto_tree_add_item(sim_tree, hf_apdu_unknown, tvb, offset,
3097
25
           tvb_reported_length_remaining(tvb, offset), ENC_NA);
3098
25
    expert_add_info(pinfo, ti, &ei_unknown_bytes);
3099
25
  }
3100
3101
264
  if (gsm_sim_trans && gsm_sim_trans->cmd_frame == pinfo->num && gsm_sim_trans->rsp_frame != 0) {
3102
3103
0
    if (gsm_sim_trans != gsm_sim_trans->related_trans) {
3104
0
      ti = proto_tree_add_uint(sim_tree, hf_related_to, NULL, 0, 0,
3105
0
             gsm_sim_trans->related_trans->cmd_frame);
3106
0
      proto_item_set_generated(ti);
3107
0
    }
3108
3109
0
    ti = proto_tree_add_uint(sim_tree, hf_response_in, NULL, 0, 0, gsm_sim_trans->rsp_frame);
3110
0
    proto_item_set_generated(ti);
3111
0
  }
3112
3113
264
  return offset;
3114
318
}
3115
3116
static int
3117
dissect_gsm_sim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3118
159
{
3119
159
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3120
159
  dissect_cmd_apdu_tvb(tvb, 0, pinfo, tree, true);
3121
159
  return tvb_captured_length(tvb);
3122
159
}
3123
3124
static int
3125
dissect_gsm_sim_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3126
159
{
3127
159
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3128
159
  dissect_cmd_apdu_tvb(tvb, 0, pinfo, tree, false);
3129
159
  return tvb_captured_length(tvb);
3130
159
}
3131
3132
static int
3133
dissect_gsm_sim_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3134
11
{
3135
11
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3136
11
  dissect_rsp_apdu_tvb(tvb, 0, pinfo, tree, NULL);
3137
11
  return tvb_captured_length(tvb);
3138
11
}
3139
3140
static int
3141
dissect_gsm_sim_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3142
0
{
3143
0
  if (pinfo->p2p_dir == P2P_DIR_SENT)
3144
0
    return dissect_gsm_sim_command(tvb, pinfo, tree, data);
3145
0
  else if (pinfo->p2p_dir == P2P_DIR_RECV)
3146
0
    return dissect_gsm_sim_response(tvb, pinfo, tree, data);
3147
3148
0
  return 0;
3149
0
}
3150
3151
void
3152
proto_register_gsm_sim(void)
3153
15
{
3154
15
  static hf_register_info hf[] = {
3155
15
    { &hf_apdu_cla_coding,
3156
15
      { "Class Coding", "gsm_sim.apdu.cla.coding",
3157
15
        FT_UINT8, BASE_HEX, VALS(apdu_cla_coding_vals), 0xf0,
3158
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3159
15
    },
3160
15
    { &hf_apdu_cla_coding_ext,
3161
15
      { "Class Coding", "gsm_sim.apdu.cla.coding",
3162
15
        FT_UINT8, BASE_HEX, VALS(apdu_cla_coding_ext_vals), 0xc0,
3163
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3164
15
    },
3165
15
    { &hf_apdu_cla_secure_messaging_ind,
3166
15
      { "Secure Messaging Indication", "gsm_sim.apdu.cla.secure_messaging_ind",
3167
15
        FT_UINT8, BASE_HEX, VALS(apdu_cla_secure_messaging_ind_vals), 0x0c,
3168
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3169
15
    },
3170
15
    { &hf_apdu_cla_secure_messaging_ind_ext,
3171
15
      { "Secure Messaging Indication", "gsm_sim.apdu.cla.secure_messaging_ind.ext",
3172
15
        FT_BOOLEAN, 8, TFS(&apdu_cla_secure_messaging_ind_ext_val), 0x20,
3173
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3174
15
    },
3175
15
    { &hf_apdu_cla_log_chan,
3176
15
      { "Logical Channel number", "gsm_sim.apdu.cla.log_chan",
3177
15
        FT_UINT8, BASE_DEC, NULL, 0x03,
3178
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3179
15
    },
3180
15
    { &hf_apdu_cla_log_chan_ext,
3181
15
      { "Logical Channel number", "gsm_sim.apdu.cla.log_chan",
3182
15
        FT_UINT8, BASE_DEC, NULL, 0x0f,
3183
15
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3184
15
    },
3185
15
    { &hf_apdu_ins,
3186
15
      { "Instruction", "gsm_sim.apdu.ins",
3187
15
        FT_UINT8, BASE_HEX, VALS(apdu_ins_vals), 0,
3188
15
        "ISO 7816-4 APDU INS (Instruction) Byte", HFILL }
3189
15
    },
3190
15
    { &hf_apdu_p1,
3191
15
      { "Parameter 1", "gsm_sim.apdu.p1",
3192
15
        FT_UINT8, BASE_HEX, NULL, 0,
3193
15
        "ISO 7816-4 APDU P1 (Parameter 1) Byte", HFILL }
3194
15
    },
3195
15
    { &hf_apdu_p2,
3196
15
      { "Parameter 2", "gsm_sim.apdu.p2",
3197
15
        FT_UINT8, BASE_HEX, NULL, 0,
3198
15
        "ISO 7816-4 APDU P2 (Parameter 2) Byte", HFILL }
3199
15
    },
3200
15
    { &hf_apdu_p3,
3201
15
      { "Length (Parameter 3)", "gsm_sim.apdu.p3",
3202
15
       FT_UINT24, BASE_DEC, NULL, 0,
3203
15
       "ISO 7816-4 APDU P3 (Parameter 3) Byte", HFILL }
3204
15
    },
3205
15
    { &hf_apdu_data,
3206
15
      { "APDU Payload", "gsm_sim.apdu.data",
3207
15
        FT_BYTES, BASE_NONE, NULL, 0,
3208
15
        "ISO 7816-4 APDU Data Payload", HFILL }
3209
15
    },
3210
15
    { &hf_apdu_sw,
3211
15
      { "Status Word", "gsm_sim.apdu.sw",
3212
15
        FT_UINT16, BASE_HEX, VALS(sw_vals), 0,
3213
15
        "ISO 7816-4 APDU Status Word", HFILL }
3214
15
    },
3215
15
    { &hf_apdu_unknown,
3216
15
      { "Unknown APDU Bytes", "gsm_sim.apdu.unknown",
3217
15
        FT_UINT8, BASE_HEX, NULL, 0,
3218
15
        NULL, HFILL },
3219
15
    },
3220
15
    { &hf_file_id,
3221
15
      { "File ID", "gsm_sim.file_id",
3222
15
        FT_UINT16, BASE_HEX, VALS(mf_dfs), 0,
3223
15
        "ISO 7816-4 File ID", HFILL }
3224
15
    },
3225
15
    { &hf_aid,
3226
15
      { "Application ID", "gsm_sim.aid",
3227
15
        FT_BYTES, BASE_NONE, NULL, 0,
3228
15
        "ISO 7816-4 Application ID", HFILL }
3229
15
    },
3230
15
    { &hf_bin_offset,
3231
15
      { "Offset", "gsm_sim.bin_offset",
3232
15
        FT_UINT16, BASE_DEC, NULL, 0,
3233
15
        "Offset into binary file", HFILL }
3234
15
    },
3235
15
    { &hf_referencing,
3236
15
      { "Referencing", "gsm_sim.referencing",
3237
15
        FT_UINT8, BASE_HEX, VALS(sfi_referencing_vals), 0xe0,
3238
15
        NULL, HFILL }
3239
15
    },
3240
15
    { &hf_sfi,
3241
15
      { "SFI", "gsm_sim.sfi",
3242
15
        FT_UINT8, BASE_HEX, VALS(sfi_vals), 0x1f,
3243
15
        NULL, HFILL }
3244
15
    },
3245
15
    { &hf_record_nr,
3246
15
      { "Record Number", "gsm_sim.record_nr",
3247
15
        FT_UINT8, BASE_DEC, NULL, 0,
3248
15
        NULL, HFILL }
3249
15
    },
3250
15
    { &hf_record_id,
3251
15
      { "Record Identifier", "gsm_sim.record_id",
3252
15
      FT_UINT8, BASE_DEC, NULL, 0x0,
3253
15
      NULL, HFILL },
3254
15
    },
3255
15
    { &hf_record_file,
3256
15
      { "File", "gsm_sim.record_file",
3257
15
      FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(record_file_vals), 0xF8,
3258
15
      NULL, HFILL }
3259
15
    },
3260
15
    { &hf_record_mode,
3261
15
      { "Mode", "gsm_sim.record_mode",
3262
15
      FT_UINT8, BASE_HEX, VALS(record_mode_vals), 0x07,
3263
15
      NULL, HFILL }
3264
15
    },
3265
15
    { &hf_store_data_block,
3266
15
      { "Block chaining", "gsm_sim.store_data.block_chaining",
3267
15
        FT_BOOLEAN, 8, TFS(&store_data_block_tfs), 0x80,
3268
15
        "More/Last block", HFILL }
3269
15
    },
3270
15
    { &hf_store_data_encryption,
3271
15
      { "Encryption", "gsm_sim.store_data.encryption",
3272
15
        FT_UINT8, BASE_HEX, VALS(store_data_encryption_vals), 0x60,
3273
15
        "General encryption information", HFILL }
3274
15
    },
3275
15
    { &hf_store_data_structure,
3276
15
      { "Data structure", "gsm_sim.store_data.data_structure",
3277
15
        FT_UINT8, BASE_HEX, VALS(store_data_structure_vals), 0x18,
3278
15
        "General data structure information", HFILL }
3279
15
    },
3280
15
    { &hf_store_data_rfu,
3281
15
      { "RFU", "gsm_sim.store_data.rfu",
3282
15
        FT_UINT8, BASE_HEX, NULL, 0x06,
3283
15
        "Reserved for Future Use", HFILL }
3284
15
    },
3285
15
    { &hf_store_data_iso_case,
3286
15
      { "ISO case", "gsm_sim.store_data.iso_case",
3287
15
        FT_BOOLEAN, 8, TFS(&store_data_iso_case_tfs), 0x01,
3288
15
        "ISO case 3/4 command indicator", HFILL }
3289
15
    },
3290
15
    { &hf_store_data_block_nr,
3291
15
      { "Block number", "gsm_sim.store_data.block_nr",
3292
15
        FT_UINT8, BASE_DEC, NULL, 0,
3293
15
        NULL, HFILL }
3294
15
    },
3295
15
    { &hf_auth_reference,
3296
15
      { "Reference", "gsm_sim.auth_reference",
3297
15
        FT_BOOLEAN, 8, TFS(&apdu_auth_reference_val), 0x80,
3298
15
        "Authentication Reference", HFILL }
3299
15
    },
3300
15
    { &hf_auth_rfu,
3301
15
      { "RFU", "gsm_sim.auth_rfu",
3302
15
        FT_UINT8, BASE_DEC, NULL, 0x78,
3303
15
        "Reserved for Future Use", HFILL }
3304
15
    },
3305
15
    { &hf_auth_context,
3306
15
      { "Context", "gsm_sim.auth_context",
3307
15
        FT_UINT8, BASE_DEC, VALS(apdu_auth_context_vals), 0x07,
3308
15
        "Authentication Context", HFILL }
3309
15
    },
3310
15
    { &hf_auth_challenge,
3311
15
      { "Challenge", "gsm_sim.auth_challenge",
3312
15
        FT_BYTES, BASE_NONE, NULL, 0,
3313
15
        "Authentication Challenge", HFILL }
3314
15
    },
3315
15
    { &hf_auth_response,
3316
15
      { "Response", "gsm_sim.auth_response",
3317
15
        FT_BYTES, BASE_NONE, NULL, 0,
3318
15
        "Authentication Response", HFILL }
3319
15
    },
3320
15
    { &hf_auth_rand_len,
3321
15
      { "Length of RAND", "gsm_sim.auth_rand_len",
3322
15
        FT_UINT8, BASE_DEC, NULL, 0,
3323
15
        "Length of Random Challenge", HFILL }
3324
15
    },
3325
15
    { &hf_auth_rand,
3326
15
      { "RAND", "gsm_sim.auth_rand",
3327
15
        FT_BYTES, BASE_NONE, NULL, 0,
3328
15
        "Random Challenge", HFILL }
3329
15
    },
3330
15
    { &hf_auth_autn_len,
3331
15
      { "Length of AUTN", "gsm_sim.auth_autn_len",
3332
15
        FT_UINT8, BASE_DEC, NULL, 0,
3333
15
        "Authentication Token Length", HFILL }
3334
15
    },
3335
15
    { &hf_auth_autn,
3336
15
      { "AUTN", "gsm_sim.auth_autn",
3337
15
        FT_BYTES, BASE_NONE, NULL, 0,
3338
15
        "Authentication Token", HFILL }
3339
15
    },
3340
15
    { &hf_auth_status,
3341
15
      { "Status", "gsm_sim.auth_status",
3342
15
        FT_UINT8, BASE_HEX, VALS(apdu_auth_status_vals), 0,
3343
15
        "Authentication Status", HFILL }
3344
15
    },
3345
15
    { &hf_auth_res_len,
3346
15
      { "Length of RES", "gsm_sim.auth_res_len",
3347
15
        FT_UINT8, BASE_DEC, NULL, 0,
3348
15
        "Length of Response", HFILL }
3349
15
    },
3350
15
    { &hf_auth_res,
3351
15
      { "RES", "gsm_sim.auth_res",
3352
15
        FT_BYTES, BASE_NONE, NULL, 0,
3353
15
        "Response", HFILL }
3354
15
    },
3355
15
    { &hf_auth_ck_len,
3356
15
      { "Length of CK", "gsm_sim.auth_ck_len",
3357
15
        FT_UINT8, BASE_DEC, NULL, 0,
3358
15
        NULL, HFILL }
3359
15
    },
3360
15
    { &hf_auth_ck,
3361
15
      { "CK", "gsm_sim.auth_ck",
3362
15
        FT_BYTES, BASE_NONE, NULL, 0,
3363
15
        NULL, HFILL }
3364
15
    },
3365
15
    { &hf_auth_ik_len,
3366
15
      { "Length of IK", "gsm_sim.auth_ik_len",
3367
15
        FT_UINT8, BASE_DEC, NULL, 0,
3368
15
        NULL, HFILL }
3369
15
    },
3370
15
    { &hf_auth_ik,
3371
15
      { "IK", "gsm_sim.auth_ik",
3372
15
        FT_BYTES, BASE_NONE, NULL, 0,
3373
15
        NULL, HFILL }
3374
15
    },
3375
15
    { &hf_auth_kc_len,
3376
15
      { "Length of Kc", "gsm_sim.auth_kc_len",
3377
15
        FT_UINT8, BASE_DEC, NULL, 0,
3378
15
        NULL, HFILL }
3379
15
    },
3380
15
    { &hf_auth_kc,
3381
15
      { "Kc", "gsm_sim.auth_kc",
3382
15
        FT_BYTES, BASE_NONE, NULL, 0,
3383
15
        NULL, HFILL }
3384
15
    },
3385
15
    { &hf_auth_auts_len,
3386
15
      { "Length of AUTS", "gsm_sim.auth_auts_len",
3387
15
        FT_UINT8, BASE_DEC, NULL, 0,
3388
15
        NULL, HFILL }
3389
15
    },
3390
15
    { &hf_auth_auts,
3391
15
      { "AUTS", "gsm_sim.auth_auts",
3392
15
        FT_BYTES, BASE_NONE, NULL, 0,
3393
15
        NULL, HFILL }
3394
15
    },
3395
15
    { &hf_auth_gsm_rand,
3396
15
      { "Random Challenge", "gsm_sim.auth_rand",
3397
15
        FT_BYTES, BASE_NONE, NULL, 0,
3398
15
        "GSM Authentication Random Challenge", HFILL }
3399
15
    },
3400
15
    { &hf_auth_gsm_sres_len,
3401
15
      { "Length of SRES", "gsm_sim.auth_sres_len",
3402
15
        FT_UINT8, BASE_DEC, NULL, 0,
3403
15
        NULL, HFILL }
3404
15
    },
3405
15
    { &hf_auth_gsm_sres,
3406
15
      { "SRES", "gsm_sim.auth_sres",
3407
15
        FT_BYTES, BASE_NONE, NULL, 0,
3408
15
        "GSM Authentication SRES Response", HFILL }
3409
15
    },
3410
15
    { &hf_auth_gsm_kc_len,
3411
15
      { "Length of Kc", "gsm_sim.auth_kc_len",
3412
15
        FT_UINT8, BASE_DEC, NULL, 0,
3413
15
        NULL, HFILL }
3414
15
    },
3415
15
    { &hf_auth_gsm_kc,
3416
15
      { "Kc", "gsm_sim.auth_kc",
3417
15
        FT_BYTES, BASE_NONE, NULL, 0,
3418
15
        "GSM Authentication Kc result", HFILL }
3419
15
    },
3420
15
    { &hf_chan_nr,
3421
15
      { "Channel Number", "gsm_sim.chan_nr",
3422
15
        FT_UINT8, BASE_DEC, NULL, 0,
3423
15
        "ISO 7816-4 Logical Channel Number", HFILL }
3424
15
    },
3425
15
    { &hf_apdu_le,
3426
15
      { "Maximum Length of Expected Response", "gsm_sim.apdu.le",
3427
15
        FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(apdu_le_vals), 0,
3428
15
        "ISO 7816-4 APDU Le Byte", HFILL }
3429
15
    },
3430
15
    { &hf_apdu_le_ext,
3431
15
      { "Maximum Length of Expected Response", "gsm_sim.apdu.le",
3432
15
        FT_UINT24, BASE_DEC|BASE_SPECIAL_VALS, VALS(apdu_le_vals_ext), 0,
3433
15
        "ISO 7816-4 APDU Le Bytes - Extended", HFILL }
3434
15
    },
3435
15
    { &hf_apdu_lc,
3436
15
      { "Length of Command", "gsm_sim.apdu.lc",
3437
15
        FT_UINT8, BASE_DEC, NULL, 0,
3438
15
        "ISO 7816-4 APDU Lc Byte", HFILL }
3439
15
    },
3440
15
    { &hf_apdu_lc_ext,
3441
15
      { "Length of Command", "gsm_sim.apdu.lc",
3442
15
        FT_UINT24, BASE_DEC, NULL, 0,
3443
15
        "ISO 7816-4 APDU Lc Bytes - Extended", HFILL }
3444
15
    },
3445
15
    { &hf_chan_op,
3446
15
      { "Channel Operation", "gsm_sim.chan_op",
3447
15
        FT_UINT8, BASE_HEX, VALS(chan_op_vals), 0,
3448
15
        "ISO 7816-4 Logical Channel Operation", HFILL }
3449
15
    },
3450
15
    { &hf_select_type,
3451
15
      { "Type", "gsm_sim.select.type",
3452
15
        FT_UINT8, BASE_HEX, VALS(select_type_vals), 0x00,
3453
15
        NULL, HFILL }
3454
15
    },
3455
15
    { &hf_select_session_control,
3456
15
      { "Session Control", "gsm_sim.select.session_control",
3457
15
        FT_UINT8, BASE_HEX, VALS(select_session_control_vals), 0x60,
3458
15
        NULL, HFILL }
3459
15
    },
3460
15
    { &hf_select_unused_p2,
3461
15
      { "Unused", "gsm_sim.select.unused",
3462
15
        FT_UINT8, BASE_HEX, NULL, 0x60,
3463
15
        NULL, HFILL }
3464
15
    },
3465
15
    { &hf_select_return_data,
3466
      /* Note: The mask 0x9C is correct according to
3467
       * ETSI TS 102 221 Table 11.2: Coding of P2
3468
       */
3469
15
      { "Return Data", "gsm_sim.select.return_data",
3470
15
        FT_UINT8, BASE_HEX, VALS(select_return_data_vals), 0x9C,
3471
15
        NULL, HFILL }
3472
15
    },
3473
15
    { &hf_select_selection,
3474
15
      { "Selection", "gsm_sim.select.selection",
3475
15
        FT_UINT8, BASE_HEX, VALS(select_selection_vals), 0x03,
3476
15
        NULL, HFILL }
3477
15
    },
3478
15
    { &hf_status_application_status,
3479
15
      { "Application Status", "gsm_sim.status.application_status",
3480
15
        FT_UINT8, BASE_HEX, VALS(status_application_status_vals), 0,
3481
15
        NULL, HFILL }
3482
15
    },
3483
15
    { &hf_status_return_data,
3484
15
      { "Return Data", "gsm_sim.status.return_data",
3485
15
        FT_UINT8, BASE_HEX, VALS(status_return_data_vals), 0,
3486
15
        NULL, HFILL }
3487
15
    },
3488
15
    { &hf_template_tag,
3489
15
      { "Template tag", "gsm_sim.template_tag",
3490
15
        FT_UINT8, BASE_HEX, VALS(template_tag_vals), 0,
3491
15
        NULL, HFILL }
3492
15
    },
3493
15
    { &hf_template_len,
3494
15
      { "Template length", "gsm_sim.template_len",
3495
15
        FT_UINT32, BASE_DEC, NULL, 0,
3496
15
        NULL, HFILL }
3497
15
    },
3498
15
    { &hf_fcp,
3499
15
      { "FCP Value", "gsm_sim.fcp",
3500
15
        FT_BYTES, BASE_NONE, NULL, 0,
3501
15
        NULL, HFILL }
3502
15
    },
3503
15
    { &hf_fcp_tag,
3504
15
      { "Tag", "gsm_sim.fcp.tag",
3505
15
        FT_UINT8, BASE_HEX, VALS(fcp_tag_vals), 0,
3506
15
        NULL, HFILL }
3507
15
    },
3508
15
    { &hf_fcp_len,
3509
15
      { "Length", "gsm_sim.fcp.len",
3510
15
        FT_UINT32, BASE_DEC, NULL, 0,
3511
15
        NULL, HFILL }
3512
15
    },
3513
15
    { &hf_fcp_value,
3514
15
      { "Value", "gsm_sim.fcp.value",
3515
15
        FT_BYTES, BASE_NONE, NULL, 0,
3516
15
        NULL, HFILL }
3517
15
    },
3518
15
    { &hf_fcp_file_size,
3519
15
      { "File size", "gsm_sim.fcp.file_size",
3520
15
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3521
15
        "File size (excluding structural information)", HFILL }
3522
15
    },
3523
15
    { &hf_fcp_total_file_size,
3524
15
      { "Total file size", "gsm_sim.fcp.total_file_size",
3525
15
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3526
15
        "Total file size (including structural information)", HFILL }
3527
15
    },
3528
15
    { &hf_fcp_file_id,
3529
15
      { "File Identifier", "gsm_sim.fcp.file_id",
3530
15
        FT_UINT16, BASE_HEX, VALS(mf_dfs), 0,
3531
15
        NULL, HFILL }
3532
15
    },
3533
15
    { &hf_fcp_df_name,
3534
15
      { "DF name (AID)", "gsm_sim.fcp.aid",
3535
15
        FT_BYTES, BASE_NONE, NULL, 0,
3536
15
        "Application Identifier", HFILL }
3537
15
    },
3538
15
    { &hf_fcp_file_rfu_byte,
3539
15
      { "RFU", "gsm_sim.fcp.file_rfu_byte",
3540
15
        FT_UINT8, BASE_HEX, NULL, 0,
3541
15
        NULL, HFILL }
3542
15
    },
3543
15
    { &hf_fcp_file_rfu,
3544
15
      { "RFU", "gsm_sim.fcp.file_rfu",
3545
15
        FT_BOOLEAN, 8, NULL, 0x80,
3546
15
        NULL, HFILL }
3547
15
    },
3548
15
    { &hf_fcp_file_accessibility,
3549
15
      { "File accessibility", "gsm_sim.fcp.file_accessibility",
3550
15
        FT_BOOLEAN, 8, TFS(&fcp_file_accessibility_tfs), 0x40,
3551
15
        NULL, HFILL }
3552
15
    },
3553
15
    { &hf_fcp_file_type,
3554
15
      { "File type", "gsm_sim.fcp.file_type",
3555
15
        FT_UINT8, BASE_HEX, VALS(fcp_file_type_vals), 0x38,
3556
15
        NULL, HFILL }
3557
15
    },
3558
15
    { &hf_fcp_file_type_ext,
3559
15
      { "File type", "gsm_sim.fcp.file_type",
3560
15
        FT_UINT8, BASE_HEX, VALS(fcp_file_type_ext_vals), 0x3F,
3561
15
        NULL, HFILL }
3562
15
    },
3563
15
    { &hf_fcp_ef_structure,
3564
15
      { "EF structure", "gsm_sim.fcp.ef_structure",
3565
15
        FT_UINT8, BASE_HEX, VALS(fcp_ef_structure_vals), 0x07,
3566
15
        NULL, HFILL }
3567
15
    },
3568
15
    { &hf_fcp_ef_structure_ext,
3569
15
      { "EF structure", "gsm_sim.fcp.ef_structure",
3570
15
        FT_UINT8, BASE_HEX, VALS(fcp_ef_structure_ext_vals), 0x3F,
3571
15
        NULL, HFILL }
3572
15
    },
3573
15
    { &hf_fcp_data_coding_byte,
3574
15
      { "Data coding byte", "gsm_sim.fcp.data_coding_byte",
3575
15
        FT_UINT8, BASE_HEX, NULL, 0,
3576
15
        NULL, HFILL }
3577
15
    },
3578
15
    { &hf_fcp_record_len,
3579
15
      { "Record length", "gsm_sim.fcp.record_len",
3580
15
        FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3581
15
        NULL, HFILL }
3582
15
    },
3583
15
    { &hf_fcp_num_records,
3584
15
      { "Number of records", "gsm_sim.fcp.num_records",
3585
15
        FT_UINT8, BASE_DEC, NULL, 0,
3586
15
        NULL, HFILL }
3587
15
    },
3588
15
    { &hf_fcp_lifecycle_status,
3589
15
      { "Life Cycle Status Integer", "gsm_sim.fcp.lifecycle_status",
3590
15
        FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(fcp_lifecycle_status_vals), 0,
3591
15
        NULL, HFILL }
3592
15
    },
3593
15
    { &hf_fcp_security_attr_compact,
3594
15
      { "Security attributes (Compact)", "gsm_sim.fcp.security_attr_compact",
3595
15
        FT_BYTES, BASE_NONE, NULL, 0,
3596
15
        NULL, HFILL }
3597
15
    },
3598
15
    { &hf_fcp_security_attr_expanded,
3599
15
      { "Security attributes (Expanded)", "gsm_sim.fcp.security_attr_expanded",
3600
15
        FT_BYTES, BASE_NONE, NULL, 0,
3601
15
        NULL, HFILL }
3602
15
    },
3603
15
    { &hf_fcp_security_attr_referenced,
3604
15
      { "Security attributes (Referenced)", "gsm_sim.fcp.security_attr_referenced",
3605
15
        FT_BYTES, BASE_NONE, NULL, 0,
3606
15
        NULL, HFILL }
3607
15
    },
3608
15
    { &hf_fcp_pin_status_do,
3609
15
      { "PIN Status DO", "gsm_sim.fcp.pin_status_do",
3610
15
        FT_BYTES, BASE_NONE, NULL, 0,
3611
15
        NULL, HFILL }
3612
15
    },
3613
15
    { &hf_fcp_sfi,
3614
15
      { "Short File Identifier", "gsm_sim.fcp.sfi",
3615
15
        FT_UINT8, BASE_DEC, NULL, 0,
3616
15
        NULL, HFILL }
3617
15
    },
3618
15
    { &hf_fcp_prop,
3619
15
      { "Proprietary", "gsm_sim.fcp.prop",
3620
15
        FT_BYTES, BASE_NONE, NULL, 0,
3621
15
        NULL, HFILL }
3622
15
    },
3623
15
    { &hf_fcp_prop_tag,
3624
15
      { "Proprietary Tag", "gsm_sim.fcp.prop.tag",
3625
15
        FT_UINT8, BASE_HEX, VALS(fcp_prop_tag_vals), 0,
3626
15
        NULL, HFILL }
3627
15
    },
3628
15
    { &hf_fcp_prop_len,
3629
15
      { "Proprietary Length", "gsm_sim.fcp.prop.len",
3630
15
        FT_UINT32, BASE_DEC, NULL, 0,
3631
15
        NULL, HFILL }
3632
15
    },
3633
15
    { &hf_fcp_prop_value,
3634
15
      { "Proprietary Value", "gsm_sim.fcp.prop.value",
3635
15
        FT_BYTES, BASE_NONE, NULL, 0,
3636
15
        NULL, HFILL }
3637
15
    },
3638
15
    { &hf_fcp_prop_uicc_clock_stop_allowed,
3639
15
      { "Clock stop allowed", "gsm_sim.fcp.prop.uicc_clock_stop_allowed",
3640
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
3641
15
        NULL, HFILL }
3642
15
    },
3643
15
    { &hf_fcp_prop_uicc_clock_stop_rfu,
3644
15
      { "RFU", "gsm_sim.fcp.prop.uicc_clock_stop_rfu",
3645
15
        FT_UINT8, BASE_DEC, NULL, 0x02,
3646
15
        NULL, HFILL }
3647
15
    },
3648
15
    { &hf_fcp_prop_uicc_clock_stop_0,
3649
15
      { "Clock stop", "gsm_sim.fcp.prop.uicc_clock_stop_0",
3650
15
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_clock_stop_0_vals), 0x0C,
3651
15
        NULL, HFILL }
3652
15
    },
3653
15
    { &hf_fcp_prop_uicc_clock_stop_1,
3654
15
      { "Clock stop", "gsm_sim.fcp.prop.uicc_clock_stop_1",
3655
15
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_clock_stop_1_vals), 0x0C,
3656
15
        NULL, HFILL }
3657
15
    },
3658
15
    { &hf_fcp_prop_uicc_supply_voltage_a,
3659
15
      { "Supply voltage class A", "gsm_sim.fcp.prop.uicc_supply_voltage_a",
3660
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3661
15
        NULL, HFILL }
3662
15
    },
3663
15
    { &hf_fcp_prop_uicc_supply_voltage_b,
3664
15
      { "Supply voltage class B", "gsm_sim.fcp.prop.uicc_supply_voltage_b",
3665
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
3666
15
        NULL, HFILL }
3667
15
    },
3668
15
    { &hf_fcp_prop_uicc_supply_voltage_c,
3669
15
      { "Supply voltage class C", "gsm_sim.fcp.prop.uicc_supply_voltage_c",
3670
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
3671
15
        NULL, HFILL }
3672
15
    },
3673
15
    { &hf_fcp_prop_uicc_supply_voltage_d,
3674
15
      { "Supply voltage class D", "gsm_sim.fcp.prop.uicc_supply_voltage_d",
3675
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
3676
15
        NULL, HFILL }
3677
15
    },
3678
15
    { &hf_fcp_prop_app_supply_voltage_class,
3679
15
      { "Supply voltage class", "gsm_sim.fcp.prop.app_supply_voltage_class",
3680
15
        FT_UINT8, BASE_HEX, VALS(supply_voltage_class_vals), 0,
3681
15
        NULL, HFILL }
3682
15
    },
3683
15
    { &hf_fcp_prop_app_power_consumption,
3684
15
      { "Application power consumption", "gsm_sim.fcp.prop.app_power_consumption",
3685
15
        FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliamps), 0,
3686
15
        NULL, HFILL }
3687
15
    },
3688
15
    { &hf_fcp_prop_app_frequency,
3689
15
      { "Power consumption frequency", "gsm_sim.fcp.prop.app_frequency",
3690
15
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
3691
15
        NULL, HFILL }
3692
15
    },
3693
15
    { &hf_fcp_prop_min_app_clock_freq,
3694
15
      { "Minimum application clock frequency", "gsm_sim.fcp.prop.min_app_clock_freq",
3695
15
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
3696
15
        NULL, HFILL }
3697
15
    },
3698
15
    { &hf_fcp_prop_avail_memory,
3699
15
      { "Available memory", "gsm_sim.fcp.prop.avail_memory",
3700
15
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3701
15
        NULL, HFILL }
3702
15
    },
3703
15
    { &hf_fcp_prop_file_details_der_encoding,
3704
15
      { "DER encoding only", "gsm_sim.fcp.prop.file_details.der_encoding",
3705
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3706
15
        NULL, HFILL }
3707
15
    },
3708
15
    { &hf_fcp_prop_file_details_rfu,
3709
15
      { "RFU", "gsm_sim.fcp.prop.file_details.rfu",
3710
15
        FT_UINT8, BASE_HEX, NULL, 0xFE,
3711
15
        NULL, HFILL }
3712
15
    },
3713
15
    { &hf_fcp_prop_reserved_file_size,
3714
15
      { "Reserved file size", "gsm_sim.fcp.prop.reserved_file_size",
3715
15
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3716
15
        NULL, HFILL }
3717
15
    },
3718
15
    { &hf_fcp_prop_max_file_size,
3719
15
      { "Maximum file size", "gsm_sim.fcp.prop.max_file_size",
3720
15
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3721
15
        NULL, HFILL }
3722
15
    },
3723
15
    { &hf_fcp_prop_supported_sys_cmds_terminal_capability,
3724
15
      { "TERMINAL CAPABILITY", "gsm_sim.fcp.prop.supported_sys_cmds.terminal_capability",
3725
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3726
15
        NULL, HFILL }
3727
15
    },
3728
15
    { &hf_fcp_prop_supported_sys_cmds_rfu,
3729
15
      { "RFU", "gsm_sim.fcp.prop.supported_sys_cmds.rfu",
3730
15
        FT_UINT8, BASE_HEX, NULL, 0xFE,
3731
15
        NULL, HFILL }
3732
15
    },
3733
15
    { &hf_fcp_prop_uicc_env_conditions_temp_class,
3734
15
      { "Temperature class", "gsm_sim.fcp.prop.uicc_env_conditions.temperature_class",
3735
15
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_env_conditions_temp_class_vals), 0x07,
3736
15
        NULL, HFILL }
3737
15
    },
3738
15
    { &hf_fcp_prop_uicc_env_conditions_high_humidity,
3739
15
      { "High humidity", "gsm_sim.fcp.prop.uicc_env_conditions.high_humidity",
3740
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3741
15
        NULL, HFILL }
3742
15
    },
3743
15
    { &hf_fcp_prop_uicc_env_conditions_rfu,
3744
15
      { "RFU", "gsm_sim.fcp.prop.uicc_env_conditions.rfu",
3745
15
        FT_UINT8, BASE_HEX, NULL, 0xF0,
3746
15
        NULL, HFILL }
3747
15
    },
3748
15
    { &hf_fcp_prop_platform_to_platform_cat_secured_apdu,
3749
15
      { "Platform to Platform CAT Secured APDU", "gsm_sim.fcp.prop.platform_to_platform_cat_secured_apdu",
3750
15
        FT_BYTES, BASE_NONE, NULL, 0,
3751
15
        NULL, HFILL }
3752
15
    },
3753
15
    { &hf_fcp_prop_test_config_state,
3754
15
      { "Test configuration state", "gsm_sim.fcp.prop.test_config_state",
3755
15
        FT_BYTES, BASE_NONE, NULL, 0,
3756
15
        NULL, HFILL }
3757
15
    },
3758
15
    { &hf_fcp_prop_test_config_criterion_type,
3759
15
      { "Test configuration criterion type", "gsm_sim.fcp.prop.test_config_criterion_type",
3760
15
        FT_BYTES, BASE_NONE, NULL, 0,
3761
15
        NULL, HFILL }
3762
15
    },
3763
15
    { &hf_suspend_uicc_op,
3764
15
      { "Suspend Operation", "gsm_sim.suspend_uicc.op",
3765
15
        FT_UINT8, BASE_HEX, VALS(suspend_uicc_vals), 0,
3766
15
        "ISO 7816-4 Suspend UICC Operation", HFILL }
3767
15
    },
3768
15
    { &hf_suspend_uicc_min_time_unit,
3769
15
      { "Minimum Time Unit", "gsm_sim.suspend_uicc.min_time_unit",
3770
15
        FT_UINT8, BASE_HEX, VALS(suspend_time_unit_vals), 0,
3771
15
        NULL, HFILL }
3772
15
    },
3773
15
    { &hf_suspend_uicc_min_time_length,
3774
15
      { "Minimum Length of Time", "gsm_sim.suspend_uicc.min_time_length",
3775
15
        FT_UINT8, BASE_DEC, NULL, 0,
3776
15
        "Length of time, expressed in units", HFILL }
3777
15
    },
3778
15
    { &hf_suspend_uicc_max_time_unit,
3779
15
      { "Maximum Time Unit", "gsm_sim.suspend_uicc.max_time_unit",
3780
15
        FT_UINT8, BASE_HEX, VALS(suspend_time_unit_vals), 0,
3781
15
        NULL, HFILL }
3782
15
    },
3783
15
    { &hf_suspend_uicc_max_time_length,
3784
15
      { "Maximum Length of Time", "gsm_sim.suspend_uicc.max_time_length",
3785
15
        FT_UINT8, BASE_DEC, NULL, 0,
3786
15
        "Length of time, expressed in units", HFILL }
3787
15
    },
3788
15
    { &hf_suspend_uicc_resume_token,
3789
15
      { "Resume Token", "gsm_sim.suspend_uicc.resume_token",
3790
15
        FT_BYTES, BASE_NONE, NULL, 0,
3791
15
        NULL, HFILL }
3792
15
    },
3793
3794
    /* Terminal Profile Byte 1 */
3795
15
    { &hf_tprof_b1,
3796
15
      { "Terminal Profile Byte 1 (Download)", "gsm_sim.tp.b1",
3797
15
        FT_UINT8, BASE_HEX, NULL, 0,
3798
15
        NULL, HFILL },
3799
15
    },
3800
15
    { &hf_tp_prof_dld,
3801
15
      { "Profile Download", "gsm_sim.tp.prof_dld",
3802
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3803
15
        "TP Profile Download", HFILL }
3804
15
    },
3805
15
    { &hf_tp_sms_data_dld,
3806
15
      { "SMS-PP Data Download", "gsm_sim.tp.sms_data_dld",
3807
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3808
15
        "TP SMS-PP Data Download", HFILL }
3809
15
    },
3810
15
    { &hf_tp_cb_data_dld,
3811
15
      { "CB Data Download", "gsm_sim.tp.cb_data_dld",
3812
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
3813
15
        "TP Cell Broadcast Data Download", HFILL }
3814
15
    },
3815
15
    { &hf_tp_menu_sel,
3816
15
      { "Menu Selection", "gsm_sim.tp.menu_sel",
3817
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3818
15
        "TP Menu Selection", HFILL }
3819
15
    },
3820
15
    { &hf_tp_sms_data_dld_support,
3821
15
      { "SMS-PP data download is supported", "gsm_sim.tp.sms_data_dld_support",
3822
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3823
15
        "TP SMS-PP data download is supported", HFILL }
3824
15
    },
3825
15
    { &hf_tp_timer_exp,
3826
15
      { "Timer expiration", "gsm_sim.tp.timer_exp",
3827
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3828
15
        "TP Timer expiration", HFILL }
3829
15
    },
3830
15
    { &hf_tp_cc_sim_support,
3831
15
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3832
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
3833
15
        "TP Call Control by USIM is supported", HFILL }
3834
15
    },
3835
15
    { &hf_tp_cc_sim_support2,
3836
15
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3837
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
3838
15
        "TP Call Control by USIM is supported", HFILL }
3839
15
    },
3840
3841
    /* Terminal Profile Byte 2 */
3842
15
    { &hf_tprof_b2,
3843
15
      { "Terminal Profile Byte 2 (Other)", "gsm_sim.tp.b2",
3844
15
        FT_UINT8, BASE_HEX, NULL, 0,
3845
15
        NULL, HFILL },
3846
15
    },
3847
15
    { &hf_tp_cmd_res,
3848
15
      { "Command result", "gsm_sim.tp.cmd_res",
3849
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3850
15
        "TP Command result", HFILL }
3851
15
    },
3852
15
    { &hf_tp_cc_sim,
3853
15
      { "Call Control by USIM", "gsm_sim.tp.cc_sim",
3854
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3855
15
        "TP Call Control by SIM", HFILL }
3856
15
    },
3857
15
    { &hf_tp_cc_sim_support3,
3858
15
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3859
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
3860
15
        "TP Call Control by USIM is supported", HFILL }
3861
15
    },
3862
15
    { &hf_tp_mo_sms_sim,
3863
15
      { "MO SMS control by SIM", "gsm_sim.tp.mo_sms_sim",
3864
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3865
15
        "TP MO short message control by SIM", HFILL }
3866
15
    },
3867
15
    { &hf_tp_cc_sim_support4,
3868
15
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3869
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3870
15
        "TP Call Control by USIM is supported", HFILL }
3871
15
    },
3872
15
    { &hf_tp_ucs2_entry,
3873
15
      { "UCS2 Entry", "gsm_sim.tp.ucs2_entry",
3874
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3875
15
        "TP UCS2 Entry", HFILL }
3876
15
    },
3877
15
    { &hf_tp_ucs2_display,
3878
15
      { "UCS2 Display", "gsm_sim.tp.ucs2_display",
3879
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
3880
15
        "TP UCS2 Display", HFILL }
3881
15
    },
3882
15
    { &hf_tp_display_ext,
3883
15
      { "Display of Extension Text", "gsm_sim.tp.display_ext",
3884
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
3885
15
        "TP Display of the Extension Text", HFILL }
3886
15
    },
3887
3888
    /* Terminal Profile Byte 3 */
3889
15
    { &hf_tprof_b3,
3890
15
      { "Terminal Profile Byte 3 (Proactive SIM)", "gsm_sim.tp.b3",
3891
15
        FT_UINT8, BASE_HEX, NULL, 0,
3892
15
        NULL, HFILL },
3893
15
    },
3894
15
    { &hf_tp_pa_display_text,
3895
15
      { "Proactive SIM: DISPLAY TEXT", "gsm_sim.tp.pa.display_text",
3896
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3897
15
        NULL, HFILL }
3898
15
    },
3899
15
    { &hf_tp_pa_get_inkey,
3900
15
      { "Proactive SIM: GET INKEY", "gsm_sim.tp.pa.get_inkey",
3901
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3902
15
        NULL, HFILL }
3903
15
    },
3904
15
    { &hf_tp_pa_get_input,
3905
15
      { "Proactive SIM: GET INPUT", "gsm_sim.tp.pa.get_input",
3906
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
3907
15
        NULL, HFILL }
3908
15
    },
3909
15
    { &hf_tp_pa_more_time,
3910
15
      { "Proactive SIM: MORE TIME", "gsm_sim.tp.pa.more_time",
3911
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3912
15
        NULL, HFILL }
3913
15
    },
3914
15
    { &hf_tp_pa_play_tone,
3915
15
      { "Proactive SIM: PLAY TONE", "gsm_sim.tp.pa.play_tone",
3916
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
3917
15
        NULL, HFILL }
3918
15
    },
3919
15
    { &hf_tp_pa_poll_intv,
3920
15
      { "Proactive SIM: POLL INTERVAL", "gsm_sim.tp.pa.poll_intv",
3921
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3922
15
        NULL, HFILL }
3923
15
    },
3924
15
    { &hf_tp_pa_polling_off,
3925
15
      { "Proactive SIM: POLLING OFF", "gsm_sim.tp.pa.polling_off",
3926
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
3927
15
        NULL, HFILL }
3928
15
    },
3929
15
    { &hf_tp_pa_refresh,
3930
15
      { "Proactive SIM: REFRESH", "gsm_sim.tp.pa.refresh",
3931
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
3932
15
        NULL, HFILL }
3933
15
    },
3934
3935
    /* Terminal Profile Byte 4 */
3936
15
    { &hf_tprof_b4,
3937
15
      { "Terminal Profile Byte 4 (Proactive SIM)", "gsm_sim.tp.b4",
3938
15
        FT_UINT8, BASE_HEX, NULL, 0,
3939
15
        NULL, HFILL },
3940
15
    },
3941
15
    { &hf_tp_pa_select_item,
3942
15
      { "Proactive SIM: SELECT ITEM", "gsm_sim.tp.pa.select_item",
3943
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3944
15
        NULL, HFILL }
3945
15
    },
3946
15
    { &hf_tp_pa_send_sms,
3947
15
      { "Proactive SIM: SEND SHORT MESSAGE", "gsm_sim.tp.pa.send_sms",
3948
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3949
15
        NULL, HFILL }
3950
15
    },
3951
15
    { &hf_tp_pa_send_ss,
3952
15
      { "Proactive SIM: SEND SS", "gsm_sim.tp.pa.send_ss",
3953
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
3954
15
        NULL, HFILL }
3955
15
    },
3956
15
    { &hf_tp_pa_send_ussd,
3957
15
      { "Proactive SIM: SEND USSD", "gsm_sim.tp.pa.send_ussd",
3958
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3959
15
        NULL, HFILL }
3960
15
    },
3961
15
    { &hf_tp_pa_set_up_call,
3962
15
      { "Proactive SIM: SET UP CALL", "gsm_sim.tp.pa.set_up_call",
3963
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
3964
15
        NULL, HFILL }
3965
15
    },
3966
15
    { &hf_tp_pa_set_up_menu,
3967
15
      { "Proactive SIM: SET UP MENU", "gsm_sim.tp.pa.set_up_menu",
3968
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3969
15
        NULL, HFILL }
3970
15
    },
3971
15
    { &hf_tp_pa_prov_loci,
3972
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION", "gsm_sim.tp.pa.prov_loci",
3973
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
3974
15
        NULL, HFILL }
3975
15
    },
3976
15
    { &hf_tp_pa_prov_loci_nmr,
3977
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR)", "gsm_sim.tp.pa.prov_loci_nmr",
3978
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
3979
15
        NULL, HFILL }
3980
15
    },
3981
3982
    /* Terminal Profile Byte 5 */
3983
15
    { &hf_tprof_b5,
3984
15
      { "Terminal Profile Byte 5 (Event driven information)", "gsm_sim.tp.b5",
3985
15
        FT_UINT8, BASE_HEX, NULL, 0,
3986
15
        NULL, HFILL },
3987
15
    },
3988
15
    { &hf_tp_pa_evt_list,
3989
15
      { "Proactive SIM: SET UP EVENT LIST", "gsm_sim.tp.pa.set_up_evt_list",
3990
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3991
15
        NULL, HFILL }
3992
15
    },
3993
15
    { &hf_tp_ev_mt_call,
3994
15
      { "Event: MT call", "gsm_sim.tp.evt.mt_call",
3995
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3996
15
        NULL, HFILL }
3997
15
    },
3998
15
    { &hf_tp_ev_call_connected,
3999
15
      { "Event: Call connected", "gsm_sim.tp.evt.call_conn",
4000
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4001
15
        NULL, HFILL }
4002
15
    },
4003
15
    { &hf_tp_ev_call_disconnected,
4004
15
      { "Event: Call disconnected", "gsm_sim.tp.evt.call_disc",
4005
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4006
15
        NULL, HFILL }
4007
15
    },
4008
15
    { &hf_tp_ev_location_status,
4009
15
      { "Event: Location status", "gsm_sim.tp.evt.loc_status",
4010
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4011
15
        NULL, HFILL }
4012
15
    },
4013
15
    { &hf_tp_ev_user_activity,
4014
15
      { "Event: User activity", "gsm_sim.tp.evt.user_activity",
4015
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4016
15
        NULL, HFILL }
4017
15
    },
4018
15
    { &hf_tp_ev_idle_screen,
4019
15
      { "Event: Idle screen available", "gsm_sim.tp.evt.idle_screen",
4020
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4021
15
        NULL, HFILL }
4022
15
    },
4023
15
    { &hf_tp_ev_cardreader_status,
4024
15
      { "Event: Card reader status", "gsm_sim.tp.evt.card_status",
4025
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4026
15
        NULL, HFILL }
4027
15
    },
4028
4029
    /* Terminal Profile Byte 6 */
4030
15
    { &hf_tprof_b6,
4031
15
      { "Terminal Profile Byte 6 (Event driven information extension)", "gsm_sim.tp.b6",
4032
15
        FT_UINT8, BASE_HEX, NULL, 0,
4033
15
        NULL, HFILL },
4034
15
    },
4035
15
    { &hf_tp_ev_lang_sel,
4036
15
      { "Event: Language Selection", "gsm_sim.tp.evt.lang_sel",
4037
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4038
15
        NULL, HFILL }
4039
15
    },
4040
15
    { &hf_tp_ev_brows_term,
4041
15
      { "Event: Browser Termination", "gsm_sim.tp.evt.brows_term",
4042
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4043
15
        NULL, HFILL }
4044
15
    },
4045
15
    { &hf_tp_ev_data_avail,
4046
15
      { "Event: Data Available", "gsm_sim.tp.evt.data_avail",
4047
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4048
15
        NULL, HFILL }
4049
15
    },
4050
15
    { &hf_tp_ev_chan_status,
4051
15
      { "Event: Channel Status", "gsm_sim.tp.evt.chan_status",
4052
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4053
15
        NULL, HFILL }
4054
15
    },
4055
15
    { &hf_tp_ev_access_techno_change,
4056
15
      { "Event: Access Technology Change", "gsm_sim.tp.evt.access_techno_change",
4057
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4058
15
        NULL, HFILL }
4059
15
    },
4060
15
    { &hf_tp_ev_disp_params_changed,
4061
15
      { "Event: Display parameters changed", "gsm_sim.tp.evt.disp_params_changed",
4062
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4063
15
        NULL, HFILL }
4064
15
    },
4065
15
    { &hf_tp_ev_local_conn,
4066
15
      { "Event: Local Connection", "gsm_sim.tp.evt.local_conn",
4067
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4068
15
        NULL, HFILL }
4069
15
    },
4070
15
    { &hf_tp_ev_nwk_search_mode_change,
4071
15
      { "Event: Network Search Mode Change", "gsm_sim.tp.evt.nwk_search_mode_change",
4072
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4073
15
        NULL, HFILL }
4074
15
    },
4075
4076
    /* Terminal Profile Byte 7 */
4077
15
    { &hf_tprof_b7,
4078
15
      { "Terminal Profile Byte 7 (Multiple card proactive commands)", "gsm_sim.tp.b7",
4079
15
        FT_UINT8, BASE_HEX, NULL, 0,
4080
15
        NULL, HFILL },
4081
15
    },
4082
15
    { &hf_tp_pa_power_on,
4083
15
      { "Proactive SIM: POWER ON CARD", "gsm_sim.tp.pa.power_on_card",
4084
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4085
15
        NULL, HFILL }
4086
15
    },
4087
15
    { &hf_tp_pa_power_off,
4088
15
      { "Proactive SIM: POWER OFF CARD", "gsm_sim.tp.pa.power_off_card",
4089
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4090
15
        NULL, HFILL }
4091
15
    },
4092
15
    { &hf_tp_pa_perform_card_apdu,
4093
15
      { "Proactive SIM: PERFORM CARD APDU", "gsm_sim.tp.pa.perf_card_apdu",
4094
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4095
15
        NULL, HFILL }
4096
15
    },
4097
15
    { &hf_tp_pa_get_reader_status,
4098
15
      { "Proactive SIM: GET READER STATUS (status)", "gsm_sim.tp.pa.get_rdr_status",
4099
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4100
15
        NULL, HFILL }
4101
15
    },
4102
15
    { &hf_tp_pa_get_reader_status_id,
4103
15
      { "Proactive SIM: GET READER STATUS (identifier)", "gsm_sim.tp.pa.get_rdr_status_id",
4104
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4105
15
        NULL, HFILL }
4106
15
    },
4107
15
    { &hf_tp_rfu,
4108
15
      { "RFU", "gsm_sim.tp.rfu",
4109
15
        FT_UINT8, BASE_HEX, NULL, 0xe0,
4110
15
        NULL, HFILL },
4111
15
    },
4112
4113
    /* Terminal Profile Byte 8 */
4114
15
    { &hf_tprof_b8,
4115
15
      { "Terminal Profile Byte 8 (Proactive SIM)", "gsm_sim.tp.b8",
4116
15
        FT_UINT8, BASE_HEX, NULL, 0,
4117
15
        NULL, HFILL },
4118
15
    },
4119
15
    { &hf_tp_pa_timer_start_stop,
4120
15
      { "Proactive SIM: TIMER MANAGEMENT (start, stop)", "gsm_sim.tp.pa.timer_start_stop",
4121
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4122
15
        NULL, HFILL }
4123
15
    },
4124
15
    { &hf_tp_pa_timer_get_current,
4125
15
      { "Proactive SIM: TIMER MANAGEMENT (get current value)", "gsm_sim.tp.pa.timer_get_current",
4126
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4127
15
        NULL, HFILL }
4128
15
    },
4129
15
    { &hf_tp_pa_prov_loci_date_tz,
4130
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (date, time, tz)", "gsm_sim.tp.pa.prov_loci_date",
4131
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4132
15
        NULL, HFILL }
4133
15
    },
4134
15
    { &hf_tp_pa_get_inkey_binary,
4135
15
      { "Proactive SIM: GET INKEY", "gsm_sim.tp.pa.get_inkey_bin",
4136
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4137
15
        NULL, HFILL }
4138
15
    },
4139
15
    { &hf_tp_pa_set_up_idle_mode_text,
4140
15
      { "Proactive SIM: SET UP IDLE MODE TEXT", "gsm_sim.tp.pa.set_up_idle_text",
4141
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4142
15
        NULL, HFILL }
4143
15
    },
4144
15
    { &hf_tp_pa_run_at_command,
4145
15
      { "Proactive SIM: RUN AT COMMAND", "gsm_sim.tp.pa.run_at_command",
4146
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4147
15
        NULL, HFILL }
4148
15
    },
4149
15
    { &hf_tp_pa_2nd_alpha_setup_call,
4150
15
      { "Proactive SIM: SETUP CALL", "gsm_sim.tp.pa.2nd_alpha_id",
4151
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4152
15
        NULL, HFILL }
4153
15
    },
4154
15
    { &hf_tp_pa_2nd_cc_sim_support,
4155
15
      { "Proactive SIM: Call Control by USIM is supported", "gsm_sim.tp.pa.cc_sim_support",
4156
15
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
4157
15
        NULL, HFILL }
4158
15
    },
4159
4160
    /* Terminal Profile Byte 9 */
4161
15
    { &hf_tprof_b9,
4162
15
      { "Terminal Profile Byte 9", "gsm_sim.tp.b9",
4163
15
        FT_UINT8, BASE_HEX, NULL, 0,
4164
15
        NULL, HFILL },
4165
15
    },
4166
15
    { &hf_tp_display_text,
4167
15
      { "DISPLAY TEXT", "gsm_sim.tp.display_text",
4168
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4169
15
        NULL, HFILL }
4170
15
    },
4171
15
    { &hf_tp_send_dtmf_cmd,
4172
15
      { "SEND DTMF command", "gsm_sim.tp.send_dtmf_cmd",
4173
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4174
15
        NULL, HFILL }
4175
15
    },
4176
15
    { &hf_tp_pa_prov_loci_nmr2,
4177
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR)", "gsm_sim.tp.pa.prov_loci_nmr",
4178
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4179
15
        NULL, HFILL }
4180
15
    },
4181
15
    { &hf_tp_pa_prov_loci_lang,
4182
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (language)", "gsm_sim.tp.pa.prov_loci_lang",
4183
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4184
15
        NULL, HFILL }
4185
15
    },
4186
15
    { &hf_tp_pa_prov_loci_ta,
4187
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Timing Advance)", "gsm_sim.tp.pa.prov_loci_ta",
4188
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4189
15
        NULL, HFILL }
4190
15
    },
4191
15
    { &hf_tp_pa_lang_notif,
4192
15
      { "Proactive SIM: LANGUAGE NOTIFICATION", "gsm_sim.tp.pa.lang_notif",
4193
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4194
15
        NULL, HFILL }
4195
15
    },
4196
15
    { &hf_tp_pa_launch_browser,
4197
15
      { "Proactive SIM: LAUNCH BROWSER", "gsm_sim.tp.pa.launch_browser",
4198
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4199
15
        NULL, HFILL }
4200
15
    },
4201
15
    { &hf_tp_pa_prov_loci_access_techno,
4202
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Access Technology)", "gsm_sim.tp.pa.prov_loci_access_techno",
4203
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4204
15
        NULL, HFILL }
4205
15
    },
4206
4207
    /* Terminal Profile Byte 10 */
4208
15
    { &hf_tprof_b10,
4209
15
      { "Terminal Profile Byte 10 (Soft keys support)", "gsm_sim.tp.b10",
4210
15
        FT_UINT8, BASE_HEX, NULL, 0,
4211
15
        NULL, HFILL },
4212
15
    },
4213
15
    { &hf_tp_soft_key_support_select_item,
4214
15
      { "Soft keys support for SELECT ITEM", "gsm_sim.tp.soft_key_support.select_item",
4215
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4216
15
        NULL, HFILL }
4217
15
    },
4218
15
    { &hf_tp_soft_key_support_set_up_menu,
4219
15
      { "Soft Keys support for SET UP MENU", "gsm_sim.tp.soft_key_support.set_up_menu",
4220
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4221
15
        NULL, HFILL }
4222
15
    },
4223
15
    { &hf_tp_rfu2,
4224
15
      { "RFU", "gsm_sim.tp.rfu",
4225
15
        FT_UINT8, BASE_HEX, NULL, 0xfc,
4226
15
        NULL, HFILL },
4227
15
    },
4228
4229
    /* Terminal Profile Byte 11 */
4230
15
    { &hf_tprof_b11,
4231
15
      { "Terminal Profile Byte 11 (Soft keys information)", "gsm_sim.tp.b11",
4232
15
        FT_UINT8, BASE_HEX, NULL, 0,
4233
15
        NULL, HFILL },
4234
15
    },
4235
15
    { &hf_tp_soft_key_info_max_nb,
4236
      /* Note: The bitmask 0xff is needed */
4237
15
      { "Maximum number of soft keys available", "gsm_sim.tp.soft_key_info.max_nb",
4238
15
        FT_UINT8, BASE_DEC, NULL, 0xff,
4239
15
        NULL, HFILL }
4240
15
    },
4241
4242
    /* Terminal Profile Byte 12 */
4243
15
    { &hf_tprof_b12,
4244
15
      { "Terminal Profile Byte 12 (Bearer Independent protocol proactive commands, class \"e\")", "gsm_sim.tp.b12",
4245
15
        FT_UINT8, BASE_HEX, NULL, 0,
4246
15
        NULL, HFILL },
4247
15
    },
4248
15
    { &hf_tp_pa_open_chan,
4249
15
      { "Proactive SIM: OPEN CHANNEL", "gsm_sim.tp.pa.open_chan",
4250
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4251
15
        NULL, HFILL }
4252
15
    },
4253
15
    { &hf_tp_pa_close_chan,
4254
15
      { "Proactive SIM: CLOSE CHANNEL", "gsm_sim.tp.pa.close_chan",
4255
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4256
15
        NULL, HFILL }
4257
15
    },
4258
15
    { &hf_tp_pa_recv_data,
4259
15
      { "Proactive SIM: RECEIVE DATA", "gsm_sim.tp.pa.recv_data",
4260
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4261
15
        NULL, HFILL }
4262
15
    },
4263
15
    { &hf_tp_pa_send_data,
4264
15
      { "Proactive SIM: SEND DATA", "gsm_sim.tp.pa.send_data",
4265
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4266
15
        NULL, HFILL }
4267
15
    },
4268
15
    { &hf_tp_pa_get_chan_status,
4269
15
      { "Proactive SIM: GET CHANNEL STATUS", "gsm_sim.tp.pa.get_chan_status",
4270
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4271
15
        NULL, HFILL }
4272
15
    },
4273
15
    { &hf_tp_pa_serv_search,
4274
15
      { "Proactive SIM: SERVICE SEARCH", "gsm_sim.tp.pa.serv_search",
4275
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4276
15
        NULL, HFILL }
4277
15
    },
4278
15
    { &hf_tp_pa_get_serv_info,
4279
15
      { "Proactive SIM: GET SERVICE INFORMATION", "gsm_sim.tp.pa.get_serv_info",
4280
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4281
15
        NULL, HFILL }
4282
15
    },
4283
15
    { &hf_tp_pa_decl_serv,
4284
15
      { "Proactive SIM: DECLARE SERVICE", "gsm_sim.tp.pa.decl_serv",
4285
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4286
15
        NULL, HFILL }
4287
15
    },
4288
4289
    /* Terminal Profile Byte 13 */
4290
15
    { &hf_tprof_b13,
4291
15
      { "Terminal Profile Byte 13 (Bearer Independent protocol supported bearers, class \"e\")", "gsm_sim.tp.b13",
4292
15
        FT_UINT8, BASE_HEX, NULL, 0,
4293
15
        NULL, HFILL },
4294
15
    },
4295
15
    { &hf_tp_bip_csd,
4296
15
      { "CSD bearer", "gsm_sim.tp.bip.csd",
4297
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4298
15
        NULL, HFILL }
4299
15
    },
4300
15
    { &hf_tp_bip_gprs,
4301
15
      { "GPRS bearer", "gsm_sim.tp.bip.gprs",
4302
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4303
15
        NULL, HFILL }
4304
15
    },
4305
15
    { &hf_tp_bip_bluetooth,
4306
15
      { "Bluetooth bearer", "gsm_sim.tp.bip.bluetooth",
4307
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4308
15
        NULL, HFILL }
4309
15
    },
4310
15
    { &hf_tp_bip_irda,
4311
15
      { "IrDA bearer", "gsm_sim.tp.bip.irda",
4312
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4313
15
        NULL, HFILL }
4314
15
    },
4315
15
    { &hf_tp_bip_rs232,
4316
15
      { "RS232 bearer", "gsm_sim.tp.bip.rs232",
4317
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4318
15
        NULL, HFILL }
4319
15
    },
4320
15
    { &hf_tp_num_chans,
4321
15
      { "Number of Channels", "gsm_sim.tp.num_chans",
4322
15
        FT_UINT8, BASE_DEC, NULL, 0xe0,
4323
15
        NULL, HFILL }
4324
15
    },
4325
4326
4327
    /* Terminal Profile Byte 14 */
4328
15
    { &hf_tprof_b14,
4329
15
      { "Terminal Profile Byte 14 (Screen height)", "gsm_sim.tp.b14",
4330
15
        FT_UINT8, BASE_HEX, NULL, 0,
4331
15
        NULL, HFILL },
4332
15
    },
4333
15
    { &hf_tp_char_height,
4334
15
      { "Display height (chars)", "gsm_sim.tp.display.height",
4335
15
        FT_UINT8, BASE_DEC, NULL, 0x1f,
4336
15
        NULL, HFILL },
4337
15
    },
4338
15
    { &hf_tp_nd,
4339
15
      { "No display capability", "gsm_sim.tp.nd",
4340
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4341
15
        NULL, HFILL },
4342
15
    },
4343
15
    { &hf_tp_nk,
4344
15
      { "No keypad available", "gsm_sim.tp.nk",
4345
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4346
15
        NULL, HFILL },
4347
15
    },
4348
15
    { &hf_tp_sizing_supp,
4349
15
      { "Screen sizing parameters", "gsm_sim.tp.disp_sizing",
4350
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4351
15
        NULL, HFILL },
4352
15
    },
4353
4354
    /* Terminal Profile Byte 15 */
4355
15
    { &hf_tprof_b15,
4356
15
      { "Terminal Profile Byte 15 (Screen width)", "gsm_sim.tp.b15",
4357
15
        FT_UINT8, BASE_HEX, NULL, 0,
4358
15
        NULL, HFILL },
4359
15
    },
4360
15
    { &hf_tp_char_width,
4361
15
      { "Display width (chars)", "gsm_sim.tp.display.width",
4362
15
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4363
15
        NULL, HFILL },
4364
15
    },
4365
15
    { &hf_tp_var_fonts,
4366
15
      { "Variable size fonts", "gsm_sim.tp.var_fonts",
4367
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4368
15
        NULL, HFILL },
4369
15
    },
4370
4371
    /* Terminal Profile Byte 16 */
4372
15
    { &hf_tprof_b16,
4373
15
      { "Terminal Profile Byte 16 (Screen effects)", "gsm_sim.tp.b16",
4374
15
        FT_UINT8, BASE_HEX, NULL, 0,
4375
15
        NULL, HFILL },
4376
15
    },
4377
15
    { &hf_tp_display_resize,
4378
15
      { "Display resize", "gsm_sim.tp.display.resize",
4379
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4380
15
        NULL, HFILL },
4381
15
    },
4382
15
    { &hf_tp_text_wrapping,
4383
15
      { "Text Wrapping", "gsm_sim.tp.display.wrapping",
4384
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4385
15
        NULL, HFILL },
4386
15
    },
4387
15
    { &hf_tp_text_scrolling,
4388
15
      { "Text Scrolling", "gsm_sim.tp.display.scrolling",
4389
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4390
15
        NULL, HFILL },
4391
15
    },
4392
15
    { &hf_tp_text_attributes,
4393
15
      { "Text Attributes", "gsm_sim.tp.display.attributes",
4394
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4395
15
        NULL, HFILL },
4396
15
    },
4397
15
    { &hf_tp_rfu3,
4398
15
      { "RFU", "gsm_sim.tp.rfu",
4399
15
        FT_UINT8, BASE_HEX, NULL, 0x10,
4400
15
        NULL, HFILL },
4401
15
    },
4402
15
    { &hf_tp_width_red_menu,
4403
15
      { "Width reduction when in menu", "gsm_sim.tp.display.width_red_menu",
4404
15
        FT_UINT8, BASE_DEC, NULL, 0xe0,
4405
15
        NULL, HFILL },
4406
15
    },
4407
4408
    /* Terminal Profile Byte 17 */
4409
15
    { &hf_tprof_b17,
4410
15
      { "Terminal Profile Byte 17 (Bearer independent protocol supported transport interface/bearers, class \"e\")", "gsm_sim.tp.b17",
4411
15
        FT_UINT8, BASE_HEX, NULL, 0,
4412
15
        NULL, HFILL },
4413
15
    },
4414
15
    { &hf_tp_bip_tcp_remote,
4415
15
      { "TCP client mode remote connection", "gsm_sim.tp.bip.tcp_remote",
4416
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4417
15
        NULL, HFILL }
4418
15
    },
4419
15
    { &hf_tp_bip_udp_remote,
4420
15
      { "UDP client mode remote connection", "gsm_sim.tp.bip.udp_remote",
4421
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4422
15
        NULL, HFILL }
4423
15
    },
4424
15
    { &hf_tp_bip_tcp_server,
4425
15
      { "TCP server mode", "gsm_sim.tp.bip.tcp_server",
4426
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4427
15
        NULL, HFILL }
4428
15
    },
4429
15
    { &hf_tp_bip_tcp_local,
4430
15
      { "TCP client mode local connection", "gsm_sim.tp.bip.tcp_local",
4431
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4432
15
        NULL, HFILL }
4433
15
    },
4434
15
    { &hf_tp_bip_udp_local,
4435
15
      { "UDP client mode local connection", "gsm_sim.tp.bip.udp_local",
4436
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4437
15
        NULL, HFILL }
4438
15
    },
4439
15
    { &hf_tp_bip_direct_com,
4440
15
      { "Direct communication channel", "gsm_sim.tp.bip.direct_com",
4441
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4442
15
        NULL, HFILL }
4443
15
    },
4444
15
    { &hf_tp_bip_eutran,
4445
15
      { "E-UTRAN bearer", "gsm_sim.tp.bip.eutran",
4446
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4447
15
        NULL, HFILL }
4448
15
    },
4449
15
    { &hf_tp_bip_hsdpa,
4450
15
      { "HSDPA bearer", "gsm_sim.tp.bip.hsdpa",
4451
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4452
15
        NULL, HFILL }
4453
15
    },
4454
4455
    /* Terminal Profile Byte 18 */
4456
15
    { &hf_tprof_b18,
4457
15
      { "Terminal Profile Byte 18 (Bearer independent protocol)", "gsm_sim.tp.b18",
4458
15
        FT_UINT8, BASE_HEX, NULL, 0,
4459
15
        NULL, HFILL },
4460
15
    },
4461
15
    { &hf_tp_pa_display_text_var_time_out,
4462
15
      { "Proactive SIM: DISPLAY TEXT (Variable Time out)", "gsm_sim.tp.pa.display_text_var_time_out",
4463
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4464
15
        NULL, HFILL }
4465
15
    },
4466
15
    { &hf_tp_pa_get_inkey_help,
4467
15
      { "Proactive SIM: GET INKEY (help is supported)", "gsm_sim.tp.pa.get_inkey_help",
4468
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4469
15
        NULL, HFILL }
4470
15
    },
4471
15
    { &hf_tp_bip_usb,
4472
15
      { "USB bearer", "gsm_sim.tp.bip.usb",
4473
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4474
15
        NULL, HFILL }
4475
15
    },
4476
15
    { &hf_tp_pa_get_inkey_var_time_out,
4477
15
      { "Proactive SIM: GET INKEY (Variable Timeout)", "gsm_sim.tp.pa.get_inkey_var_time_out",
4478
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4479
15
        NULL, HFILL }
4480
15
    },
4481
15
    { &hf_tp_pa_prov_loci_esn,
4482
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (ESN)", "gsm_sim.tp.pa.prov_loci_esn",
4483
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4484
15
        NULL, HFILL }
4485
15
    },
4486
15
    { &hf_tp_cc_gprs,
4487
15
      { "CALL CONTROL on GPRS", "gsm_sim.tp.cc_gprs",
4488
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4489
15
        NULL, HFILL }
4490
15
    },
4491
15
    { &hf_tp_pa_prov_loci_imeisv,
4492
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (IMEISV)", "gsm_sim.tp.pa.prov_loci_imeisv",
4493
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4494
15
        NULL, HFILL }
4495
15
    },
4496
15
    { &hf_tp_pa_prov_loci_search_mode_change,
4497
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Search Mode change)", "gsm_sim.tp.pa.prov_loci_search_mode_change",
4498
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4499
15
        NULL, HFILL }
4500
15
    },
4501
4502
    /* Terminal Profile Byte 19 */
4503
15
    { &hf_tprof_b19,
4504
15
      { "Terminal Profile Byte 19 (TIA/EIA-136-C facilities)", "gsm_sim.tp.b19",
4505
15
        FT_UINT8, BASE_HEX, NULL, 0,
4506
15
        NULL, HFILL },
4507
15
    },
4508
15
    { &hf_tp_tia_eia_version,
4509
15
      { "TIA/EIA Version", "gsm_sim.tp.tia_eia_version",
4510
15
        FT_UINT8, BASE_DEC, NULL, 0x0f,
4511
15
        NULL, HFILL }
4512
15
    },
4513
15
    { &hf_tp_rfu4,
4514
15
      { "RFU", "gsm_sim.tp.rfu",
4515
15
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4516
15
        NULL, HFILL },
4517
15
    },
4518
4519
    /* Terminal Profile Byte 20 */
4520
15
    { &hf_tprof_b20,
4521
15
      { "Terminal Profile Byte 20 (TIA/EIA/IS-820-A facilities)", "gsm_sim.tp.b20",
4522
15
        FT_UINT8, BASE_HEX, NULL, 0,
4523
15
        NULL, HFILL },
4524
15
    },
4525
15
    { &hf_tp_tia_iea_is820a_reserved,
4526
15
      { "Reserved", "gsm_sim.tp.tia_iea_is820a_reserved",
4527
15
        FT_UINT8, BASE_HEX, NULL, 0xff,
4528
15
        NULL, HFILL }
4529
15
    },
4530
4531
    /* Terminal Profile Byte 21 */
4532
15
    { &hf_tprof_b21,
4533
15
      { "Terminal Profile Byte 21 (Extended Launch Browser Capability)", "gsm_sim.tp.b21",
4534
15
        FT_UINT8, BASE_HEX, NULL, 0,
4535
15
        NULL, HFILL },
4536
15
    },
4537
15
    { &hf_tp_ext_launch_browser_wml,
4538
15
      { "WML", "gsm_sim.tp.ext_launch_browser.wml",
4539
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4540
15
        NULL, HFILL }
4541
15
    },
4542
15
    { &hf_tp_ext_launch_browser_xhtml,
4543
15
      { "XHTML", "gsm_sim.tp.ext_launch_browser.xhtml",
4544
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4545
15
        NULL, HFILL }
4546
15
    },
4547
15
    { &hf_tp_ext_launch_browser_html,
4548
15
      { "HTML", "gsm_sim.tp.ext_launch_browser.html",
4549
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4550
15
        NULL, HFILL }
4551
15
    },
4552
15
    { &hf_tp_ext_launch_browser_chtml,
4553
15
      { "CHTML", "gsm_sim.tp.ext_launch_browser.chtml",
4554
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4555
15
        NULL, HFILL }
4556
15
    },
4557
15
    { &hf_tp_rfu5,
4558
15
      { "RFU", "gsm_sim.tp.rfu",
4559
15
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4560
15
        NULL, HFILL },
4561
15
    },
4562
4563
    /* Terminal Profile Byte 22 */
4564
15
    { &hf_tprof_b22,
4565
15
      { "Terminal Profile Byte 22", "gsm_sim.tp.b22",
4566
15
        FT_UINT8, BASE_HEX, NULL, 0,
4567
15
        NULL, HFILL },
4568
15
    },
4569
15
    { &hf_tp_utran_ps_ext_params,
4570
15
      { "UTRAN PS with extended parameters", "gsm_sim.tp.utran_ps_ext_params",
4571
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4572
15
        NULL, HFILL }
4573
15
    },
4574
15
    { &hf_tp_pa_prov_loci_batt_state,
4575
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (battery state)", "gsm_sim.tp.pa.prov_loci_batt_state",
4576
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4577
15
        NULL, HFILL }
4578
15
    },
4579
15
    { &hf_tp_pa_play_tone_melody,
4580
15
      { "Proactive SIM: PLAY TONE (Melody tones and Themed tones supported)", "gsm_sim.tp.pa.play_tone_melody",
4581
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4582
15
        NULL, HFILL }
4583
15
    },
4584
15
    { &hf_tp_mm_call_set_up_call,
4585
15
      { "Multi-media Calls in SET UP CALL", "gsm_sim.tp.mm_call_set_up_call",
4586
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4587
15
        NULL, HFILL }
4588
15
    },
4589
15
    { &hf_tp_toolkit_initiated_gba,
4590
15
      { "Toolkit-initiated GBA", "gsm_sim.tp.toolkit_initiated_gba",
4591
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4592
15
        NULL, HFILL }
4593
15
    },
4594
15
    { &hf_tp_pa_retrieve_mm_msg,
4595
15
      { "Proactive SIM: RETRIEVE MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.retrieve_mm_msg",
4596
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4597
15
        NULL, HFILL }
4598
15
    },
4599
15
    { &hf_tp_pa_submit_mm_msg,
4600
15
      { "Proactive SIM: SUBMIT MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.submit_mm_msg",
4601
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4602
15
        NULL, HFILL }
4603
15
    },
4604
15
    { &hf_tp_pa_display_mm_msg,
4605
15
      { "Proactive SIM: DISPLAY MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.display_mm_msg",
4606
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4607
15
        NULL, HFILL }
4608
15
    },
4609
4610
    /* Terminal Profile Byte 23 */
4611
15
    { &hf_tprof_b23,
4612
15
      { "Terminal Profile Byte 23", "gsm_sim.tp.b23",
4613
15
        FT_UINT8, BASE_HEX, NULL, 0,
4614
15
        NULL, HFILL },
4615
15
    },
4616
15
    { &hf_tp_pa_set_frames,
4617
15
      { "Proactive SIM: SET FRAMES", "gsm_sim.tp.pa.set_frames",
4618
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4619
15
        NULL, HFILL }
4620
15
    },
4621
15
    { &hf_tp_pa_get_frames_status,
4622
15
      { "Proactive SIM: GET FRAMES STATUS", "gsm_sim.tp.pa.get_frames_status",
4623
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4624
15
        NULL, HFILL }
4625
15
    },
4626
15
    { &hf_tp_mms_notif_download,
4627
15
      { "MMS notification download", "gsm_sim.tp.mms_notif_download",
4628
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4629
15
        NULL, HFILL }
4630
15
    },
4631
15
    { &hf_tp_alpha_id_refresh_cmd,
4632
15
      { "Alpha Identifier in REFRESH command", "gsm_sim.tp.alpha_id_refresh_cmd",
4633
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4634
15
        NULL, HFILL }
4635
15
    },
4636
15
    { &hf_tp_geo_loc_report,
4637
15
      { "Geographical Location Reporting", "gsm_sim.tp.geo_loc_report",
4638
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4639
15
        NULL, HFILL }
4640
15
    },
4641
15
    { &hf_tp_pa_prov_loci_meid,
4642
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (MEID)", "gsm_sim.tp.pa.prov_loci_meid",
4643
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4644
15
        NULL, HFILL }
4645
15
    },
4646
15
    { &hf_tp_pa_prov_loci_nmr_utran_eutran,
4647
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR(UTRAN/E-UTRAN))", "gsm_sim.tp.pa.prov_loci_nmr_utran_eutran",
4648
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4649
15
        NULL, HFILL }
4650
15
    },
4651
15
    { &hf_tp_ussd_data_download,
4652
15
      { "USSD Data download and application mode", "gsm_sim.tp.ussd_data_download",
4653
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4654
15
        NULL, HFILL }
4655
15
    },
4656
4657
    /* Terminal Profile Byte 24 */
4658
15
    { &hf_tprof_b24,
4659
15
      { "Terminal Profile Byte 24 (Class \"i\")", "gsm_sim.tp.b24",
4660
15
        FT_UINT8, BASE_HEX, NULL, 0,
4661
15
        NULL, HFILL },
4662
15
    },
4663
15
    { &hf_tp_class_i_max_nb_frames,
4664
15
      { "Maximum number of frames supported", "gsm_sim.tp.class_i_max_nb_frames",
4665
15
        FT_UINT8, BASE_DEC, NULL, 0x0f,
4666
15
        NULL, HFILL }
4667
15
    },
4668
15
    { &hf_tp_rfu6,
4669
15
      { "RFU", "gsm_sim.tp.rfu",
4670
15
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4671
15
        NULL, HFILL },
4672
15
    },
4673
4674
    /* Terminal Profile Byte 25 */
4675
15
    { &hf_tprof_b25,
4676
15
      { "Terminal Profile Byte 25 (Event driven information extensions)", "gsm_sim.tp.b25",
4677
15
        FT_UINT8, BASE_HEX, NULL, 0,
4678
15
        NULL, HFILL },
4679
15
    },
4680
15
    { &hf_tp_evt_browsing_status,
4681
15
      { "Event: Browsing status", "gsm_sim.tp.evt.browsing_status",
4682
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4683
15
        NULL, HFILL }
4684
15
    },
4685
15
    { &hf_tp_evt_mms_transfer_status,
4686
15
      { "Event: MMS Transfer status", "gsm_sim.tp.evt.mms_transfer_status",
4687
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4688
15
        NULL, HFILL }
4689
15
    },
4690
15
    { &hf_tp_evt_frame_info_changed,
4691
15
      { "Event: Frame Information changed", "gsm_sim.tp.evt.frame_info_changed",
4692
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4693
15
        NULL, HFILL }
4694
15
    },
4695
15
    { &hf_tp_evt_iwlan_access_status,
4696
15
      { "Event: I-WLAN Access status", "gsm_sim.tp.evt.iwlan_access_status",
4697
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4698
15
        NULL, HFILL }
4699
15
    },
4700
15
    { &hf_tp_evt_nw_reject_geran_utran,
4701
15
      { "Event: Network Rejection for GERAN/UTRAN", "gsm_sim.tp.evt.nw_reject_geran_utran",
4702
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4703
15
        NULL, HFILL }
4704
15
    },
4705
15
    { &hf_tp_evt_hci_connectivity,
4706
15
      { "Event: HCI connectivity", "gsm_sim.tp.evt.hci_connectivity",
4707
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4708
15
        NULL, HFILL }
4709
15
    },
4710
15
    { &hf_tp_evt_nw_reject_eutran,
4711
15
      { "Event: Network Rejection for E-UTRAN", "gsm_sim.tp.evt.reject_eutran",
4712
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4713
15
        NULL, HFILL }
4714
15
    },
4715
15
    { &hf_tp_evt_mult_access_techno_change,
4716
15
      { "Multiple access technologies supported in Event Access Technology Change and PROVIDE LOCAL INFORMATION",
4717
15
        "gsm_sim.tp.evt.mult_access_techno_change",
4718
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4719
15
        NULL, HFILL }
4720
15
    },
4721
4722
    /* Terminal Profile Byte 26 */
4723
15
    { &hf_tprof_b26,
4724
15
      { "Terminal Profile Byte 26 (Event driven information extensions)", "gsm_sim.tp.b26",
4725
15
        FT_UINT8, BASE_HEX, NULL, 0,
4726
15
        NULL, HFILL },
4727
15
    },
4728
15
    { &hf_tp_evt_csg_cell_select,
4729
15
      { "Event: CSG Cell Selection", "gsm_sim.tp.evt.csg_cell_select",
4730
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4731
15
        NULL, HFILL }
4732
15
    },
4733
15
    { &hf_tp_evt_contactless_state_req,
4734
15
      { "Event: Contactless state request", "gsm_sim.tp.evt.contactless_state_req",
4735
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4736
15
        NULL, HFILL }
4737
15
    },
4738
15
    { &hf_tp_rfu7,
4739
15
      { "RFU", "gsm_sim.tp.rfu",
4740
15
        FT_UINT8, BASE_HEX, NULL, 0xfc,
4741
15
        NULL, HFILL },
4742
15
    },
4743
4744
    /* Terminal Profile Byte 27 */
4745
15
    { &hf_tprof_b27,
4746
15
      { "Terminal Profile Byte 27 (Event driven information extensions)", "gsm_sim.tp.b27",
4747
15
        FT_UINT8, BASE_HEX, NULL, 0,
4748
15
        NULL, HFILL },
4749
15
    },
4750
15
    { &hf_tp_rfu8,
4751
15
      { "RFU", "gsm_sim.tp.rfu",
4752
15
        FT_UINT8, BASE_HEX, NULL, 0xff,
4753
15
        NULL, HFILL },
4754
15
    },
4755
4756
    /* Terminal Profile Byte 28 */
4757
15
    { &hf_tprof_b28,
4758
15
      { "Terminal Profile Byte 28 (Text attributes)", "gsm_sim.tp.b28",
4759
15
        FT_UINT8, BASE_HEX, NULL, 0,
4760
15
        NULL, HFILL },
4761
15
    },
4762
15
    { &hf_tp_text_align_left,
4763
15
      { "Alignment left", "gsm_sim.tp.text.align_left",
4764
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4765
15
        NULL, HFILL }
4766
15
    },
4767
15
    { &hf_tp_text_align_centre,
4768
15
      { "Alignment centre", "gsm_sim.tp.text.align_centre",
4769
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4770
15
        NULL, HFILL }
4771
15
    },
4772
15
    { &hf_tp_text_align_right,
4773
15
      { "Alignment right", "gsm_sim.tp.text.align_right",
4774
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4775
15
        NULL, HFILL }
4776
15
    },
4777
15
    { &hf_tp_text_font_size_normal,
4778
15
      { "Font size normal", "gsm_sim.tp.text.font_size_normal",
4779
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4780
15
        NULL, HFILL }
4781
15
    },
4782
15
    { &hf_tp_text_font_size_large,
4783
15
      { "Font size large", "gsm_sim.tp.text.font_size_large",
4784
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4785
15
        NULL, HFILL }
4786
15
    },
4787
15
    { &hf_tp_text_font_size_small,
4788
15
      { "Font size small", "gsm_sim.tp.text.font_size_small",
4789
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4790
15
        NULL, HFILL }
4791
15
    },
4792
15
    { &hf_tp_rfu9,
4793
15
      { "RFU", "gsm_sim.tp.rfu",
4794
15
        FT_UINT8, BASE_HEX, NULL, 0xc0,
4795
15
        NULL, HFILL },
4796
15
    },
4797
4798
    /* Terminal Profile Byte 29 */
4799
15
    { &hf_tprof_b29,
4800
15
      { "Terminal Profile Byte 29 (Text attributes)", "gsm_sim.tp.b29",
4801
15
        FT_UINT8, BASE_HEX, NULL, 0,
4802
15
        NULL, HFILL },
4803
15
    },
4804
15
    { &hf_tp_text_style_normal,
4805
15
      { "Style normal", "gsm_sim.tp.text.style_normal",
4806
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4807
15
        NULL, HFILL }
4808
15
    },
4809
15
    { &hf_tp_text_style_bold,
4810
15
      { "Style bold", "gsm_sim.tp.text.style_bold",
4811
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4812
15
        NULL, HFILL }
4813
15
    },
4814
15
    { &hf_tp_text_style_italic,
4815
15
      { "Style italic", "gsm_sim.tp.text.style_italic",
4816
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4817
15
        NULL, HFILL }
4818
15
    },
4819
15
    { &hf_tp_text_style_underlined,
4820
15
      { "Style underlined", "gsm_sim.tp.text.style_underlined",
4821
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4822
15
        NULL, HFILL }
4823
15
    },
4824
15
    { &hf_tp_text_style_strikethrough,
4825
15
      { "Style strikethrough", "gsm_sim.tp.text.style_strikethrough",
4826
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4827
15
        NULL, HFILL }
4828
15
    },
4829
15
    { &hf_tp_text_style_text_fg_colour,
4830
15
      { "Style text foreground colour", "gsm_sim.tp.text.style_text_fg_colour",
4831
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4832
15
        NULL, HFILL }
4833
15
    },
4834
15
    { &hf_tp_text_style_text_bg_colour,
4835
15
      { "Style text background colour", "gsm_sim.tp.text.style_text_bg_colour",
4836
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4837
15
        NULL, HFILL }
4838
15
    },
4839
15
    { &hf_tp_rfu10,
4840
15
      { "RFU", "gsm_sim.tp.rfu",
4841
15
        FT_UINT8, BASE_HEX, NULL, 0x80,
4842
15
        NULL, HFILL },
4843
15
    },
4844
4845
    /* Terminal Profile Byte 30 */
4846
15
    { &hf_tprof_b30,
4847
15
      { "Terminal Profile Byte 30", "gsm_sim.tp.b30",
4848
15
        FT_UINT8, BASE_HEX, NULL, 0,
4849
15
        NULL, HFILL },
4850
15
    },
4851
15
    { &hf_tp_bip_iwlan,
4852
15
      { "I-WLAN bearer", "gsm_sim.tp.bip.iwlan",
4853
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4854
15
        NULL, HFILL }
4855
15
    },
4856
15
    { &hf_tp_pa_prov_loci_wsid,
4857
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (WSID of the current I-WLAN connection)", "gsm_sim.tp.pa.prov_loci_wsid",
4858
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4859
15
        NULL, HFILL }
4860
15
    },
4861
15
    { &hf_tp_term_app,
4862
15
      { "TERMINAL APPLICATIONS", "gsm_sim.tp.term_app",
4863
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4864
15
        NULL, HFILL }
4865
15
    },
4866
15
    { &hf_tp_steering_roaming_refresh,
4867
15
      { "\"Steering of Roaming\" REFRESH", "gsm_sim.tp.steering_roaming_refresh",
4868
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4869
15
        NULL, HFILL }
4870
15
    },
4871
15
    { &hf_tp_pa_activate,
4872
15
      { "Proactive SIM: ACTIVATE", "gsm_sim.tp.pa.activate",
4873
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4874
15
        NULL, HFILL }
4875
15
    },
4876
15
    { &hf_tp_pa_geo_loc_req,
4877
15
      { "Proactive SIM: Geographical Location Request", "gsm_sim.tp.pa.geo_loc_req",
4878
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4879
15
        NULL, HFILL }
4880
15
    },
4881
15
    { &hf_tp_pa_prov_loci_broadcast_nw_info,
4882
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Broadcast Network Information)", "gsm_sim.tp.pa.prov_loci_broadcast_nw_info",
4883
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4884
15
        NULL, HFILL }
4885
15
    },
4886
15
    { &hf_tp_steering_roaming_iwlan_refresh,
4887
15
      { "\"Steering of Roaming for I-WLAN\" REFRESH", "gsm_sim.tp.steering_roaming_iwlan_refresh",
4888
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4889
15
        NULL, HFILL }
4890
15
    },
4891
4892
    /* Terminal Profile Byte 31 */
4893
15
    { &hf_tprof_b31,
4894
15
      { "Terminal Profile Byte 31", "gsm_sim.tp.b31",
4895
15
        FT_UINT8, BASE_HEX, NULL, 0,
4896
15
        NULL, HFILL },
4897
15
    },
4898
15
    { &hf_tp_pa_contactless_state_changed,
4899
15
      { "Proactive SIM: Contactless State Changed", "gsm_sim.tp.pa.contactless_state_changed",
4900
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4901
15
        NULL, HFILL }
4902
15
    },
4903
15
    { &hf_tp_csg_cell_discovery,
4904
15
      { "CSG cell discovery", "gsm_sim.tp.csg_cell_discovery",
4905
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4906
15
        NULL, HFILL }
4907
15
    },
4908
15
    { &hf_tp_cnf_params_support_open_chan_server_mode,
4909
15
      { "Confirmation parameters supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.cnf_params_support_open_chan_server_mode",
4910
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4911
15
        NULL, HFILL }
4912
15
    },
4913
15
    { &hf_tp_com_ctrl_ims,
4914
15
      { "Communication Control for IMS", "gsm_sim.tp.com_ctrl_ims",
4915
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4916
15
        NULL, HFILL }
4917
15
    },
4918
15
    { &hf_tp_cat_over_modem_itf,
4919
15
      { "CAT over the modem interface", "gsm_sim.tp.cat_over_modem_itf",
4920
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4921
15
        NULL, HFILL }
4922
15
    },
4923
15
    { &hf_tp_evt_incoming_data_ims,
4924
15
      { "Event: Incoming IMS Data", "gsm_sim.tp.evt.incoming_data_ims",
4925
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4926
15
        NULL, HFILL }
4927
15
    },
4928
15
    { &hf_tp_evt_ims_registration,
4929
15
      { "Event: IMS Registration", "gsm_sim.tp.evt.ims_registration",
4930
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4931
15
        NULL, HFILL }
4932
15
    },
4933
15
    { &hf_tp_pa_prof_env_cont,
4934
15
      { "Proactive SIM: Profile Container, Envelope Container, COMMAND CONTAINER and ENCAPSULATED SESSION CONTROL", "gsm_sim.tp.pa.prof_env_cont",
4935
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4936
15
        NULL, HFILL }
4937
15
    },
4938
4939
    /* Terminal Profile Byte 32 */
4940
15
    { &hf_tprof_b32,
4941
15
      { "Terminal Profile Byte 32", "gsm_sim.tp.b32",
4942
15
        FT_UINT8, BASE_HEX, NULL, 0,
4943
15
        NULL, HFILL },
4944
15
    },
4945
15
    { &hf_tp_bip_ims,
4946
15
      { "IMS bearer", "gsm_sim.tp.bip.ims",
4947
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4948
15
        NULL, HFILL }
4949
15
    },
4950
15
    { &hf_tp_pa_prov_loci_henb_ip_addr,
4951
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (H(e)NB IP address)", "gsm_sim.tp.pa.prov_loci_henb_ip_addr",
4952
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4953
15
        NULL, HFILL }
4954
15
    },
4955
15
    { &hf_tp_pa_prov_loci_henb_surround_macro,
4956
15
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (H(e)NB surrounding macrocells)", "gsm_sim.tp.pa.prov_loci_henb_surround_macro",
4957
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4958
15
        NULL, HFILL }
4959
15
    },
4960
15
    { &hf_tp_launch_params_support_open_chan_server_mode,
4961
15
      { "Launch parameters supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.launch_params_support_open_chan_server_mode",
4962
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4963
15
        NULL, HFILL }
4964
15
    },
4965
15
    { &hf_tp_direct_com_support_open_chan_server_mode,
4966
15
      { "Direct communication channel supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.direct_com_support_open_chan_server_mode",
4967
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4968
15
        NULL, HFILL }
4969
15
    },
4970
15
    { &hf_tp_pa_sec_prof_env_cont,
4971
15
      { "Proactive SIM: Security for Profile Container, Envelope Container, COMMAND CONTAINER and ENCAPSULATED SESSION CONTROL", "gsm_sim.tp.sec_prof_env_cont",
4972
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4973
15
        NULL, HFILL }
4974
15
    },
4975
15
    { &hf_tp_cat_serv_list_ecat_client,
4976
15
      { "CAT service list for eCAT client", "gsm_sim.tp.serv_list_ecat_client",
4977
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4978
15
        NULL, HFILL }
4979
15
    },
4980
15
    { &hf_tp_support_refresh_enforcement_policy,
4981
15
      { "Support of refresh enforcement policy", "gsm_sim.tp.refresh_enforcement_policy",
4982
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4983
15
        NULL, HFILL }
4984
15
    },
4985
4986
    /* Terminal Profile Byte 33 */
4987
15
    { &hf_tprof_b33,
4988
15
      { "Terminal Profile Byte 33", "gsm_sim.tp.b33",
4989
15
        FT_UINT8, BASE_HEX, NULL, 0,
4990
15
        NULL, HFILL },
4991
15
    },
4992
15
    { &hf_tp_support_dns_addr_req,
4993
15
      { "Support of DNS server address request for OPEN CHANNEL related to packet data service bearer", "gsm_sim.tp.support_dns_addr_req",
4994
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4995
15
        NULL, HFILL }
4996
15
    },
4997
15
    { &hf_tp_support_nw_access_name_reuse,
4998
15
      { "Support of Network Access Name reuse indication for CLOSE CHANNEL related to packet data service bearer", "gsm_sim.tp.nw_access_name_reuse",
4999
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5000
15
        NULL, HFILL }
5001
15
    },
5002
15
    { &hf_tp_ev_poll_intv_nego,
5003
15
      { "Event: Poll Interval Negotiation", "gsm_sim.tp.evt.poll_intv_nego",
5004
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5005
15
        NULL, HFILL }
5006
15
    },
5007
15
    { &hf_tp_prose_usage_info_reporting,
5008
15
      { "ProSe usage information reporting", "gsm_sim.tp.evt.prose_usage_info_reporting",
5009
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5010
15
        NULL, HFILL }
5011
15
    },
5012
15
    { &hf_tp_pa_prov_loci_rat,
5013
15
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (Supported Radio Access Technologies)", "gsm_sim.tp.pa.prov_loci_rat",
5014
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5015
15
        NULL, HFILL }
5016
15
    },
5017
15
    { &hf_tp_evt_wlan_access_status,
5018
15
      { "Event: WLAN Access status", "gsm_sim.tp.evt.wlan_access_status",
5019
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5020
15
        NULL, HFILL }
5021
15
    },
5022
15
    { &hf_tp_wlan_bearer,
5023
15
      { "WLAN bearer support", "gsm_sim.tp.wlan_bearer",
5024
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5025
15
        NULL, HFILL }
5026
15
    },
5027
15
    { &hf_tp_pa_prov_loci_wlan_id,
5028
15
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (WLAN identifier of the current WLAN connection)", "gsm_sim.tp.pa.prov_loci_wlan_id",
5029
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5030
15
        NULL, HFILL }
5031
15
    },
5032
5033
    /* Terminal Profile Byte 34 */
5034
15
    { &hf_tprof_b34,
5035
15
      { "Terminal Profile Byte 34", "gsm_sim.tp.b34",
5036
15
        FT_UINT8, BASE_HEX, NULL, 0,
5037
15
        NULL, HFILL },
5038
15
    },
5039
15
    { &hf_tp_uri_send_short_msg,
5040
15
      { "URI support for SEND SHORT MESSAGE", "gsm_sim.tp.uri_send_short_msg",
5041
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5042
15
        NULL, HFILL }
5043
15
    },
5044
15
    { &hf_tp_ims_uri_setup_call,
5045
15
      { "IMS URI supported for SET UP CALL", "gsm_sim.tp.ims_uri_setup_call",
5046
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5047
15
        NULL, HFILL }
5048
15
    },
5049
15
    { &hf_tp_media_type_voice_setup_call,
5050
15
      { "Media Type \"Voice\" supported for SET UP CALL and Call Control by USIM", "gsm_sim.tp.media_type_voice_setup_call",
5051
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5052
15
        NULL, HFILL }
5053
15
    },
5054
15
    { &hf_tp_media_type_video_setup_call,
5055
15
      { "Media Type \"Video\" supported for SET UP CALL and Call Control by USIM", "gsm_sim.tp.media_type_video_setup_call",
5056
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5057
15
        NULL, HFILL }
5058
15
    },
5059
15
    { &hf_tp_pa_prov_loci_eutran_timing_advance_info,
5060
15
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (E-UTRAN Timing Advance Information)", "gsm_sim.tp.pa.prov_loci_eutran_timing_advance_info",
5061
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5062
15
        NULL, HFILL }
5063
15
    },
5064
15
    { &hf_tp_refresh_euicc_profile_state_change,
5065
15
      { "REFRESH with \"eUICC Profile State Change\" mode", "gsm_sim.tp.refresh_euicc_profile_state_change",
5066
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5067
15
        NULL, HFILL }
5068
15
    },
5069
15
    { &hf_tp_ext_rej_cause_code_nw_reject_eutran,
5070
15
      { "Extended Rejection Cause Code in Event: Network Rejection for E-UTRAN", "gsm_sim.tp.ext_rej_cause_code_nw_reject_eutran",
5071
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5072
15
        NULL, HFILL }
5073
15
    },
5074
15
    { &hf_tp_deprecated_b34,
5075
15
      { "Deprecated", "gsm_sim.tp.deprecated",
5076
15
        FT_UINT8, BASE_HEX, NULL, 0x80,
5077
15
        NULL, HFILL }
5078
15
    },
5079
5080
    /* Terminal Profile Byte 35 */
5081
15
    { &hf_tprof_b35,
5082
15
      { "Terminal Profile Byte 35", "gsm_sim.tp.b35",
5083
15
        FT_UINT8, BASE_HEX, NULL, 0,
5084
15
        NULL, HFILL },
5085
15
    },
5086
15
    { &hf_tp_pa_get_input_var_timeout,
5087
15
      { "Proactive UICC: GET INPUT (Variable Time out)", "gsm_sim.tp.pa.get_input_var_timeout",
5088
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5089
15
        NULL, HFILL }
5090
15
    },
5091
15
    { &hf_tp_data_conn_status_change_pdp,
5092
15
      { "Data Connection Status Change Event support - PDP Connection", "gsm_sim.tp.data_conn_status_change_pdp",
5093
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5094
15
        NULL, HFILL }
5095
15
    },
5096
15
    { &hf_tp_data_conn_status_change_pdn,
5097
15
      { "Data Connection Status Change Event support - PDN Connection", "gsm_sim.tp.data_conn_status_change_pdn",
5098
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5099
15
        NULL, HFILL }
5100
15
    },
5101
15
    { &hf_tp_refresh_app_update,
5102
15
      { "REFRESH with \"Application Update\" mode", "gsm_sim.tp.refresh_app_update",
5103
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5104
15
        NULL, HFILL }
5105
15
    },
5106
15
    { &hf_tp_pa_lsi_proactive_session_request,
5107
15
      { "Proactive UICC: LSI COMMAND with \"Proactive Session Request\"", "gsm_sim.tp.pa.lsi_proactive_session_request",
5108
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5109
15
        NULL, HFILL }
5110
15
    },
5111
15
    { &hf_tp_pa_lsi_uicc_platform_reset,
5112
15
      { "Proactive UICC: LSI COMMAND with \"UICC Platform Reset\"", "gsm_sim.tp.pa.lsi_uicc_platform_reset",
5113
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5114
15
        NULL, HFILL }
5115
15
    },
5116
15
    { &hf_tp_rfu11,
5117
15
      { "RFU", "gsm_sim.tp.rfu",
5118
15
        FT_UINT8, BASE_HEX, NULL, 0xc0,
5119
15
        NULL, HFILL },
5120
15
    },
5121
5122
    /* Terminal Profile Byte 36 */
5123
15
    { &hf_tprof_b36,
5124
15
      { "Terminal Profile Byte 36", "gsm_sim.tp.b36",
5125
15
        FT_UINT8, BASE_HEX, NULL, 0,
5126
15
        NULL, HFILL },
5127
15
    },
5128
15
    { &hf_tp_data_conn_status_change_pdu,
5129
15
      { "Data Connection Status Change Event support - PDU Connection", "gsm_sim.tp.data_conn_status_change_pdu",
5130
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5131
15
        NULL, HFILL }
5132
15
    },
5133
15
    { &hf_tp_evt_nw_reject_ng_ran,
5134
15
      { "Event: Network Rejection for NG-RAN", "gsm_sim.tp.evt.nw_reject_ng_ran",
5135
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5136
15
        NULL, HFILL }
5137
15
    },
5138
15
    { &hf_tp_non_ip_data_delivery,
5139
15
      { "Non-IP Data Delivery support", "gsm_sim.tp.non_ip_data_delivery",
5140
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5141
15
        NULL, HFILL }
5142
15
    },
5143
15
    { &hf_tp_prov_loci_slice_info,
5144
15
      { "Support of PROVIDE LOCAL INFORMATION, Slice(s) information", "gsm_sim.tp.prov_loci_slice_info",
5145
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5146
15
        NULL, HFILL }
5147
15
    },
5148
15
    { &hf_tp_refresh_sor_cmci_param,
5149
15
      { "REFRESH \"Steering of Roaming\" SOR-CMCI parameter support", "gsm_sim.tp.refresh_sor_cmci_param",
5150
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5151
15
        NULL, HFILL }
5152
15
    },
5153
15
    { &hf_tp_evt_nw_reject_satellite_ng_ran,
5154
15
      { "Event: Network Rejection for Satellite NG-RAN", "gsm_sim.tp.evt.nw_reject_satellite_ng_ran",
5155
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5156
15
        NULL, HFILL }
5157
15
    },
5158
15
    { &hf_tp_cag_feature,
5159
15
      { "Support of CAG feature", "gsm_sim.tp.cag_feature",
5160
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5161
15
        NULL, HFILL }
5162
15
    },
5163
15
    { &hf_tp_evt_slices_status_change,
5164
15
      { "Event: Slices Status Change", "gsm_sim.tp.evt.slices_status_change",
5165
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5166
15
        NULL, HFILL }
5167
15
    },
5168
5169
    /* Terminal Profile Byte 37 */
5170
15
    { &hf_tprof_b37,
5171
15
      { "Terminal Profile Byte 37", "gsm_sim.tp.b37",
5172
15
        FT_UINT8, BASE_HEX, NULL, 0,
5173
15
        NULL, HFILL },
5174
15
    },
5175
15
    { &hf_tp_prov_loci_rejected_slice_info,
5176
15
      { "Support of PROVIDE LOCAL INFORMATION, Rejected Slice(s) Information", "gsm_sim.tp.prov_loci_rejected_slice_info",
5177
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5178
15
        NULL, HFILL }
5179
15
    },
5180
15
    { &hf_tp_ext_info_pli,
5181
15
      { "Support of Extended information for PLI (Location Information), Event: Location Status, Event: Network Rejection", "gsm_sim.tp.ext_info_pli",
5182
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5183
15
        NULL, HFILL }
5184
15
    },
5185
15
    { &hf_tp_chaining_pli_env_cmds,
5186
15
      { "Support of chaining of PLI/Envelope commands", "gsm_sim.tp.chaining_pli_env_cmds",
5187
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5188
15
        NULL, HFILL }
5189
15
    },
5190
15
    { &hf_tp_5g_prose_usage_info_reporting,
5191
15
      { "5G ProSe usage information reporting", "gsm_sim.tp.5g_prose_usage_info_reporting",
5192
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5193
15
        NULL, HFILL }
5194
15
    },
5195
15
    { &hf_tp_rfu12,
5196
15
      { "RFU", "gsm_sim.tp.rfu",
5197
15
        FT_UINT8, BASE_HEX, NULL, 0xf0,
5198
15
        NULL, HFILL },
5199
15
    },
5200
5201
    /* Terminal Profile Byte 38 */
5202
15
    { &hf_tprof_b38,
5203
15
      { "Terminal Profile Byte 38", "gsm_sim.tp.b38",
5204
15
        FT_UINT8, BASE_HEX, NULL, 0,
5205
15
        NULL, HFILL },
5206
15
    },
5207
15
    { &hf_tp_rfu13,
5208
15
      { "RFU", "gsm_sim.tp.rfu",
5209
15
        FT_UINT8, BASE_HEX, NULL, 0xff,
5210
15
        NULL, HFILL },
5211
15
    },
5212
5213
    /* Terminal Profile Byte 39 */
5214
15
    { &hf_tprof_b39,
5215
15
      { "Terminal Profile Byte 39", "gsm_sim.tp.b39",
5216
15
        FT_UINT8, BASE_HEX, NULL, 0,
5217
15
        NULL, HFILL },
5218
15
    },
5219
15
    { &hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info,
5220
15
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (NG-RAN/Satellite NG-RAN Timing Advance Information)", "gsm_sim.tp.pa.prov_loci_ng_ran_satellite_timing_advance_info",
5221
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5222
15
        NULL, HFILL }
5223
15
    },
5224
15
    { &hf_tp_rfu14,
5225
15
      { "RFU", "gsm_sim.tp.rfu",
5226
15
        FT_UINT8, BASE_HEX, NULL, 0xfe,
5227
15
        NULL, HFILL },
5228
15
    },
5229
5230
    /* Terminal Capability */
5231
15
    { &hf_tc,
5232
15
      { "Terminal Capability", "gsm_sim.tc",
5233
15
        FT_BYTES, BASE_NONE, NULL, 0,
5234
15
        NULL, HFILL }
5235
15
    },
5236
15
    { &hf_tc_tag,
5237
15
      { "Tag", "gsm_sim.tc.tag",
5238
15
        FT_UINT8, BASE_HEX, VALS(terminal_capability_tag_vals), 0,
5239
15
        NULL, HFILL }
5240
15
    },
5241
15
    { &hf_tc_len,
5242
15
      { "Length", "gsm_sim.tc.len",
5243
15
        FT_UINT32, BASE_DEC, NULL, 0,
5244
15
        NULL, HFILL }
5245
15
    },
5246
15
    { &hf_tc_value,
5247
15
      { "Value", "gsm_sim.tc.value",
5248
15
        FT_BYTES, BASE_NONE, NULL, 0,
5249
15
        NULL, HFILL }
5250
15
    },
5251
15
    { &hf_tc_actual_used_supply_voltage_class,
5252
15
      { "Actual used supply voltage class", "gsm_sim.tc.actual_used_supply_voltage_class",
5253
15
        FT_UINT8, BASE_HEX, VALS(supply_voltage_class_vals), 0,
5254
15
        NULL, HFILL }
5255
15
    },
5256
15
    { &hf_tc_max_available_power_supply,
5257
15
      { "Maximum available power supply", "gsm_sim.tc.max_available_power_supply",
5258
15
        FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliamps), 0,
5259
15
        NULL, HFILL }
5260
15
    },
5261
15
    { &hf_tc_actual_used_clock_frequency,
5262
15
      { "Actual used clock frequency", "gsm_sim.tc.actual_used_clock_frequency",
5263
15
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
5264
15
        NULL, HFILL }
5265
15
    },
5266
15
    { &hf_tc_additional_interfaces_uicc_clf,
5267
15
      { "UICC-CLF", "gsm_sim.tc.additional_interfaces.uicc_clf",
5268
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5269
15
        NULL, HFILL }
5270
15
    },
5271
15
    { &hf_tc_additional_interfaces_rfu,
5272
15
      { "RFU", "gsm_sim.tc.additional_interfaces.rfu",
5273
15
        FT_UINT8, BASE_HEX, NULL, 0xFE,
5274
15
        NULL, HFILL }
5275
15
    },
5276
15
    { &hf_tc_sgp22_luid,
5277
15
      { "LUId", "gsm_sim.tc.sgp22.luid",
5278
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5279
15
        NULL, HFILL }
5280
15
    },
5281
15
    { &hf_tc_sgp22_lpdd,
5282
15
      { "LPDd", "gsm_sim.tc.sgp22.lpdd",
5283
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5284
15
        NULL, HFILL }
5285
15
    },
5286
15
    { &hf_tc_sgp22_ldsd,
5287
15
      { "LDSd", "gsm_sim.tc.sgp22.ldsd",
5288
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5289
15
        NULL, HFILL }
5290
15
    },
5291
15
    { &hf_tc_sgp22_luie,
5292
15
      { "LUIe", "gsm_sim.tc.sgp22.luie",
5293
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5294
15
        NULL, HFILL }
5295
15
    },
5296
15
    { &hf_tc_sgp22_rfu,
5297
15
      { "RFU", "gsm_sim.tc.sgp22.rfu",
5298
15
        FT_UINT8, BASE_HEX, NULL, 0xF0,
5299
15
        NULL, HFILL }
5300
15
    },
5301
15
    { &hf_tc_sgp32_ipad,
5302
15
      { "IPAd", "gsm_sim.tc.sgp32.ipad",
5303
15
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5304
15
        NULL, HFILL }
5305
15
    },
5306
15
    { &hf_tc_sgp32_rfu,
5307
15
      { "RFU", "gsm_sim.tc.sgp32.rfu",
5308
15
        FT_UINT8, BASE_HEX, NULL, 0xFE,
5309
15
        NULL, HFILL }
5310
15
    },
5311
5312
15
    { &hf_tprof_unknown_byte,
5313
15
      { "Unknown Terminal Profile Byte", "gsm_sim.tp.unknown_byte",
5314
15
        FT_UINT8, BASE_HEX, NULL, 0,
5315
15
        NULL, HFILL },
5316
15
    },
5317
5318
15
    { &hf_cat_ber_tag,
5319
15
      { "BER-TLV Tag", "gsm_sim.cat.ber_tlv_tag",
5320
15
        FT_UINT8, BASE_HEX, VALS(ber_tlv_cat_tag_vals), 0,
5321
15
        "Card Application Toolkit BER-TLV tag", HFILL },
5322
15
    },
5323
5324
15
    { &hf_search_ef_identifier,
5325
15
      { "EF Identifier", "gsm_sim.search_ef_identifier",
5326
15
      FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(search_ef_identifier_vals), 0xF8,
5327
15
      NULL, HFILL },
5328
15
    },
5329
15
    { &hf_search_mode,
5330
15
      { "Search Mode", "gsm_sim.search_mode",
5331
15
        FT_UINT8, BASE_HEX, VALS(search_mode_vals), 0x07,
5332
15
        NULL, HFILL },
5333
15
    },
5334
15
    { &hf_search_enhanced_type,
5335
15
      { "Enhanced Search Type", "gsm_sim.search_enhanced_type",
5336
15
      FT_UINT8, BASE_HEX, VALS(search_enhanced_type), 0xF8,
5337
15
      NULL, HFILL },
5338
15
    },
5339
15
    { &hf_search_enhanced_mode,
5340
15
      { "Enhanced Search Mode", "gsm_sim.search_enhanced_mode",
5341
15
      FT_UINT8, BASE_HEX, VALS(search_enhanced_mode_vals), 0x07,
5342
15
      NULL, HFILL },
5343
15
    },
5344
15
    { &hf_search_enhanced_offset,
5345
15
      { "Enhanced Search Offset", "gsm_sim.search_enhanced_offset",
5346
15
      FT_UINT8, BASE_DEC, NULL, 0x0,
5347
15
      NULL, HFILL },
5348
15
    },
5349
15
    { &hf_search_enhanced_value,
5350
15
      { "Enhanced Search Value", "gsm_sim.search_enhanced_value",
5351
15
      FT_UINT8, BASE_DEC, NULL, 0x0,
5352
15
      NULL, HFILL },
5353
15
    },
5354
5355
15
    { &hf_related_to,
5356
15
      { "Related To", "gsm_sim.related_to",
5357
15
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
5358
15
        "This APDU is related to the command in this frame", HFILL }
5359
15
    },
5360
15
    { &hf_response_in,
5361
15
      { "Response In", "gsm_sim.response_in",
5362
15
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
5363
15
        "The response to this command is in this frame", HFILL }
5364
15
    },
5365
15
    { &hf_response_to,
5366
15
      { "Response To", "gsm_sim.response_to",
5367
15
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
5368
15
        "This is the response to the command in this frame", HFILL }
5369
15
    },
5370
15
    { &hf_response_time,
5371
15
      { "Response Time", "gsm_sim.response_time",
5372
15
        FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
5373
15
        "The time between the command and the response", HFILL }
5374
15
    },
5375
5376
    /* Fragment entries */
5377
15
    { &hf_gsm_sim_fragments,
5378
15
      { "APDU fragments", "gsm_sim.fragments", FT_NONE, BASE_NONE,
5379
15
        NULL, 0x00, NULL, HFILL }
5380
15
    },
5381
15
    { &hf_gsm_sim_fragment,
5382
15
      { "APDU fragment", "gsm_sim.fragment", FT_FRAMENUM, BASE_NONE,
5383
15
        NULL, 0x00, NULL, HFILL }
5384
15
    },
5385
15
    { &hf_gsm_sim_fragment_overlap,
5386
15
      { "APDU fragment overlap", "gsm_sim.fragment.overlap", FT_BOOLEAN,
5387
15
        BASE_NONE, NULL, 0x0, NULL, HFILL }
5388
15
    },
5389
15
    { &hf_gsm_sim_fragment_overlap_conflicts,
5390
15
      { "APDU fragment overlapping with conflicting data",
5391
15
        "gsm_sim.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
5392
15
        NULL, 0x0, NULL, HFILL }
5393
15
    },
5394
15
    { &hf_gsm_sim_fragment_multiple_tails,
5395
15
      { "APDU has multiple tail fragments",
5396
15
        "gsm_sim.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
5397
15
        NULL, 0x0, NULL, HFILL }
5398
15
    },
5399
15
    { &hf_gsm_sim_fragment_too_long_fragment,
5400
15
      { "APDU fragment too long", "gsm_sim.fragment.too_long_fragment",
5401
15
        FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
5402
15
    },
5403
15
    { &hf_gsm_sim_fragment_error,
5404
15
      { "APDU defragmentation error", "gsm_sim.fragment.error", FT_FRAMENUM,
5405
15
        BASE_NONE, NULL, 0x00, NULL, HFILL }
5406
15
    },
5407
15
    { &hf_gsm_sim_fragment_count,
5408
15
      { "APDU fragment count", "gsm_sim.fragment.count", FT_UINT32, BASE_DEC,
5409
15
        NULL, 0x00, NULL, HFILL }
5410
15
    },
5411
15
    { &hf_gsm_sim_reassembled_in,
5412
15
      { "Reassembled APDU in frame", "gsm_sim.reassembled.in", FT_FRAMENUM, BASE_NONE,
5413
15
        NULL, 0x00, "This APDU packet is reassembled in this frame", HFILL }
5414
15
    },
5415
15
    { &hf_gsm_sim_reassembled_length,
5416
15
      { "Reassembled APDU length", "gsm_sim.reassembled.length", FT_UINT32, BASE_DEC,
5417
15
        NULL, 0x00, "The total length of the reassembled payload", HFILL }
5418
15
    },
5419
15
  };
5420
15
  static int *ett[] = {
5421
15
    &ett_sim,
5422
15
    &ett_tprof_b1,
5423
15
    &ett_tprof_b2,
5424
15
    &ett_tprof_b3,
5425
15
    &ett_tprof_b4,
5426
15
    &ett_tprof_b5,
5427
15
    &ett_tprof_b6,
5428
15
    &ett_tprof_b7,
5429
15
    &ett_tprof_b8,
5430
15
    &ett_tprof_b9,
5431
15
    &ett_tprof_b10,
5432
15
    &ett_tprof_b11,
5433
15
    &ett_tprof_b12,
5434
15
    &ett_tprof_b13,
5435
15
    &ett_tprof_b14,
5436
15
    &ett_tprof_b15,
5437
15
    &ett_tprof_b16,
5438
15
    &ett_tprof_b17,
5439
15
    &ett_tprof_b18,
5440
15
    &ett_tprof_b19,
5441
15
    &ett_tprof_b20,
5442
15
    &ett_tprof_b21,
5443
15
    &ett_tprof_b22,
5444
15
    &ett_tprof_b23,
5445
15
    &ett_tprof_b24,
5446
15
    &ett_tprof_b25,
5447
15
    &ett_tprof_b26,
5448
15
    &ett_tprof_b27,
5449
15
    &ett_tprof_b28,
5450
15
    &ett_tprof_b29,
5451
15
    &ett_tprof_b30,
5452
15
    &ett_tprof_b31,
5453
15
    &ett_tprof_b32,
5454
15
    &ett_tprof_b33,
5455
15
    &ett_tprof_b34,
5456
15
    &ett_tprof_b35,
5457
15
    &ett_tprof_b36,
5458
15
    &ett_tprof_b37,
5459
15
    &ett_tprof_b38,
5460
15
    &ett_tprof_b39,
5461
15
    &ett_terminal_capability,
5462
15
    &ett_auth_challenge,
5463
15
    &ett_auth_response,
5464
15
    &ett_fcp,
5465
15
    &ett_fcp_proprietary,
5466
15
    &ett_gsm_sim_fragment,
5467
15
    &ett_gsm_sim_fragments,
5468
15
  };
5469
5470
15
  static ei_register_info ei[] = {
5471
15
    { &ei_unknown_bytes, { "gsm_sim.unknown_bytes", PI_PROTOCOL, PI_WARN, "Unknown bytes", EXPFILL }},
5472
15
  };
5473
15
  expert_module_t *expert_gsm_sim;
5474
5475
15
  proto_gsm_sim = proto_register_protocol("GSM SIM 11.11", "GSM SIM",
5476
15
             "gsm_sim");
5477
5478
15
  proto_register_field_array(proto_gsm_sim, hf, array_length(hf));
5479
15
  proto_register_subtree_array(ett, array_length(ett));
5480
15
  expert_gsm_sim = expert_register_protocol(proto_gsm_sim);
5481
15
  expert_register_field_array(expert_gsm_sim, ei, array_length(ei));
5482
5483
15
  transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
5484
15
  reassembly_table_register (&gsm_sim_reassembly_table, &addresses_reassembly_table_functions);
5485
5486
  /* This dissector is for SIMtrace, which always combines the command
5487
   * & response APDUs into one packet before sending it to GSMTAP. Cf.
5488
   * https://github.com/yarrick/scsniff/issues/1#issuecomment-2295835330
5489
   */
5490
15
  sim_handle = register_dissector("gsm_sim", dissect_gsm_sim, proto_gsm_sim);
5491
15
  register_dissector("gsm_sim.command", dissect_gsm_sim_command, proto_gsm_sim);
5492
15
  register_dissector("gsm_sim.response", dissect_gsm_sim_response, proto_gsm_sim);
5493
15
  register_dissector("gsm_sim.bertlv", dissect_bertlv, proto_gsm_sim);
5494
15
  sim_part_handle = register_dissector("gsm_sim.part", dissect_gsm_sim_part, proto_gsm_sim);
5495
15
}
5496
5497
void
5498
proto_reg_handoff_gsm_sim(void)
5499
15
{
5500
15
  dissector_add_for_decode_as("usbccid.subdissector", sim_part_handle);
5501
5502
15
  sub_handle_cap = find_dissector_add_dependency("etsi_cat", proto_gsm_sim);
5503
15
}
5504
5505
/*
5506
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
5507
 *
5508
 * Local variables:
5509
 * c-basic-offset: 8
5510
 * tab-width: 8
5511
 * indent-tabs-mode: t
5512
 * End:
5513
 *
5514
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
5515
 * :indentSize=8:tabSize=8:noTabs=false:
5516
 */