rework hops a bit

options
Simon 4 years ago
parent db1e8576a1
commit 0693eb85e1

@ -1236,7 +1236,7 @@ class routerOBP(OPENBRIDGE):
OPENBRIDGE.__init__(self, _name, _config, _report)
self.STATUS = {}
def to_target(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,_noOBP,sysIgnore,_hops):
def to_target(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,_noOBP,sysIgnore, _hops = bytes(0)):
_sysIgnore = sysIgnore
for _target in BRIDGES[_bridge]:
if (_target['SYSTEM'] != self._system) and (_target['ACTIVE']):
@ -1413,7 +1413,7 @@ class routerOBP(OPENBRIDGE):
#Ignore this system and TS pair if it's called again on this packet
return(_sysIgnore)
def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id,_hops):
def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id):
_int_dst_id = int_id(_dst_id)
#Assemble transmit HBP packet header
_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]])
@ -1423,7 +1423,7 @@ class routerOBP(OPENBRIDGE):
if CONFIG['REPORTS']['REPORT']:
systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore'))
def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops):
def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops = bytes(0)):
_int_dst_id = int_id(_dst_id)
_target_status = systems[_target].STATUS
@ -1463,7 +1463,7 @@ class routerOBP(OPENBRIDGE):
systems[_target]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_target, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore'))
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops):
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash, _hops = bytes(0)):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
@ -1583,7 +1583,7 @@ class routerOBP(OPENBRIDGE):
_tmp_bits = _bits ^ 1 << 7
else:
_tmp_bits = _bits
self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id,_hops)
self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id)
else:
logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id)
@ -2034,7 +2034,7 @@ class routerHBP(HBSYSTEM):
if CONFIG['REPORTS']['REPORT']:
systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore'))
def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops):
def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops = bytes(0)):
# _sysIgnore = sysIgnore
_int_dst_id = int_id(_dst_id)
_target_status = systems[_target].STATUS

@ -137,15 +137,12 @@ class OPENBRIDGE(DatagramProtocol):
def dereg(self):
logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
def send_system(self, _packet,_hops):
def send_system(self, _packet,_hops = bytes(0)):
#Don't do anything if we are STUNned
if 'STUN' in self._CONFIG:
logger.info('(%s) Bridge STUNned, discarding', self._system)
return
if not _hops:
_hops = bytes(0)
if _packet[:3] == DMR and self._config['TARGET_IP']:
if 'VER' in self._config and self._config['VER'] > 1:
_packet = b''.join([DMRF,_packet[4:11], self._CONFIG['GLOBAL']['SERVER_ID'],_packet[15:], time_ns().to_bytes(8,'big')])
@ -206,7 +203,7 @@ class OPENBRIDGE(DatagramProtocol):
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops):
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops = bytes(0)):
pass
#print(int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), int_id(_seq), _slot, _call_type, _frame_type, repr(_dtype_vseq), int_id(_stream_id))
@ -214,8 +211,6 @@ class OPENBRIDGE(DatagramProtocol):
# Keep This Line Commented Unless HEAVILY Debugging!
#logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
_hops = bytes(0)
if _packet[:3] == DMR: # DMRData -- encapsulated DMR data frame
if _packet[:4] == DMRD:
if self._config['VER'] > 1:
@ -301,7 +296,7 @@ class OPENBRIDGE(DatagramProtocol):
return
# Userland actions -- typically this is the function you subclass for an application
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops)
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash)
#Silently treat a DMRD packet like a keepalive - this is because it's traffic and the
#Other end may not have enabled ENAHNCED_OBP
self._config['_bcka'] = time()

Loading…
Cancel
Save

Powered by TurnKey Linux.