bson: extract types into bson-types.h and functions into typed headers.