path: root/src/target/fake_trx/
diff options
authorVadim Yanitskiy <>2017-07-10 19:39:06 +0700
committerVadim Yanitskiy <>2017-10-23 22:05:49 +0330
commit663dce62608205c56d2bca4717fd9640753c0dc3 (patch)
treef261a0347dc9451ebae921058fb268bae583cda0 /src/target/fake_trx/
parent63c86222b55bbbc06ecefbd5c73abda2251eca9e (diff)
target/fake_trx: initial release of virtual transceiver
This is a set of tools for creating a virtual Um-interface between OsmocomBB and OsmoBTS. It may be extremely useful for testing and development of GSM stack, including both sides (MS and BTS). This software implements OsmoTRX (Osmocom's fork of OpenBTS transceiver) style clock (CLCK), control (CTRL) and data interfaces. So, OsmoBTS source code doesn't require any modifications, while for OsmocomBB you will need to use a new application - trxcon, which can be found in the 'fixeria/sdr_phy' branch until one is merged to master. Brief description of available applications: - - main application, that allows to connect both OsmocomBB and OsmoBTS without actual RF hardware. Currently only a single MS may work with a single BTS. - - a peripheral tool aimed to emulate TDMA frame clock generator. Could be used for testing and clock synchronization of multiple applications. It should be noted, that one relays on generic system timer (via Python), so a random clock jitter takes place. - - another peripheral tool, which could be used for sending CTRL commands directly in manual mode, and also for application fuzzing. Change-Id: Ib1fb80682002ac85a72fa6abef459a4c44f4ab97
Diffstat (limited to 'src/target/fake_trx/')
1 files changed, 53 insertions, 0 deletions
diff --git a/src/target/fake_trx/ b/src/target/fake_trx/
new file mode 100644
index 0000000..3fa5050
--- /dev/null
+++ b/src/target/fake_trx/
@@ -0,0 +1,53 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+# Virtual Um-interface (fake transceiver)
+# UDP link implementation
+# (C) 2017 by Vadim Yanitskiy <>
+# All Rights Reserved
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import socket
+import select
+class UDPLink:
+ def __init__(self, remote_addr, remote_port, bind_port):
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self.sock.bind(('', bind_port))
+ self.sock.setblocking(0)
+ # Save remote info
+ self.remote_addr = remote_addr
+ self.remote_port = remote_port
+ def loop(self):
+ r_event, w_event, x_event =[self.sock], [], [])
+ # Check for incoming data
+ if self.sock in r_event:
+ data, addr = self.sock.recvfrom(128)
+ self.handle_rx(data)
+ def shutdown(self):
+ self.sock.close();
+ def send(self, data):
+ self.sock.sendto(data, (self.remote_addr, self.remote_port))
+ def handle_rx(self, data):
+ raise NotImplementedError