aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-virtual/virtual_um.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-09 13:13:37 +0100
committerHarald Welte <laforge@gnumonks.org>2017-07-13 19:34:17 +0000
commit5eb17e28acdd6fba22a1f2e60f4d55aaef18b47a (patch)
tree7e2e6dd96ce541fb4fda6ae3694ba27d971e1033 /src/osmo-bts-virtual/virtual_um.h
parent152c2f489cd214b1a400b158df2b8726f779358a (diff)
VIRT-PHY: Initial check-in of a new virtual BTS
This patch adds a virtual physical layer designed to simulate the Um air interface between BTS and MS. It does so by encapsulating MAC blocks (Layer 2 PDUs) via GSMTAP and sending them through multicast UDP streams, both in uplink and in downlink. The purpose of this is enable testing without any radio hardware or related licenses. OsmocomBB has recently received as similar patch-set, adding a virty_phy executable that can be run on a PC instead of the classic 'layer1' firmware on a real phone. Using GSMTAP means that one can use unmodified wireshark to decode the messages exchanged on the virtual Um layer. This code was originally started by Harald in January 2016, continued by Sebastian Stumpf in late 2016 and early 2017, and finally completed by Harald in July 2017. Change-Id: I1bf7670975b1e367c1c62983020865a043542622
Diffstat (limited to 'src/osmo-bts-virtual/virtual_um.h')
-rw-r--r--src/osmo-bts-virtual/virtual_um.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/osmo-bts-virtual/virtual_um.h b/src/osmo-bts-virtual/virtual_um.h
new file mode 100644
index 00000000..6e7c3841
--- /dev/null
+++ b/src/osmo-bts-virtual/virtual_um.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <osmocom/core/select.h>
+#include <osmocom/core/msgb.h>
+#include "osmo_mcast_sock.h"
+
+#define VIRT_UM_MSGB_SIZE 256
+#define DEFAULT_MS_MCAST_GROUP "224.0.0.1"
+#define DEFAULT_MS_MCAST_PORT 4729 /* IANA-registered port for GSMTAP */
+#define DEFAULT_BTS_MCAST_GROUP "225.0.0.1"
+#define DEFAULT_BTS_MCAST_PORT 4729 /* IANA-registered port for GSMTAP */
+
+struct virt_um_inst {
+ void *priv;
+ struct mcast_bidir_sock *mcast_sock;
+ void (*recv_cb)(struct virt_um_inst *vui, struct msgb *msg);
+};
+
+struct virt_um_inst *virt_um_init(
+ void *ctx, char *tx_mcast_group, uint16_t tx_mcast_port,
+ char *rx_mcast_group, uint16_t rx_mcast_port,
+ void (*recv_cb)(struct virt_um_inst *vui, struct msgb *msg));
+
+void virt_um_destroy(struct virt_um_inst *vui);
+
+int virt_um_write_msg(struct virt_um_inst *vui, struct msgb *msg);