import the wireshark patch

This commit is contained in:
Harald Welte 2010-11-18 22:58:44 +01:00
commit f11c508b51
1 changed files with 982 additions and 0 deletions

982
wireshark/simcard.patch Normal file
View File

@ -0,0 +1,982 @@
Index: wireshark/epan/dissectors/Makefile.common
===================================================================
--- wireshark.orig/epan/dissectors/Makefile.common 2010-11-18 16:04:39.000000000 +0100
+++ wireshark/epan/dissectors/Makefile.common 2010-11-18 17:04:03.000000000 +0100
@@ -67,6 +67,7 @@
packet-dcerpc-dnsserver.c \
packet-dcerpc-eventlog.c \
packet-dcerpc-lsa.c \
+ packet-gsm_sim.c \
packet-dcerpc-winreg.c
#
Index: wireshark/epan/dissectors/packet-gsm_sim.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ wireshark/epan/dissectors/packet-gsm_sim.c 2010-11-18 19:53:29.000000000 +0100
@@ -0,0 +1,923 @@
+/* packet-gsm_sim.c
+ * Routines for packet dissection of GSM SIM APDUs (GSM TS 11.11)
+ * Copyright 2010 by Harald Welte <laforge@gnumonks.org>
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+
+#include <epan/packet.h>
+#include <epan/emem.h>
+#include <epan/lapd_sapi.h>
+#include <epan/prefs.h>
+
+//#include "packet-gsm_sim.h"
+
+#include <stdio.h>
+
+static int proto_gsm_sim = -1;
+
+/* ISO 7816-4 APDU */
+static int hf_apdu_cla = -1;
+static int hf_apdu_ins = -1;
+static int hf_apdu_p1 = -1;
+static int hf_apdu_p2 = -1;
+static int hf_apdu_p3 = -1;
+static int hf_apdu_data = -1;
+static int hf_apdu_sw = -1;
+static int hf_apdu_sw1 = -1;
+static int hf_apdu_sw2 = -1;
+
+static int hf_file_id = -1;
+static int hf_bin_offset = -1;
+static int hf_record_nr = -1;
+static int hf_auth_rand = -1;
+
+/* Chapter 5.2 TS 11.14 */
+static int hf_tp_prof_dld = -1;
+static int hf_tp_sms_data_dld = -1;
+static int hf_tp_cb_data_dld = -1;
+static int hf_tp_menu_sel = -1;
+static int hf_tp_9e_err = -1;
+static int hf_tp_timer_exp = -1;
+static int hf_tp_ussd_cc = -1;
+static int hf_tp_auto_redial = -1;
+/* Second byte (Other) */
+static int hf_tp_cmd_res = -1;
+static int hf_tp_cc_sim = -1;
+static int hf_tp_cc_sim_cellid = -1;
+static int hf_tp_mo_sms_sim = -1;
+static int hf_tp_alpha_id = -1;
+static int hf_tp_ucs2_entry = -1;
+static int hf_tp_ucs2_display = -1;
+static int hf_tp_display_ext = -1;
+/* 3rd byte (Proactive SIM) */
+static int hf_tp_pa_display_text = -1;
+static int hf_tp_pa_get_inkey = -1;
+static int hf_tp_pa_get_input = -1;
+static int hf_tp_pa_more_time = -1;
+static int hf_tp_pa_play_tone = -1;
+static int hf_tp_pa_poll_interval = -1;
+static int hf_tp_pa_polling_off = -1;
+static int hf_tp_pa_refresh = -1;
+/* 4th byte (Proactive SIM) */
+static int hf_tp_pa_select_item = -1;
+static int hf_tp_pa_send_sms = -1;
+static int hf_tp_pa_send_ss = -1;
+static int hf_tp_pa_send_ussd = -1;
+static int hf_tp_pa_setup_call = -1;
+static int hf_tp_pa_setup_menu = -1;
+static int hf_tp_pa_loci_lac = -1;
+static int hf_tp_pa_loci_nmr = -1;
+/* 5th byte (Event drive information) */
+static int hf_tp_pa_evt_list = -1;
+static int hf_tp_ev_mt_call = -1;
+static int hf_tp_ev_call_connected = -1;
+static int hf_tp_ev_call_disconnected = -1;
+static int hf_tp_ev_location_status = -1;
+static int hf_tp_ev_user_activity = -1;
+static int hf_tp_ev_idle_screen = -1;
+static int hf_tp_ev_cardreader_status = -1;
+
+static int hf_stk_tp0 = -1;
+static int hf_stk_tp1 = -1;
+static int hf_stk_tp2 = -1;
+static int hf_stk_tp3 = -1;
+static int hf_stk_tp4 = -1;
+static int hf_stk_tp5 = -1;
+static int hf_stk_tp6 = -1;
+static int hf_stk_tp7 = -1;
+static int hf_stk_tp8 = -1;
+static int hf_stk_tp9 = -1;
+
+static int ett_sim = -1;
+
+static const value_string apdu_cla_vals[] = {
+ { 0xa0, "GSM" },
+ { 0, NULL }
+};
+
+/* Table 9 of GSM TS 11.11 */
+static const value_string apdu_ins_vals[] = {
+ { 0xA4, "SELECT" },
+ { 0xF2, "STATUS" },
+ { 0xB0, "READ BINARY" },
+ { 0xD6, "UPDATE BINARY" },
+ { 0xB2, "READ RECORD" },
+ { 0xDC, "UPDATE RECORD" },
+ { 0xA2, "SEEK" },
+ { 0x32, "INCREASE" },
+ { 0x20, "VERIFY CHV" },
+ { 0x24, "CHANGE CHV" },
+ { 0x26, "DISABLE CHV" },
+ { 0x28, "ENABLE CHV" },
+ { 0x2C, "UNBLOCK CHV" },
+ { 0x04, "INVALIDATE" },
+ { 0x44, "REHABILITATE" },
+ { 0x88, "RUN GSM ALGORITHM" },
+ { 0xFA, "SLEEP" },
+ { 0xC0, "GET RESPONSE" },
+ { 0x10, "TERMINAL PROFILE" },
+ { 0xC2, "ENVELOPE" },
+ { 0x12, "FETCH" },
+ { 0x14, "TERMINAL RESPONSE" },
+ { 0, NULL }
+};
+
+/* Section 10.7 */
+
+/* Files at the MF level */
+static const value_string mf_dfs[] = {
+ { 0x7f20, "DF.GSM" },
+ { 0x7f10, "DF.TELECOM" },
+ { 0x7f22, "DF.IS-41" },
+ { 0x7f23, "DF.FP-CTS" },
+#if 0
+ { 0, NULL }
+};
+static const value_string mf_efs[] = {
+#endif
+ { 0x2fe2, "EF.ICCID" },
+ { 0x2f05, "EF.ELP" },
+#if 0
+ { 0, NULL }
+};
+
+/* Elementary files at the DF.TELECOM level */
+static const value_string df_telecom_efs[] = {
+#endif
+ { 0x6f3a, "EF.ADN" },
+ { 0x6f3b, "EF.FDN" },
+ { 0x6f3c, "EF.SMS" },
+ { 0x6f3d, "EF.CCP" },
+ { 0x6f40, "EF.MSISDN" },
+ { 0x6f42, "EF.SMSP" },
+ { 0x6f43, "EF.SMSS" },
+ { 0x6f44, "EF.LND" },
+ { 0x6f47, "EF.SMSR" },
+ { 0x6f49, "EF.SDN" },
+ { 0x6f4a, "EF.EXT1" },
+ { 0x6f4b, "EF.EXT2" },
+ { 0x6f4c, "EF.EXT3" },
+ { 0x6f4d, "EF.BDN" },
+ { 0x6f4e, "EF.EXT4" },
+#if 0
+ { 0, NULL }
+};
+
+/* Elementary Files at the DF.GSM level */
+static const value_string df_gsm_efs[] = {
+#endif
+ { 0x6f05, "EF.LP" },
+ { 0x6f07, "EF.IMSI" },
+ { 0x6f20, "EF.Kc" },
+ { 0x6f30, "EF.PLMNsel" },
+ { 0x6f31, "EF.HPPLMN" },
+ { 0x6f37, "EF.ACMax" },
+ { 0x6f38, "EF.SST" },
+ { 0x6f39, "EF.ACM" },
+ { 0x6f3e, "EF.GID1" },
+ { 0x6f3f, "EF.GID2" },
+ { 0x6f41, "EF.PUCT" },
+ { 0x6f45, "EF.CBMI" },
+ { 0x6f46, "EF.SPN" },
+ { 0x6f74, "EF.BCCH" },
+ { 0x6f78, "EF.ACC" },
+ { 0x6f7b, "EF.FPLMN" },
+ { 0x6f7e, "EF.LOCI" },
+ { 0x6fad, "EF.AD" },
+ { 0x6fae, "EF.PHASE" },
+ { 0x6fb1, "EF.VGCS" },
+ { 0x6fb2, "EF.VGCSS" },
+ { 0x6fb3, "EF.VBS" },
+ { 0x6fb4, "EF.VBSS" },
+ { 0x6fb5, "EF.eMLPP" },
+ { 0x6fb6, "EF.AAeM" },
+ { 0x6fb7, "EF.ECC" },
+ { 0x6f50, "EF.CBMIR" },
+ { 0x6f51, "EF.NIA" },
+ { 0x6f52, "EF.KcGPRS" },
+ { 0x6f53, "EF.LOCIGPRS" },
+ { 0x6f54, "EF.SUME" },
+ { 0x6f60, "EF.PLMNwAcT" },
+ { 0x6f61, "EF.OPLMNwAcT" },
+ { 0x6f62, "EF.HPLMNAcT" },
+ { 0x6f63, "EF.CPBCCH" },
+ { 0x6f64, "EF.INVSCAN" },
+#if 0
+ { 0, NULL }
+};
+
+static const value_string df_gsm_dfs[] = {
+#endif
+ { 0x5f30, "DF.IRIDIUM" },
+ { 0x5f31, "DF.GLOBST" },
+ { 0x5f32, "DF.ICO" },
+ { 0x5f33, "DF.ACeS" },
+ { 0x5f40, "DF.EIA/TIA-533" },
+ { 0x5f60, "DF.CTS" },
+ { 0x5f70, "DF.SoLSA" },
+ { 0x5f3c, "DF.MExE" },
+ { 0, NULL }
+};
+
+#define P1_OFFS 0
+#define P2_OFFS 1
+#define P3_OFFS 2
+#define DATA_OFFS 3
+
+static int
+dissect_gsm_apdu(guint8 ins, guint8 p1, guint8 p2, guint8 p3,
+ tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+{
+ guint16 g16;
+
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
+ val_to_str(ins, apdu_ins_vals, "%02x"));
+
+ switch (ins) {
+ case 0xA4: /* SELECT */
+ if (p3 < 2)
+ break;
+ g16 = tvb_get_ntohs(tvb, offset+DATA_OFFS);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
+ val_to_str(g16, mf_dfs, "%04x"));
+ proto_tree_add_item(tree, hf_file_id, tvb, offset+DATA_OFFS, p3, FALSE);
+ offset++;
+ break;
+ case 0xB0: /* READ BINARY */
+ case 0xD6: /* UPDATE BINARY */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Offset=%u ", p1 << 8 | p2);
+ proto_tree_add_item(tree, hf_bin_offset, tvb, offset+P1_OFFS, 2, FALSE);
+ proto_tree_add_item(tree, hf_apdu_data, tvb, offset+DATA_OFFS, p3, FALSE);
+ break;
+ case 0xB2: /* READ RECORD */
+ case 0xDC: /* READ RECORD */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "RecordNr=%u ", p1);
+ proto_tree_add_item(tree, hf_record_nr, tvb, offset+P1_OFFS, 1, FALSE);
+ proto_tree_add_item(tree, hf_apdu_data, tvb, offset+DATA_OFFS, p3, FALSE);
+ break;
+ case 0x20: /* VERIFY CHV */
+ case 0x24: /* CHANGE CHV */
+ case 0x2C: /* UNBLOCK CHV */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "CHV=%u ", offset+P2_OFFS, 1, FALSE);
+ offset += DATA_OFFS;
+ break;
+ case 0x88: /* RUN GSM ALGO */
+ proto_tree_add_item(tree, hf_auth_rand, tvb, offset+DATA_OFFS, 16, FALSE);
+ offset += DATA_OFFS+16;
+ /* FIXME: SRES, Kc */
+ break;
+ case 0x10: /* TERMINAL PROFILE */
+ offset += DATA_OFFS;
+ proto_tree_add_item(tree, hf_tp_prof_dld, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_sms_data_dld, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_cb_data_dld, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_menu_sel, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_9e_err, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_timer_exp, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_ussd_cc, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_auto_redial, tvb, offset, 1, FALSE);
+ offset++;
+ proto_tree_add_item(tree, hf_tp_cmd_res, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_cc_sim, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_cc_sim_cellid, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_mo_sms_sim, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_alpha_id, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_ucs2_entry, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_tp_ucs2_display, tvb, offset, 1, FALSE);
+ offset++;
+ /* FIXME */
+#if 0
+ proto_tree_add_item(tree, hf_stk_tp0, tvb, offset++, 1, FALSE);
+ proto_tree_add_item(tree, hf_stk_tp1, tvb, offset++, 1, FALSE);
+ proto_tree_add_item(tree, hf_stk_tp2, tvb, offset++, 1, FALSE);
+#endif
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+static void
+dissect_apdu_tvb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+{
+ guint8 cla, ins, p1, p2, p3;
+ guint16 sw;
+ proto_item *ti;
+ proto_tree *sim_tree = NULL;
+ int rc = -1;
+ guint tvb_len = tvb_length(tvb);
+
+ cla = tvb_get_guint8(tvb, offset);
+ ins = tvb_get_guint8(tvb, offset+1);
+ p1 = tvb_get_guint8(tvb, offset+2);
+ p2 = tvb_get_guint8(tvb, offset+3);
+ p3 = tvb_get_guint8(tvb, offset+4);
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_gsm_sim, tvb, 0, -1, FALSE);
+ sim_tree = proto_item_add_subtree(ti, ett_sim);
+
+ proto_tree_add_item(sim_tree, hf_apdu_cla, tvb, offset, 1, TRUE);
+ proto_tree_add_item(sim_tree, hf_apdu_ins, tvb, offset+1, 1, TRUE);
+ }
+ offset += 2;
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
+ val_to_str(cla, apdu_cla_vals, "%02x"));
+
+ if (cla == 0xA0)
+ rc = dissect_gsm_apdu(ins, p1, p2, p3, tvb, offset, pinfo, sim_tree);
+
+ if (rc == -1 && sim_tree) {
+ /* default dissector */
+ proto_tree_add_item(sim_tree, hf_apdu_p1, tvb, offset+0, 1, TRUE);
+ proto_tree_add_item(sim_tree, hf_apdu_p2, tvb, offset+1, 1, TRUE);
+ proto_tree_add_item(sim_tree, hf_apdu_p3, tvb, offset+2, 1, TRUE);
+ proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+3, p3, TRUE);
+ }
+ offset += 3;
+
+ /* FIXME: DATA */
+
+ /* obtain status word */
+ sw = tvb_get_ntohs(tvb, tvb_len-2);
+ proto_tree_add_item(sim_tree, hf_apdu_sw, tvb, tvb_len-2, 2, FALSE);
+#if 0
+ sw1 = tvb_get_guint8(tvb, tvb_len-2);
+ proto_tree_add_item(sim_tree, hf_apdu_sw1, tvb, tvb_len-2, 1, TRUE);
+ sw2 = tvb_get_guint8(tvb, tvb_len-1);
+ proto_tree_add_item(sim_tree, hf_apdu_sw2, tvb, tvb_len-1, 1, TRUE);
+#endif
+}
+
+static void
+dissect_gsm_sim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_item *ti;
+ proto_tree *sim_tree;
+
+ dissect_apdu_tvb(tvb, 0, pinfo, tree);
+#if 0
+ int offset = 0;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "SIM");
+
+ //top_tree = tree;
+ if (tree) {
+ u_int8_t msg_disc = tvb_get_guint8(tvb, offset);
+
+ ti = proto_tree_add_item(tree, proto_abis_oml, tvb, 0, -1, FALSE);
+ oml_tree = proto_item_add_subtree(ti, ett_oml);
+
+ proto_tree_add_item(oml_tree, hf_oml_msg_disc, tvb, offset++,
+ 1, TRUE);
+ proto_tree_add_item(oml_tree, hf_oml_placement, tvb, offset++,
+ 1, TRUE);
+ proto_tree_add_item(oml_tree, hf_oml_sequence, tvb, offset++,
+ 1, TRUE);
+ proto_tree_add_item(oml_tree, hf_oml_length, tvb, offset++,
+ 1, TRUE);
+
+ switch (msg_disc) {
+ case ABIS_OM_MDISC_FOM:
+ offset = dissect_oml_fom(tvb, pinfo, oml_tree,
+ offset, ti);
+ break;
+ case ABIS_OM_MDISC_MANUF:
+ offset = dissect_oml_manuf(tvb, pinfo, oml_tree, offset, ti);
+ break;
+ case ABIS_OM_MDISC_MMI:
+ case ABIS_OM_MDISC_TRAU:
+ default:
+ break;
+ }
+ }
+#endif
+}
+
+void
+proto_reg_handoff_gsm_sim(void);
+
+void
+proto_register_gsm_sim(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_apdu_cla,
+ { "Class", "iso7816.apdu.cla",
+ FT_UINT8, BASE_HEX, VALS(apdu_cla_vals), 0,
+ "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
+ },
+ { &hf_apdu_ins,
+ { "Instruction", "iso7816.apdu.ins",
+ FT_UINT8, BASE_HEX, VALS(apdu_ins_vals), 0,
+ "ISO 7816-4 APDU INS (Instruction) Byte", HFILL }
+ },
+ { &hf_apdu_p1,
+ { "Parameter 1", "iso7816.apdu.p1",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "ISO 7816-4 APDU P1 (Parameter 1) Byte", HFILL }
+ },
+ { &hf_apdu_p2,
+ { "Parameter 2", "iso7816.apdu.p2",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "ISO 7816-4 APDU P2 (Parameter 2) Byte", HFILL }
+ },
+ { &hf_apdu_p3,
+ { "Length (Parameter 3)", "iso7816.apdu.p3",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "ISO 7816-4 APDU P3 (Parameter 3) Byte", HFILL }
+ },
+ { &hf_apdu_data,
+ { "APDU Payload", "iso7816.apdu.data",
+ FT_NONE, BASE_NONE, NULL, 0,
+ "ISO 7816-4 APDU Data Payload", HFILL }
+ },
+ { &hf_apdu_sw,
+ { "Status Word (SW1:SW2)", "iso7816.apdu.sw",
+ FT_UINT16, BASE_HEX, NULL, 0,
+ "ISO 7816-4 APDU Status Word", HFILL }
+ },
+ { &hf_file_id,
+ { "File ID", "iso7816.file_id",
+ FT_UINT16, BASE_HEX, VALS(mf_dfs), 0,
+ "ISO 7816-4 File ID", HFILL }
+ },
+ { &hf_bin_offset,
+ { "Offset", "iso7816.bin_offset",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "Offset into binary file", HFILL }
+ },
+ { &hf_record_nr,
+ { "Record number", "iso7816.record_nr",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ "Offset into binary file", HFILL }
+ },
+ { &hf_auth_rand,
+ { "Random Challenge", "iso7816.auth_rand",
+ FT_NONE, BASE_NONE, NULL, 0,
+ "GSM Authentication Random Challenge", HFILL }
+ },
+ /* Terminal Profile Byte 0 */
+ { &hf_tp_prof_dld,
+ { "Profile Download", "iso7816.tp.prof_dld",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
+ "TP Profile Downolad", HFILL }
+ },
+ { &hf_tp_sms_data_dld,
+ { "SMS-PP Data Download", "iso7816.tp.sms_data_dld",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
+ "TP SMS-PP Data Downolad", HFILL }
+ },
+ { &hf_tp_cb_data_dld,
+ { "CB Data Download", "iso7816.tp.cb_data_dld",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
+ "TP Cell Broadcast Data Downolad", HFILL }
+ },
+ { &hf_tp_menu_sel,
+ { "Menu Selection", "iso7816.tp.menu_sel",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
+ "TP Menu Selection", HFILL }
+ },
+ { &hf_tp_9e_err,
+ { "Menu Selection", "iso7816.tp.9e_err",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
+ "TP 9EXX response code for SIM data download error", HFILL }
+ },
+ { &hf_tp_timer_exp,
+ { "Timer expiration", "iso7816.tp.timer_exp",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
+ "TP Timer expiration", HFILL }
+ },
+ { &hf_tp_ussd_cc,
+ { "USSD string data in Call Control", "iso7816.tp.ussd_cc",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
+ "TP USSD string data object in Call Control", HFILL }
+ },
+ { &hf_tp_auto_redial,
+ { "Envelope CC during automatic redial", "iso7816.tp.auto_redial",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
+ "TP Envelope CC always sent to SIM during automatic redial", HFILL }
+ },
+ /* Terminal Profile Byte 1 */
+ { &hf_tp_cmd_res,
+ { "Command result", "iso7816.tp.cmd_res",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
+ "TP Command result", HFILL }
+ },
+ { &hf_tp_cc_sim,
+ { "Call Control by SIM", "iso7816.tp.cc_sim",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
+ "TP Call Control by SIM", HFILL }
+ },
+ { &hf_tp_cc_sim_cellid,
+ { "Cell ID in Call Control by SIM", "iso7816.tp.cc_sim_cellid",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
+ "TP Cell ID included in Call Control by SIM", HFILL }
+ },
+ { &hf_tp_mo_sms_sim,
+ { "MO SMS control by SIM", "iso7816.tp.mo_sms_sim",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
+ "TP MO short message control by SIM", HFILL }
+ },
+ { &hf_tp_alpha_id,
+ { "Alpha identifier according 9.1.3", "iso7816.tp.alpha_id",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
+ "TP Handling of alpha identifier according to 9.1.3", HFILL }
+ },
+ { &hf_tp_ucs2_entry,
+ { "UCS2 Entry", "iso7816.tp.ucs2_entry",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
+ "TP UCS2 Entry", HFILL }
+ },
+ { &hf_tp_ucs2_display,
+ { "UCS2 Display", "iso7816.tp.ucs2_display",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
+ "TP UCS2 Display", HFILL }
+ },
+ { &hf_tp_display_ext,
+ { "Display of Extension Text", "iso7816.tp.display_ext",
+ FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
+ "TP Display of the Extension Text", HFILL }
+ },
+#if 0
+ { &hf_oml_msg_disc,
+ { "Message Discriminator", "oml.msg_dsc",
+ FT_UINT8, BASE_HEX, VALS(oml_msg_disc_vals), 0,
+ "GSM 12.21 Message Discriminator", HFILL }
+ },
+ { &hf_oml_placement,
+ { "Placement Indicator", "oml.placement",
+ FT_UINT8, BASE_HEX, VALS(oml_placement_vals), 0,
+ "GSM 12.21 Placement Indicator", HFILL }
+ },
+ { &hf_oml_sequence,
+ { "Sequence Number", "oml.sequence",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "Sequence Number (if multi-part msg)", HFILL }
+ },
+ { &hf_oml_length,
+ { "Length Indicator", "oml.length",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ "Total length of payload", HFILL }
+ },
+ { &hf_oml_fom_msgtype,
+ { "FOM Message Type", "oml.fom.msg_type",
+ FT_UINT8, BASE_HEX|BASE_EXT_STRING, (&oml_fom_msgtype_vse), 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_objclass,
+ { "FOM Object Class", "oml.fom.obj_class",
+ FT_UINT8, BASE_HEX, VALS(oml_fom_objclass_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_inst_bts,
+ { "FOM Object Instance BTS", "oml.fom.obj_inst.bts",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_inst_trx,
+ { "FOM Object Instance TRX", "oml.fom.obj_inst.trx",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_inst_ts,
+ { "FOM Object Instance TS", "oml.fom.obj_inst.ts",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_attr_tag,
+ { "FOM Attribute ID", "oml.fom.attr_id",
+ FT_UINT8, BASE_HEX|BASE_EXT_STRING, (&oml_fom_attr_vse), 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_attr_len,
+ { "FOM Attribute Length", "oml.fom.attr_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_oml_fom_attr_val,
+ { "FOM Attribute Value", "oml.fom.attr_val",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+
+
+
+ /* OML Attributes */
+ { &hf_attr_adm_state,
+ { "Administrative State", "oml.fom.attr.adm_state",
+ FT_UINT8, BASE_HEX, VALS(oml_adm_state_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_arfcn,
+ { "ARFCN", "oml.fom.attr.arfcn",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_oper_state,
+ { "Operational State", "oml.fom.attr.oper_state",
+ FT_UINT8, BASE_HEX, VALS(oml_oper_state_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_avail_state,
+ { "Availability Status", "oml.fom.attr.avail_state",
+ FT_UINT8, BASE_HEX, VALS(oml_avail_state_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_event_type,
+ { "Event Type", "oml.fom.attr.event_type",
+ FT_UINT8, BASE_HEX, VALS(oml_event_type_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_severity,
+ { "Severity", "oml.fom.attr.severity",
+ FT_UINT8, BASE_HEX, VALS(oml_severity_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_bcch_arfcn,
+ { "BCCH ARFCN", "oml.fom.attr.bcch_arfcn",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "ARFCN of the BCCH", HFILL }
+ },
+ { &hf_attr_bsic,
+ { "BSIC", "oml.fom.attr.bsic",
+ FT_UINT16, BASE_HEX, NULL, 0,
+ "Base Station Identity Cdoe", HFILL }
+ },
+ { &hf_attr_test_no,
+ { "Test Number", "oml.fom.attr.test_no",
+ FT_UINT8, BASE_HEX, VALS(oml_test_no_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_tsc,
+ { "TSC", "oml.fom.attr.tsc",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "Training Sequence Code", HFILL }
+ },
+ { &hf_attr_tei,
+ { "TEI", "oml.fom.attr.tei",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_ach_btsp,
+ { "BTS E1 Port", "oml.fom.attr.abis_ch.bts_port",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_ach_tslot,
+ { "E1 Timeslot", "oml.fom.attr.abis_ch.timeslot",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_ach_sslot,
+ { "E1 Subslot", "oml.fom.attr.abis_ch.subslot",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_gsm_time,
+ { "GSM Time", "oml.fom.attr.gsm_time",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "GSM Time", HFILL }
+ },
+ { &hf_attr_chan_comb,
+ { "Channel Combination", "oml.fom.attr.chan_comb",
+ FT_UINT8, BASE_HEX, VALS(oml_chan_comb_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_hsn,
+ { "HSN", "oml.fom.attr.hsn",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ "Hopping Sequence Number", HFILL }
+ },
+ { &hf_attr_maio,
+ { "MAIO", "oml.fom.attr.maio",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ "Mobile Allocation Index Offset", HFILL }
+ },
+
+ /* IP Access */
+ { &hf_oml_ipa_tres_attr_tag,
+ { "IPA Test Result Embedded IE",
+ "oml.fom.testrep.ipa_tag",
+ FT_UINT8, BASE_HEX, VALS(ipacc_testres_ie_vals), 0,
+ "Information Element embedded into the Test Result "
+ "of ip.access BTS", HFILL },
+ },
+ { &hf_oml_ipa_tres_attr_len,
+ { "IPA Test Result Embedded IE Length",
+ "oml.fom.testrep.ipa_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "Length of ip.access Test Result Embedded IE", HFILL }
+ },
+ { &hf_attr_ipa_test_res,
+ { "IPA Test Result", "oml.fom.testrep.result",
+ FT_UINT8, BASE_DEC, VALS(ipacc_test_res_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_rxlev,
+ { "Rx Level", "oml.fom.testrep.ipa_rxlev",
+ FT_UINT16, BASE_DEC, NULL, 0xfc00, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_b_rxlev,
+ { "Rx Level", "oml.fom.testrep.ipa_rxlev_b",
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_arfcn,
+ { "ARFCN", "oml.fom.testrep.ipa_arfcn",
+ FT_UINT16, BASE_DEC, NULL, 0x03ff, "ARFCN", HFILL }
+ },
+ { &hf_attr_ipa_tr_f_qual,
+ { "Frequency Quality", "oml.fom.testrep.ipa.freq_qual",
+ FT_UINT8, BASE_DEC, NULL, 0xfc, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_f_err,
+ { "Frequency Error", "oml.fom.testrep.ipa.freq_err",
+ FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_rxqual,
+ { "Rx Quality", "oml.fom.testrep.ipa.rx_qual",
+ FT_UINT8, BASE_DEC, NULL, 0x7, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_frame_offs,
+ { "Frame Offset", "oml.fom.testrep.ipa.frame_offset",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_framenr_offs,
+ { "Frame Number Offset",
+ "oml.fom.testrep.ipa.framenr_offset",
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_bsic,
+ { "BSIC", "oml.fom.testrep.ipa.bsic",
+ FT_UINT8, BASE_DEC, NULL, 0x3f,
+ "Base Station Identity Code", HFILL }
+ },
+ { &hf_attr_ipa_tr_cell_id,
+ { "Cell ID", "oml.fom.testrep.ipa.cell_id",
+ FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_rsl_ip,
+ { "BSC RSL IP Address", "oml.fom.attr.ipa.rsl_ip",
+ FT_IPv4, BASE_NONE, NULL, 0,
+ "IP Address to which the BTS establishes "
+ "the RSL link", HFILL }
+ },
+ { &hf_attr_ipa_rsl_port,
+ { "BSC RSL TCP Port", "oml.fom.attr.ipa.rsl_port",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "Port number to which the BST establishes "
+ "the RSL link", HFILL }
+ },
+ { &hf_attr_ipa_prim_oml_ip,
+ { "Primary OML IP Address",
+ "oml.fom.attr.ipa.prim_oml_ip",
+ FT_IPv4, BASE_NONE, NULL, 0,
+ "IP Address of the BSC for the primary OML link",
+ HFILL }
+ },
+ { &hf_attr_ipa_prim_oml_port,
+ { "Primary OML TCP Port",
+ "oml.fom.attr.ipa.prim_oml_port",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "TCP Port of the BSC for the primarly OML link",
+ HFILL }
+ },
+ { &hf_attr_ipa_location_name,
+ { "Location Name", "oml.fom.attr.ipa.loc_name",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_unit_name,
+ { "Unit Name", "oml.fom.attr.ipa.unit_name",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_unit_id,
+ { "Unit ID", "oml.fom.attr.ipa.unit_id",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nv_flags,
+ { "NVRAM Config Flags", "oml.fom.attr.ipa.nv_flags",
+ FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nv_mask,
+ { "NVRAM Config Mask", "oml.fom.attr.ipa.nv_mask",
+ FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_si2,
+ { "System Information 2", "oml.fom.attr.ipa.si2",
+ FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_si2bis,
+ { "System Information 2bis", "oml.fom.attr.ipa.si2bis",
+ FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_si2ter,
+ { "System Information 2ter", "oml.fom.attr.ipa.si2ter",
+ FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_tr_chan_desc,
+ { "Cell Channel Description",
+ "oml.fom.attr.ipa.chan_desc",
+ FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nsl_sport,
+ { "NS Link IP Source Port",
+ "oml.fom.attr.ipa.nsl_sport",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nsl_daddr,
+ { "NS Link IP Destination Addr",
+ "oml.fom.attr.ipa.nsl_daddr",
+ FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nsl_dport,
+ { "NS Link IP Destination Port",
+ "oml.fom.attr.ipa.nsl_dport",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nsei,
+ { "NSEI", "oml.fom.attr.ipa.nsei",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_nsvci,
+ { "NSVCI", "oml.fom.attr.ipa.nsvci",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_bvci,
+ { "BVCI", "oml.fom.attr.ipa.bvci",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+ { &hf_attr_ipa_rac,
+ { "RAC", "oml.fom.attr.ipa.rac",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "Routing Area Code", HFILL }
+ },
+#endif
+ };
+ static gint *ett[] = {
+ &ett_sim,
+ };
+
+ module_t *sim_module;
+
+ proto_gsm_sim = proto_register_protocol("GSM SIM 11.11", "GSM SIM",
+ "gsm_sim");
+
+ proto_register_field_array(proto_gsm_sim, hf, array_length(hf));
+
+ proto_register_subtree_array(ett, array_length(ett));
+
+ register_dissector("gsm_sim", dissect_gsm_sim, proto_gsm_sim);
+
+#if 0
+ sim_module = prefs_register_protocol(proto_gsm_sim, proto_reg_handoff_gsm_sim);
+ prefs_register_bool_preference(sim_module, "use_ipaccess_oml",
+ "Use nanoBTS definitions",
+ "Use ipaccess nanoBTS specific definitions for OML",
+ &global_oml_use_nano_bts);
+#endif
+}
+
+/* This function is called once at startup and every time the user hits
+ * 'apply' in the preferences dialogue */
+void
+proto_reg_handoff_gsm_sim(void)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ dissector_handle_t gsm_sim_handle;
+
+ gsm_sim_handle = create_dissector_handle(dissect_gsm_sim, proto_gsm_sim);
+ //dissector_add("iso7816.apdu.sim", 0, gsm_sim_handle);
+
+ } else {
+ /* preferences have been changed */
+ }
+}
Index: wireshark/epan/dissectors/packet-gsmtap.c
===================================================================
--- wireshark.orig/epan/dissectors/packet-gsmtap.c 2010-11-18 16:11:48.000000000 +0100
+++ wireshark/epan/dissectors/packet-gsmtap.c 2010-11-18 17:04:37.000000000 +0100
@@ -46,6 +46,7 @@
#define GSMTAP_TYPE_UM 0x01
#define GSMTAP_TYPE_ABIS 0x02
#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */
+#define GSMTAP_TYPE_SIMCARD 0x04
#define GSMTAP_BURST_UNKNOWN 0x00
#define GSMTAP_BURST_FCCH 0x01
@@ -125,6 +126,7 @@
GSMTAP_SUB_UM,
GSMTAP_SUB_UM_LAPDM,
GSMTAP_SUB_ABIS,
+ GSMTAP_SUB_SIM,
GSMTAP_SUB_MAX
};
@@ -236,6 +238,13 @@
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSMTAP");
+ /* Some GSMTAP types are completely unrelated to the Um air interface */
+ switch (type) {
+ case GSMTAP_TYPE_SIMCARD:
+ call_dissector(sub_handles[GSMTAP_SUB_SIM], payload_tvb, pinfo, tree);
+ return;
+ }
+
if (arfcn & GSMTAP_ARFCN_F_UPLINK) {
col_append_str(pinfo->cinfo, COL_RES_NET_SRC, "MS");
col_append_str(pinfo->cinfo, COL_RES_NET_DST, "BTS");
@@ -393,6 +402,7 @@
sub_handles[GSMTAP_SUB_UM] = find_dissector("gsm_a_ccch");
sub_handles[GSMTAP_SUB_UM_LAPDM] = find_dissector("lapdm");
sub_handles[GSMTAP_SUB_ABIS] = find_dissector("gsm_a_dtap");
+ sub_handles[GSMTAP_SUB_SIM] = find_dissector("gsm_sim");
gsmtap_handle = create_dissector_handle(dissect_gsmtap, proto_gsmtap);
dissector_add("udp.port", GSMTAP_UDP_PORT, gsmtap_handle);
}