iap: Start work on high-level IAP framework.

This code runs, but hasn't been tested yet.