further decouple lapdm code from osmocom_ms and l1ctl
[osmocom-bb.git] / src / host / layer23 / src / misc / app_cbch_sniff.c
index 9e2d1a9..f10b30f 100644 (file)
 #include <osmocom/bb/common/l23_app.h>
 #include <osmocom/bb/misc/layer3.h>
 
-#include <osmocore/msgb.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/signal.h>
-#include <osmocore/rsl.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/signal.h>
+#include <osmocom/gsm/rsl.h>
+
+#include <l1ctl_proto.h>
 
 struct osmocom_ms *g_ms;
 struct gsm48_sysinfo g_sysinfo = {};
@@ -52,7 +54,7 @@ static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s)
                        "HSN = %d  hseq (%d): %s\n",
                        s->chan_nr, s->tsc, s->maio, s->hsn,
                        s->hopp_len,
-                       hexdump((unsigned char *) s->hopping, s->hopp_len * 2));
+                       osmo_hexdump((unsigned char *) s->hopping, s->hopp_len * 2));
                return l1ctl_tx_dm_est_req_h1(ms,
                        s->maio, s->hsn, s->hopping, s->hopp_len,
                        s->chan_nr, s->tsc,
@@ -134,8 +136,9 @@ static int rcv_rll(struct osmocom_ms *ms, struct msgb *msg)
        return 0;
 }
 
-static int rcv_rsl(struct msgb *msg, struct osmocom_ms *ms)
+static int rcv_rsl(struct msgb *msg, struct lapdm_entity *le, void *l3ctx)
 {
+       struct osmocom_ms *ms = l3ctx;
        struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
        int rc = 0;
 
@@ -179,13 +182,13 @@ int l23_app_init(struct osmocom_ms *ms)
        /* don't do layer3_init() as we don't want an actualy L3 */
 
        g_ms = ms;
-       osmol2_register_handler(ms, &rcv_rsl);
+       lapdm_channel_set_l1(&ms->lapdm_channel, &rcv_rsl, ms);
 
        l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
        /* FIXME: L1CTL_RES_T_FULL doesn't reset dedicated mode
         * (if previously set), so we release it here. */
        l1ctl_tx_dm_rel_req(ms);
-       return register_signal_handler(SS_L1CTL, &signal_cb, NULL);
+       return osmo_signal_register_handler(SS_L1CTL, &signal_cb, NULL);
 }
 
 static struct l23_app_info info = {