def guess_payload(p):
    LDPTypes = {
        0x0001: LDPNotification,
        0x0100: LDPHello,
        0x0200: LDPInit,
        0x0201: LDPKeepAlive,
        0x0300: LDPAddress,
        0x0301: LDPAddressWM,
        0x0400: LDPLabelMM,
        0x0401: LDPLabelReqM,
        0x0404: LDPLabelARM,
        0x0402: LDPLabelWM,
        0x0403: LDPLabelRelM,
        }
    type = struct.unpack("!H",p[0:2])[0]
    type = type & 0x7fff
    if type == 0x0001 and struct.unpack("!H",p[2:4])[0] > 20:
        return LDP
    if type in LDPTypes:
        return LDPTypes[type]
    else:
        return conf.raw_layer