Fixed LCR to work with the current API of OpenBSC.
[lcr.git] / gsm.cpp
diff --git a/gsm.cpp b/gsm.cpp
index 9ffcc4c..d6109c9 100644 (file)
--- a/gsm.cpp
+++ b/gsm.cpp
@@ -18,10 +18,10 @@ extern "C" {
 #include <getopt.h>
 
 #include <openbsc/db.h>
-#include <openbsc/select.h>
+#include <osmocore/select.h>
 #include <openbsc/debug.h>
 #include <openbsc/e1_input.h>
-#include <openbsc/talloc.h>
+#include <osmocore/talloc.h>
 #include <openbsc/mncc.h>
 #include <openbsc/trau_frame.h>
 struct gsm_network *bsc_gsmnet = 0;
@@ -36,7 +36,7 @@ void on_dso_load_ho_dec(void);
 int bts_model_unknown_init(void);
 int bts_model_bs11_init(void);
 int bts_model_nanobts_init(void);
-static struct debug_target *stderr_target;
+static struct log_target *stderr_target;
 
 /* timer to store statistics */
 #define DB_SYNC_INTERVAL       60, 0
@@ -44,12 +44,9 @@ static struct timer_list db_sync_timer;
 
 #include "gsm_audio.h"
 
-#undef AF_ISDN
-#undef PF_ISDN
-extern  int     AF_ISDN;
-#define PF_ISDN AF_ISDN
 }
 
+#include <mISDN/mISDNcompat.h>
 
 struct lcr_gsm *gsm = NULL;
 
@@ -249,7 +246,7 @@ void Pgsm::bchannel_send(unsigned int prim, unsigned int id, unsigned char *data
        memcpy(buf+MISDN_HEADER_LEN, data, len);
        ret = sendto(p_m_g_gsm_b_sock, buf, MISDN_HEADER_LEN+len, 0, NULL, 0);
        if (ret <= 0)
-               PERROR("Failed to send to socket index %d\n", index);
+               PERROR("Failed to send to socket index %d\n", p_m_g_gsm_b_index);
 }
 
 void Pgsm::frame_send(void *_frame)
@@ -1607,22 +1604,24 @@ int gsm_init(void)
        char hlr[128], cfg[128], filename[128];
         mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
        int pcapfd, rc;
+       char conf_error[128] = "";
 
-       debug_init();
+
+       log_init(&log_info);
        tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
        talloc_ctx_init();
        on_dso_load_token();
        on_dso_load_rrlp();
        on_dso_load_ho_dec();
-       stderr_target = debug_target_create_stderr();
-       debug_add_target(stderr_target);
+       stderr_target = log_target_create_stderr();
+       log_add_target(stderr_target);
 
        bts_model_unknown_init();
        bts_model_bs11_init();
        bts_model_nanobts_init();
 
        /* enable filters */
-       debug_set_all_filter(stderr_target, 1);
+       log_set_all_filter(stderr_target, 1);
 
        /* seed the PRNG */
        srand(time(NULL));
@@ -1632,14 +1631,14 @@ int gsm_init(void)
        gsm->gsm_sock = -1;
 
        /* parse options */
-       if (!gsm_conf(&gsm->conf)) {
-               PERROR("%s", gsm_conf_error);
+       if (!gsm_conf(&gsm->conf, conf_error)) {
+               PERROR("%s", conf_error);
                return gsm_exit(-EINVAL);
        }
 
        /* set debug */
        if (gsm->conf.debug[0])
-               debug_parse_category_mask(stderr_target, gsm->conf.debug);
+               log_parse_category_mask(stderr_target, gsm->conf.debug);
 
        /* open pcap file */
        if (gsm->conf.pcapfile[0]) {
@@ -1707,7 +1706,7 @@ int handle_gsm(void)
        int ret1, ret2;
 
        ret1 = bsc_upqueue((struct gsm_network *)gsm->network);
-       debug_reset_context();
+       log_reset_context();
        ret2 = bsc_select_main(1); /* polling */
        if (ret1 || ret2)
                return 1;