diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-08-10 00:20:03 +0700 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2018-09-13 15:35:44 +0200 |
commit | 216558454d4b7d912ec6e206c3ed15251b03821f (patch) | |
tree | 34529d7b5b92d100f26bed0b1ea31c18b044b7f0 /python/trx | |
parent | f94a51b64d8822c80d5cf45997434e98a97b5739 (diff) |
apps/grgsm_trx: introduce bind address option
The new option (-b --bind-addr) allows one to specify the bind
address for both DATA and CTRL interfaces. By default, '0.0.0.0'
is used, so there are no restrictions for the L1 source address.
Change-Id: I3339f686b53db07cfd1bff9a516f4bdc28058cd9
Diffstat (limited to 'python/trx')
-rw-r--r-- | python/trx/ctrl_if_bb.py | 5 | ||||
-rw-r--r-- | python/trx/radio_if.py | 4 | ||||
-rw-r--r-- | python/trx/udp_link.py | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/python/trx/ctrl_if_bb.py b/python/trx/ctrl_if_bb.py index 7886e23..f5a9fa3 100644 --- a/python/trx/ctrl_if_bb.py +++ b/python/trx/ctrl_if_bb.py @@ -26,9 +26,10 @@ import grgsm from ctrl_if import ctrl_if class ctrl_if_bb(ctrl_if): - def __init__(self, remote_addr, remote_port, bind_port, tb, pm): + def __init__(self, remote_addr, remote_port, bind_addr, bind_port, tb, pm): print("[i] Init CTRL interface") - ctrl_if.__init__(self, remote_addr, remote_port, bind_port) + ctrl_if.__init__(self, remote_addr, remote_port, + bind_addr, bind_port) # Set link to the follow graph (top block) self.tb = tb diff --git a/python/trx/radio_if.py b/python/trx/radio_if.py index 25a35a5..1c7f003 100644 --- a/python/trx/radio_if.py +++ b/python/trx/radio_if.py @@ -81,8 +81,8 @@ class radio_if(gr.top_block): def __init__(self, phy_args, phy_sample_rate, phy_rx_gain, phy_tx_gain, phy_ppm, phy_rx_antenna, phy_tx_antenna, - trx_remote_addr, trx_base_port, - trx_bind_addr = "0.0.0.0"): + trx_bind_addr, trx_remote_addr, + trx_base_port): print("[i] Init Radio interface") diff --git a/python/trx/udp_link.py b/python/trx/udp_link.py index d96a6aa..efa701b 100644 --- a/python/trx/udp_link.py +++ b/python/trx/udp_link.py @@ -26,10 +26,10 @@ import socket import select class udp_link: - def __init__(self, remote_addr, remote_port, bind_port): + def __init__(self, remote_addr, remote_port, bind_addr = '0.0.0.0', bind_port = 0): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.sock.bind((remote_addr, bind_port)) + self.sock.bind((bind_addr, bind_port)) self.sock.setblocking(0) # Save remote info |