/* "min_len" is the minimum length of the PDU; the length field in the TPKT header must be at least "4+min_len" in order for this to be a valid TPKT PDU for the protocol in question.  */
int is_tpkt(tvbuff_t *tvb, int min_len)
/* "min_len" is the minimum length of the PDU; the length field in the TPKT header must be at least "4+min_len" in order for this to be a valid TPKT PDU for the protocol in question.  */
int is_tpkt(tvbuff_t *tvb, int min_len)
{
    guint16 pkt_len;
    if (!proto_is_protocol_enabled(proto_tpkt_ptr))
        return -1;
    if (tvb_captured_length(tvb) < 4)
        return -1;
    if (!(tvb_get_guint8(tvb, 0) == 3 && tvb_get_guint8(tvb, 1) == 0))
        return -1;
    pkt_len = tvb_get_ntohs(tvb, 2);
    if (pkt_len < 4 + min_len)
        return -1;
    return pkt_len;
}