diff --git a/main.c b/main.c index e7f503d..3e50a7b 100644 --- a/main.c +++ b/main.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include @@ -62,8 +64,14 @@ #define OSMO_CTRL_PORT_MGW 4267 #endif +/* only temporarily until this is in libosmocore gsmtap.h */ +#ifndef GSMTAP_E1T1_V5EF +#define GSMTAP_E1T1_V5EF 0x06 +#endif + void *tall_v5le_ctx = NULL; struct v5x_instance *v5i = NULL; +static struct gsmtap_inst *g_gti; struct v5le_config { }; @@ -102,6 +110,10 @@ static void hdlc_rx_cb(struct e1inp_ts *ts, struct msgb *msg) LOGP(DLINP, LOGL_NOTICE, "L1->L2: %s\n", msgb_hexdump(msg)); + /* send V5 data via gsmtap so wireshark can receive + decode it */ + gsmtap_send_ex(g_gti, GSMTAP_TYPE_E1T1, GSMTAP_ARFCN_F_UPLINK, ts->num, GSMTAP_E1T1_V5EF, + 0, 0, 0, 0, msgb_data(msg), msgb_length(msg)); + lapv5ef_rx(v5if->primary_link, msg); } @@ -117,6 +129,10 @@ int ph_data_req(struct msgb *msg, void *cbdata) struct e1inp_line *e1_line = e1inp_line_find(0); struct e1inp_ts *ts = &e1_line->ts[16-1]; + /* send V5 data via gsmtap so wireshark can receive + decode it */ + gsmtap_send_ex(g_gti, GSMTAP_TYPE_E1T1, 0, ts->num, GSMTAP_E1T1_V5EF, + 0, 0, 0, 0, msgb_data(msg), msgb_length(msg)); + return e1inp_ts_send_hdlc(ts, msg); } @@ -318,6 +334,10 @@ int main(int argc, char **argv) if (rc < 0) return rc; + g_gti = gsmtap_source_init("localhost", GSMTAP_UDP_PORT, 0); + OSMO_ASSERT(g_gti); + gsmtap_source_add_sink(g_gti); + rc = e1_init(); OSMO_ASSERT(rc == 0);