@classmethod
    def parser(cls, buf):
        (nxt, size, type_, seg, cmp_, pad) = struct.unpack_from(
            cls._PACK_STR, buf)
        data = cls._MIN_LEN
        header_len = cls._get_size(size)
        cmpi = int(cmp_ >> 4)
        cmpe = int(cmp_ & 0xf)
        pad = int(pad >> 4)
        adrs = []
        if size:
            # Address[1..n-1] has size (16 - CmprI) octets
            adrs_len_i = 16 - cmpi
            # Address[n] has size (16 - CmprE) octets
            adrs_len_e = 16 - cmpe
            form_i = "%ds" % adrs_len_i
            form_e = "%ds" % adrs_len_e
            while data < (header_len - (adrs_len_e + pad)):
                (adr, ) = struct.unpack_from(form_i, buf[data:])
                adr = (b'\x00' * cmpi) + adr
                adrs.append(addrconv.ipv6.bin_to_text(adr))
                data += adrs_len_i
            (adr, ) = struct.unpack_from(form_e, buf[data:])
            adr = (b'\x00' * cmpe) + adr
            adrs.append(addrconv.ipv6.bin_to_text(adr))
        return cls(nxt, size, type_, seg, cmpi, cmpe, adrs)
dataset/ETHPy150Open osrg/ryu/ryu/lib/packet/ipv6.py/routing_type3.parser/original