simutil: Add util to find CPHS service availability

This commit is contained in:
Denis Kenzior 2011-12-16 09:44:32 -06:00
parent 7f18695f46
commit fe7d012c39
2 changed files with 19 additions and 0 deletions

View File

@ -1477,6 +1477,14 @@ gboolean sim_sst_is_active(unsigned char *efsst, unsigned char len,
return (efsst[index / 4] >> (((index % 4) * 2) + 1)) & 1;
}
gboolean sim_cphs_is_active(unsigned char *cphs, enum sim_cphs_service index)
{
if (index >= 2 * 4u)
return FALSE;
return ((cphs[index / 4] >> ((index % 4) * 2)) & 3) == 3;
}
GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len)
{
GSList *ret = NULL;

View File

@ -242,6 +242,15 @@ enum sim_sst_service {
SIM_SST_SERVICE_PROVIDER_DISPLAY_INFO = 55
};
/* CPHS 4.2, Section B.3.1.1 */
enum sim_cphs_service {
SIM_CPHS_SERVICE_CSP = 0x0,
SIM_CPHS_SERVICE_SST = 0x1,
SIM_CPHS_SERVICE_MAILBOX_NUMBERS = 0x2,
SIM_CPHS_SERVICE_SHORT_SPN = 0x3,
SIM_CPHS_SERVICE_INFO_NUMBERS = 0x4,
};
/* CPHS 4.2, Section B4.7 CSP Service Group Codes */
enum sim_csp_entry {
SIM_CSP_ENTRY_CALL_OFFERING = 0x01,
@ -483,5 +492,7 @@ gboolean sim_sst_is_available(unsigned char *service_sst, unsigned char len,
enum sim_sst_service index);
gboolean sim_sst_is_active(unsigned char *service_sst, unsigned char len,
enum sim_sst_service index);
gboolean sim_cphs_is_active(unsigned char *service_cphs,
enum sim_cphs_service index);
GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len);