diff libcommon/names.c @ 0:f7145c77b7fb

starting libcommon: factored out of fc-simtool
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 11 Feb 2021 22:28:45 +0000
parents
children ab3c945f869e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libcommon/names.c	Thu Feb 11 22:28:45 2021 +0000
@@ -0,0 +1,76 @@
+/*
+ * This module contains the table of user-friendly file names
+ * and a function for searching this table.
+ */
+
+#include <string.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "file_id.h"
+
+static struct nametab {
+	char	*name;
+	int	file_id;
+} name_table[] = {
+	{"MF",		FILEID_MF},
+	{"DF_GSM",	DF_GSM},
+	{"DF_DCS1800",	DF_DCS1800},
+	{"DF_TELECOM",	DF_TELECOM},
+	{"gsm",		DF_GSM},
+	{"telecom",	DF_TELECOM},
+	/* EFs under MF */
+	{"EF_DIR",	EF_DIR},
+	{"EF_ICCID",	EF_ICCID},
+	/* EFs under DF_GSM */
+	{"EF_LP",	EF_LP},
+	{"EF_IMSI",	EF_IMSI},
+	{"EF_Kc",	EF_Kc},
+	{"EF_PLMNsel",	EF_PLMNsel},
+	{"EF_HPLMN",	EF_HPLMN},
+	{"EF_ACMmax",	EF_ACMmax},
+	{"EF_SST",	EF_SST},
+	{"EF_ACM",	EF_ACM},
+	{"EF_GID1",	EF_GID1},
+	{"EF_GID2",	EF_GID2},
+	{"EF_PUCT",	EF_PUCT},
+	{"EF_CBMI",	EF_CBMI},
+	{"EF_SPN",	EF_SPN},
+	{"EF_CBMID",	EF_CBMID},
+	{"EF_CBMIR",	EF_CBMIR},
+	{"EF_BCCH",	EF_BCCH},
+	{"EF_ACC",	EF_ACC},
+	{"EF_FPLMN",	EF_FPLMN},
+	{"EF_LOCI",	EF_LOCI},
+	{"EF_AD",	EF_AD},
+	{"EF_PHASE",	EF_PHASE},
+	{"EF_ECC",	EF_ECC},
+	{"EF_PNN",	EF_PNN},
+	{"EF_OPL",	EF_OPL},
+	/* EFs under DF_TELECOM */
+	{"EF_ADN",	EF_ADN},
+	{"EF_FDN",	EF_FDN},
+	{"EF_SMS",	EF_SMS},
+	{"EF_CCP",	EF_CCP},
+	{"EF_MSISDN",	EF_MSISDN},
+	{"EF_SMSP",	EF_SMSP},
+	{"EF_SMSS",	EF_SMSS},
+	{"EF_LND",	EF_LND},
+	{"EF_SDN",	EF_SDN},
+	{"EF_EXT1",	EF_EXT1},
+	{"EF_EXT2",	EF_EXT2},
+	{"EF_EXT3",	EF_EXT3},
+	/* table search terminator */
+	{0,		-1}
+};
+
+find_symbolic_file_name(soughtname)
+	char *soughtname;
+{
+	struct nametab *tp;
+
+	for (tp = name_table; tp->name; tp++)
+		if (!strcmp(tp->name, soughtname))
+			break;
+	return tp->file_id;
+}