fix SVRD UNIT again, add NO_MAP as location option, add other_options to OBP config

This commit is contained in:
KF7EEL 2021-09-06 16:06:14 -07:00
parent dd521eb385
commit 75625510c9
6 changed files with 39 additions and 11 deletions

View File

@ -346,7 +346,15 @@ def svrd_send_all(_svrd_data):
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
if CONFIG['SYSTEMS'][system]['ENCRYPTION_KEY'] != b'':
systems[system].send_system(_svrd_packet + _svrd_data)
## pass
# Send any data packets to connections with ALL_DATA specified in other options
def all_data(_data):
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
if 'ALL_DATA' in CONFIG['SYSTEMS'][system]['OTHER_OPTIONS']:
print('mirrored to ' + system)
systems[system].send_system(_data)
# Import Bridging rules
@ -501,6 +509,12 @@ class routerOBP(OPENBRIDGE):
if _mode == b'UNIT':
UNIT_MAP[_data] = (self._system, time())
## def mmdvm_cmd(self, _cmd):
## print('---')
## print(_cmd)
## print('---')
## pass
def group_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time()
@ -852,8 +866,9 @@ class routerOBP(OPENBRIDGE):
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'unit':
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'vscsbk':
logger.debug('CSBK recieved, but HBlink does not process them currently')
elif _call_type == 'vcsbk':
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
logger.debug('CSBK recieved, forwarded to destination TG.')
else:
logger.error('Unknown call type recieved -- not processed')
@ -1361,7 +1376,9 @@ class routerHBP(HBSYSTEM):
else:
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'vcsbk':
logger.debug('CSBK recieved, but HBlink does not process them currently')
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
logger.debug('CSBK recieved, forwarded to destination TG.')
all_data(_data)
else:
logger.error('Unknown call type recieved -- not processed')
@ -1564,5 +1581,5 @@ if __name__ == '__main__':
# Download burn list
with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
f.write(str(download_burnlist(CONFIG)))
print(CONFIG['SYSTEMS'])
reactor.run()

View File

@ -303,6 +303,7 @@ def build_config(_config_file):
'TG2_ACL': 'PERMIT:ALL',
'USE_ENCRYPTION': config.getboolean(section, 'USE_ENCRYPTION'),
'ENCRYPTION_KEY': bytes(config.get(section, 'ENCRYPTION_KEY'), 'utf-8'),
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
}})
elif config.get(section, 'MODE') == 'PROXY':
CONFIG['SYSTEMS'].update({section: {

View File

@ -172,7 +172,6 @@ class OPENBRIDGE(DatagramProtocol):
# logger.debug('(%s) TX Packet to OpenBridge %s:%s -- %s', self._system, self._config['TARGET_IP'], self._config['TARGET_PORT'], ahex(_packet))
# Special Server Data packet, encrypted using frenet, send
elif _packet[:4] == SVRD:
print(_packet)
_enc_pkt = encrypt_packet(self._config['ENCRYPTION_KEY'], _packet)
_packet = b'SVRD' + _enc_pkt
self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
@ -288,7 +287,8 @@ class OPENBRIDGE(DatagramProtocol):
_stream_id = _data[16:20]
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
else:
self.svrd_received(_d_pkt[4:8], _d_pkt[4:])
self.svrd_received(_d_pkt[4:8], _d_pkt[8:])
#************************************************
# HB MASTER CLASS
@ -525,6 +525,9 @@ class HBSYSTEM(DatagramProtocol):
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
def mmdvm_cmd(self, _cmd):
pass
def master_dereg(self):
for _peer in self._peers:
self.send_peer(_peer, MSTCL + _peer)
@ -751,7 +754,12 @@ class HBSYSTEM(DatagramProtocol):
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
logger.info('(%s) Peer %s (%s) has sent repeater configuration', self._system, _this_peer['CALLSIGN'], _this_peer['RADIO_ID'])
self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], str(_this_peer['PACKAGE_ID']) + ' - ' + str(_this_peer['SOFTWARE_ID']))
if 'NO_MAP' in str(_this_peer['LOCATION']):
self.send_peer_loc(_peer_id, self._peers[_peer_id]['CALLSIGN'], '*', '*', '*', '*', '*', '*')
## print(_this_peer['LOCATION'])
## pass
else:
self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], str(_this_peer['PACKAGE_ID']) + ' - ' + str(_this_peer['SOFTWARE_ID']))
else:
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
logger.warning('(%s) Peer info from Radio ID that has not logged in: %s', self._system, int_id(_peer_id))
@ -776,6 +784,7 @@ class HBSYSTEM(DatagramProtocol):
and self._peers[_peer_id]['SOCKADDR'] == _sockaddr:
logger.info('(%s) Peer %s (%s) has send options: %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id), _data[8:])
# Send remove from map command
## self.mmdvm_cmd(_data)
if 'NO_MAP' in str(_data[8:]):
self.send_peer_loc(_peer_id, self._peers[_peer_id]['CALLSIGN'], '*', '*', '*', '*', '*', '*')
self.transport.write(b''.join([RPTACK, _peer_id]), _sockaddr)

View File

@ -2800,7 +2800,8 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
'TG1_ACL': obp.tg_acl,
'TG2_ACL': 'PERMIT:ALL',
'USE_ENCRYPTION': obp.obp_encryption,
'ENCRYPTION_KEY': obp.encryption_key
'ENCRYPTION_KEY': obp.encryption_key,
'OTHER_OPTIONS': obp.other_options
}})
for pr in p:
master_config_list.update({pr.name: {

View File

@ -26,7 +26,7 @@
<tbody>
<tr>
<td>NO_MAP</td>
<td>This option will prevent your hotspot/repeater from plotting on the map.</td>
<td>This option will prevent your hotspot/repeater from plotting on the map. <strong>This option may also be entered into the Location field of your hotspot, if your hotspot doesn't have an options field.</strong></td>
</tr>
</tbody>

View File

@ -33,7 +33,7 @@
<tbody>
<tr>
<td>NO_MAP</td>
<td>This option will prevent your hotspot/repeater from plotting on the map.</td>
<td>This option will prevent your hotspot/repeater from plotting on the map. <strong>This option may also be entered into the Location field of your hotspot, if your hotspot doesn't have an options field.</strong></td>
</tr>
</tbody>