aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-03-20 12:11:03 +0100
committerHarald Welte <laforge@osmocom.org>2020-03-21 16:31:17 +0100
commitbf90d747ad678fd301831b299c12f9de332341f9 (patch)
treec4a7fe8a538b7cf9f3c75ab28a910c12ecbc3c1e
parent870f94d0ccc0c64cda1631e7da0bffbe302097a6 (diff)
sim: add osim_file_desc_find_aid()
-rw-r--r--TODO-RELEASE3
-rw-r--r--include/osmocom/sim/sim.h3
-rw-r--r--src/sim/core.c16
3 files changed, 21 insertions, 1 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 329e217b..41453001 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,4 +7,5 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
-gsm API/ABI change l1sap.h, added struct members to ph_data_param and ph_tch_param \ No newline at end of file
+gsm API/ABI change l1sap.h, added struct members to ph_data_param and ph_tch_param
+sim API/ABI change new osim_file_desc_find_aid()
diff --git a/include/osmocom/sim/sim.h b/include/osmocom/sim/sim.h
index 8eb3f11a..5440d855 100644
--- a/include/osmocom/sim/sim.h
+++ b/include/osmocom/sim/sim.h
@@ -243,6 +243,9 @@ struct osim_file_desc *
osim_file_desc_find_name(struct osim_file_desc *parent, const char *name);
struct osim_file_desc *
+osim_file_desc_find_aid(struct osim_file_desc *parent, const uint8_t *aid, uint8_t aid_len);
+
+struct osim_file_desc *
osim_file_desc_find_fid(struct osim_file_desc *parent, uint16_t fid);
struct osim_file_desc *
diff --git a/src/sim/core.c b/src/sim/core.c
index b93633c1..4360ff11 100644
--- a/src/sim/core.c
+++ b/src/sim/core.c
@@ -187,6 +187,22 @@ osim_file_desc_find_name(struct osim_file_desc *parent, const char *name)
}
struct osim_file_desc *
+osim_file_desc_find_aid(struct osim_file_desc *parent, const uint8_t *aid, uint8_t aid_len)
+{
+ struct osim_file_desc *ofd;
+ llist_for_each_entry(ofd, &parent->child_list, list) {
+ if (ofd->type != TYPE_ADF)
+ continue;
+ if (aid_len > ofd->df_name_len)
+ continue;
+ if (!memcmp(ofd->df_name, aid, aid_len)) {
+ return ofd;
+ }
+ }
+ return NULL;
+}
+
+struct osim_file_desc *
osim_file_desc_find_fid(struct osim_file_desc *parent, uint16_t fid)
{
struct osim_file_desc *ofd;