@classmethod
    def parse(cls, buf):

        pkt = DhcpPacket()
        (pkt.ciaddr,) = cls.struct('4s').unpack_from(buf, 12)
        (pkt.giaddr,) = cls.struct('4s').unpack_from(buf, 24)
        cls.struct('4s').pack_into(buf, 24, b'')
        pos = 240
        while pos < len(buf):
            (opttag,) = cls.struct('B').unpack_from(buf, pos)
            if opttag == 0:
                pos += 1
                continue
            if opttag == END:
                pkt.end = pos
                break
            (optlen,) = cls.struct('B').unpack_from(buf, pos + 1)
            startpos = pos
            pos += 2
            if opttag != RELAY_AGENT_INFO:
                pos += optlen
                continue
            optend = pos + optlen
            while pos < optend:
                (subopttag, suboptlen) = cls.struct('BB').unpack_from(buf, pos)
                fmt = '%is' % (suboptlen,)
                (val,) = cls.struct(fmt).unpack_from(buf, pos + 2)
                pkt.relay_options[subopttag] = val
                pos += suboptlen + 2
            cls.struct('%is' % (optlen + 2)).pack_into(buf, startpos, b'')
        pkt.buf = buf
        return pkt
Yield the objects required for a list of commits.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cpnr/dhcp_relay.py/DhcpPacket.parse--crossover with--dataset/ETHPy150Open natestedman/Observatory/observatory/lib/dulwich/server.py/BackendRepo.fetch_objects