def tlv(buf):
    n = 4
    try:
        t, l = struct.unpack('>HH', buf[:n])
    except struct.error:
        raise dpkt.UnpackError
    v = buf[n:n+l]
    if len(v) < l:
        raise dpkt.NeedData
    buf = buf[n+l:]
    return (t,l,v, buf)

# TOC 1.0: http://jamwt.com/Py-TOC/PROTOCOL

# TOC 2.0: http://www.firestuff.org/projects/firetalk/doc/toc2.txt
dataset/ETHPy150Open dragondjf/QMarkdowner/dpkt/aim.py/tlv/original