def _generate_packets(file_h, header, layers=<NUM_LIT:0>):
hdrp = ctypes.pointer(header)<EOL>while True:<EOL><INDENT>pkt = _read_a_packet(file_h, hdrp, layers)<EOL>if pkt:<EOL><INDENT>yield pkt<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Read packets one by one from the capture file. Expects the file
handle to point to the location immediately after the header (24
bytes).