summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-03-14 15:35:50 +0100
committerHarald Welte <laforge@gnumonks.org>2016-03-17 16:55:11 +0100
commit4acaa13433cc15e4f1d9ee850d78af47419768ab (patch)
treee3438d0895439579e2d568e877aaf9118f5755ba /include
parent2c34ab4a80c227be4bb685f75fc24fde86a0704e (diff)
sim: add class_tables / card profiles
The tables permit code to determine the APDU class of an APDU based on it APDU/TPDU header (CLA/INS/P1/P2/P3).
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am1
-rw-r--r--include/osmocom/sim/class_tables.h42
2 files changed, 43 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index ac22ee64..0e5ed745 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -92,6 +92,7 @@ nobase_include_HEADERS = \
osmocom/gsm/rxlev_stat.h \
osmocom/gsm/sysinfo.h \
osmocom/gsm/tlv.h \
+ osmocom/sim/class_tables.h \
osmocom/sim/sim.h
if ENABLE_PLUGIN
diff --git a/include/osmocom/sim/class_tables.h b/include/osmocom/sim/class_tables.h
new file mode 100644
index 00000000..ad89d949
--- /dev/null
+++ b/include/osmocom/sim/class_tables.h
@@ -0,0 +1,42 @@
+#pragma once
+
+/* simtrace - tables determining APDU case for card emulation
+ *
+ * (C) 2016 by Harald Welte <laforge@gnumonks.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, or
+ * any later version as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+struct osim_cla_ins_case {
+ uint8_t cla;
+ uint8_t cla_mask;
+ int (*helper)(const struct osim_cla_ins_case *cic, const uint8_t *hdr);
+ const uint8_t *ins_tbl;
+};
+
+struct osim_cla_ins_card_profile {
+ const char *name;
+ const char *description;
+ const struct osim_cla_ins_case *cic_arr;
+ unsigned int cic_arr_size;
+};
+
+extern const struct osim_cla_ins_card_profile osim_iso7816_cic_profile;
+extern const struct osim_cla_ins_card_profile osim_uicc_cic_profile;
+extern const struct osim_cla_ins_card_profile osim_uicc_sim_cic_profile;
+
+int osim_determine_apdu_case(const struct osim_cla_ins_card_profile *prof,
+ const uint8_t *hdr);