changeset 57:eb4274e7f4da

simsniff-dec: decode SELECT file IDs
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Oct 2023 03:54:00 +0000
parents 966a54303d68
children 95ed46b5f8f1
files sw/sniff-dec/command.c sw/sniff-dec/hl_decode.c
diffstat 2 files changed, 71 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sw/sniff-dec/command.c	Wed Oct 04 01:18:50 2023 +0000
+++ b/sw/sniff-dec/command.c	Wed Oct 04 03:54:00 2023 +0000
@@ -89,6 +89,8 @@
 	sw1 = rx_byte;
 	if (data_sofar)
 		print_data();
+	if (cmd_hdr[1] == 0xA4 && cmd_hdr[4] == 2 && data_sofar == 2)
+		decode_file_id((data_buf[0] << 8) | data_buf[1]);
 	state = STATE_CMD_SW;
 }
 
--- a/sw/sniff-dec/hl_decode.c	Wed Oct 04 01:18:50 2023 +0000
+++ b/sw/sniff-dec/hl_decode.c	Wed Oct 04 03:54:00 2023 +0000
@@ -50,3 +50,72 @@
 	if (tp->cmdname)
 		printf(" Command: %s\n", tp->cmdname);
 }
+
+static struct file_id_tab {
+	u_short	file_id;
+	char	*name;
+} file_id_table[] = {
+	{0x2F00, "EF_DIR"},
+	{0x2FE2, "EF_ICCID"},
+	{0x3F00, "MF"},
+	{0x6F05, "EF_LP"},
+	{0x6F07, "EF_IMSI"},
+	{0x6F20, "EF_Kc"},
+	{0x6F30, "EF_PLMNsel"},
+	{0x6F31, "EF_HPLMN"},
+	{0x6F37, "EF_ACMmax"},
+	{0x6F38, "EF_SST"},
+	{0x6F39, "EF_ACM"},
+	{0x6F3A, "EF_ADN"},
+	{0x6F3B, "EF_FDN"},
+	{0x6F3C, "EF_SMS"},
+	{0x6F3D, "EF_CCP"},
+	{0x6F3E, "EF_GID1"},
+	{0x6F3F, "EF_GID2"},
+	{0x6F40, "EF_MSISDN"},
+	{0x6F41, "EF_PUCT"},
+	{0x6F42, "EF_SMSP"},
+	{0x6F43, "EF_SMSS"},
+	{0x6F44, "EF_LND"},
+	{0x6F45, "EF_CBMI"},
+	{0x6F46, "EF_SPN"},
+	{0x6F48, "EF_CBMID"},
+	{0x6F49, "EF_SDN"},
+	{0x6F4A, "EF_EXT1"},
+	{0x6F4B, "EF_EXT2"},
+	{0x6F4C, "EF_EXT3"},
+	{0x6F50, "EF_CBMIR"},
+	{0x6F52, "EF_KcGPRS"},
+	{0x6F53, "EF_LOCIGPRS"},
+	{0x6F54, "EF_SUME"},
+	{0x6F74, "EF_BCCH"},
+	{0x6F78, "EF_ACC"},
+	{0x6F7B, "EF_FPLMN"},
+	{0x6F7E, "EF_LOCI"},
+	{0x6FAD, "EF_AD"},
+	{0x6FAE, "EF_PHASE"},
+	{0x6FB7, "EF_ECC"},
+	{0x6FC5, "EF_PNN"},
+	{0x6FC6, "EF_OPL"},
+	{0x6FC7, "EF_MBDN"},
+	{0x6FC9, "EF_MBI"},
+	{0x6FCA, "EF_MWIS"},
+	{0x7F10, "DF_TELECOM"},
+	{0x7F20, "DF_GSM"},
+	{0x7F21, "DF_DCS1800"},
+	/* table search terminator */
+	{0,      0}
+};
+
+void
+decode_file_id(file_id)
+	unsigned file_id;
+{
+	struct file_id_tab *tp;
+
+	for (tp = file_id_table; tp->name; tp++)
+		if (tp->file_id == file_id)
+			break;
+	if (tp->name)
+		printf(" Matching SELECT: %s\n", tp->name);
+}