@ -163,11 +163,6 @@ class OPENBRIDGE(DatagramProtocol):
self . _bcve = self . _bcve_task . start ( 60 )
self . _bcve = self . _bcve_task . start ( 60 )
self . _bcve . addErrback ( self . loopingErrHandle )
self . _bcve . addErrback ( self . loopingErrHandle )
logger . debug ( ' ( %s ) *BridgeControl* starting topography timer ' , self . _system )
self . _bcto_task = task . LoopingCall ( self . send_my_bcto )
self . _bcto = self . _bcto_task . start ( 604 ) #600
self . _bcto . addErrback ( self . loopingErrHandle )
def dereg ( self ) :
def dereg ( self ) :
logger . info ( ' ( %s ) is mode OPENBRIDGE. No De-Registration required, continuing shutdown ' , self . _system )
logger . info ( ' ( %s ) is mode OPENBRIDGE. No De-Registration required, continuing shutdown ' , self . _system )
@ -267,6 +262,7 @@ class OPENBRIDGE(DatagramProtocol):
logger . trace ( ' ( %s ) *BridgeControl* sent BCVE. Ver: %s ' , self . _system , VER )
logger . trace ( ' ( %s ) *BridgeControl* sent BCVE. Ver: %s ' , self . _system , VER )
else :
else :
logger . trace ( ' ( %s ) *BridgeControl* not sending BCVE, TARGET_IP currently not known ' , self . _system )
logger . trace ( ' ( %s ) *BridgeControl* not sending BCVE, TARGET_IP currently not known ' , self . _system )
<< << << < HEAD
def send_my_bcto ( self ) :
def send_my_bcto ( self ) :
if self . _config [ ' VER ' ] > 5 :
if self . _config [ ' VER ' ] > 5 :
@ -306,15 +302,14 @@ class OPENBRIDGE(DatagramProtocol):
logger . trace ( ' ( %s ) *BridgeControl* retransmitted BCTO. ' , self . _system )
logger . trace ( ' ( %s ) *BridgeControl* retransmitted BCTO. ' , self . _system )
else :
else :
logger . trace ( ' ( %s ) *BridgeControl* not retransmitting BCTO, TARGET_IP currently not known. ' , self . _system )
logger . trace ( ' ( %s ) *BridgeControl* not retransmitting BCTO, TARGET_IP currently not known. ' , self . _system )
== == == =
>> >> >> > parent of 7 eccd3e ( Auto topography discovery system : )
def dmrd_received ( self , _peer_id , _rf_src , _dst_id , _seq , _slot , _call_type , _frame_type , _dtype_vseq , _stream_id , _data , _hash , _hops = b ' ' , _source_server = b ' \x00 \x00 \x00 \x00 ' , _ber = b ' \x00 ' , _rssi = b ' \x00 ' , _source_rptr = b ' \x00 \x00 \x00 \x00 ' ) :
def dmrd_received ( self , _peer_id , _rf_src , _dst_id , _seq , _slot , _call_type , _frame_type , _dtype_vseq , _stream_id , _data , _hash , _hops = b ' ' , _source_server = b ' \x00 \x00 \x00 \x00 ' , _ber = b ' \x00 ' , _rssi = b ' \x00 ' , _source_rptr = b ' \x00 \x00 \x00 \x00 ' ) :
pass
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))
#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))
def process_bcto ( self , src , dst , ver ) :
pass
def datagramReceived ( self , _packet , _sockaddr ) :
def datagramReceived ( self , _packet , _sockaddr ) :
# Keep This Line Commented Unless HEAVILY Debugging!
# Keep This Line Commented Unless HEAVILY Debugging!
@ -336,7 +331,7 @@ class OPENBRIDGE(DatagramProtocol):
if compare_digest ( _hash , _ckhs ) and ( _sockaddr == self . _config [ ' TARGET_SOCK ' ] or self . _config [ ' RELAX_CHECKS ' ] ) :
if compare_digest ( _hash , _ckhs ) and ( _sockaddr == self . _config [ ' TARGET_SOCK ' ] or self . _config [ ' RELAX_CHECKS ' ] ) :
_peer_id = _data [ 11 : 15 ]
_peer_id = _data [ 11 : 15 ]
if self . _config [ ' NETWORK_ID ' ] != _peer_id :
if self . _config [ ' NETWORK_ID ' ] != _peer_id :
logger . error ( ' ( %s ) OpenBridge packet discarded because NETWORK_ID: %s Does not match sent Serv er ID: %s ' , self . _system , int_id ( self . _config [ ' NETWORK_ID ' ] ) , int_id ( _peer_id ) )
logger . error ( ' ( %s ) OpenBridge packet discarded because NETWORK_ID: %s Does not match sent Pe er ID: %s ' , self . _system , int_id ( self . _config [ ' NETWORK_ID ' ] ) , int_id ( _peer_id ) )
return
return
#This is a v1 packet, so all the extended stuff we can set to default
#This is a v1 packet, so all the extended stuff we can set to default
@ -751,30 +746,6 @@ class OPENBRIDGE(DatagramProtocol):
else :
else :
h , p = _sockaddr
h , p = _sockaddr
logger . warning ( ' ( %s ) *ProtoControl* BCVE invalid, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s SRC IP: %s SRC PORT: %s ' , self . _system , _packet [ : 4 ] , repr ( _packet [ : 53 ] ) , len ( _packet [ 53 : ] ) , repr ( _packet [ 53 : ] ) , h , p )
logger . warning ( ' ( %s ) *ProtoControl* BCVE invalid, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s SRC IP: %s SRC PORT: %s ' , self . _system , _packet [ : 4 ] , repr ( _packet [ : 53 ] ) , len ( _packet [ 53 : ] ) , repr ( _packet [ 53 : ] ) , h , p )
if _packet [ : 4 ] == BCTO :
if self . _config [ ' VER ' ] > 5 :
_hash = _packet [ 18 : ]
_h = blake2b ( key = self . _config [ ' PASSPHRASE ' ] , digest_size = 16 )
_h . update ( _packet [ : 18 ] )
_hash2 = _h . digest ( )
_uid = _packet [ 4 : 8 ]
_src = _packet [ 8 : 12 ]
_dst = _packet [ 12 : 16 ]
_ver = _packet [ 16 : 17 ]
_hops = _packet [ 17 : 18 ]
if _hash == _hash2 :
logger . trace ( ' ( %s ) *ProtoControl* BCTO received: %s connected to %s with proto ver. %s . HOPS: %s ' , self . _system , int_id ( _src ) , int_id ( _dst ) , int . from_bytes ( _ver , ' big ' ) , int . from_bytes ( _hops , ' big ' ) )
if int . from_bytes ( _hops , ' big ' ) < 10 and _src != self . _CONFIG [ ' GLOBAL ' ] [ ' SERVER_ID ' ] and not self . check_bcto_uid ( _uid ) :
self . retransmit_bcto ( _packet [ 4 : 17 ] , int . from_bytes ( _hops , ' big ' ) )
else :
logger . trace ( ' ( %s ) *BridgeControl* not retransmitting BCTO - hop count exceeded, already seen or my packet ' , self . _system )
if not self . check_bcto_uid ( _uid ) :
self . process_bcto ( _uid , _src , _dst , _ver , _hops )
else :
h , p = _sockaddr
logger . warning ( ' ( %s ) *ProtoControl* BCTO invalid, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s SRC IP: %s SRC PORT: %s ' , self . _system , _packet [ : 4 ] , repr ( _packet [ : 18 ] ) , len ( _packet [ 18 : ] ) , repr ( _packet [ 18 : ] ) , h , p )