hpimdm/packet/PacketHPIMHeader.py
def parse_bytes(cls, data: bytes):
        """
        Parse received Packet from bits/bytes and convert them into Header object... also parse Header's payload
        """
        print("parsePimHdr: ", data)

        pim_hdr = data[0:cls.PIM_HDR_LEN]
        (boot_time, pim_ver_type, security_id, security_len) = struct.unpack(cls.PIM_HDR, pim_hdr)

        print(pim_ver_type)
        pim_version = (pim_ver_type & 0xF0) >> 4
        pim_type = pim_ver_type & 0x0F

        if pim_version != cls.PIM_VERSION:
            print("Version of PROTOCOL packet received not known (!=0)")
            raise Exception

        security_and_pim_payload = data[cls.PIM_HDR_LEN:]
        security_value = security_and_pim_payload[:security_len]
        print("Received hmac value: ", security_value)
        pim_payload = security_and_pim_payload[security_len:]
        pim_payload = cls.PIM_MSG_TYPES[pim_type].parse_bytes(pim_payload)
        return PacketHPIMHeader(pim_payload, boot_time, security_id, security_len, security_value)

        Parse received Packet from bits/bytes and convert them into Header object... also parse Header's payload
        
Parse received Packet from bits/bytes and convert them into Header object... also parse Header's payload
Parse received Packet from bits / bytes and convert them into Header object ... also parse Header ' s payload
def parse_bytes(cls, data: bytes):
        print("parsePimHdr: ", data)
        pim_hdr = data[0:cls.PIM_HDR_LEN]
        (boot_time, pim_ver_type, security_id, security_len) = struct.unpack(cls.PIM_HDR, pim_hdr)
        print(pim_ver_type)
        pim_version = (pim_ver_type & 0xF0) >> 4
        pim_type = pim_ver_type & 0x0F
        if pim_version != cls.PIM_VERSION:
            print("Version of PROTOCOL packet received not known (!=0)")
            raise Exception
        security_and_pim_payload = data[cls.PIM_HDR_LEN:]
        security_value = security_and_pim_payload[:security_len]
        print("Received hmac value: ", security_value)
        pim_payload = security_and_pim_payload[security_len:]
        pim_payload = cls.PIM_MSG_TYPES[pim_type].parse_bytes(pim_payload)
        return PacketHPIMHeader(pim_payload, boot_time, security_id, security_len, security_value)
def parse_bytes ( cls , data : bytes ) : print ( "parsePimHdr: " , data ) pim_hdr = data [ 0 : cls . PIM_HDR_LEN ] ( boot_time , pim_ver_type , security_id , security_len ) = struct . unpack ( cls . PIM_HDR , pim_hdr ) print ( pim_ver_type ) pim_version = ( pim_ver_type & 0xF0 ) >> 4 pim_type = pim_ver_type & 0x0F if pim_version != cls . PIM_VERSION : print ( "Version of PROTOCOL packet received not known (!=0)" ) raise Exception security_and_pim_payload = data [ cls . PIM_HDR_LEN : ] security_value = security_and_pim_payload [ : security_len ] print ( "Received hmac value: " , security_value ) pim_payload = security_and_pim_payload [ security_len : ] pim_payload = cls . PIM_MSG_TYPES [ pim_type ] . parse_bytes ( pim_payload ) return PacketHPIMHeader ( pim_payload , boot_time , security_id , security_len , security_value )
Parse received Packet from bits/bytes and convert them into Header object... also parse Header's payload
Parse received Packet from bits / bytes and convert them into Header object ... also parse Header ' s payload
"""
        Parse received Packet from bits/bytes and convert them into Header object... also parse Header's payload
        """
cls
data
bytes