diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-17 17:09:35 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-19 13:56:58 +0200 |
commit | 99d82d17a19d43ecaa3aff5d1acf4045196e58fa (patch) | |
tree | fa7fd1315a346867351b7f16e08b6b4214dd6c84 | |
parent | 48382f3797ff02e4eb04931b3e1f843bc873045f (diff) |
layer23: subscriber: Split gsm_subscr_write_loci() internally per-backend
Change-Id: I5f024972016afe0e161b745236c84b00ee44ad5e
-rw-r--r-- | src/host/layer23/src/common/subscriber.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index 08559aaa..16d985f2 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -56,6 +56,8 @@ static int gsm_subscr_generate_kc_simcard(struct osmocom_ms *ms, uint8_t key_seq static int gsm_subscr_generate_kc_testcard(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, uint8_t no_sim); +static int gsm_subscr_write_loci_simcard(struct osmocom_ms *ms); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -253,6 +255,29 @@ int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t return rc; } +/* update LOCI on SIM */ +int gsm_subscr_write_loci(struct osmocom_ms *ms) +{ + struct gsm_subscriber *subscr = &ms->subscr; + + /* skip, if no real valid SIM */ + if (subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) + return 0; + + LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n"); + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + return gsm_subscr_write_loci_simcard(ms); + case GSM_SIM_TYPE_TEST: + LOGP(DMM, LOGL_NOTICE, "Updating LOCI on test SIM: not implemented!\n"); + return 0; /* TODO */ + default: + OSMO_ASSERT(0); + } +} + /* * test card */ @@ -940,19 +965,13 @@ static int subscr_write_plmn_na(struct osmocom_ms *ms) } /* update LOCI on SIM */ -int gsm_subscr_write_loci(struct osmocom_ms *ms) +static int gsm_subscr_write_loci_simcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; struct sim_hdr *nsh; struct gsm1111_ef_loci *loci; - /* skip, if no real valid SIM */ - if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) - return 0; - - LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n"); - /* write to SIM */ nmsg = gsm_sim_msgb_alloc(subscr->sim_handle_update, SIM_JOB_UPDATE_BINARY); |