aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-virtual/osmo_mcast_sock.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/osmo_mcast_sock.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/osmo_mcast_sock.h')
-rw-r--r--src/osmo-bts-virtual/osmo_mcast_sock.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/osmo-bts-virtual/osmo_mcast_sock.h b/src/osmo-bts-virtual/osmo_mcast_sock.h
new file mode 100644
index 00000000..aa2013c6
--- /dev/null
+++ b/src/osmo-bts-virtual/osmo_mcast_sock.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <netinet/in.h>
+#include <osmocom/core/select.h>
+
+struct mcast_bidir_sock {
+ struct osmo_fd tx_ofd;
+ struct osmo_fd rx_ofd;
+};
+
+struct mcast_bidir_sock *mcast_bidir_sock_setup(void *ctx,
+ const char *tx_mcast_group, uint16_t tx_mcast_port,
+ const char *rx_mcast_group, uint16_t rx_mcast_port, bool loopback,
+ int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
+ void *osmo_fd_data);
+
+int mcast_server_sock_setup(struct osmo_fd *ofd, const char *tx_mcast_group,
+ uint16_t tx_mcast_port, bool loopback);
+
+int mcast_client_sock_setup(struct osmo_fd *ofd, const char *mcast_group, uint16_t mcast_port,
+ int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
+ void *osmo_fd_data);
+
+int mcast_bidir_sock_tx(struct mcast_bidir_sock *bidir_sock, const uint8_t *data, unsigned int data_len);
+int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, uint8_t *buf, unsigned int buf_len);
+void mcast_bidir_sock_close(struct mcast_bidir_sock* bidir_sock);
+