/* Extract a variable length integer from a tvbuff  */
static void get_varint(tvbuff_t *tvb, const gint offset, gint *length, guint64 *ret)
/* Extract a variable length integer from a tvbuff  */
static void get_varint(tvbuff_t *tvb, const gint offset, gint *length, guint64 *ret)
{
  guint value;
  value = tvb_get_guint8(tvb, offset);
  if (value < 0xfd)
  {
    *length = 1;
    *ret = value;
    return;
  }
  if (value == 0xfd)
  {
    *length = 3;
    *ret = tvb_get_letohs(tvb, offset+1);
    return;
  }
  if (value == 0xfe)
  {
    *length = 5;
    *ret = tvb_get_letohl(tvb, offset+1);
    return;
  }
  *length = 9;
  *ret = tvb_get_letoh64(tvb, offset+1);
  return;
}