summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/gsm48_mm.c
diff options
context:
space:
mode:
authorAndreas.Eversberg <jolly@eversberg.eu>2010-11-13 18:45:09 +0000
committerAndreas.Eversberg <jolly@eversberg.eu>2010-11-13 18:45:09 +0000
commit6f2b172780195e0af780ecd0a4fff0fac9b8438b (patch)
tree44423a4d31fa2767e26c988a258a960e7e51e5a1 /src/host/layer23/src/mobile/gsm48_mm.c
parent4df881932c30c2d3deb88c53a55a21fd342068d8 (diff)
[layer23] Added support for multiple MS instances
To create another instance: 'ms <name> create' To remove an instance: 'no ms <name>' If no instance exists, 'ms 1' is created automatically on startup. Each instance can be enabled / disabled by using 'shutdown' or 'no shutdown'. Multiple instances may share the same layer2 socket (same phone hardware), but in this case only one instance can be enabled at the same time. This makes it much easier to select different settings without modifying them. A 'shutdown' initiates the IMSI detach procedure before shutdown is completed. A 'shutdown force' will immidiately shutdown. There is no need to restart the software anymore, if fundamental settings are changed. In this case, a 'shutdown' followed by a 'no shutdown' will do the job. If you already have an old osmocom.cfg, you need to "no shutdown" it. Everything else behaves as before.
Diffstat (limited to 'src/host/layer23/src/mobile/gsm48_mm.c')
-rw-r--r--src/host/layer23/src/mobile/gsm48_mm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c
index b77f4335..d4444cf2 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -33,12 +33,12 @@
#include <osmocom/bb/common/logging.h>
#include <osmocom/bb/common/osmocom_data.h>
-#include <osmocom/bb/common/l23_app.h>
#include <osmocom/bb/common/networks.h>
#include <osmocom/bb/common/l1ctl.h>
#include <osmocom/bb/mobile/gsm48_cc.h>
extern void *l23_ctx;
+extern int (*l23_app_exit) (struct osmocom_ms *ms, int force);
void mm_conn_free(struct gsm48_mm_conn *conn);
static int gsm48_rcv_rr(struct osmocom_ms *ms, struct msgb *msg);
@@ -1741,11 +1741,12 @@ static int gsm48_mm_imsi_detach_end(struct osmocom_ms *ms, struct msgb *msg)
subscr->sim_valid = 0;
/* wait for RR idle and then power off when IMSI is detached */
- if (mm->power_off) {
+ if (ms->shutdown) {
if (mm->state == GSM48_MM_ST_MM_IDLE) {
- l23_app_exit(ms);
- exit(0);
+ l23_app_exit(ms, 1);
+ return 0;
}
+ /* power off when MM idle */
mm->power_off_idle = 1;
return 0;
@@ -1816,9 +1817,9 @@ static int gsm48_mm_imsi_detach_release(struct osmocom_ms *ms, struct msgb *msg)
new_mm_state(mm, GSM48_MM_ST_WAIT_NETWORK_CMD, 0);
/* power off */
- if (mm->power_off) {
- l23_app_exit(ms);
- exit(0);
+ if (ms->shutdown) {
+ l23_app_exit(ms, 1);
+ return 0;
}
return 0;