Wholesale constification.

Approved by:	re (blanket)
Add missing #includes and fix some incorrect definitions.

Approved by:	re (blanket)
Massive constification + solve an alignment issue by using a union.

Approved by:	re (blanket)