hpimdm/packet/PacketHPIMSync.py
def parse_bytes(cls, data: bytes):
        """
        Parse received Protocol Sync Packet and all its entries from binary format
        and convert it into ProtocolSync object and PacketProtocolSyncEntries
        """
        (my_snapshot_sn, neighbor_snapshot_sn, neighbor_boot_time, flags_and_sync_sn) = \
            struct.unpack(cls.PIM_HDR_INSTALL_WITHOUT_TREES,
                          data[:cls.PIM_HDR_INSTALL_WITHOUT_TREES_LEN])

        sync_sn = flags_and_sync_sn & 0x3FFFFFFF
        master_flag = flags_and_sync_sn >> 31
        more_flag = (flags_and_sync_sn & 0x4FFFFFFF) >> 30
        data = data[cls.PIM_HDR_INSTALL_WITHOUT_TREES_LEN:]
        sync_msg = cls(my_snapshot_sn, neighbor_snapshot_sn, sync_sn, [], master_flag=master_flag,
                       more_flag=more_flag, neighbor_boot_time=neighbor_boot_time)
        if more_flag:
            while data != b'':
                tree_msg = cls._get_entry_object().parse_bytes(data)

                sync_msg.add_tree(tree_msg)
                data = data[len(tree_msg):]
        else:
            while data != b'':
                option = PacketHPIMHelloOptions.parse_bytes(data)
                option_length = len(option)
                data = data[option_length:]
                sync_msg.add_hello_option(option)
        return sync_msg

        Parse received Protocol Sync Packet and all its entries from binary format
        and convert it into ProtocolSync object and PacketProtocolSyncEntries
        
Parse received Protocol Sync Packet and all its entries from binary format
and convert it into ProtocolSync object and PacketProtocolSyncEntries
Parse received Protocol Sync Packet and all its entries from binary format and convert it into ProtocolSync object and PacketProtocolSyncEntries
def parse_bytes(cls, data: bytes):
        (my_snapshot_sn, neighbor_snapshot_sn, neighbor_boot_time, flags_and_sync_sn) = \
            struct.unpack(cls.PIM_HDR_INSTALL_WITHOUT_TREES,
                          data[:cls.PIM_HDR_INSTALL_WITHOUT_TREES_LEN])
        sync_sn = flags_and_sync_sn & 0x3FFFFFFF
        master_flag = flags_and_sync_sn >> 31
        more_flag = (flags_and_sync_sn & 0x4FFFFFFF) >> 30
        data = data[cls.PIM_HDR_INSTALL_WITHOUT_TREES_LEN:]
        sync_msg = cls(my_snapshot_sn, neighbor_snapshot_sn, sync_sn, [], master_flag=master_flag,
                       more_flag=more_flag, neighbor_boot_time=neighbor_boot_time)
        if more_flag:
            while data != b'':
                tree_msg = cls._get_entry_object().parse_bytes(data)
                sync_msg.add_tree(tree_msg)
                data = data[len(tree_msg):]
        else:
            while data != b'':
                option = PacketHPIMHelloOptions.parse_bytes(data)
                option_length = len(option)
                data = data[option_length:]
                sync_msg.add_hello_option(option)
        return sync_msg
def parse_bytes ( cls , data : bytes ) : ( my_snapshot_sn , neighbor_snapshot_sn , neighbor_boot_time , flags_and_sync_sn ) = struct . unpack ( cls . PIM_HDR_INSTALL_WITHOUT_TREES , data [ : cls . PIM_HDR_INSTALL_WITHOUT_TREES_LEN ] ) sync_sn = flags_and_sync_sn & 0x3FFFFFFF master_flag = flags_and_sync_sn >> 31 more_flag = ( flags_and_sync_sn & 0x4FFFFFFF ) >> 30 data = data [ cls . PIM_HDR_INSTALL_WITHOUT_TREES_LEN : ] sync_msg = cls ( my_snapshot_sn , neighbor_snapshot_sn , sync_sn , [ ] , master_flag = master_flag , more_flag = more_flag , neighbor_boot_time = neighbor_boot_time ) if more_flag : while data != b'' : tree_msg = cls . _get_entry_object ( ) . parse_bytes ( data ) sync_msg . add_tree ( tree_msg ) data = data [ len ( tree_msg ) : ] else : while data != b'' : option = PacketHPIMHelloOptions . parse_bytes ( data ) option_length = len ( option ) data = data [ option_length : ] sync_msg . add_hello_option ( option ) return sync_msg
Parse received Protocol Sync Packet and all its entries from binary format
and convert it into ProtocolSync object and PacketProtocolSyncEntries
Parse received Protocol Sync Packet and all its entries from binary format and convert it into ProtocolSync object and PacketProtocolSyncEntries
"""
        Parse received Protocol Sync Packet and all its entries from binary format
        and convert it into ProtocolSync object and PacketProtocolSyncEntries
        """
cls
data
bytes