Work on NAT

This commit is contained in:
Cort Buffington 2013-11-22 09:23:55 -06:00
parent 056e55823e
commit 45da762a38
2 changed files with 7 additions and 4 deletions

10
bridge.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
#
# This work is licensed under the Creative Commons Attribution-ShareAlike
@ -19,7 +21,8 @@ import binascii
import dmrlink
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc, dmr_nat, logger
NAT = True
NAT = 0
#NAT = '\x2f\x9b\x80'
# Notes and pieces of next steps...
# RPT_WAKE_UP = b'\x85' + NETWORK[_network]['LOCAL']['RADIO_ID] + b'\x00\x00\x00\x01' + b'\x01' + b'\x01'
@ -45,7 +48,6 @@ class bridgeIPSC(IPSC):
#************************************************
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
print('packet ', h(_src_sub))
if (_ts not in self.ACTIVE_CALLS):
self.ACTIVE_CALLS.append(_ts)
# send repeater wake up, but send them when a repeater is likely not TXing check time since end (see below)
@ -64,8 +66,8 @@ class bridgeIPSC(IPSC):
# Re-Write the destinaion Group ID
_tmp_data = _tmp_data.replace(_dst_sub, source['DST_GROUP'])
# Calculate and append the authentication hash for the target network... if necessary
if NAT:
_tmp_data = dmr_nat(_tmp_data, _src_sub, '\x00\x0C\x30')
if NAT:
_tmp_data = dmr_nat(_tmp_data, _src_sub, NAT)
if NETWORK[_target]['LOCAL']['AUTH_ENABLED'] == True:
_tmp_data = self.hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _tmp_data)
# Send the packet to all peers in the target IPSC

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
#
# This work is licensed under the Creative Commons Attribution-ShareAlike