/* A 'heuristic dissector' that attemtps to establish whether we have a genuine SMPP PDU here. Only works when: at least the fixed header is there it has a correct overall PDU length it is a 'well-known' operation has a 'well-known' or 'reserved' status  */
static gboolean dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* A 'heuristic dissector' that attemtps to establish whether we have a genuine SMPP PDU here. Only works when: at least the fixed header is there it has a correct overall PDU length it is a 'well-known' operation has a 'well-known' or 'reserved' status  */
static gboolean dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    guint        command_id;
    guint        command_status;
    guint        command_length;
    if (tvb_reported_length(tvb) < SMPP_MIN_LENGTH)
        return FALSE;
    command_length = tvb_get_ntohl(tvb, 0);
    if (command_length > 64 * 1024 || command_length < SMPP_MIN_LENGTH)
        return FALSE;
    command_id = tvb_get_ntohl(tvb, 4);
    if (try_val_to_str(command_id, vals_command_id) == NULL)
        return FALSE;
    command_status = tvb_get_ntohl(tvb, 8);
    if (try_val_to_str(command_status, vals_command_status) == NULL &&
                try_rval_to_str(command_status, reserved_command_status) == NULL)
        return FALSE;
    dissect_smpp(tvb, pinfo, tree, data);
    return TRUE;
}