Move CNameDB to db.h.

Move the CNameDB class to db.h and move the definition of vchType to
headers.  Fix the includes in other files so that everything compiles.