/* Given a 4-byte MPLS label starting at offset "offset", in tvbuff "tvb", decode it. Return the label in "label", EXP bits in "exp", bottom_of_stack in "bos", and TTL in "ttl"  */
void decode_mpls_label(tvbuff_t *tvb, int offset, guint32 *label, guint8 *exp, guint8 *bos, guint8 *ttl)
/* Given a 4-byte MPLS label starting at offset "offset", in tvbuff "tvb", decode it. Return the label in "label", EXP bits in "exp", bottom_of_stack in "bos", and TTL in "ttl"  */
void decode_mpls_label(tvbuff_t *tvb, int offset, guint32 *label, guint8 *exp, guint8 *bos, guint8 *ttl)
{
    guint8 octet0 = tvb_get_guint8(tvb, offset+0);
    guint8 octet1 = tvb_get_guint8(tvb, offset+1);
    guint8 octet2 = tvb_get_guint8(tvb, offset+2);
    *label = (octet0 << 12) + (octet1 << 4) + ((octet2 >> 4) & 0xff);
    *exp = (octet2 >> 1) & 0x7;
    *bos = (octet2 & 0x1);
    *ttl = tvb_get_guint8(tvb, offset+3);
}