diff --git a/TODO-RELEASE b/TODO-RELEASE index 329e217b0..41453001d 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 8eb3f11a4..5440d8551 100644 --- a/include/osmocom/sim/sim.h +++ b/include/osmocom/sim/sim.h @@ -242,6 +242,9 @@ struct osim_file { 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); diff --git a/src/sim/core.c b/src/sim/core.c index b93633c17..4360ff11a 100644 --- a/src/sim/core.c +++ b/src/sim/core.c @@ -186,6 +186,22 @@ osim_file_desc_find_name(struct osim_file_desc *parent, const char *name) return NULL; } +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) {