Fixed a few more bugs...
AND found some caveats, which will be listed as issues shortly.
This commit is contained in:
parent
2811e980d9
commit
48a100f0df
@ -10,6 +10,7 @@ from __future__ import print_function
|
|||||||
from twisted.internet.protocol import DatagramProtocol
|
from twisted.internet.protocol import DatagramProtocol
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet import task
|
from twisted.internet import task
|
||||||
|
from binascii import b2a_hex as h
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import dmrlink
|
import dmrlink
|
||||||
@ -18,6 +19,7 @@ from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc, d
|
|||||||
RULES = {
|
RULES = {
|
||||||
'K0USY': {
|
'K0USY': {
|
||||||
'GROUP_VOICE': [
|
'GROUP_VOICE': [
|
||||||
|
{'SRC_GROUP': b'\x00\x00\x03', 'DST_NET': 'LAWRENCE', 'DST_GROUP': b'\x00\x00\x03'},
|
||||||
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'LAWRENCE', 'DST_GROUP': b'\x00\x0C\x30'},
|
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'LAWRENCE', 'DST_GROUP': b'\x00\x0C\x30'},
|
||||||
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2'}
|
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2'}
|
||||||
],
|
],
|
||||||
@ -30,6 +32,7 @@ RULES = {
|
|||||||
},
|
},
|
||||||
'LAWRENCE': {
|
'LAWRENCE': {
|
||||||
'GROUP_VOICE': [
|
'GROUP_VOICE': [
|
||||||
|
{'SRC_GROUP': b'\x00\x00\x03', 'DST_NET': 'K0USY', 'DST_GROUP': b'\x00\x00\x03'},
|
||||||
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'K0USY', 'DST_GROUP': b'\x00\x0C\x30'},
|
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'K0USY', 'DST_GROUP': b'\x00\x0C\x30'},
|
||||||
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2'}
|
{'SRC_GROUP': b'\x00\x0C\x30', 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2'}
|
||||||
],
|
],
|
||||||
@ -61,7 +64,7 @@ class bridgeIPSC(IPSC):
|
|||||||
self.ACTIVE_CALLS = []
|
self.ACTIVE_CALLS = []
|
||||||
|
|
||||||
#def datagramReceived(self, data, (host, port)):
|
#def datagramReceived(self, data, (host, port)):
|
||||||
# print(binascii.b2a_hex(data))
|
# print(h(data))
|
||||||
|
|
||||||
|
|
||||||
#************************************************
|
#************************************************
|
||||||
@ -112,7 +115,7 @@ class bridgeUnauthIPSC(bridgeIPSC):
|
|||||||
def hashed_packet(self, _key, _data):
|
def hashed_packet(self, _key, _data):
|
||||||
return _data
|
return _data
|
||||||
|
|
||||||
# Remove the hash from a packet and return the payload
|
# Remove the hash from a packet and return the payload... except don't
|
||||||
#
|
#
|
||||||
def strip_hash(self, _data):
|
def strip_hash(self, _data):
|
||||||
return _data
|
return _data
|
||||||
|
16
dmrlink.py
16
dmrlink.py
@ -195,12 +195,16 @@ def valid_master(_network, _peerid):
|
|||||||
# Accept a complete packet, ready to be sent, and send it to all active peers + master in an IPSC
|
# Accept a complete packet, ready to be sent, and send it to all active peers + master in an IPSC
|
||||||
#
|
#
|
||||||
def send_to_ipsc(_target, _packet):
|
def send_to_ipsc(_target, _packet):
|
||||||
# Send to the Master
|
_network = NETWORK[_target]
|
||||||
networks[_target].transport.write(_packet, (NETWORK[_target]['MASTER']['IP'], NETWORK[_target]['MASTER']['PORT']))
|
_network_instance = networks[_target]
|
||||||
|
_peers = _network['PEERS']
|
||||||
|
|
||||||
|
# Send to the Master
|
||||||
|
_network_instance.transport.write(_packet, (_network['MASTER']['IP'], _network['MASTER']['PORT']))
|
||||||
# Send to each connected Peer
|
# Send to each connected Peer
|
||||||
for peer in networks[_target]['PEERS'].keys():
|
for peer in _peers.keys():
|
||||||
if peer['STATUS']['CONNECTED'] == True:
|
if _peers[peer]['STATUS']['CONNECTED'] == True:
|
||||||
networks[_target].transport.write(_packet, (peer['IP'], peer['PORT']))
|
_network_instance.transport.write(_packet, (_peers[peer]['IP'], _peers[peer]['PORT']))
|
||||||
|
|
||||||
|
|
||||||
# De-register a peer from an IPSC by removing it's infomation
|
# De-register a peer from an IPSC by removing it's infomation
|
||||||
@ -763,7 +767,7 @@ class UnauthIPSC(IPSC):
|
|||||||
def hashed_packet(self, _key, _data):
|
def hashed_packet(self, _key, _data):
|
||||||
return _data
|
return _data
|
||||||
|
|
||||||
# Remove the hash from a packet and return the payload
|
# Remove the hash from a packet and return the payload... except don't
|
||||||
#
|
#
|
||||||
def strip_hash(_self, _data):
|
def strip_hash(_self, _data):
|
||||||
return _data
|
return _data
|
||||||
|
5
log.py
5
log.py
@ -10,6 +10,7 @@ from __future__ import print_function
|
|||||||
from twisted.internet.protocol import DatagramProtocol
|
from twisted.internet.protocol import DatagramProtocol
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet import task
|
from twisted.internet import task
|
||||||
|
from binascii import b2a_hex as h
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
import time
|
import time
|
||||||
@ -37,7 +38,7 @@ class logIPSC(IPSC):
|
|||||||
print('({}) Call Control Type 3 Packet Received' .format(_network))
|
print('({}) Call Control Type 3 Packet Received' .format(_network))
|
||||||
|
|
||||||
def xcmp_xnl(self, _network, _data):
|
def xcmp_xnl(self, _network, _data):
|
||||||
print('({}) XCMP/XNL Packet Received From: {}' .format(_network, binascii.b2a_hex(_data)))
|
print('({}) XCMP/XNL Packet Received From: {}' .format(_network, h(_data)))
|
||||||
|
|
||||||
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
|
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
|
||||||
# _log = logger.debug
|
# _log = logger.debug
|
||||||
@ -102,7 +103,7 @@ class logUnauthIPSC(logIPSC):
|
|||||||
def hashed_packet(self, _key, _data):
|
def hashed_packet(self, _key, _data):
|
||||||
return _data
|
return _data
|
||||||
|
|
||||||
# Remove the hash from a packet and return the payload
|
# Remove the hash from a packet and return the payload... except don't
|
||||||
#
|
#
|
||||||
def strip_hash(self, _data):
|
def strip_hash(self, _data):
|
||||||
return _data
|
return _data
|
||||||
|
Loading…
Reference in New Issue
Block a user