A canonical structure for constrained optimal control problems