Compliance checking

This set of patches add API code to evaluate compliance. This is a work in progress, not ready to merge yet.