summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/sim/sim.h6
-rw-r--r--src/sim/core.c25
2 files changed, 31 insertions, 0 deletions
diff --git a/include/osmocom/sim/sim.h b/include/osmocom/sim/sim.h
index bb4b7d8e..e818a657 100644
--- a/include/osmocom/sim/sim.h
+++ b/include/osmocom/sim/sim.h
@@ -242,6 +242,12 @@ struct osim_file {
struct osim_file_desc *
osim_file_find_name(struct osim_file_desc *parent, const char *name);
+struct osim_file_desc *
+osim_file_find_fid(struct osim_file_desc *parent, uint16_t fid);
+
+struct osim_file_desc *
+osim_file_find_sfid(struct osim_file_desc *parent, uint8_t sfid);
+
/* STATUS WORDS */
enum osim_card_sw_type {
diff --git a/src/sim/core.c b/src/sim/core.c
index 890df667..ddddc7dc 100644
--- a/src/sim/core.c
+++ b/src/sim/core.c
@@ -183,6 +183,31 @@ osim_file_find_name(struct osim_file_desc *parent, const char *name)
return NULL;
}
+struct osim_file_desc *
+osim_file_find_fid(struct osim_file_desc *parent, uint16_t fid)
+{
+ struct osim_file_desc *ofd;
+ llist_for_each_entry(ofd, &parent->child_list, list) {
+ if (ofd->fid == fid) {
+ return ofd;
+ }
+ }
+ return NULL;
+}
+
+struct osim_file_desc *
+osim_file_find_sfid(struct osim_file_desc *parent, uint8_t sfid)
+{
+ struct osim_file_desc *ofd;
+ llist_for_each_entry(ofd, &parent->child_list, list) {
+ if (ofd->sfid == sfid) {
+ return ofd;
+ }
+ }
+ return NULL;
+}
+
+
/*! \brief Generate an APDU message and initialize APDU command header
* \param[in] cla CLASS byte
* \param[in] ins INSTRUCTION byte