from collections import Counter

def extract_flows(packets):
    """
    Returns flow table:
    (src, dst, proto) -> count
    """
    flows = Counter()

    for pkt in packets:
        if not pkt.haslayer("IP"):
            continue

        src = pkt["IP"].src
        dst = pkt["IP"].dst
        proto = pkt.payload.name

        flows[(src, dst, proto)] += 1

    return flows
