sim: add osim_file_desc_find_aid()

Change-Id: I80468c8c4f4590c262019f42285e8d8fd3444f7f
This commit is contained in:
Harald Welte 2020-03-20 12:11:03 +01:00
parent 870f94d0cc
commit bf90d747ad
3 changed files with 21 additions and 1 deletions

View File

@ -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
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()

View File

@ -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);

View File

@ -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)
{