Iniatial gsmtap support

This requires a wireshark with support for passing the new gsmtap V5
format into the existing wireshark dissectors for V5.
This commit is contained in:
Harald Welte 2022-12-02 16:14:33 +01:00
parent b885d47b45
commit c2fbf51f50
1 changed files with 20 additions and 0 deletions

20
main.c
View File

@ -35,6 +35,8 @@
#include <osmocom/core/stats.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/ctrl/control_vty.h>
@ -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);