summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/app_mobile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/layer23/src/mobile/app_mobile.c')
-rw-r--r--src/host/layer23/src/mobile/app_mobile.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c
index cbae4217..1e0e0157 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -54,8 +54,8 @@ extern struct llist_head ms_list;
extern int vty_reading;
int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg);
+int mncc_recv_socket(struct osmocom_ms *ms, int msg_type, void *arg);
int mncc_recv_dummy(struct osmocom_ms *ms, int msg_type, void *arg);
-int (*mncc_recv_app)(struct osmocom_ms *ms, int, void *);
static int quit;
/* handle ms instance */
@@ -241,6 +241,27 @@ static int mobile_init(struct osmocom_ms *ms)
"default IMEI.\n***\n");
}
+ /* Choose and init an MNCC handler */
+ switch (ms->settings.mncc_handler) {
+ case MNCC_HANDLER_SOCKET:
+ LOGP(DMOB, LOGL_INFO, "Using external MNCC-handler (socket '%s') "
+ "for MS '%s'\n", ms->settings.mncc_socket_path, ms->name);
+ ms->mncc_entity.mncc_recv = mncc_recv_socket;
+ ms->mncc_entity.sock_state = mncc_sock_init(ms,
+ ms->settings.mncc_socket_path);
+ break;
+ case MNCC_HANDLER_MOBILE:
+ LOGP(DMOB, LOGL_INFO, "Using the built-in MNCC-handler "
+ "for MS '%s'\n", ms->name);
+ ms->mncc_entity.mncc_recv = mncc_recv_mobile;
+ break;
+ case MNCC_HANDLER_DUMMY:
+ default:
+ LOGP(DMOB, LOGL_INFO, "Using dummy MNCC-handler (no call support) "
+ "for MS '%s'\n", ms->name);
+ ms->mncc_entity.mncc_recv = mncc_recv_dummy;
+ }
+
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
LOGP(DMOB, LOGL_NOTICE, "Mobile '%s' initialized, please start phone now!\n", ms->name);
return 0;
@@ -323,16 +344,6 @@ struct osmocom_ms *mobile_new(char *name)
mobile_set_shutdown(ms, MS_SHUTDOWN_COMPL);
- if (mncc_recv_app) {
- ms->mncc_entity.mncc_recv = mncc_recv_app;
- ms->mncc_entity.sock_state = mncc_sock_init(ms,
- ms->settings.mncc_socket_path);
- } else if (ms->settings.ch_cap == GSM_CAP_SDCCH)
- ms->mncc_entity.mncc_recv = mncc_recv_dummy;
- else
- ms->mncc_entity.mncc_recv = mncc_recv_mobile;
-
-
return ms;
}
@@ -343,7 +354,8 @@ int mobile_delete(struct osmocom_ms *ms, int force)
ms->deleting = true;
- if (mncc_recv_app) {
+ /* Close MNCC socket if used */
+ if (ms->settings.mncc_handler == MNCC_HANDLER_SOCKET) {
mncc_sock_exit(ms->mncc_entity.sock_state);
ms->mncc_entity.sock_state = NULL;
}
@@ -437,14 +449,12 @@ static struct vty_app_info vty_info = {
};
/* global init */
-int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *),
- const char *config_file, const char *vty_ip, uint16_t vty_port)
+int l23_app_init(const char *config_file,
+ const char *vty_ip, uint16_t vty_port)
{
struct telnet_connection dummy_conn;
int rc = 0;
- mncc_recv_app = mncc_recv;
-
osmo_gps_init();
vty_info.tall_ctx = l23_ctx;