summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-05-17 14:50:44 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-05-19 13:56:58 +0200
commitfd1552c22507159a8c4928bbfdf83b8d17f74eff (patch)
tree4b91c80fd3ef7df090d68cc5d0c52b31b7b91136
parent1ad195e28f46c0d132406973f123b9b4e9271062 (diff)
layer23: subscriber: Move sap specific code inside subscriber.c
Step forward towards a generic subscriber interface. Change-Id: I780f06203cd6971866d81060a5ecee8bc00782f4
-rw-r--r--src/host/layer23/include/osmocom/bb/common/subscriber.h1
-rw-r--r--src/host/layer23/src/common/subscriber.c7
-rw-r--r--src/host/layer23/src/common/vty.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h
index 72f65f00..8f0966ef 100644
--- a/src/host/layer23/include/osmocom/bb/common/subscriber.h
+++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h
@@ -102,7 +102,6 @@ int gsm_subscr_testcard(struct osmocom_ms *ms);
int gsm_subscr_sap_rsp_cb(struct osmocom_ms *ms, int res_code,
uint8_t res_type, uint16_t param_len, const uint8_t *param_val);
int gsm_subscr_sapcard(struct osmocom_ms *ms);
-int gsm_subscr_remove_sapcard(struct osmocom_ms *ms);
int gsm_subscr_simcard(struct osmocom_ms *ms);
void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2,
int8_t mode);
diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c
index d5d0604e..4357ca35 100644
--- a/src/host/layer23/src/common/subscriber.c
+++ b/src/host/layer23/src/common/subscriber.c
@@ -37,6 +37,8 @@
* if list is changed, the result is not written back to SIM */
//#define TEST_EMPTY_FPLMN
+static int gsm_subscr_remove_sapcard(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);
@@ -1006,6 +1008,9 @@ int gsm_subscr_remove(struct osmocom_ms *ms)
return -EINVAL;
}
+ if (subscr->sim_type == GSM_SIM_TYPE_SAP)
+ gsm_subscr_remove_sapcard(ms);
+
/* remove card */
osmo_signal_dispatch(SS_L23_SUBSCR, S_L23_SUBSCR_SIM_DETACHED, ms);
@@ -1257,7 +1262,7 @@ int gsm_subscr_sapcard(struct osmocom_ms *ms)
}
/* Deattach sapcard */
-int gsm_subscr_remove_sapcard(struct osmocom_ms *ms)
+static int gsm_subscr_remove_sapcard(struct osmocom_ms *ms)
{
return sap_close(ms);
}
diff --git a/src/host/layer23/src/common/vty.c b/src/host/layer23/src/common/vty.c
index 262d60ae..56ff6bcd 100644
--- a/src/host/layer23/src/common/vty.c
+++ b/src/host/layer23/src/common/vty.c
@@ -613,9 +613,6 @@ DEFUN(sim_remove, sim_remove_cmd, "sim remove MS_NAME",
return CMD_WARNING;
}
- if (ms->subscr.sim_type == GSM_SIM_TYPE_SAP)
- gsm_subscr_remove_sapcard(ms);
-
gsm_subscr_remove(ms);
return CMD_SUCCESS;
}