<s> """<STR_LIT>""" <EOL> import hashlib <EOL> from . errors import EncodingError , DecodingError <EOL> from . debugging import ModuleLogger , DebugContents , bacpypes_debugging <EOL> from . pdu import LocalStation , PCI , PDUData <EOL> _debug = <NUM_LIT:0> <EOL> _log = ModuleLogger ( globals ( ) ) <EOL> bsl_pdu_types = { } <EOL> def register_bslpdu_type ( klass ) : <EOL> bsl_pdu_types [ klass . messageType ] = klass <EOL> DEVICE_TO_DEVICE_SERVICE_ID = <NUM_LIT> <EOL> ROUTER_TO_ROUTER_SERVICE_ID = <NUM_LIT> <EOL> PROXY_SERVICE_ID = <NUM_LIT> <EOL> LANE_SERVICE_ID = <NUM_LIT> <EOL> CLIENT_SERVER_SERVICE_ID = <NUM_LIT> <EOL> _md5 = lambda x : hashlib . md5 ( x ) . digest ( ) <EOL> _sha1 = lambda x : hashlib . sha1 ( x ) . digest ( ) <EOL> _sha224 = lambda x : hashlib . sha224 ( x ) . digest ( ) <EOL> _sha256 = lambda x : hashlib . sha256 ( x ) . digest ( ) <EOL> _sha384 = lambda x : hashlib . sha384 ( x ) . digest ( ) <EOL> _sha512 = lambda x : hashlib . sha512 ( x ) . digest ( ) <EOL> hash_functions = ( _md5 , _sha1 , _sha224 , _sha256 , _sha384 , _sha512 ) <EOL> SUCCESS = <NUM_LIT:0> <EOL> NO_DEVICE_TO_DEVICE_SERVICE = <NUM_LIT:1> <EOL> NO_ROUTER_TO_ROUTER_SERVICE = <NUM_LIT:2> <EOL> NO_PROXY_SERVICE = <NUM_LIT:3> <EOL> NO_LANE_SERVICE = <NUM_LIT:4> <EOL> UNRECOGNIZED_SERVICE = <NUM_LIT:5> <EOL> AUTHENTICATION_REQUIRED = <NUM_LIT:10> <EOL> AUTHENTICATION_FAILURE = <NUM_LIT:11> <EOL> AUTHENTICATION_NO_SERVICE = <NUM_LIT:12> <EOL> AUTHENTICATION_HASH = <NUM_LIT> <EOL> @ bacpypes_debugging <EOL> class BSLCI ( PCI , DebugContents ) : <EOL> _debug_contents = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> result = <NUM_LIT> <EOL> serviceRequest = <NUM_LIT> <EOL> accessRequest = <NUM_LIT> <EOL> accessChallenge = <NUM_LIT> <EOL> accessResponse = <NUM_LIT> <EOL> deviceToDeviceAPDU = <NUM_LIT> <EOL> routerToRouterNPDU = <NUM_LIT> <EOL> proxyToServerUnicastNPDU = <NUM_LIT> <EOL> proxyToServerBroadcastNPDU = <NUM_LIT> <EOL> serverToProxyUnicastNPDU = <NUM_LIT> <EOL> serverToProxyBroadcastNPDU = <NUM_LIT> <EOL> clientToLESUnicastNPDU = <NUM_LIT> <EOL> clientToLESBroadcastNPDU = <NUM_LIT> <EOL> lesToClientUnicastNPDU = <NUM_LIT> <EOL> lesToClientBroadcastNPDU = <NUM_LIT> <EOL> clientToServerUnicastAPDU = <NUM_LIT> <EOL> clientToServerBroadcastAPDU = <NUM_LIT> <EOL> serverToClientUnicastAPDU = <NUM_LIT> <EOL> serverToClientBroadcastAPDU = <NUM_LIT> <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( BSLCI , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciType = <NUM_LIT> <EOL> self . bslciFunction = None <EOL> self . bslciLength = None <EOL> def update ( self , bslci ) : <EOL> PCI . update ( self , bslci ) <EOL> self . bslciType = bslci . bslciType <EOL> self . bslciFunction = bslci . bslciFunction <EOL> self . bslciLength = bslci . bslciLength <EOL> def encode ( self , pdu ) : <EOL> """<STR_LIT>""" <EOL> if _debug : BSLCI . _debug ( "<STR_LIT>" , pdu ) <EOL> PCI . update ( pdu , self ) <EOL> pdu . put ( self . bslciType ) <EOL> pdu . put ( self . bslciFunction ) <EOL> if ( self . bslciLength != len ( self . pduData ) + <NUM_LIT:4> ) : <EOL> raise EncodingError ( "<STR_LIT>" ) <EOL> pdu . put_short ( self . bslciLength ) <EOL> def decode ( self , pdu ) : <EOL> """<STR_LIT>""" <EOL> if _debug : BSLCI . _debug ( "<STR_LIT>" , pdu ) <EOL> PCI . update ( self , pdu ) <EOL> self . bslciType = pdu . get ( ) <EOL> if self . bslciType != <NUM_LIT> : <EOL> raise DecodingError ( "<STR_LIT>" ) <EOL> self . bslciFunction = pdu . get ( ) <EOL> self . bslciLength = pdu . get_short ( ) <EOL> if ( self . bslciLength != len ( pdu . pduData ) + <NUM_LIT:4> ) : <EOL> raise DecodingError ( "<STR_LIT>" ) <EOL> class BSLPDU ( BSLCI , PDUData ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( BSLPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> def encode ( self , pdu ) : <EOL> BSLCI . encode ( self , pdu ) <EOL> pdu . put_data ( self . pduData ) <EOL> def decode ( self , pdu ) : <EOL> BSLCI . decode ( self , pdu ) <EOL> self . pduData = pdu . get_data ( len ( pdu . pduData ) ) <EOL> class Result ( BSLCI ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . result <EOL> def __init__ ( self , code = None , * args , ** kwargs ) : <EOL> super ( Result , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . result <EOL> self . bslciLength = <NUM_LIT:6> <EOL> self . bslciResultCode = code <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put_short ( self . bslciResultCode ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . bslciResultCode = bslpdu . get_short ( ) <EOL> register_bslpdu_type ( Result ) <EOL> class ServiceRequest ( BSLCI ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . serviceRequest <EOL> def __init__ ( self , code = None , * args , ** kwargs ) : <EOL> super ( ServiceRequest , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . serviceRequest <EOL> self . bslciLength = <NUM_LIT:6> <EOL> self . bslciServiceID = code <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put_short ( self . bslciServiceID ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . bslciServiceID = bslpdu . get_short ( ) <EOL> register_bslpdu_type ( ServiceRequest ) <EOL> class AccessRequest ( BSLCI ) : <EOL> _debug_contents = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> messageType = BSLCI . accessRequest <EOL> def __init__ ( self , hashFn = <NUM_LIT:0> , username = '<STR_LIT>' , * args , ** kwargs ) : <EOL> super ( AccessRequest , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . accessRequest <EOL> self . bslciLength = <NUM_LIT:5> <EOL> self . bslciHashFn = hashFn <EOL> self . bslciUsername = username <EOL> if username : <EOL> self . bslciLength += len ( username ) <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( self . bslciHashFn ) <EOL> bslpdu . put_data ( self . bslciUsername ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . bslciHashFn = bslpdu . get ( ) <EOL> self . bslciUsername = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( AccessRequest ) <EOL> class AccessChallenge ( BSLCI ) : <EOL> _debug_contents = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> messageType = BSLCI . accessChallenge <EOL> def __init__ ( self , hashFn = <NUM_LIT:0> , challenge = '<STR_LIT>' , * args , ** kwargs ) : <EOL> super ( AccessChallenge , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . accessChallenge <EOL> self . bslciLength = <NUM_LIT:5> <EOL> self . bslciHashFn = hashFn <EOL> self . bslciChallenge = challenge <EOL> if challenge : <EOL> self . bslciLength += len ( challenge ) <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( self . bslciHashFn ) <EOL> bslpdu . put_data ( self . bslciChallenge ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . bslciHashFn = bslpdu . get ( ) <EOL> self . bslciChallenge = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( AccessChallenge ) <EOL> class AccessResponse ( BSLCI ) : <EOL> _debug_contents = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> messageType = BSLCI . accessResponse <EOL> def __init__ ( self , hashFn = <NUM_LIT:0> , response = '<STR_LIT>' , * args , ** kwargs ) : <EOL> super ( AccessResponse , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . accessResponse <EOL> self . bslciLength = <NUM_LIT:5> <EOL> self . bslciHashFn = hashFn <EOL> self . bslciResponse = response <EOL> if response : <EOL> self . bslciLength += len ( response ) <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( self . bslciHashFn ) <EOL> bslpdu . put_data ( self . bslciResponse ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . bslciHashFn = bslpdu . get ( ) <EOL> self . bslciResponse = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( AccessResponse ) <EOL> class DeviceToDeviceAPDU ( BSLPDU ) : <EOL> messageType = BSLCI . deviceToDeviceAPDU <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( DeviceToDeviceAPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . deviceToDeviceAPDU <EOL> self . bslciLength = <NUM_LIT:4> + len ( self . pduData ) <EOL> def encode ( self , bslpdu ) : <EOL> self . bslciLength = <NUM_LIT:4> + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( DeviceToDeviceAPDU ) <EOL> class RouterToRouterNPDU ( BSLPDU ) : <EOL> messageType = BSLCI . routerToRouterNPDU <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( RouterToRouterNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . routerToRouterNPDU <EOL> self . bslciLength = <NUM_LIT:4> + len ( self . pduData ) <EOL> def encode ( self , bslpdu ) : <EOL> self . bslciLength = <NUM_LIT:4> + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( RouterToRouterNPDU ) <EOL> class ProxyToServerUnicastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . proxyToServerUnicastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ProxyToServerUnicastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . proxyToServerUnicastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ProxyToServerUnicastNPDU ) <EOL> class ProxyToServerBroadcastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . proxyToServerBroadcastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ProxyToServerBroadcastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . proxyToServerBroadcastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ProxyToServerBroadcastNPDU ) <EOL> class ServerToProxyUnicastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . serverToProxyUnicastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ServerToProxyUnicastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . serverToProxyUnicastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ServerToProxyUnicastNPDU ) <EOL> class ServerToProxyBroadcastNPDU ( BSLPDU ) : <EOL> messageType = BSLCI . serverToProxyBroadcastNPDU <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( ServerToProxyBroadcastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . serverToProxyBroadcastNPDU <EOL> self . bslciLength = <NUM_LIT:4> + len ( self . pduData ) <EOL> def encode ( self , bslpdu ) : <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ServerToProxyBroadcastNPDU ) <EOL> class ClientToLESUnicastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . clientToLESUnicastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ClientToLESUnicastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . clientToLESUnicastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ClientToLESUnicastNPDU ) <EOL> class ClientToLESBroadcastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . clientToLESBroadcastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ClientToLESBroadcastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . clientToLESBroadcastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ClientToLESBroadcastNPDU ) <EOL> class LESToClientUnicastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . lesToClientUnicastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( LESToClientUnicastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . lesToClientUnicastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( LESToClientUnicastNPDU ) <EOL> class LESToClientBroadcastNPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . lesToClientBroadcastNPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( LESToClientBroadcastNPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . lesToClientBroadcastNPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( LESToClientBroadcastNPDU ) <EOL> class ClientToServerUnicastAPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . clientToServerUnicastAPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ClientToServerUnicastAPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . clientToServerUnicastAPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ClientToServerUnicastAPDU ) <EOL> class ClientToServerBroadcastAPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . clientToServerBroadcastAPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ClientToServerBroadcastAPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . clientToServerBroadcastAPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ClientToServerBroadcastAPDU ) <EOL> class ServerToClientUnicastAPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . serverToClientUnicastAPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ServerToClientUnicastAPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . serverToClientUnicastAPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ServerToClientUnicastAPDU ) <EOL> class ServerToClientBroadcastAPDU ( BSLPDU ) : <EOL> _debug_contents = ( '<STR_LIT>' , ) <EOL> messageType = BSLCI . serverToClientBroadcastAPDU <EOL> def __init__ ( self , addr = None , * args , ** kwargs ) : <EOL> super ( ServerToClientBroadcastAPDU , self ) . __init__ ( * args , ** kwargs ) <EOL> self . bslciFunction = BSLCI . serverToClientBroadcastAPDU <EOL> self . bslciLength = <NUM_LIT:5> + len ( self . pduData ) <EOL> self . bslciAddress = addr <EOL> if addr is not None : <EOL> self . bslciLength += addr . addrLen <EOL> def encode ( self , bslpdu ) : <EOL> addrLen = self . bslciAddress . addrLen <EOL> self . bslciLength = <NUM_LIT:5> + addrLen + len ( self . pduData ) <EOL> BSLCI . update ( bslpdu , self ) <EOL> bslpdu . put ( addrLen ) <EOL> bslpdu . put_data ( self . bslciAddress . addrAddr ) <EOL> bslpdu . put_data ( self . pduData ) <EOL> def decode ( self , bslpdu ) : <EOL> BSLCI . update ( self , bslpdu ) <EOL> addrLen = bslpdu . get ( ) <EOL> self . bslciAddress = LocalStation ( bslpdu . get_data ( addrLen ) ) <EOL> self . pduData = bslpdu . get_data ( len ( bslpdu . pduData ) ) <EOL> register_bslpdu_type ( ServerToClientBroadcastAPDU ) </s>
