X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=gsm_ms.cpp;h=1e33162df5ec9199d03f749143a4da681dd5b472;hp=c8292f9ad6c61a31e4e2d380aeae82c75d1eb19e;hb=132d639333dd5e7a7832dcd9784181ee09a16f9e;hpb=da91d7d85fe092122e35ece52695f98345738359 diff --git a/gsm_ms.cpp b/gsm_ms.cpp index c8292f9..1e33162 100644 --- a/gsm_ms.cpp +++ b/gsm_ms.cpp @@ -17,10 +17,11 @@ extern "C" { #include #include +#include -#include -#include -#include +#include +#include +#include #include #include @@ -28,14 +29,14 @@ extern "C" { #include } -static const char *config_file = "/etc/osmocom/osmocom.cfg"; +//char *config_dir = NULL; + short vty_port = 4247; struct llist_head ms_list; struct log_target *stderr_target; void *l23_ctx = NULL; - -static int dtmf_timeout(struct lcr_timer *timer, void *instance, int index); +struct gsmtap_inst *gsmtap_inst; static int dtmf_timeout(struct lcr_timer *timer, void *instance, int index); @@ -62,12 +63,6 @@ Pgsm_ms::Pgsm_ms(int type, struct mISDNport *mISDNport, char *portname, struct p memset(&p_m_g_dtmf_timer, 0, sizeof(p_m_g_dtmf_timer)); add_timer(&p_m_g_dtmf_timer, dtmf_timeout, this, 0); - p_m_g_dtmf_state = DTMF_ST_IDLE; - p_m_g_dtmf_index = 0; - p_m_g_dtmf[0] = '\0'; - memset(&p_m_g_dtmf_timer, 0, sizeof(p_m_g_dtmf_timer)); - add_timer(&p_m_g_dtmf_timer, dtmf_timeout, this, 0); - PDEBUG(DEBUG_GSM, "Created new GSMMSPort(%s %s).\n", portname, ms_name); } @@ -832,15 +827,20 @@ int gsm_ms_exit(int rc) int gsm_ms_init(void) { + const char *home; + size_t len; + const char osmocomcfg[] = ".osmocom/bb/mobile.cfg"; + char *config_file = NULL; + INIT_LLIST_HEAD(&ms_list); - log_init(&log_info); + log_init(&log_info, NULL); stderr_target = log_target_create_stderr(); log_add_target(stderr_target); log_set_all_filter(stderr_target, 1); l23_ctx = talloc_named_const(NULL, 1, "layer2 context"); - log_parse_category_mask(stderr_target, "DCS:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DPAG:DSUM"); + log_parse_category_mask(stderr_target, "DNB:DCS:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DPAG:DSUM"); log_set_log_level(stderr_target, LOGL_INFO); #if 0 @@ -853,6 +853,17 @@ int gsm_ms_init(void) } #endif + home = getenv("HOME"); + if (home != NULL) { + len = strlen(home) + 1 + sizeof(osmocomcfg); + config_file = (char *)talloc_size(l23_ctx, len); + if (config_file != NULL) + snprintf(config_file, len, "%s/%s", home, osmocomcfg); + } + /* save the config file directory name */ + config_dir = talloc_strdup(l23_ctx, config_file); + config_dir = dirname(config_dir); + l23_app_init(message_ms, config_file, vty_port); return 0; @@ -921,7 +932,7 @@ int handle_gsm_ms(int *_quit) if (quit && llist_empty(&ms_list)) *_quit = 1; // debug_reset_context(); - if (bsc_select_main(1)) /* polling */ + if (osmo_select_main(1)) /* polling */ work = 1; return work;